/* ==========================================================================
   Wallet UI – stylesheet
   Restrained, data-first interface. Neutral surfaces, one brand color
   (--primary) and one accent (--accent), both set from the admin settings.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
    --primary: #2f6fed;
    --accent: #e8b008;

    --bg: #0b0d10;
    --panel: #14171c;
    --panel-2: #1a1e24;
    --panel-3: #22272e;
    --input: #101317;
    --line: #232830;
    --line-2: #2e343d;

    --text: #e9ebee;
    --text-2: #929aa5;
    --text-3: #626a75;

    --up: #18b47b;
    --down: #e5484d;
    --warn: #d99a0b;
    --info: #4c8dff;

    --primary-tint: color-mix(in srgb, var(--primary) 12%, transparent);
    --up-tint: color-mix(in srgb, var(--up) 12%, transparent);
    --down-tint: color-mix(in srgb, var(--down) 12%, transparent);
    --warn-tint: color-mix(in srgb, var(--warn) 14%, transparent);
    --info-tint: color-mix(in srgb, var(--info) 12%, transparent);

    --r-sm: 3px;
    --r: 4px;
    --r-lg: 6px;

    --font: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

    --sidebar-w: 232px;
    --topbar-h: 56px;

    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f4f5f6;
    --panel: #ffffff;
    --panel-2: #f7f8f9;
    --panel-3: #eef0f2;
    --input: #ffffff;
    --line: #e6e8eb;
    --line-2: #d5d9de;

    --text: #1b1f24;
    --text-2: #636b76;
    --text-3: #949ba5;

    color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--primary); color: #fff; }

.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.text-success { color: var(--up); }
.text-danger { color: var(--down); }
.text-warning { color: var(--warn); }
.text-primary { color: var(--primary); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 600; }
.hidden { display: none !important; }
.link { color: var(--primary); }
.link:hover { text-decoration: underline; }

/* ---------- Layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-sm { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; 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)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 16px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 14px;
    border: 1px solid var(--line-2); border-radius: var(--r);
    background: var(--panel-2); color: var(--text);
    font-weight: 500; font-size: 13.5px; white-space: nowrap;
    cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--panel-3); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); border-color: color-mix(in srgb, var(--primary) 88%, #000); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #14171c; }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 90%, #000); }
.btn-success { background: transparent; border-color: color-mix(in srgb, var(--up) 45%, transparent); color: var(--up); }
.btn-success:hover { background: var(--up-tint); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--down) 45%, transparent); color: var(--down); }
.btn-danger:hover { background: var(--down-tint); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-outline { background: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }

/* ---------- Panels ---------- */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    min-width: 0;
}
.card-body { padding: 18px; }
.card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 50px; padding: 10px 18px; border-bottom: 1px solid var(--line);
}
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-header .sub { color: var(--text-3); font-size: 12px; font-weight: 400; margin-top: 1px; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--line); }
.card-flush .table th:first-child, .card-flush .table td:first-child { padding-left: 18px; }
.card-flush .table th:last-child, .card-flush .table td:last-child { padding-right: 18px; }

/* Figures strip (KPIs) */
.stat { padding: 16px 18px; }
.stat .label { color: var(--text-2); font-size: 12.5px; }
.stat .value { font-size: 22px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .meta { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.stat-icon { display: none; }

/* Balance panel */
.balance-card { padding: 20px 22px; }
.balance-card .label { color: var(--text-2); font-size: 13px; }
.balance-card .amount { font-size: 30px; font-weight: 600; margin: 6px 0 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.balance-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center;
    height: 20px; padding: 0 7px; border-radius: var(--r-sm);
    font-size: 11.5px; font-weight: 500; white-space: nowrap;
    background: var(--panel-3); color: var(--text-2);
}
.badge-success { background: var(--up-tint); color: var(--up); }
.badge-danger { background: var(--down-tint); color: var(--down); }
.badge-warning { background: var(--warn-tint); color: var(--warn); }
.badge-info { background: var(--info-tint); color: var(--info); }
.badge-primary { background: var(--primary-tint); color: var(--primary); }
.badge-neutral { background: var(--panel-3); color: var(--text-2); }

.change { font-weight: 500; font-variant-numeric: tabular-nums; }
.change.up { color: var(--up); }
.change.down { color: var(--down); }

/* ---------- Coin mark & avatar ---------- */
.coin {
    --c: #6b7480;
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--c); color: #fff;
    font-weight: 600; font-size: 9.5px; letter-spacing: -.02em;
}
.coin-sm { width: 22px; height: 22px; font-size: 8px; }
.coin-lg { width: 40px; height: 40px; font-size: 12px; }
.asset { display: flex; align-items: center; gap: 10px; min-width: 0; }
.asset .name { font-weight: 500; }
.asset .sym { color: var(--text-3); font-size: 12px; }

.avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--panel-3); color: var(--text-2);
    font-weight: 600; font-size: 12px; border: 1px solid var(--line-2);
}
.avatar-lg { width: 52px; height: 52px; font-size: 17px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-weight: 400; font-size: 12px; color: var(--text-3);
    padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--panel-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .actions form { margin: 0; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty svg { width: 28px; height: 28px; margin: 0 auto 10px; opacity: .6; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 12.5px; color: var(--text-2); }
.input, .select, .textarea {
    width: 100%; height: 38px; padding: 0 12px;
    background: var(--input); border: 1px solid var(--line-2); border-radius: var(--r);
    color: var(--text); outline: none;
    transition: border-color .12s;
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select {
    appearance: none; padding-right: 32px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23808893' stroke-width='2' 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:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input-sm, .select.input-sm { height: 32px; font-size: 13px; }
.input[type="color"] { padding: 3px; width: 46px; cursor: pointer; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 90px; }
.input-group .addon { position: absolute; right: 6px; display: flex; gap: 4px; align-items: center; color: var(--text-2); font-size: 12.5px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 32px; }
.help { font-size: 12px; color: var(--text-3); }
.error-text { font-size: 12px; color: var(--down); }
.is-invalid { border-color: var(--down) !important; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch .title { font-weight: 500; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 10px; background: var(--panel-3); position: relative; cursor: pointer; flex-shrink: 0; border: 1px solid var(--line-2); transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--primary); border-color: var(--primary); }
.switch input:checked::after { transform: translateX(16px); }

/* Tabs */
.segmented { display: flex; gap: 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.segmented a { padding: 10px 0; color: var(--text-2); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.segmented a:hover { color: var(--text); }
.segmented a.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 500; }

/* Filter bar */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.filters .input-icon { flex: 1; min-width: 200px; max-width: 360px; }
.filters .select { width: auto; min-width: 130px; }

/* ---------- Alerts / notices ---------- */
.alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line-2);
    background: var(--panel-2); color: var(--text);
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.alert-success { border-color: color-mix(in srgb, var(--up) 35%, transparent); background: var(--up-tint); }
.alert-success svg { color: var(--up); }
.alert-danger { border-color: color-mix(in srgb, var(--down) 35%, transparent); background: var(--down-tint); }
.alert-danger svg { color: var(--down); }
.alert-warning { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-tint); }
.alert-warning svg { color: var(--warn); }
.alert-info svg { color: var(--info); }

.toast-stack { position: fixed; top: 12px; right: 12px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(400px, calc(100vw - 24px)); }
.toast { background: var(--panel); box-shadow: 0 6px 24px rgb(0 0 0 / .25); }
.toast.alert-success { background: color-mix(in srgb, var(--up) 10%, var(--panel)); }
.toast.alert-danger { background: color-mix(in srgb, var(--down) 10%, var(--panel)); }
.toast .close { margin-left: auto; background: none; border: 0; color: var(--text-2); cursor: pointer; padding: 0; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 16px; background: rgb(0 0 0 / .6); }
.modal.open { display: flex; }
.modal-box { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: 0 20px 60px rgb(0 0 0 / .4); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 18px; color: var(--text); white-space: pre-line; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }

/* ---------- App shell ---------- */
.shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
    background: var(--panel); border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
    transition: transform .2s ease;
}
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--line); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 1px; }
.nav-section { font-size: 11.5px; color: var(--text-3); padding: 14px 10px 6px; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    height: 36px; padding: 0 10px; border-radius: var(--r);
    color: var(--text-2);
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link.active { background: var(--panel-3); color: var(--text); font-weight: 500; }
.nav-link.active svg { color: var(--primary); }
.nav-link .count { margin-left: auto; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.sidebar-footer { padding: 10px; border-top: 1px solid var(--line); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 4px; }
.sidebar-user .name { font-weight: 500; font-size: 13px; }
.sidebar-user .email { font-size: 11.5px; color: var(--text-3); }

.main { margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
    display: flex; align-items: center; gap: 8px; padding: 0 24px;
    background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar .title { font-size: 14px; font-weight: 500; color: var(--text-2); }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; }
.content { padding: 24px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 20px; }
.page-head p { color: var(--text-2); margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.backdrop { display: none; }

/* Brand */
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15.5px; }
.brand-mark {
    width: 26px; height: 26px; border-radius: var(--r); display: grid; place-items: center;
    background: var(--primary); color: #fff; font-weight: 700; font-size: 14px;
}
.brand img { height: 28px; width: auto; }
.brand .tag { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: var(--r-sm); border: 1px solid var(--line-2); color: var(--text-2); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown summary { list-style: none; cursor: pointer; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; z-index: 50;
    background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg);
    box-shadow: 0 10px 30px rgb(0 0 0 / .3); padding: 4px;
}
.dropdown-menu a, .dropdown-menu button {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 8px 10px; border-radius: var(--r); border: 0; background: none; cursor: pointer;
    color: var(--text-2); text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--panel-2); color: var(--text); }
.dropdown-menu svg { width: 15px; height: 15px; }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* Activity list */
.activity { display: flex; flex-direction: column; }
.activity-item { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
a.activity-item:hover { background: var(--panel-2); }
.activity-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--panel-3); }
.activity-icon svg { width: 14px; height: 14px; }
.activity-icon.in { color: var(--up); }
.activity-icon.out { color: var(--down); }

/* Allocation */
.alloc { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--panel-3); gap: 2px; }
.alloc span { display: block; height: 100%; }
.legend { display: flex; flex-direction: column; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* Key/value list */
.kv { display: flex; flex-direction: column; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 500; text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* Coin picker */
.coin-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.coin-option { position: relative; }
.coin-option input { position: absolute; opacity: 0; pointer-events: none; }
.coin-option label, .coin-option a {
    display: flex; align-items: center; gap: 8px; padding: 9px 10px; cursor: pointer;
    border: 1px solid var(--line-2); border-radius: var(--r); background: var(--input);
}
.coin-option label:hover, .coin-option a:hover { border-color: var(--text-3); }
.coin-option input:checked + label, .coin-option a.active { border-color: var(--primary); background: var(--primary-tint); }

.address-box { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--input); border: 1px solid var(--line-2); border-radius: var(--r); }
.address-box code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: 13px; }
.qr { padding: 10px; background: #fff; border-radius: var(--r); width: fit-content; border: 1px solid var(--line); }
.qr img, .qr canvas { width: 156px; height: 156px; }

.steps { counter-reset: step; display: flex; flex-direction: column; gap: 12px; padding: 0; margin: 0; }
.steps li { list-style: none; display: flex; gap: 10px; color: var(--text-2); }
.steps li::before {
    counter-increment: step; content: counter(step);
    width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; font-size: 11px; font-weight: 600;
    border: 1px solid var(--line-2); color: var(--text);
}

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--line); }
.pagination .pages { display: flex; gap: 2px; flex-wrap: wrap; }
.pagination .page { min-width: 28px; height: 28px; padding: 0 8px; border-radius: var(--r); display: grid; place-items: center; font-size: 12.5px; color: var(--text-2); }
.pagination a.page:hover { background: var(--panel-2); color: var(--text); }
.pagination .page.active { background: var(--panel-3); color: var(--text); font-weight: 600; }
.pagination .page.disabled { opacity: .35; }

/* Chart */
.chart-box { position: relative; height: 280px; }

/* Settings */
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.preset { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--input); cursor: pointer; font-size: 12.5px; }
.preset:hover { border-color: var(--text-3); }
.preset .sw { display: flex; gap: 2px; }
.preset .sw span { width: 12px; height: 12px; border-radius: 2px; }
.logo-preview { width: 100%; height: 84px; border-radius: var(--r); border: 1px dashed var(--line-2); display: grid; place-items: center; background: var(--input); }
.logo-preview img { max-height: 48px; }

/* Address editor rows */
.addr-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 18px; border-bottom: 1px solid var(--line); }
.addr-row:last-child { border-bottom: 0; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; }
.auth-top { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--panel); }
.auth-main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 64px 16px 40px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box .card-body { padding: 26px; }
.auth-box h1 { font-size: 22px; }
.auth-box .sub { color: var(--text-2); margin: 4px 0 20px; }
.auth-foot { padding: 18px 24px; text-align: center; color: var(--text-3); font-size: 12px; }
.demo-box { margin-top: 12px; padding: 12px 14px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel); }
.demo-box button { all: unset; cursor: pointer; display: flex; justify-content: space-between; width: 100%; padding: 5px 0; font-size: 12.5px; color: var(--text-2); }
.demo-box button:hover { color: var(--text); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    .grid-main { grid-template-columns: minmax(0, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .sidebar { transform: translateX(-100%); }
    .sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgb(0 0 0 / .4); }
    .sidebar-open .backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgb(0 0 0 / .5); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
}

@media (max-width: 760px) {
    .content { padding: 16px; }
    .topbar { padding: 0 12px; }
    .grid-2, .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .grid { gap: 12px; }
    .card-body, .stat { padding: 14px; }
    .card-header, .filters, .pagination, .card-footer { padding-left: 14px; padding-right: 14px; }
    .activity-item { padding: 10px 14px; }
    .stat .value { font-size: 18px; }
    .balance-card .amount { font-size: 26px; }
    .page-head h1 { font-size: 18px; }
    .filters .select, .filters .input-icon { min-width: 0; max-width: none; flex: 1 1 140px; }
    .hide-sm { display: none !important; }
    .addr-row { grid-template-columns: minmax(0, 1fr); padding: 10px 14px; }
    .auth-main { padding-top: 32px; }

    /* Tables become stacked rows on phones */
    .table.responsive thead { display: none; }
    .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
    .table.responsive tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
    .table.responsive tbody tr:last-child { border-bottom: 0; }
    .table.responsive td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0 !important; border: 0; text-align: right; }
    .table.responsive td::before { content: attr(data-label); color: var(--text-3); font-size: 12px; text-align: left; flex-shrink: 0; }
    .table.responsive td[data-label=""]::before, .table.responsive td:not([data-label])::before { display: none; }
    .table.responsive .actions { justify-content: flex-end; width: 100%; padding-top: 4px; }
}

@media (max-width: 420px) {
    .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .balance-card .actions .btn { flex: 1; }
}
