/* ==========================================================================
   Payment gateway control panel — shared styles for /admin and /merchant.
   Self-contained on purpose: no CDN, no webfont, no build step. The panel has
   to render correctly on a server with no outbound internet access.
   ========================================================================== */

:root {
    --bg:            #070b14;
    --bg-soft:       #0c1220;
    --surface:       #111a2c;
    --surface-2:     #161f33;
    --surface-3:     #1c2740;
    --line:          #22304d;
    --line-soft:     #1a2438;

    --text:          #e8eefc;
    --text-2:        #a8b6d4;
    --text-3:        #6b7c9e;

    --accent:        #6366f1;
    --accent-2:      #8b5cf6;
    --accent-soft:   rgba(99, 102, 241, .14);
    --accent-line:   rgba(99, 102, 241, .38);

    --ok:            #34d399;
    --ok-soft:       rgba(52, 211, 153, .12);
    --ok-line:       rgba(52, 211, 153, .32);
    --warn:          #fbbf24;
    --warn-soft:     rgba(251, 191, 36, .12);
    --warn-line:     rgba(251, 191, 36, .32);
    --danger:        #f87171;
    --danger-soft:   rgba(248, 113, 113, .12);
    --danger-line:   rgba(248, 113, 113, .32);
    --info:          #38bdf8;
    --info-soft:     rgba(56, 189, 248, .12);
    --info-line:     rgba(56, 189, 248, .32);

    --r-sm: 8px;
    --r:    12px;
    --r-lg: 18px;
    --shadow: 0 18px 40px -20px rgba(0, 0, 0, .9);

    --sans: "Segoe UI", Roboto, "Helvetica Neue", system-ui, -apple-system, "Noto Sans Bengali", sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

    --sidebar-w: 254px;
}

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

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.ic { width: 18px; height: 18px; flex: 0 0 auto; }
.ic-sm { width: 15px; height: 15px; flex: 0 0 auto; }
.ic-lg { width: 22px; height: 22px; flex: 0 0 auto; }

.mono { font-family: var(--mono); font-size: .86em; }
.num  { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.dim   { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.hide { display: none !important; }

/* --------------------------------------------------------------- shell -- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--bg-soft);
    border-right: 1px solid var(--line-soft);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;

    /*
     * 100vh on a phone is the viewport with the browser UI hidden, not the part
     * you can actually see. The last ~60px of the column therefore sits behind
     * the address bar — which is exactly where .sidebar-foot lives, so Logout
     * was unreachable in the admin panel. dvh tracks the visible height; the vh
     * line stays as the fallback for browsers without it.
     */
    height: 100vh;
    height: 100dvh;

    overflow-y: auto;
    scrollbar-width: thin;
}

.brandmark {
    display: flex; align-items: center; gap: 11px;
    padding: 20px 18px 18px;
    border-bottom: 1px solid var(--line-soft);
}
.brandmark-badge {
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 8px 18px -8px var(--accent);
}
.brandmark-name { font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.brandmark-role { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 700; }

.nav { padding: 14px 12px; flex: 1 1 auto; }
.nav-group { margin-bottom: 18px; }
.nav-label {
    font-size: 10px; letter-spacing: .13em; text-transform: uppercase;
    color: var(--text-3); font-weight: 700; padding: 0 8px 7px;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 10px; border-radius: var(--r-sm);
    color: var(--text-2); font-weight: 500;
    transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.is-active {
    background: var(--accent-soft);
    color: #c7cbff;
    box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item .pill {
    margin-left: auto; background: var(--danger-soft); color: var(--danger);
    border: 1px solid var(--danger-line);
    font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
}

/*
 * Pinned to the bottom of the sidebar's scrollport.
 *
 * The admin nav is sixteen items in three groups and overflows a phone screen,
 * so before this the only way to reach Logout was to scroll a list taller than
 * the viewport to its very end. Sticky keeps it in place while the nav scrolls
 * underneath — which is why it needs an opaque background it did not need when
 * it was just the last block in the column.
 *
 * The safe-area inset is for iPhones, where the home indicator overlaps the
 * bottom of the viewport.
 */
.sidebar-foot {
    position: sticky;
    bottom: 0;
    background: var(--bg-soft);
    border-top: 1px solid var(--line-soft);
    padding: 14px 16px 18px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}
.who { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.who img, .who .who-initial {
    width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
    object-fit: cover; background: var(--accent-soft);
    border: 1px solid var(--accent-line); color: #c7cbff;
    display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.who-name { font-weight: 600; font-size: 13px; }
.who-mail { font-size: 11.5px; color: var(--text-3); }
.who > div { min-width: 0; }
.who-name, .who-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 26px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(12, 18, 32, .82);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.topbar .sub { font-size: 12.5px; color: var(--text-3); margin: 1px 0 0; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }

.burger {
    display: none; background: var(--surface); border: 1px solid var(--line);
    color: var(--text); border-radius: var(--r-sm); padding: 7px; cursor: pointer;
}

.content { padding: 24px 26px 60px; flex: 1 1 auto; }

/* --------------------------------------------------------------- cards -- */

.card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--line-soft);
}
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 650; }
.card-head .sub { font-size: 12px; color: var(--text-3); margin: 1px 0 0; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; align-items: center; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }

/* stat tiles */
.stat {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    padding: 18px;
    position: relative;
    overflow: hidden;
}
.stat::after {
    content: ""; position: absolute; inset: auto -30px -40px auto;
    width: 120px; height: 120px; border-radius: 50%;
    background: var(--accent-soft); filter: blur(24px);
}
.stat-top { display: flex; align-items: center; gap: 9px; position: relative; z-index: 1; }
.stat-icon {
    width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
    background: var(--accent-soft); border: 1px solid var(--accent-line); color: #b4b9ff;
}
.stat-label { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); font-weight: 650; }
.stat-value { font-size: 25px; font-weight: 700; margin-top: 12px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.stat-note { font-size: 12px; color: var(--text-3); margin-top: 3px; position: relative; z-index: 1; }
.stat.ok     .stat-icon { background: var(--ok-soft);     border-color: var(--ok-line);     color: var(--ok); }
.stat.ok::after     { background: var(--ok-soft); }
.stat.warn   .stat-icon { background: var(--warn-soft);   border-color: var(--warn-line);   color: var(--warn); }
.stat.warn::after   { background: var(--warn-soft); }
.stat.info   .stat-icon { background: var(--info-soft);   border-color: var(--info-line);   color: var(--info); }
.stat.info::after   { background: var(--info-soft); }
.stat.danger .stat-icon { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.stat.danger::after { background: var(--danger-soft); }

/* -------------------------------------------------------------- tables -- */

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
    text-align: left; padding: 11px 16px;
    font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
    color: var(--text-3); font-weight: 700;
    background: var(--bg-soft); border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
}
table.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: rgba(99, 102, 241, .045); }
table.tbl td .stack { display: flex; align-items: center; gap: 10px; }
table.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }

.thumb {
    width: 36px; height: 36px; border-radius: 9px; object-fit: contain;
    background: #fff; padding: 3px; border: 1px solid var(--line); flex: 0 0 auto;
}
.thumb.round { border-radius: 50%; background: var(--surface-2); padding: 0; }
.thumb.lg { width: 54px; height: 54px; }

.empty { padding: 54px 20px; text-align: center; color: var(--text-3); }
.empty svg { width: 34px; height: 34px; margin-bottom: 10px; opacity: .5; }
.empty p { margin: 0; }

/* -------------------------------------------------------------- badges -- */

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 650; white-space: nowrap;
    border: 1px solid transparent;
}
.badge-ok      { background: var(--ok-soft);      color: var(--ok);      border-color: var(--ok-line); }
.badge-warn    { background: var(--warn-soft);    color: var(--warn);    border-color: var(--warn-line); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-line); }
.badge-info    { background: var(--info-soft);    color: var(--info);    border-color: var(--info-line); }
.badge-neutral { background: var(--surface-3);    color: var(--text-2);  border-color: var(--line); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok .dot { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* Standalone status dots, for rows that carry state without a full badge. */
.dot { display: inline-block; vertical-align: middle; }
.dot-ok    { background: var(--ok);     animation: pulse 2s ease-in-out infinite; }
.dot-warn  { background: var(--warn); }
.dot-bad   { background: var(--danger); }
.dot-muted { background: var(--text-3); }

.row-between { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }

/* ------------------------------------------------------------- buttons -- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 15px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .14s, border-color .14s, transform .06s;
    white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--accent-line); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent; color: #fff;
    box-shadow: 0 10px 22px -12px var(--accent);
}
.btn-primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn-ok      { background: var(--ok-soft);     border-color: var(--ok-line);     color: var(--ok); }
.btn-warn    { background: var(--warn-soft);   border-color: var(--warn-line);   color: var(--warn); }
.btn-danger  { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.btn-ghost   { background: transparent; border-color: var(--line); color: var(--text-2); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-icon { padding: 7px; }
.btn-block { width: 100%; }

.btn-row { display: flex; gap: 9px; flex-wrap: wrap; }

/* --------------------------------------------------------------- forms -- */

.field { margin-bottom: 16px; }
.field > label, .label {
    display: block; margin-bottom: 6px;
    font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
    color: var(--text-3); font-weight: 700;
}
.input, .select, .textarea {
    width: 100%; padding: 10px 13px;
    background: var(--bg-soft); color: var(--text);
    border: 1px solid var(--line); border-radius: 10px;
    font: inherit; font-size: 13.5px;
    transition: border-color .14s, box-shadow .14s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { min-height: 96px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7c9e' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; background-size: 15px; padding-right: 34px; }
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.field-error { border-color: var(--danger) !important; }
.err { font-size: 11.5px; color: var(--danger); margin-top: 5px; }

.check { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.check span { font-size: 13px; color: var(--text-2); }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
    position: absolute; inset: 0; cursor: pointer;
    background: var(--surface-3); border: 1px solid var(--line);
    border-radius: 999px; transition: background .18s, border-color .18s;
}
.switch .track::before {
    content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px;
    background: var(--text-3); border-radius: 50%; transition: transform .18s, background .18s;
}
.switch input:checked + .track { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .track::before { transform: translateX(18px); background: var(--accent); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }

/* -------------------------------------------------------------- alerts -- */

.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 15px; border-radius: var(--r);
    border: 1px solid var(--line); background: var(--surface-2);
    font-size: 13px; margin-bottom: 16px;
}
.alert svg { margin-top: 1px; }
.alert-ok     { background: var(--ok-soft);     border-color: var(--ok-line);     color: var(--ok); }
.alert-danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.alert-warn   { background: var(--warn-soft);   border-color: var(--warn-line);   color: var(--warn); }
.alert-info   { background: var(--info-soft);   border-color: var(--info-line);   color: var(--info); }

/* ------------------------------------------------------------- filters -- */

.filters {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
    padding: 15px 20px; border-bottom: 1px solid var(--line-soft);
}
.filters .field { margin: 0; min-width: 150px; }
.filters .grow { flex: 1 1 220px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-box .input { padding-left: 36px; }

/* -------------------------------------------------------------- pager --- */

.pager { display: flex; align-items: center; gap: 5px; padding: 14px 20px; flex-wrap: wrap; }
.pager-item {
    min-width: 32px; height: 32px; padding: 0 9px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 8px;
    font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.pager-item:hover { border-color: var(--accent-line); color: var(--text); }
.pager-item.is-active { background: var(--accent-soft); border-color: var(--accent); color: #c7cbff; }
.pager-item.is-disabled { opacity: .35; pointer-events: none; }
.pager-gap { color: var(--text-3); padding: 0 3px; }
.pager-total { margin-left: auto; font-size: 12px; color: var(--text-3); }

/* ---------------------------------------------------------------- tabs -- */

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line-soft); padding: 0 20px; overflow-x: auto; }
.tab {
    padding: 12px 14px; font-size: 13px; font-weight: 600; color: var(--text-3);
    border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer;
    background: none; border-top: 0; border-left: 0; border-right: 0; font-family: inherit;
}
.tab:hover { color: var(--text-2); }
.tab.is-active { color: #c7cbff; border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ------------------------------------------------------------- key/val -- */

.kv { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 0; }
.kv > dt {
    padding: 10px 0; font-size: 12px; color: var(--text-3); font-weight: 600;
    border-bottom: 1px solid var(--line-soft);
}
.kv > dd {
    padding: 10px 0; margin: 0; font-size: 13.5px;
    border-bottom: 1px solid var(--line-soft); word-break: break-word;
}
.kv > dt:last-of-type, .kv > dd:last-of-type { border-bottom: 0; }

.copyfield { display: flex; gap: 8px; align-items: stretch; }
.copyfield .input { font-family: var(--mono); font-size: 12px; }

/* -------------------------------------------------------------- modals -- */

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(3, 6, 14, .74);
    backdrop-filter: blur(3px); z-index: 90;
    display: none; align-items: center; justify-content: center; padding: 22px;
}
.modal-backdrop.is-open { display: flex; }
.modal {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); box-shadow: var(--shadow);
    width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
}
.modal.wide { max-width: 780px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.modal-head .x { margin-left: auto; background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 4px; }
.modal-head .x:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; gap: 9px; justify-content: flex-end; }

/* --------------------------------------------------------------- toast -- */

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 9px; }
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--r);
    background: var(--surface-2); border: 1px solid var(--line);
    box-shadow: var(--shadow); font-size: 13px; max-width: 360px;
    animation: toast-in .22s ease-out;
}
.toast.ok     { border-color: var(--ok-line);     color: var(--ok); }
.toast.error  { border-color: var(--danger-line); color: var(--danger); }
.toast.warn   { border-color: var(--warn-line);   color: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------- auth pages -- */

/*
 * The admin card. Staff sign in here daily and want the shortest path to the
 * password field, so this one stays a plain box on a gradient.
 */
.auth {
    min-height: 100vh; display: grid; place-items: center; padding: 26px;
    background:
        radial-gradient(ellipse 70% 55% at 50% 0%, rgba(99, 102, 241, .22), transparent 70%),
        var(--bg);
}
.auth-card {
    width: 100%; max-width: 410px;
    background: var(--surface); border: 1px solid var(--line-soft);
    border-radius: 22px; padding: 30px; box-shadow: var(--shadow);
}
.auth-card.wide { max-width: 520px; }
.auth-mark { display: grid; place-items: center; margin-bottom: 18px; }
.auth-mark .brandmark-badge { width: 50px; height: 50px; border-radius: 15px; }
.auth h1 { font-size: 21px; margin: 0 0 4px; text-align: center; font-weight: 700; letter-spacing: -.02em; }
.auth .sub { text-align: center; color: var(--text-3); font-size: 13px; margin: 0 0 24px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-3); }
.auth-foot a { color: #a5b4fc; font-weight: 600; }

/* ------------------------------------------------- merchant auth: split -- */

/*
 * Artwork down one side, the form down the other.
 *
 * The whole slideshow is CSS. Four frames on one 28-second loop, each one
 * offset by a quarter of it, with the captions and the progress bars running
 * the same loop at the same offsets — so nothing has to be kept in sync by
 * JavaScript, and nothing breaks if the script fails to load on a bad
 * connection. Which is the sign-in page's whole job: work when things are
 * already going wrong.
 */
.auth-body { background: var(--bg); }

.auth-split {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
}

/* Pinned, so a tall form (register) scrolls past a still picture rather than
   stretching the artwork into a 1400px-high column. */
.auth-art {
    position: sticky; top: 0; align-self: start;
    height: 100vh; height: 100dvh;
    overflow: hidden;
    background: var(--bg-soft);
    isolation: isolate;
}

.auth-slides { position: absolute; inset: 0; }

.auth-slide {
    position: absolute; inset: 0;
    opacity: 0;
    animation: auth-frame 28s ease-in-out infinite;
    animation-delay: calc(var(--i) * 7s);
    will-change: opacity, transform;
}

.auth-slide img { width: 100%; height: 100%; object-fit: cover; }

/*
 * The scrim. Two layers: one vertical, so the caption at the bottom has
 * something to sit on whatever the photograph does down there, and one indigo
 * wash that pulls a daylight street towards the panel's own palette.
 *
 * The right edge fades into the form's background so the two halves meet
 * without a hard seam.
 */
.auth-veil {
    position: absolute; inset: 0; z-index: 1;
    background:
        linear-gradient(180deg, rgba(7, 11, 20, .62) 0%, rgba(7, 11, 20, .28) 34%, rgba(7, 11, 20, .94) 100%),
        linear-gradient(100deg, rgba(99, 102, 241, .30), rgba(139, 92, 246, .10) 55%, transparent),
        linear-gradient(270deg, var(--bg) 0%, transparent 22%);
}

.auth-art-body {
    position: relative; z-index: 2;
    height: 100%;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 36px 42px 40px;
    color: #fff;
}

.auth-art-brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.auth-art-brand img { max-height: 30px; width: auto; }
.auth-art-brand .brandmark-badge { width: 32px; height: 32px; border-radius: 10px; }

/* The captions are stacked on one grid cell so they cross-fade in place instead
   of pushing each other around. */
.auth-captions { display: grid; margin-bottom: 26px; }
.auth-caption {
    grid-area: 1 / 1;
    /* In px, not ch: the block inherits the 14px body size, so a `ch` measure
       here sizes the headline's column against the paragraph's font and squeezes
       a 30px headline into a 215px gutter. */
    max-width: 460px;
    opacity: 0;
    animation: auth-caption 28s ease-in-out infinite;
    animation-delay: calc(var(--i) * 7s);
}
.auth-caption h2 {
    margin: 0 0 10px;
    font-size: clamp(22px, 2.4vw, 30px); line-height: 1.16;
    letter-spacing: -.03em; font-weight: 800;
}
.auth-caption p {
    margin: 0; max-width: 40ch;
    font-size: 14px; line-height: 1.65;
    color: rgba(255, 255, 255, .74);
}

.auth-dots { display: flex; gap: 7px; }
.auth-dots i {
    position: relative; overflow: hidden;
    width: 30px; height: 3px; border-radius: 2px;
    background: rgba(255, 255, 255, .22);
}
.auth-dots i::after {
    content: ''; position: absolute; inset: 0;
    background: #fff; transform-origin: left; transform: scaleX(0);
    animation: auth-dot 28s linear infinite;
    animation-delay: calc(var(--i) * 7s);
}

/*
 * A quarter of the loop each. The frame holds from 4% to 25% and hands over
 * across the next 5%, which overlaps the incoming frame's own fade-in — a gap
 * would show the empty background through both.
 */
@keyframes auth-frame {
    0%   { opacity: 0; transform: scale(1.07); }
    4%   { opacity: 1; }
    25%  { opacity: 1; }
    30%  { opacity: 0; transform: scale(1.16); }
    100% { opacity: 0; transform: scale(1.07); }
}

@keyframes auth-caption {
    0%   { opacity: 0; transform: translateY(16px); }
    5%   { opacity: 1; transform: none; }
    23%  { opacity: 1; transform: none; }
    28%  { opacity: 0; transform: translateY(-12px); }
    100% { opacity: 0; transform: translateY(16px); }
}

@keyframes auth-dot {
    0%     { transform: scaleX(0); }
    25%    { transform: scaleX(1); }
    30%    { transform: scaleX(1); }
    30.01% { transform: scaleX(0); }
    100%   { transform: scaleX(0); }
}

/* ------------------------------------------------- merchant auth: form -- */

.auth-pane {
    display: grid; place-items: center;
    padding: 46px 30px;
    background:
        radial-gradient(ellipse 90% 60% at 90% 0%, rgba(99, 102, 241, .16), transparent 68%),
        var(--bg);
}

.auth-form { width: 100%; max-width: 372px; }
.auth-form.wide { max-width: 470px; }

.auth-back {
    display: inline-flex; align-items: center; gap: 8px;
    margin-bottom: 28px;
    font-size: 12.5px; font-weight: 600; color: var(--text-3);
    transition: color .14s;
}
.auth-back:hover { color: var(--text-2); }

.auth-form h1 { font-size: 25px; margin: 0 0 6px; font-weight: 800; letter-spacing: -.03em; }
.auth-form .sub { color: var(--text-3); font-size: 13.5px; margin: 0 0 28px; line-height: 1.55; }
.auth-form .auth-foot { text-align: left; }

/* The pane is already a page rather than a card, so the fields carry the
   surface instead of an outer box. */
.auth-form .input { background: var(--surface); padding: 11px 14px; }

.auth-legal {
    display: flex; flex-wrap: wrap; gap: 4px 16px;
    margin: 40px 0 0; padding-top: 18px;
    border-top: 1px solid var(--line-soft);
    font-size: 12px;
}
.auth-legal a { color: var(--text-3); transition: color .14s; }
.auth-legal a:hover { color: var(--text-2); }

@media (max-width: 940px) {
    /*
     * The artwork becomes a band across the top. It keeps the identity on a
     * phone without spending half the viewport on it — a merchant on a handset
     * came here to type a password, not to read four captions.
     */
    .auth-split { grid-template-columns: minmax(0, 1fr); }

    /*
     * `relative`, not `static`. The slides are absolutely positioned against
     * this box, so dropping it out of the positioned flow to unpin it sends
     * them to the initial containing block instead — a full-page-height image
     * spilling out of a 132px band, with `overflow: hidden` on an element that
     * is no longer their container and therefore clips nothing.
     */
    .auth-art { position: relative; height: 168px; }
    .auth-art-body { padding: 20px 24px; justify-content: space-between; }
    .auth-captions { display: none; }
    .auth-veil { background: linear-gradient(180deg, rgba(7, 11, 20, .40), var(--bg) 96%); }
    .auth-pane { padding: 34px 24px 48px; align-items: start; background: var(--bg); }
    .auth-back { display: none; }
}

@media (max-width: 520px) {
    .auth-art { height: 132px; }
    .auth-form h1 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    /*
     * Freeze on the first frame rather than cancelling the keyframes. Every
     * slide starts at opacity 0, so stopping the animation without this leaves
     * a visitor who asked for less motion looking at an empty panel.
     */
    .auth-slide, .auth-caption, .auth-dots i::after { animation: none; }
    .auth-slide:first-child, .auth-caption:first-child { opacity: 1; transform: none; }
    .auth-dots i:first-child::after { transform: scaleX(1); }
}

/* Same reasoning for a browser that never runs the keyframes at all. */
@supports not (animation-name: auth-frame) {
    .auth-slide:first-child, .auth-caption:first-child { opacity: 1; }
}

/* --------------------------------------------------- page transitions -- */

/*
 * The panel is a multi-page app: every filter, every save, every nav click is a
 * full document load. Handing both documents to the browser lets it cross-fade
 * them, and naming the parts that do not change keeps them still while it does.
 *
 * No JavaScript, deliberately. A hand-rolled version has to hold the navigation
 * back while an animation plays, and on a panel where half the clicks are POSTs
 * that redirect, that is a way to make a slow save look like a broken one.
 */
@view-transition { navigation: auto; }

/* Named, so they are the same element on both sides of a navigation. The
   sidebar and the topbar are the frame; only the content inside them moves. */
.sidebar   { view-transition-name: panel-sidebar; }
.topbar    { view-transition-name: panel-topbar; }

/* The artwork stays put while the form crosses over — signing in and creating
   an account are two states of one screen, not two screens. */
.auth-art  { view-transition-name: auth-art; }

::view-transition-old(root) { animation: pvt-out .16s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: pvt-in .28s cubic-bezier(.22, .61, .36, 1) both; }

@keyframes pvt-out { to   { opacity: 0; } }
@keyframes pvt-in  { from { opacity: 0; transform: translateY(9px); } }

/* Everywhere else: one short rise on load, so arriving reads as arriving. The
   opening state is in the keyframe, not on the element, so a browser that
   ignores `animation` shows the content rather than hiding it forever. */
@supports not (view-transition-name: none) {
    .content, .auth-form, .auth-card { animation: pvt-in .28s cubic-bezier(.22, .61, .36, 1) both; }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root) { animation: pvt-out .1s linear both; }
    ::view-transition-new(root) { animation: pvt-out .1s linear reverse both; }
    .content, .auth-form, .auth-card { animation: none; }
}

/* -------------------------------------------------------------- charts -- */

.bars { display: flex; align-items: flex-end; gap: 5px; height: 130px; padding: 0 2px; }
.bars .bar { flex: 1 1 0; background: linear-gradient(180deg, var(--accent), rgba(99,102,241,.22)); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; }
.bars .bar:hover { filter: brightness(1.25); }
.bars .bar span {
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    font-size: 10.5px; color: var(--text-2); margin-bottom: 4px; white-space: nowrap;
    opacity: 0; transition: opacity .14s;
}
.bars .bar:hover span { opacity: 1; }
.bar-labels { display: flex; gap: 5px; margin-top: 7px; }
.bar-labels span { flex: 1 1 0; text-align: center; font-size: 10px; color: var(--text-3); }

/* ---------------------------------------------------------- responsive -- */

@media (max-width: 1180px) {
    .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.side { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed; left: 0; top: 0; z-index: 80;
        transform: translateX(-100%); transition: transform .2s ease;
        box-shadow: var(--shadow);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open::after {
        content: ""; position: fixed; inset: 0; background: rgba(3, 6, 14, .6); z-index: 70;
    }
    .burger { display: inline-flex; }
    .content { padding: 18px 15px 50px; }
    .topbar { padding: 12px 15px; }
    .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .kv { grid-template-columns: minmax(0, 1fr); }
    .kv > dt { padding-bottom: 0; border-bottom: 0; }
}

@media (max-width: 560px) {
    .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); }
    .stat-value { font-size: 22px; }
    .topbar h1 { font-size: 15.5px; }
}

@media print {
    .sidebar, .topbar-actions, .burger, .filters, .pager, .actions { display: none !important; }
    body { background: #fff; color: #000; }
    .card { border-color: #ccc; box-shadow: none; }
}
