/* BoutiqDesk: shared look for every page.
   Colours live at the top. Change a value here and the whole site follows. */

:root {
  --purple-950: #2E1065;
  --purple-900: #4C1D95;
  --purple-800: #5B21B6;
  --purple-700: #6D28D9;
  --purple-600: #7C3AED;
  --purple-500: #8B5CF6;
  --purple-200: #DDD6FE;
  --purple-100: #EDE9FE;
  --purple-50: #F5F3FF;

  --ink: #1F1838;
  --muted: #6B6585;
  --line: #E8E4F3;
  --bg: #F5F3FA;
  --card: #FFFFFF;

  --success: #059669;
  --success-bg: #DCFCE7;
  --success-ink: #15803D;
  --danger: #DC2626;
  --danger-bg: #FEE2E2;
  --danger-ink: #B91C1C;
  --amber-bg: #FEF3C7;
  --amber-ink: #B45309;

  /* Names the older page code still uses */
  --accent: var(--purple-700);
  --accent-soft: var(--line);
  --warn: var(--danger-ink);
  --good: var(--success-ink);

  --sidebar-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--purple-700); }
.icon { flex: none; vertical-align: middle; }

:focus-visible { outline: 2px solid var(--purple-500); outline-offset: 2px; }

/* ---------- Layout shell ---------- */
.shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  color: #fff;
  background: linear-gradient(180deg, #3A1080 0%, #5B21B6 58%, #6D28D9 100%);
  z-index: 50;
  transition: transform 0.25s ease;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, 0.16); display: grid; place-items: center; flex: none; }
.brand-text { min-width: 0; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.brand-sub { font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.sidebar-close { display: none; margin-left: auto; background: none; border: 0; color: #fff; padding: 6px; border-radius: 8px; cursor: pointer; }

.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 14px; flex: 1; overflow-y: auto; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: rgba(255, 255, 255, 0.84); text-decoration: none; font-weight: 500;
}
.side-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.side-link.active { background: var(--purple-600); color: #fff; box-shadow: 0 6px 16px rgba(20, 5, 60, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
.side-link:focus-visible { outline-color: #fff; }

.side-user { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.side-user-name { font-weight: 600; font-size: 13.5px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-role { font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #A78BFA, #7C3AED); display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; }

.main { margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 20px; font-weight: 700; line-height: 1.25; }
.topbar-title p { font-size: 13px; color: var(--muted); }

.top-search { position: relative; width: 280px; }
.top-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.top-search input { padding-left: 38px; background: #F1EEF9; border-color: transparent; border-radius: 12px; }

.icon-btn { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: none; color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--purple-50); }
.menu-btn { display: none; }
.avatar-top { width: 36px; height: 36px; font-size: 14px; }

.bell-wrap { position: relative; }
.bell-dot { position: absolute; top: 8px; right: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); border: 2px solid #fff; }
.bell-pop {
  position: absolute; right: 0; top: calc(100% + 10px); width: 300px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(46, 16, 101, 0.18); padding: 8px; z-index: 60;
}
.bell-head { padding: 8px 10px 6px; font-weight: 600; font-size: 13px; }
.bell-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.bell-item:hover { background: var(--purple-50); }
.bell-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.bell-empty { padding: 14px 10px; color: var(--muted); font-size: 13.5px; }

.scrim { position: fixed; inset: 0; background: rgba(20, 8, 50, 0.5); z-index: 40; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.scrim.show { opacity: 1; pointer-events: auto; }

.content { width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 28px 64px; }
#page-content { display: grid; gap: 20px; }
#page-content > * { min-width: 0; }

/* ---------- Cards, headings, tone colours ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: 0 1px 2px rgba(46, 16, 101, 0.04); }
.card h2 { font-size: 18px; font-weight: 700; line-height: 1.3; }
.card .sub, .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.link-more { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 13px; text-decoration: none; }

.tone-violet { background: #EDE9FE; color: #6D28D9; }
.tone-green { background: #DCFCE7; color: #15803D; }
.tone-amber { background: #FEF3C7; color: #B45309; }
.tone-fuchsia { background: #FAE8FF; color: #A21CAF; }
.tone-rose { background: #FFE4E6; color: #BE123C; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok, .pill.up { background: var(--success-bg); color: var(--success-ink); }
.pill.low { background: var(--amber-bg); color: var(--amber-ink); }
.pill.out, .pill.down { background: var(--danger-bg); color: var(--danger-ink); }
.pill.flat { background: #F1EFF7; color: var(--muted); }

/* ---------- Forms and buttons ---------- */
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--purple-500); outline-offset: 0; border-color: var(--purple-500); }
input.invalid { border-color: var(--danger); }
input::placeholder { color: #A29CBA; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 18px; }
.field-error { color: var(--danger-ink); font-size: 12px; margin-top: 4px; min-height: 16px; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.status, .form-status { font-size: 14px; min-height: 20px; }
.status.error, .form-status.error { color: var(--danger-ink); }
.status.success, .form-status.success { color: var(--success-ink); font-weight: 500; }

button { font-family: inherit; }
button.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--purple-700); color: #fff; border: 0; border-radius: 10px;
  padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.15s;
}
button.primary:hover:not(:disabled) { background: var(--purple-800); }
button.primary:disabled { opacity: 0.55; cursor: default; }
button.secondary {
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 18px; font-size: 14px; font-weight: 500; cursor: pointer;
}
button.secondary:hover { background: var(--purple-50); }
.link-btn { background: none; border: 0; color: var(--purple-700); font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 0; }
.link-btn:hover { text-decoration: underline; }

.list-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar select { width: auto; }
.search-box { width: 260px; max-width: 100%; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 14px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 14px 13px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
th.right, td.right { text-align: right; }
.empty { color: var(--muted); padding: 18px 0; }
td.empty { text-align: center; }
.rank { color: var(--purple-700); font-weight: 700; display: inline-block; min-width: 22px; }
.item-meta { color: var(--muted); font-size: 13px; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions button, .remove-btn { background: none; border: 0; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.edit-btn { color: var(--purple-700); }
.edit-btn:hover { background: var(--purple-50); }
.delete-btn, .remove-btn { color: var(--danger-ink); }
.delete-btn:hover, .remove-btn:hover { background: var(--danger-bg); }

/* ---------- Dashboard: hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 28px; color: #fff;
  background: linear-gradient(135deg, #3B1585 0%, #5B21B6 50%, #7C3AED 100%);
  box-shadow: 0 14px 34px rgba(76, 29, 149, 0.28);
}
.hero::after {
  content: ""; position: absolute; width: 360px; height: 360px; right: -90px; top: -150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0) 68%); pointer-events: none;
}
.hero-top { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.hero h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.hero-sub { margin-top: 6px; color: rgba(255, 255, 255, 0.84); }
.hero-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.date-pill { background: rgba(255, 255, 255, 0.16); border-radius: 999px; padding: 6px 14px; font-size: 13px; }
.hero-btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.3); color: #fff;
  border-radius: 10px; padding: 8px 14px; font-weight: 600; font-size: 14px;
}
.hero-btn:hover { background: rgba(255, 255, 255, 0.24); }
.hero-btn:focus-visible { outline-color: #fff; }
.hero-btn.icon-only { padding: 8px 10px; }
.hero-cards { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 24px; }
.glass { background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.24); border-radius: 14px; padding: 16px 18px; backdrop-filter: blur(6px); }
.g-head { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: rgba(255, 255, 255, 0.9); }
.g-icon { width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, 0.18); display: grid; place-items: center; }
.g-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 10px; line-height: 1.15; }
.g-note { font-size: 12.5px; color: rgba(255, 255, 255, 0.82); margin-top: 2px; }
.spin .icon { animation: spin 0.8s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

.notice { background: var(--danger-bg); color: var(--danger-ink); border-radius: 12px; padding: 12px 16px; font-weight: 500; }

/* ---------- Dashboard: KPI cards ---------- */
.kpi-grid, .stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.kpi { padding: 20px; }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 14px; line-height: 1.15; }
.kpi-label { font-weight: 600; margin-top: 6px; }
.kpi-sub { color: var(--muted); font-size: 13px; }
.kpi-meter { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 16px; }
.progress { height: 8px; border-radius: 99px; background: #F0EDF8; overflow: hidden; margin-top: 6px; }
.progress span { display: block; height: 100%; border-radius: 99px; transition: width 0.7s ease; }
.p-violet { background: linear-gradient(90deg, #7C3AED, #A78BFA); }
.p-green { background: linear-gradient(90deg, #059669, #34D399); }
.p-amber { background: linear-gradient(90deg, #D97706, #FBBF24); }
.p-fuchsia { background: linear-gradient(90deg, #C026D3, #E879F9); }
.kpi-foot { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 8px; }

/* ---------- Dashboard: analytics and activity ---------- */
.grid-analytics { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 16px; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; }
.seg { display: inline-flex; background: #F1EEF9; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--purple-700); color: #fff; }

.bar-row + .bar-row { margin-top: 16px; }
.bar-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.bar-label { font-weight: 600; }
.bar-label small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.bar-figures { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.bar-track { height: 34px; border-radius: 10px; background: #F3F0FA; overflow: hidden; }
.bar-fill {
  height: 100%; min-width: 46px; border-radius: 10px; color: #fff; font-weight: 600; font-size: 12.5px;
  background: linear-gradient(90deg, #5B21B6, #7C3AED);
  display: flex; align-items: center; justify-content: flex-end; padding-right: 12px; transition: width 0.7s ease;
}
.bar-fill.none { min-width: 0; background: none; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.tile { border-radius: 12px; padding: 14px 10px; text-align: center; }
.tile-value { font-weight: 700; font-size: 18px; line-height: 1.3; }
.tile-label { font-size: 12px; opacity: 0.85; }

.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--success-ink); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.activity { list-style: none; margin: 0; padding: 0; max-height: 440px; overflow-y: auto; }
.activity li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity li:last-child { border-bottom: 0; }
.act-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.act-title { font-weight: 500; }
.act-detail { color: var(--purple-700); font-weight: 700; }
.act-time { color: var(--muted); font-size: 12.5px; }

/* ---------- Dashboard: quick actions, sellers, pending ---------- */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qa {
  display: flex; flex-direction: column; justify-content: flex-end; min-height: 116px; padding: 16px;
  border-radius: 14px; color: #fff; text-decoration: none;
}
.qa .icon { margin-bottom: auto; }
.qa strong { font-size: 15px; }
.qa span { font-size: 12.5px; opacity: 0.92; }
.qa:hover { filter: brightness(1.08); }
.qa:focus-visible { outline-color: var(--purple-700); }
.qa-1 { background: linear-gradient(135deg, #6D28D9, #4C1D95); }
.qa-2 { background: linear-gradient(135deg, #C026D3, #86198F); }
.qa-3 { background: linear-gradient(135deg, #6366F1, #4338CA); }
.qa-4 { background: linear-gradient(135deg, #9333EA, #581C87); }

.seller { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: #F8F6FC; }
.seller + .seller { margin-top: 10px; }
.seller-avatar { position: relative; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; }
.seller-rank { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: var(--ink); font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22); }
.rank-1 { background: linear-gradient(135deg, #FBBF24, #D97706); color: #2B1B00; }
.rank-2 { background: linear-gradient(135deg, #E2E8F0, #94A3B8); color: #1E293B; }
.rank-3 { background: linear-gradient(135deg, #FDBA74, #EA580C); color: #2B1200; }
.rank-n { background: linear-gradient(135deg, #A78BFA, #7C3AED); }
.seller-info { flex: 1; min-width: 0; }
.seller-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seller-meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seller-rev { text-align: right; }
.seller-rev strong { display: block; }
.seller-rev span { color: var(--muted); font-size: 12px; }

.pending-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pending { border-radius: 16px; padding: 18px; border: 1px solid; }
.pending-amber { background: #FFF7E6; border-color: #FCE3B0; }
.pending-rose { background: #FFF1F2; border-color: #FECDD3; }
.pending-violet { background: #F5F0FF; border-color: #DDD0FB; }
.pending-top { display: flex; justify-content: space-between; align-items: center; }
.pending-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.pending-count { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 99px; display: grid; place-items: center; color: #fff; font-weight: 700; }
.bg-amber { background: #B45309; }
.bg-rose { background: #DC2626; }
.bg-violet { background: #6D28D9; }
.pending h3 { font-size: 16px; font-weight: 700; margin: 14px 0 4px; }
.pending p { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.pending-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 11px; border-radius: 10px; color: #fff; font-weight: 600; text-decoration: none; }
.pending-btn:hover { filter: brightness(1.1); }
.pending-btn:focus-visible { outline-color: var(--ink); }

/* ---------- Filters (Reports) ---------- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-btn { background: #fff; border: 1px solid var(--line); color: var(--muted); padding: 8px 16px; font-size: 13px; font-weight: 600; border-radius: 999px; cursor: pointer; }
.filter-btn:hover { background: var(--purple-50); }
.filter-btn.active { background: var(--purple-700); border-color: var(--purple-700); color: #fff; }
.filter-spacer { flex: 1; }
.range-label { color: var(--muted); font-size: 13px; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
ul.list li:last-child { border-bottom: 0; }

/* ---------- Sales page ---------- */
.pos-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pos-side { display: grid; gap: 16px; position: sticky; top: 92px; }
.picker { position: relative; }
.results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10; display: none;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; max-height: 280px; overflow-y: auto;
  box-shadow: 0 12px 30px rgba(46, 16, 101, 0.16);
}
.results.open { display: block; }
.result { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.result:last-child { border-bottom: 0; }
.result:hover, .result:focus { background: var(--purple-50); outline: none; }
.result .meta { color: var(--muted); font-size: 12.5px; }
.no-results { padding: 12px 14px; color: var(--muted); }
.selected-product { display: none; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--purple-50); border: 1px solid var(--purple-200); }
.selected-product.open { display: flex; }
.selected-product .clear-btn { margin-left: auto; background: none; border: 0; color: var(--purple-700); font-weight: 600; cursor: pointer; }
.item-row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.item-row .qty { width: 110px; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0; margin-top: 4px; border-top: 1px solid var(--line); }
.total-line strong { font-size: 26px; letter-spacing: -0.02em; }
.new-customer-form { display: none; gap: 10px; margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--purple-50); }
.new-customer-form.open { display: grid; }
.stack { display: grid; gap: 14px; }

.receipt-text {
  font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 14px; padding: 14px 16px;
  background: var(--purple-50); border: 1px dashed var(--purple-200); border-radius: 12px;
}
button.whatsapp-btn { display: inline-flex; align-items: center; justify-content: center; background: #128C4B; color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer; }
button.whatsapp-btn:hover { background: #0E7A41; }
.receipt-note { font-size: 12.5px; color: var(--muted); margin-top: 10px; }

/* ---------- Responsive ---------- */
@media (min-width: 1500px) { .content { max-width: 1360px; } }

@media (max-width: 1100px) {
  .hero-cards, .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-analytics, .grid-two, .pos-grid { grid-template-columns: 1fr; }
  .pos-side { position: static; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(20, 8, 50, 0.4); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .topbar { padding: 12px 18px; }
  .content { padding: 20px 18px 56px; }
  .top-search { width: 200px; }
  .pending-grid { grid-template-columns: 1fr; }
  .columns { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .top-search { display: none; }
  .topbar-title p { display: none; }
  .card { padding: 18px; }
  .hero { padding: 20px; }
  .hero h2 { font-size: 23px; }
  .g-value { font-size: 26px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .search-box, .toolbar, .toolbar select { width: 100%; }
  .list-header { align-items: stretch; }
  .bell-pop { position: fixed; left: 12px; right: 12px; top: 68px; width: auto; }
  .form-actions button.primary { flex: 1 1 100%; }
  .item-row .qty { width: 100%; }
  .item-row button { flex: 1 1 100%; }

  /* Storekeeper POS and its companion pages (till, returns, account) */
  .pos-topbar { padding: 12px 16px; gap: 10px; }
  .pos-topbar .pos-title { font-size: 15px; }
  .pos-topbar a.secondary, .pos-topbar button.secondary, .pos-topbar button.primary#install-btn {
    padding: 8px 12px; font-size: 13px;
  }
  .pos-user { margin-left: 0; }
  .pos-user-name { max-width: 100px; }
  .pos-content { padding: 16px; }
}

@media (max-width: 480px) {
  .hero-cards, .kpi-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Login page ---------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(160deg, #2E1065 0%, #5B21B6 55%, #6D28D9 100%);
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--card); border-radius: 20px;
  padding: 36px 32px; box-shadow: 0 24px 60px rgba(46, 16, 101, 0.35);
}
.auth-logo:has(img) { background: none !important; box-shadow: none !important; width: auto !important; height: auto !important; }
.auth-logo {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--purple-600), var(--purple-900));
  display: grid; place-items: center; color: #fff;
}
.auth-title { text-align: center; font-size: 20px; font-weight: 700; color: var(--ink); }
.auth-sub { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 4px; margin-bottom: 26px; }
.auth-card label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card button.primary { width: 100%; padding: 12px; font-size: 15px; margin-top: 6px; }
.auth-error {
  background: var(--danger-bg); color: var(--danger-ink); border-radius: 10px;
  padding: 10px 12px; font-size: 13.5px; margin-bottom: 16px; display: none;
}
.auth-error.show { display: block; }
.auth-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 20px; }

/* ---------- Storekeeper POS page (no sidebar - standalone) ---------- */
.pos-page { min-height: 100vh; background: var(--bg); }
.pos-topbar {
  display: flex; align-items: center; flex-wrap: wrap; row-gap: 10px; gap: 14px; padding: 14px 24px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.pos-topbar .brand-mark { background: linear-gradient(135deg, var(--purple-600), var(--purple-900)); color: #fff; flex: none; }
.pos-topbar .pos-title { font-weight: 700; font-size: 16px; color: var(--ink); }
.pos-topbar .pos-sub { font-size: 12.5px; color: var(--muted); }
.pos-topbar .spacer { flex: 1 1 auto; min-width: 0; }
.pos-user { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-left: auto; }
.pos-user-name { font-size: 13.5px; font-weight: 600; color: var(--ink); max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-user-role { font-size: 11.5px; color: var(--muted); }
.pos-content { max-width: 1200px; margin: 0 auto; padding: 24px; }
.role-pill {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px;
  background: var(--purple-100); color: var(--purple-800);
}
