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

:root {
    --bg: #0a0f1a;
    --surface: #131b2e;
    --surface2: #1c2740;
    --border: #2a3a55;
    --text: #f1f5f9;
    --text-dim: #8899b4;
    --accent: #22c55e;
    --accent-light: #4ade80;
    --green: #4ade80;
    --red: #f87171;
    --yellow: #fbbf24;
    --radius: 10px;
    --brand-gradient: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--brand-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.brand-name span { color: var(--accent); }

.brand-company {
    font-size: 0.65rem;
    color: var(--text-dim);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

header h1 {
    font-size: 1.4rem;
    color: var(--accent);
    white-space: nowrap;
}

nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-btn:hover { color: var(--text); border-color: var(--text-dim); }
.nav-btn.active { background: var(--brand-gradient); color: #fff; border-color: var(--accent); font-weight: 600; }

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--accent-light);
}

.card h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-dim);
}

/* Summary cards row */
.summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.summary-card .label {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.summary-card .amount {
    font-size: 1.8rem;
    font-weight: 700;
}

.summary-card .amount.positive { color: var(--green); }
.summary-card .amount.negative { color: var(--red); }

/* Forms */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 140px;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

input, select, textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

textarea { resize: vertical; min-height: 60px; }

.btn {
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-success { background: var(--green); color: var(--bg); }
.btn-danger { background: var(--red); color: var(--bg); }
.btn-warning { background: var(--yellow); color: var(--bg); }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover td { background: rgba(255,255,255,0.02); }

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-dim { color: var(--text-dim); }
.text-right { text-align: right; }
.text-center { text-align: center; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-green { background: rgba(74,222,128,0.15); color: var(--green); }
.badge-red { background: rgba(248,113,113,0.15); color: var(--red); }
.badge-yellow { background: rgba(251,191,36,0.15); color: var(--yellow); }
.badge-blue { background: rgba(56,189,248,0.15); color: var(--accent); }
.badge-blue { background: rgba(56,189,248,0.15); color: var(--accent); }

.empty-state {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 20px;
    font-size: 0.95rem;
}

/* Recent activity list */
.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-info { display: flex; flex-direction: column; gap: 2px; }
.activity-type { font-size: 0.8rem; color: var(--text-dim); }
.activity-amount { font-weight: 600; white-space: nowrap; }

/* Footer */
footer {
    text-align: center;
    padding: 32px 24px;
    margin-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.75rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

/* PIN Login Screen */
.pin-overlay {
    position: fixed; inset: 0;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}

.pin-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    width: 320px;
    max-width: 90vw;
}

.pin-box h2 { color: var(--accent); margin-bottom: 8px; }

.pin-display {
    display: flex; gap: 8px; justify-content: center;
    margin-bottom: 16px;
}

.pin-dot {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border);
    transition: all 0.15s;
}

.pin-dot.filled {
    background: var(--accent);
    border-color: var(--accent);
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 240px;
    margin: 0 auto;
}

.pin-key {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 16px;
    border-radius: var(--radius);
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.pin-key:hover:not(:disabled) { background: var(--border); }
.pin-key:active:not(:disabled) { transform: scale(0.95); }
.pin-key:disabled { visibility: hidden; }
.pin-key-action { font-size: 1.2rem; }

/* Auth status in header */
#auth-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* Denomination Grid */
.denom-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.denom-header {
    display: grid;
    grid-template-columns: 1fr 100px 100px;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.denom-row {
    display: grid;
    grid-template-columns: 1fr 100px 100px;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
}

.denom-label { font-weight: 600; }

.denom-qty {
    width: 100%;
    text-align: center;
    padding: 6px !important;
}

.denom-sub { font-size: 0.9rem; }

/* Text yellow (for variance) */
.text-yellow { color: var(--yellow); }

/* Responsive */
@media (max-width: 600px) {
    header { padding: 12px 16px; }
    main { padding: 16px; }
    .summary-row { grid-template-columns: 1fr 1fr; }
    .form-row { flex-direction: column; }
    .form-group { min-width: 100%; }
    .denom-header, .denom-row { grid-template-columns: 1fr 80px 80px; }
    #auth-status { margin-left: 0; }
}

/* Print styles */
@media print {
    body { background: #fff; color: #111; }
    header { display: none; }
    main { padding: 0; max-width: 100%; }
    .card { background: #fff; border: 1px solid #ccc; break-inside: avoid; }
    .card h2 { color: #111; }
    .summary-card { background: #f9f9f9; border: 1px solid #ccc; }
    .summary-card .label { color: #555; }
    .summary-card .amount { color: #111; }
    .summary-card .amount.positive { color: #16a34a; }
    .summary-card .amount.negative { color: #dc2626; }
    .text-green { color: #16a34a !important; }
    .text-red { color: #dc2626 !important; }
    .text-dim { color: #555 !important; }
    .badge { border: 1px solid #ccc; }
    .badge-green { background: #dcfce7; color: #16a34a; }
    .badge-red { background: #fee2e2; color: #dc2626; }
    .badge-yellow { background: #fef9c3; color: #a16207; }
    .badge-blue { background: #e0f2fe; color: #0369a1; }
    th { color: #555; }
    th, td { border-bottom: 1px solid #ddd; }
    tr:hover td { background: none; }
    .btn { display: none; }
    .summary-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    footer { display: none; }
    #pin-screen { display: none !important; }
    #auth-status { display: none; }
}
