/* ═══════════════════════════════════════════
   UniStock Pro — Main Stylesheet
   ═══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #0f1f3d;
  --navy2:      #1a3060;
  --gold:       #e8a020;
  --gold2:      #f5c050;
  --bg:         #f4f5f8;
  --surface:    #ffffff;
  --surface2:   #f0f2f6;
  --border:     rgba(0,0,0,0.08);
  --text:       #111827;
  --text2:      #6b7280;
  --text3:      #9ca3af;
  --red:        #ef4444;
  --red-bg:     #fef2f2;
  --green:      #10b981;
  --green-bg:   #ecfdf5;
  --blue:       #3b82f6;
  --blue-bg:    #eff6ff;
  --radius:     14px;
  --radius-sm:  8px;
  --nav-h:      68px;
  --top-h:      58px;
  --shadow:     0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.14);
}

html, body {
  height: 100%;
  background: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.hidden { display: none !important; }

/* ── Login ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  position: relative;
  overflow: hidden;
  padding: 24px;
}

.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.25;
}
.b1 { width: 340px; height: 340px; background: var(--gold); top: -80px; right: -80px; }
.b2 { width: 260px; height: 260px; background: #3b82f6; bottom: -60px; left: -60px; }

.login-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.login-logo { text-align: center; margin-bottom: 28px; }
.logo-icon { font-size: 40px; display: block; margin-bottom: 10px; }
.logo-text { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 800; color: var(--navy); }
.logo-text span { color: var(--gold); }
.logo-sub { font-size: 13px; color: var(--text2); margin-top: 4px; }
.login-error { color: var(--red); font-size: 13px; margin-bottom: 8px; min-height: 20px; text-align: center; }
.login-hint { font-size: 12px; color: var(--text3); text-align: center; margin-top: 14px; }

/* ── App Shell ── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 520px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

/* ── Top Bar ── */
.topbar {
  height: var(--top-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-logo { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; color: #fff; }
.topbar-logo span { color: var(--gold); }
.topbar-sub { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.sync-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text3);
  transition: background 0.3s;
}
.sync-dot.online { background: var(--green); }
.sync-dot.offline { background: var(--red); }
.sync-dot.syncing { background: var(--gold); animation: pulse 1s infinite; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.2); }

/* ── Content ── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px calc(var(--nav-h) + 16px);
  -webkit-overflow-scrolling: touch;
}

.screen { display: none; }
.screen.active { display: block; }

.screen-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.screen-title { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 700; color: var(--navy); }
.screen-date { font-size: 12px; color: var(--text3); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

/* ── Stats ── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-card.accent { background: var(--navy); }
.stat-card.accent .stat-num { color: #fff; }
.stat-card.accent .stat-lbl { color: rgba(255,255,255,0.6); }
.stat-card.warn .stat-num { color: var(--red); }
.stat-num { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 700; color: var(--navy); }
.stat-lbl { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ── Section Label ── */
.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text3);
  margin: 18px 0 8px;
}

/* ── Category Cards ── */
.cat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  user-select: none;
}
.cat-card:active { transform: scale(0.98); }

.cat-icon-wrap {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.shirt-bg  { background: #dbeafe; }
.pants-bg  { background: #fef3c7; }
.safari-bg { background: #dcfce7; }
.shoes-bg  { background: #fce7f3; }
.acc-bg    { background: #ede9fe; }

.cat-info { flex: 1; }
.cat-name  { font-weight: 600; font-size: 15px; }
.cat-sizes { font-size: 12px; color: var(--text2); margin-top: 2px; }
.cat-right { text-align: right; }
.cat-total { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 700; color: var(--navy); }
.cat-pcs   { font-size: 11px; color: var(--text3); }
.cat-chevron { font-size: 20px; color: var(--text3); margin-left: 4px; }

/* ── Size Grid ── */
.size-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.size-cell {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}
.size-cell:hover { border-color: var(--navy); }
.size-cell.low { border-color: var(--red); background: var(--red-bg); }
.size-lbl { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--navy); }
.size-qty { font-size: 12px; color: var(--text2); margin-top: 3px; }
.size-qty.low { color: var(--red); font-weight: 600; }

/* ── Buttons ── */
.btn {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: scale(0.98); opacity: 0.9; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy2); }
.btn-gold { background: var(--gold); color: #1a1a1a; }
.btn-gold:hover { background: var(--gold2); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--border); }
.btn-outline:hover { background: var(--surface2); }
.btn-outline-danger { background: var(--red-bg); color: var(--red); border: 1.5px solid rgba(239,68,68,0.2); }

.icon-text-btn {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.action-btns { display: flex; flex-direction: column; gap: 8px; }

/* ── Inputs ── */
.input-group { margin-bottom: 14px; }
.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.optional { font-weight: 400; color: var(--text3); }
.inp {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  transition: border-color 0.15s;
  appearance: none;
}
.inp:focus { outline: none; border-color: var(--navy); background: var(--surface); }
select.inp {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.search-inp { margin-bottom: 10px; }

/* ── Quantity ── */
.qty-row { display: flex; align-items: center; gap: 16px; }
.qty-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--navy);
  font-size: 22px;
  font-weight: 300;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
}
.qty-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.qty-display { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 700; min-width: 48px; text-align: center; color: var(--navy); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  background: var(--surface2);
  border-radius: 10px;
  padding: 4px;
}
.tab-btn {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn.active { background: var(--surface); color: var(--navy); box-shadow: var(--shadow); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.form-card { padding: 18px; }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--surface2);
  margin-bottom: 14px;
  transition: all 0.15s;
}
.upload-zone:hover { border-color: var(--navy); background: #eef2ff; }
.upload-icon { font-size: 36px; margin-bottom: 10px; }
.upload-text { font-size: 14px; color: var(--text2); line-height: 1.6; }
.upload-text strong { color: var(--text); }

.ai-result {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--blue-bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.ai-icon { font-size: 20px; }
.ai-text { font-size: 13px; color: var(--blue); font-weight: 500; }

/* ── Employee List ── */
.emp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.emp-row:last-child { border-bottom: none; }
.emp-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.emp-info { flex: 1; }
.emp-name { font-weight: 600; font-size: 14px; }
.emp-dept { font-size: 12px; color: var(--text2); margin-top: 1px; }
.emp-count { font-size: 12px; color: var(--text3); white-space: nowrap; }
.emp-chev { font-size: 18px; color: var(--text3); }

.emp-profile-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.emp-avatar-lg {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 18px; font-weight: 700;
  flex-shrink: 0;
}
.emp-detail-name { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; }
.emp-detail-dept { font-size: 13px; color: var(--text2); margin-top: 2px; }
.emp-detail-id { font-size: 12px; color: var(--text3); margin-top: 1px; }

.issued-item-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.issued-item-row:last-child { border-bottom: none; }
.issued-icon { font-size: 22px; }
.issued-info { flex: 1; }
.issued-name { font-weight: 600; font-size: 14px; }
.issued-size { font-size: 12px; color: var(--text2); margin-top: 1px; }

/* ── Activity ── */
.activity-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.activity-row:last-child { border-bottom: none; }
.act-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.act-dot.in { background: var(--green); }
.act-dot.out { background: var(--red); }
.act-body { flex: 1; }
.act-title { font-size: 13px; font-weight: 600; }
.act-sub { font-size: 12px; color: var(--text2); margin-top: 1px; }
.act-time { font-size: 11px; color: var(--text3); white-space: nowrap; }

/* ── Alert Row ── */
.alert-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.alert-row:last-child { border-bottom: none; }
.alert-name { font-size: 13px; font-weight: 600; }
.alert-sub { font-size: 12px; color: var(--text2); margin-top: 1px; }

/* ── Badges ── */
.badge {
  font-size: 11px; font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  display: inline-block;
  white-space: nowrap;
}
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-gold { background: #fef3c7; color: #92400e; }

.role-badge {
  font-size: 12px; font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--blue-bg);
  color: var(--blue);
}

/* ── Report Bars ── */
.report-bar-row { margin-bottom: 14px; }
.report-bar-header { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.report-bar-name { font-weight: 600; }
.report-bar-num { color: var(--text2); }
.report-bar-track { height: 10px; background: var(--surface2); border-radius: 5px; overflow: hidden; }
.report-bar-fill { height: 100%; border-radius: 5px; transition: width 0.6s ease; }

/* ── Bottom Nav ── */
.nav-bar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px 8px;
  z-index: 50;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text3);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}
.nav-item.active { color: var(--navy); }
.nav-item.active svg { stroke: var(--navy); }

.nav-center { position: relative; }
.nav-plus {
  width: 52px; height: 52px;
  background: var(--navy);
  border-radius: 16px;
  color: #fff;
  font-size: 28px;
  font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(15,31,61,0.35);
  transform: translateY(-8px);
  transition: transform 0.15s, background 0.15s;
}
.nav-center:hover .nav-plus { background: var(--navy2); transform: translateY(-10px); }
.nav-center.active .nav-plus { background: var(--gold); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.48);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding-bottom: 0;
}
.modal-sheet {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 520px;
  padding: 20px 20px 36px;
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(60px); opacity:0 } to { transform: none; opacity:1 } }
.modal-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 18px; }
.modal-title { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; margin-bottom: 18px; }

/* ── Return items ── */
.return-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.return-row:last-child { border-bottom: none; }
.return-btn {
  background: var(--red-bg); color: var(--red);
  border: none; border-radius: 6px;
  padding: 5px 12px; font-size: 12px;
  font-weight: 600; cursor: pointer;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--navy);
  color: #fff;
  padding: 11px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  z-index: 500;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Back Button ── */
.back-btn {
  display: flex; align-items: center; gap: 4px;
  background: none; border: none;
  color: var(--blue);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  padding: 4px 0 12px;
}

/* ── Empty State ── */
.empty-state { text-align: center; color: var(--text3); font-size: 13px; padding: 16px 0; }

/* ── User info ── */
.user-info-card { padding: 14px 16px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── PWA safe area ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .nav-bar { padding-bottom: calc(8px + env(safe-area-inset-bottom)); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .content { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }
}

@media (min-width: 520px) {
  .app { box-shadow: 0 0 40px rgba(0,0,0,0.12); }
}
