/* ==========================================================================
   StoreNest design system - shared by marketing, Super Admin and Merchant admin.
   Tokens first; light + dark; component primitives below.
   ========================================================================== */
:root {
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --border: #e7e9f1;
  --border-strong: #d5d9e6;
  --text: #0f1424;
  --text-2: #4a5169;
  --text-3: #7c839b;
  --brand: #5b4bf5;
  --brand-600: #4a3bdc;
  --brand-50: #f0eefe;
  --brand-100: #e2defd;
  --accent: #14b8a6;
  --success: #12a05c; --success-bg: #e6f7ee;
  --warn: #c77a07;    --warn-bg: #fff4de;
  --danger: #d6385a;  --danger-bg: #fdebef;
  --info: #2f6fed;    --info-bg: #e8f0ff;
  --muted-bg: #eef0f6;
  --chart-1: #7c6cff; --chart-2: #4a3bdc;
  --radius: 12px; --radius-sm: 8px; --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16,24,48,.05);
  --shadow: 0 1px 3px rgba(16,24,48,.06), 0 8px 24px -12px rgba(16,24,48,.12);
  --shadow-lg: 0 24px 60px -20px rgba(24,28,60,.35);
  --ring: 0 0 0 3px rgba(91,75,245,.22);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0f1c; --surface: #131728; --surface-2: #171c30; --border: #232944; --border-strong: #303860;
    --text: #eef0fa; --text-2: #b4bad4; --text-3: #8089a8;
    --brand: #8b7dff; --brand-600: #a094ff; --brand-50: #1d1f3d; --brand-100: #2a2c58;
    --success-bg: #0e2a1e; --warn-bg: #2f2410; --danger-bg: #331621; --info-bg: #12244a; --muted-bg: #1d2238;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0f1c; --surface: #131728; --surface-2: #171c30; --border: #232944; --border-strong: #303860;
  --text: #eef0fa; --text-2: #b4bad4; --text-3: #8089a8;
  --brand: #8b7dff; --brand-600: #a094ff; --brand-50: #1d1f3d; --brand-100: #2a2c58;
  --success-bg: #0e2a1e; --warn-bg: #2f2410; --danger-bg: #331621; --info-bg: #12244a; --muted-bg: #1d2238;
  color-scheme: dark;
}

/* Surfaces designed on white (marketing site, invoices, hosted payment page) opt out of dark mode. */
body.light, body.mk {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f9fafc; --border: #e7e9f1; --border-strong: #d5d9e6;
  --text: #0f1424; --text-2: #4a5169; --text-3: #7c839b;
  --brand: #5b4bf5; --brand-600: #4a3bdc; --brand-50: #f0eefe; --brand-100: #e2defd;
  --success-bg: #e6f7ee; --warn-bg: #fff4de; --danger-bg: #fdebef; --info-bg: #e8f0ff; --muted-bg: #eef0f6;
  --shadow: 0 1px 3px rgba(16,24,48,.06), 0 8px 24px -12px rgba(16,24,48,.12);
  color-scheme: light; background: var(--bg); color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; font-weight: 650; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-sm { width: 15px; height: 15px; } .i-lg { width: 22px; height: 22px; }
.muted { color: var(--text-3); } .text-2 { color: var(--text-2); }
.small { font-size: 12.5px; } .xs { font-size: 11.5px; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: 16px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn { --b: var(--border-strong); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; font: 600 13.5px/1 var(--font);
  color: var(--text); background: var(--surface); border: 1px solid var(--b); border-radius: 10px; cursor: pointer; transition: .15s ease; white-space: nowrap; box-shadow: var(--shadow-sm); text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { color: #fff; background: linear-gradient(180deg, var(--brand), var(--brand-600)); --b: transparent; box-shadow: 0 1px 2px rgba(59,45,200,.35), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-primary:hover { background: linear-gradient(180deg, var(--brand), var(--brand-600)); filter: brightness(1.07); }
.btn-danger { color: #fff; background: var(--danger); --b: transparent; } .btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-ghost { background: transparent; box-shadow: none; --b: transparent; } .btn-ghost:hover { background: var(--muted-bg); }
.btn-soft { background: var(--brand-50); color: var(--brand-600); --b: transparent; box-shadow: none; } .btn-soft:hover { background: var(--brand-100); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; } .btn-lg { height: 46px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; } .btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.icon-btn { width: 34px; height: 34px; padding: 0; border-radius: 9px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.req::after { content: " *"; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=tel], input[type=url], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; font: 500 14px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; outline: none; transition: .15s; }
textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237c839b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--text-3); font-weight: 400; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
input[type=color] { width: 44px; height: 40px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
input[type=file] { font: 500 13px var(--font); }
.check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; }
.input-group { display: flex; } .input-group > :first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; } .input-group > :last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.input-prefix { display: inline-flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border-strong); border-right: 0; border-radius: 10px 0 0 10px; color: var(--text-3); font-size: 13.5px; }
.input-prefix + input { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-suffix { display: inline-flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 10px 10px 0; color: var(--text-3); font-size: 13.5px; white-space: nowrap; }
.input-group input:has(+ .input-suffix) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0,1fr)); } .form-grid .span-2 { grid-column: span 2; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }
.validation-summary, .alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert-danger { color: var(--danger); background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warn { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-info { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert-success { color: var(--success); background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert b { font-weight: 650; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; } .card-body { padding: 20px; } .card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { position: sticky; top: 0; text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; } .table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; } .table th.num { text-align: right; }
.table a.row-link { color: var(--text); font-weight: 600; } .table a.row-link:hover { color: var(--brand); text-decoration: none; }
.cell-user { display: flex; align-items: center; gap: 11px; min-width: 0; } .cell-user .t { font-weight: 600; } .cell-user .s { font-size: 12px; color: var(--text-3); }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--muted-bg); border: 1px solid var(--border); flex: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; color: #fff; background: hsl(var(--h, 250) 55% 50%); }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); } .empty h3 { color: var(--text); font-size: 16px; margin: 12px 0 4px; } .empty .art { width: 64px; height: 64px; margin: 0 auto; display: grid; place-items: center; border-radius: 18px; background: var(--brand-50); color: var(--brand); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { color: var(--success); background: var(--success-bg); } .badge-warn { color: var(--warn); background: var(--warn-bg); }
.badge-danger { color: var(--danger); background: var(--danger-bg); } .badge-info { color: var(--info); background: var(--info-bg); } .badge-muted { color: var(--text-2); background: var(--muted-bg); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--brand-50); color: var(--brand-600); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 7px; font-size: 12px; background: var(--muted-bg); color: var(--text-2); }

/* ---------- tabs / pager / progress ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; font-size: 13.5px; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.tabs a:hover { color: var(--text); } .tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.pager { display: flex; align-items: center; gap: 6px; padding: 14px 20px; border-top: 1px solid var(--border); justify-content: space-between; font-size: 13px; color: var(--text-3); }
.pager .pages { display: flex; gap: 4px; } .pager a, .pager span.cur { min-width: 32px; height: 32px; padding: 0 8px; display: grid; place-items: center; border-radius: 8px; color: var(--text-2); font-weight: 600; text-decoration: none; }
.pager a:hover { background: var(--muted-bg); } .pager span.cur { background: var(--brand); color: #fff; }
.meter { height: 8px; border-radius: 99px; background: var(--muted-bg); overflow: hidden; } .meter > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--chart-1), var(--chart-2)); transition: width .4s; }
.meter.warn > i { background: linear-gradient(90deg, #f6b73c, #e08a0b); } .meter.danger > i { background: linear-gradient(90deg, #f0728d, var(--danger)); }

/* ---------- toasts / dialog ---------- */
.toasts { position: fixed; z-index: 100; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--success); border-radius: 12px; box-shadow: var(--shadow-lg); animation: toast-in .3s cubic-bezier(.2,.9,.3,1.2); font-size: 13.5px; }
.toast.err { border-left-color: var(--danger); } .toast .i { margin-top: 1px; } .toast.ok .i { color: var(--success); } .toast.err .i { color: var(--danger); }
.toast .x { margin-left: auto; background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0; } .toast a { font-weight: 650; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
dialog { border: 0; border-radius: var(--radius-lg); padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(10,13,30,.55); backdrop-filter: blur(3px); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); } dialog .dlg-body { padding: 22px; overflow: auto; } dialog .dlg-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); }

/* ---------- charts ---------- */
svg.chart { width: 100%; height: auto; display: block; } svg.chart .grid { stroke: var(--border); stroke-dasharray: 3 4; } svg.chart .axis { fill: var(--text-3); font: 500 10.5px var(--font); }
svg.chart .bar rect { transition: opacity .15s; } svg.chart:hover .bar rect { opacity: .55; } svg.chart .bar:hover rect { opacity: 1; }
svg.spark { width: 100px; height: 32px; } svg.donut { width: 132px; height: 132px; } svg.donut .donut-n { font: 700 20px var(--font); fill: var(--text); } svg.donut .donut-l { font: 500 10px var(--font); fill: var(--text-3); }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; } .legend span { display: flex; align-items: center; gap: 8px; } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; } @keyframes spin { to { transform: rotate(360deg); } }
@media print { .no-print { display: none !important; } body { background: #fff; } }
