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

:root {
  --primary:      #ea692d;
  --primary-dark: #c8541f;
  --bg:           #FFF8F5;
  --card:         #FFFFFF;
  --text:         #1A1A1A;
  --muted:        #6B6B6B;
  --border:       #F0DDD5;
  --success:      #2E7D5C;
  --success-bg:   #E8F5EF;
  --warning:      #A56C00;
  --warning-bg:   #FEF3CD;
  --danger:       #C0392B;
  --danger-bg:    #FDECEA;
  --sidebar-bg:   #1C1C2E;
  --radius:       12px;
  --radius-sm:    8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Topbar ─────────────────────────────────── */
.topbar {
  background: var(--primary);
  color: white;
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-logo  { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; }
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-sub   { font-size: 11px; opacity: 0.75; }
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; cursor: pointer;
  border: none; color: white;
}

/* ── Cards ──────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  padding: 20px;
}

/* ── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 13px 20px;
  border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary  { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline  { background: white; color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost    { background: none; color: var(--primary); font-size: 14px; padding: 8px 12px; }
.btn-full     { width: 100%; }
.btn-sm       { padding: 8px 14px; font-size: 13px; }

/* ── Forms ──────────────────────────────────── */
.field { margin-bottom: 18px; }
label  { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type="email"],
input[type="text"],
input[type="number"],
select {
  width: 100%; padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; color: var(--text);
  background: #FAFAFA; outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus { border-color: var(--primary); background: white; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ── OTP ────────────────────────────────────── */
.otp-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; }
.otp-row input {
  width: 46px; height: 54px; text-align: center;
  font-size: 22px; font-weight: 700;
  padding: 0; background: #FAFAFA;
}
.otp-row input:focus { border-color: var(--primary); background: white; }

/* ── Badges ─────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 9px;
  border-radius: 20px; font-size: 11px; font-weight: 700;
}
.badge-ok      { background: var(--success-bg); color: var(--success); }
.badge-warn    { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }

/* ── Progress bar ───────────────────────────── */
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }
.fill-ok     { background: var(--success); }
.fill-warn   { background: #F5A623; }
.fill-danger { background: var(--danger); }

/* ── Status dot ─────────────────────────────── */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot-ok     { background: var(--success); }
.dot-warn   { background: #F5A623; }
.dot-danger { background: var(--danger); }

/* ── Section title ──────────────────────────── */
.section-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: 0.8px; text-transform: uppercase;
  margin: 20px 0 10px;
}

/* ── Bottom nav ─────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white; border-top: 1px solid var(--border);
  display: flex; height: 62px; z-index: 100;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; border: none; background: none;
  color: var(--muted); font-size: 10px; font-weight: 500; cursor: pointer;
  text-decoration: none;
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 20px; line-height: 1; }

/* ── Alert row ──────────────────────────────── */
.alert-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: 10px; border-left: 3px solid;
  margin-bottom: 10px;
}
.alert-row.danger { background: var(--danger-bg);  border-color: var(--danger); }
.alert-row.warn   { background: var(--warning-bg); border-color: #F5A623; }
.alert-row .alert-body strong { font-size: 13px; display: block; }
.alert-row .alert-body span   { font-size: 12px; color: var(--muted); }

/* ── Week tabs ──────────────────────────────── */
.week-tabs {
  background: white; border-bottom: 1px solid var(--border);
  display: flex; overflow-x: auto; scrollbar-width: none;
}
.week-tabs::-webkit-scrollbar { display: none; }
.week-tab {
  flex-shrink: 0; padding: 12px 18px; border: none; background: none;
  font-size: 13px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
  position: relative;
}
.week-tab.active { color: var(--primary); font-weight: 600; border-color: var(--primary); }
.week-tab .w-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-left: 5px; vertical-align: middle;
  background: var(--border);
}
.week-tab.done   .w-dot { background: var(--success); }
.week-tab.partial .w-dot { background: #F5A623; }

/* ── Inventory item ─────────────────────────── */
.inv-item {
  background: white; border-radius: var(--radius); margin-bottom: 8px;
  padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.inv-name  { font-size: 14px; font-weight: 500; flex: 1; min-width: 0; }
.inv-unit  { font-size: 11px; color: var(--muted); }
.inv-fields { display: flex; gap: 6px; flex-shrink: 0; }
.qty-col   { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.qty-label { font-size: 10px; color: var(--muted); }
.qty-input {
  width: 60px; height: 44px; padding: 0 6px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500; text-align: center;
  background: var(--bg); outline: none;
  -moz-appearance: textfield;
}
.qty-input::-webkit-inner-spin-button { display: none; }
.qty-input:focus  { border-color: var(--primary); background: white; }
.qty-input.filled { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.qty-input.merma  { border-color: var(--danger);  background: var(--danger-bg);  color: var(--danger); }

/* ── Search bar ─────────────────────────────── */
.search-bar {
  padding: 10px 14px; background: white;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 8px;
}
.search-input {
  flex: 1; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; background: var(--bg); outline: none;
}
.search-input:focus { border-color: var(--primary); }

/* ── Save bar ───────────────────────────────── */
.save-bar {
  position: fixed; bottom: 62px; left: 0; right: 0; z-index: 90;
  padding: 10px 14px;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}

/* ── Loader ─────────────────────────────────── */
.loader {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--muted); font-size: 14px; gap: 10px;
}
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ──────────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: #1A1A1A; color: white; padding: 10px 20px;
  border-radius: 20px; font-size: 13px; font-weight: 500;
  z-index: 999; opacity: 0; transition: opacity 0.2s;
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ── Admin sidebar (desktop) ────────────────── */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; min-height: 100vh; background: var(--sidebar-bg);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 10;
}
.sidebar-brand { padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo  { width: 44px; height: 44px; border-radius: 50%; margin-bottom: 10px; }
.sidebar-name  { font-size: 13px; color: white; font-weight: 600; }
.sidebar-role  { font-size: 11px; color: rgba(255,255,255,0.4); }
.sidebar-nav   { padding: 12px 10px; flex: 1; }
.sidebar-label { font-size: 10px; color: rgba(255,255,255,0.3); font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; padding: 8px 8px 4px; }
.sidebar-link  {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 8px; cursor: pointer;
  color: rgba(255,255,255,0.55); font-size: 13px; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  transition: background 0.15s, color 0.15s; text-decoration: none;
}
.sidebar-link:hover  { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }
.sidebar-link.active { background: rgba(234,105,45,0.2); color: #f5905a; }
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.admin-main { margin-left: 220px; flex: 1; padding: 28px; }

/* ── KPI cards ──────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi-card  { background: white; border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 1px 8px rgba(0,0,0,0.05); }
.kpi-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.kpi-value { font-size: 30px; font-weight: 800; line-height: 1; }
.kpi-sub   { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Table ──────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-align: left; padding: 8px 12px; text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px; font-size: 13px;
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 640px) {
  .admin-main { margin-left: 0; padding: 16px; }
  .sidebar    { display: none; }
  .kpi-grid   { grid-template-columns: 1fr 1fr; }
}

/* ── Utilities ──────────────────────────────── */
.content  { padding: 16px; max-width: 520px; margin: 0 auto; padding-bottom: 90px; }
.mt-1 { margin-top: 8px;  }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.text-muted   { color: var(--muted); }
.text-small   { font-size: 12px; }
.text-center  { text-align: center; }
.hidden       { display: none !important; }
