:root {
    --brand: #635bff;
    --brand-dark: #4b3ec7;
    --ink: #0a2540;
    --ink-2: #425466;
    --muted: #697386;
    --line: #e6ebf1;
    --line-2: #eef1f6;
    --canvas: #f6f9fc;
    --surface: #ffffff;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warn: #d97706;
    --warn-bg: #fef3c7;
    --info: #0ea5e9;
    --info-bg: #e0f2fe;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --shadow-sm: 0 1px 3px rgba(50,50,93,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 6px 20px rgba(50,50,93,.08), 0 3px 6px rgba(0,0,0,.03);
    --shadow-lg: 0 20px 40px rgba(50,50,93,.10), 0 10px 20px rgba(0,0,0,.05);
    --radius: 10px;
    --radius-lg: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.bg-canvas { background: var(--canvas); min-height: 100vh; }

.text-success { color: var(--success) !important; }
.text-muted { color: var(--muted) !important; }
.nowrap { white-space: nowrap; }

/* ==== AUTH ==== */
.auth-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } }
.auth-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 72px;
    background: var(--surface);
    max-width: 620px;
    width: 100%;
    margin: 0 auto;
}
@media (max-width: 900px) { .auth-card { padding: 40px 24px; } }
.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
}
.auth-logo {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--brand) 0%, #7d75ff 100%);
    color: #fff;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    letter-spacing: 0.5px;
}
.auth-brand-name { font-weight: 600; font-size: 15px; color: var(--ink); }
.auth-brand-sub { color: var(--muted); font-size: 13px; }
.auth-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
    color: var(--ink);
}
.auth-sub {
    color: var(--ink-2);
    margin: 0 0 32px;
    font-size: 15px;
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 400px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
}
.field input, .filter-group input, .filter-group select {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    color: var(--ink);
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .filter-group input:focus, .filter-group select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.12);
}
.auth-error {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
}
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 20px;
    background: linear-gradient(135deg, var(--brand) 0%, #7d75ff 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(99, 91, 255, 0.25);
    transition: transform .1s, box-shadow .1s, opacity .15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99, 91, 255, 0.35); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-ghost {
    padding: 8px 14px;
    background: transparent;
    color: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: var(--canvas); border-color: #cfd7e3; }
.auth-footer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--line-2);
    font-size: 13px;
    color: var(--muted);
    max-width: 400px;
    line-height: 1.6;
}
.auth-brand-side {
    background: linear-gradient(160deg, #0a2540 0%, #1a3a6b 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}
.auth-brand-side::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(99, 91, 255, 0.35) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(125, 117, 255, 0.28) 0%, transparent 40%);
}
.side-content { position: relative; z-index: 1; max-width: 420px; }
.side-title { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 16px; }
.side-sub { color: rgba(255,255,255,0.75); font-size: 16px; line-height: 1.6; }
@media (max-width: 900px) { .auth-brand-side { display: none; } }

/* ==== TOPBAR ==== */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--brand) 0%, #7d75ff 100%);
    color: #fff; font-weight: 700; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
}
.brand-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.brand-sub { font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--canvas);
    border-radius: 999px;
    border: 1px solid var(--line);
}
.user-avatar {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, #0a2540 0%, #425466 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
}
.user-name { font-size: 13px; font-weight: 500; color: var(--ink); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==== PAGE ==== */
.page { padding: 32px 0 60px; }
.page-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-head { margin-bottom: 28px; }
.page-title { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
.page-sub { color: var(--ink-2); margin: 0; }

/* ==== STATS ==== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0.4px; text-transform: uppercase; margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-trend { font-size: 12px; margin-top: 6px; }

/* ==== FILTERS ==== */
.filter-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.filter-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr) auto;
    gap: 14px;
    align-items: end;
}
@media (max-width: 720px) { .filter-row { grid-template-columns: 1fr 1fr; } .filter-actions { grid-column: span 2; } }
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group label { font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
.filter-actions { display: flex; }
.filter-actions .btn-primary { padding: 10px 22px; }

/* ==== TX ==== */
.tx-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.tx-head {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}
.tx-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.chip {
    background: var(--canvas);
    color: var(--muted);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--line);
}
.tx-table-wrap { overflow-x: auto; }
.tx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tx-table th {
    text-align: left;
    padding: 12px 20px;
    background: #fafbfd;
    color: var(--muted);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.tx-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--line-2);
    vertical-align: top;
}
.tx-table tr:last-child td { border-bottom: none; }
.tx-table tr:hover td { background: #fafbfd; }
.tx-table td.num, .tx-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tx-table tr.empty td { padding: 40px 20px; text-align: center; color: var(--muted); }
.tx-desc { max-width: 480px; color: var(--ink-2); font-size: 13px; line-height: 1.4; }
.tx-amt { font-weight: 600; font-size: 14px; }
.tx-sub { color: var(--muted); font-size: 12px; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* ==== STATUS PILLS ==== */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid transparent;
}
.status-pill::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    flex-shrink: 0;
}
.status-pending    { background: var(--warn-bg);    color: var(--warn);    border-color: rgba(217, 119, 6, 0.15); }
.status-processing { background: var(--info-bg);    color: var(--info);    border-color: rgba(14, 165, 233, 0.15); }
.status-partial    { background: var(--warn-bg);    color: var(--warn);    border-color: rgba(217, 119, 6, 0.15); }
.status-paid       { background: var(--success-bg); color: var(--success); border-color: rgba(16, 185, 129, 0.15); }
