:root {
    --bg: #f0f4f8;
    --sidebar-bg: #0b1f36;
    --sidebar-bg2: #143552;
    --primary: #1e4a7a;
    --primary-dark: #0f2744;
    --gold: #c5a059;
    --gold-bright: #d4af37;
    --gold-light: #e8d5a8;
    --text: #0f172a;
    --muted: #64748b;
    --card-bg: #ffffff;
    --border: #d7e0ea;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

/* Sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg2));
    color: var(--gold-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 20;
}
.brand {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gold-light);
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(197,160,89,.15);
}
.brand-mark { flex-shrink: 0; width: 42px; height: 42px; border-radius: 11px; box-shadow: 0 2px 10px rgba(0,0,0,.35); object-fit: cover; }
.brand-text { line-height: 1.15; letter-spacing: -0.01em; color: var(--gold-light); font-size: 1.15rem; }
.nav-menu { padding: 14px 12px; flex: 1; overflow-y: auto; min-height: 0; }
.nav-menu .nav-link, .sidebar-footer .nav-link {
    color: var(--gold-light);
    border-radius: 10px;
    padding: 11px 14px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 11px;
    font-weight: 500;
    transition: all .15s;
}
.nav-menu .nav-link:hover, .sidebar-footer .nav-link:hover { background: rgba(197,160,89,.12); color: #fff; }
.nav-menu .nav-link.active { background: linear-gradient(135deg, var(--gold), var(--gold-bright)); color: var(--sidebar-bg); box-shadow: 0 4px 14px rgba(0,0,0,.28); font-weight: 600; }
.nav-menu .nav-link i { font-size: 1.1rem; }
.table-group-header td {
    background: rgba(197,160,89,.08);
    border-top: 2px solid rgba(197,160,89,.25);
    color: var(--primary);
    font-size: .92rem;
}
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(197,160,89,.15); }

/* Main */
.main { flex: 1; margin-left: 250px; display: flex; flex-direction: column; }
.topbar {
    background: linear-gradient(90deg, var(--sidebar-bg), var(--primary));
    color: var(--gold-light);
    padding: 0 26px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.page-title { font-size: 1.25rem; font-weight: 600; }
.user-box { display: flex; align-items: center; gap: 12px; }
.user-info { text-align: right; line-height: 1.1; }
.user-name { font-weight: 600; }
.user-role { font-size: .75rem; opacity: .8; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.content { padding: 26px; flex: 1; }

/* Cards / panels */
.card { border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--border); font-weight: 600; border-radius: 14px 14px 0 0 !important; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    display: flex; align-items: center; gap: 16px;
}
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #fff;
}
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.bg-indigo { background: var(--primary); }
.bg-green { background: #16a34a; }
.bg-amber { background: #f59e0b; }
.bg-rose { background: #e11d48; }
.bg-sky { background: #0ea5e9; }

/* Tables */
.table { background: #fff; }
.table thead th { background: #f8fafc; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid var(--border); }
.table td { vertical-align: middle; }
.card-number { font-family: 'SF Mono', Consolas, monospace; letter-spacing: 1px; }

/* Badges */
.badge-status { padding: 5px 11px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.st-Active { background: #dcfce7; color: #166534; }
.st-Blocked { background: #fee2e2; color: #991b1b; }
.st-Closed { background: #e2e8f0; color: #475569; }

.tx-Load { color: #16a34a; font-weight: 600; }
.tx-Spend { color: #e11d48; font-weight: 600; }
.tx-Refund { color: #0ea5e9; font-weight: 600; }
.tx-Adjust { color: #f59e0b; font-weight: 600; }

.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--sidebar-bg); font-weight: 600; }
.btn-primary:hover { background: var(--gold-bright); border-color: var(--gold-bright); color: var(--sidebar-bg); }

.page-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }

/* Login */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, var(--sidebar-bg) 0%, var(--primary) 55%, #1a3a5c 100%);
    padding: 20px;
}
.login-card {
    background: #fff; border-radius: 18px; padding: 40px;
    width: 100%; max-width: 410px;
    box-shadow: 0 24px 64px rgba(11,31,54,.45);
    border: 1px solid rgba(197,160,89,.18);
}
.login-card .logo { text-align: center; margin-bottom: 14px; }
.login-card .logo img { border-radius: 22px; box-shadow: 0 10px 28px rgba(11,31,54,.35); }
.login-card h1 { text-align: center; font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; color: var(--sidebar-bg); }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 26px; }
.login-hint { text-align: center; font-size: .8rem; color: var(--muted); margin-top: 16px; }

/* Operation type selector */
.op-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.op-option input { display: none; }
.op-option label {
    display: block; text-align: center; padding: 16px 8px; border-radius: 12px;
    border: 2px solid var(--border); cursor: pointer; font-weight: 600; transition: all .15s;
}
.op-option label i { display: block; font-size: 1.5rem; margin-bottom: 6px; }
.op-option input:checked + label { border-color: var(--gold); background: #f5f2e8; color: var(--primary-dark); }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    .op-grid { grid-template-columns: repeat(2, 1fr); }
}
