@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700;800;900&family=Barlow:wght@400;500;600;700;800&display=swap');

:root {
    --navy: #1a2a4e;
    --navy-dark: #0f1b35;
    --navy-mid: #243560;
    --blue: #0020f8;
    --blue-light: #3a5af8;
    --gray: #636666;
    --gray-light: #8a8f94;
    --white-gray: #f7f8fc;
    --bg: #f0f2f8;
    --surface: #ffffff;
    --surface-2: #f7f8fc;
    --ink: #0f1b35;
    --muted: #5a6278;
    --line: #dde0ec;
    --line-strong: #bcc2d8;
    --accent: var(--navy);
    --accent-hover: var(--navy-dark);
    --accent-blue: var(--blue);
    --danger: #c0392b;
    --good: #1a7a4a;
    --warn: #9a6800;
    --shadow: 0 2px 8px rgba(15,27,53,.10);
    --shadow-lg: 0 4px 20px rgba(15,27,53,.14);
    --focus: 0 0 0 3px rgba(0,32,248,.18);
    --radius: 8px;
    --radius-lg: 12px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Barlow', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--blue); }

button, .button, input, select, textarea { font: inherit; }

button, .button {
    align-items: center;
    background: var(--navy);
    border: 1.5px solid var(--navy);
    border-radius: var(--radius);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    font-family: 'Barlow Condensed', sans-serif;
    letter-spacing: .04em;
    text-transform: uppercase;
    justify-content: center;
    min-height: 38px;
    padding: 8px 16px;
    transition: background .15s, border-color .15s;
}
button:hover, .button:hover {
    background: var(--navy-dark);
    border-color: var(--navy-dark);
    text-decoration: none;
}
button.secondary, .button.secondary {
    background: #fff;
    border-color: var(--line-strong);
    color: var(--ink);
}
button.secondary:hover, .button.secondary:hover { background: var(--surface-2); }
button.danger, .button.danger {
    background: var(--danger);
    border-color: var(--danger);
}
button:disabled { cursor: not-allowed; opacity: .5; }
.button.tiny, button.tiny {
    font-size: 12px;
    min-height: 28px;
    padding: 4px 10px;
}

.shell { min-height: 100vh; }

/* SIDEBAR */
.sidebar {
    background: var(--navy-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 0;
    left: 0;
    min-height: 100vh;
    padding: 0;
    position: fixed;
    top: 0;
    width: 220px;
    z-index: 10;
    box-shadow: 3px 0 16px rgba(10,20,50,.18);
}

.brand {
    align-items: center;
    color: #fff;
    display: flex;
    gap: 10px;
    padding: 18px 16px 16px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
    background: var(--navy);
}
.brand:hover { text-decoration: none; color: #fff; }

.brand-logo {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

.brand-text strong {
    display: block;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1;
}
.brand-text small {
    color: rgba(255,255,255,.55);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.auth-brand .brand-logo { width: 52px; height: 52px; }
.auth-brand .brand-text strong { font-size: 22px; }

.sidebar nav {
    display: grid;
    gap: 2px;
    padding: 12px 10px;
    flex: 1;
}
.sidebar nav a {
    border-radius: 6px;
    color: rgba(255,255,255,.70);
    font-weight: 600;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: background .12s, color .12s;
}
.sidebar nav a::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255,255,255,.3);
    flex-shrink: 0;
    transition: background .12s, width .12s, height .12s;
}
.sidebar nav a.active, .sidebar nav a:hover {
    background: rgba(255,255,255,.10);
    color: #fff;
    text-decoration: none;
}
.sidebar nav a.active::before {
    background: var(--blue-light);
    width: 6px;
    height: 6px;
}

.userbox {
    border-top: 1px solid rgba(255,255,255,.08);
    color: rgba(255,255,255,.7);
    display: grid;
    gap: 2px;
    padding: 14px 16px;
}
.userbox strong { color: #fff; font-size: 14px; }
.userbox span { color: rgba(255,255,255,.45); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.userbox a { color: rgba(255,255,255,.55); font-size: 12px; margin-top: 6px; display: inline-block; }
.userbox a:hover { color: #fff; }

.main { margin-left: 220px; padding: 24px 28px 40px; }

.auth .main {
    align-items: center;
    display: flex;
    justify-content: center;
    margin: 0;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(145deg, #0f1b35 0%, #1a2a4e 50%, #1a2a60 100%);
}

.topbar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}
.nav-toggle { display: none; }

/* TOP ACCENT BAR */
.main::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, var(--navy) 0%, var(--blue) 60%, var(--blue-light) 100%);
    margin: -24px -28px 24px;
}
.auth .main::before { display: none; }

h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 26px; font-weight: 800; font-family: 'Barlow Condensed', sans-serif; letter-spacing: .02em; text-transform: uppercase; }
h2 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    padding: 20px;
}
.panel.narrow { max-width: 820px; }

.auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    padding: 32px;
    width: 100%;
    border-top: 4px solid var(--blue);
}
.auth-card h1 {
    font-size: 22px;
    margin-bottom: 6px;
    color: var(--navy);
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
}
.auth-brand:hover { text-decoration: none; }

.grid, .form-grid { display: grid; gap: 14px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; }
.field { display: grid; gap: 5px; }
.field span {
    color: var(--navy);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.field.wide, .field.full { grid-column: 1 / -1; }

input, select, textarea {
    background: #fff;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--ink);
    min-height: 38px;
    padding: 8px 10px;
    width: 100%;
    transition: border-color .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 0; box-shadow: var(--focus); }
textarea { resize: vertical; }

button:focus, .button:focus { box-shadow: var(--focus); outline: 0; }

.form-actions, .actions, .filter-actions, .inline-actions {
    align-items: center; display: flex; flex-wrap: wrap; gap: 8px;
}
.form-actions { grid-column: 1 / -1; }

.toolbar {
    align-items: center; display: flex; gap: 16px;
    justify-content: space-between; margin-bottom: 16px;
}
.toolbar p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.flash {
    border-radius: var(--radius);
    font-weight: 600;
    margin-bottom: 16px;
    padding: 11px 14px;
    border-left: 4px solid;
}
.flash.success { background: #edfaf4; border-color: var(--good); color: var(--good); }
.flash.error { background: #fdf0ee; border-color: var(--danger); color: var(--danger); }
.flash.info { background: #eef1fc; border-color: var(--navy); color: var(--navy); }

/* METRIC CARDS */
.metric-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}
.metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    color: var(--ink);
    display: grid;
    gap: 4px;
    min-height: 110px;
    padding: 16px;
    transition: box-shadow .15s, border-color .15s;
}
.metric:hover { border-color: var(--navy); box-shadow: var(--shadow-lg); text-decoration: none; }
.metric.primary { border-top: 3px solid var(--blue); }
.metric span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.metric strong { font-size: 28px; font-weight: 800; font-family: 'Barlow Condensed', sans-serif; color: var(--navy); }
.metric em { color: var(--muted); font-style: normal; font-size: 12px; font-weight: 600; }

/* FILTERS */
.filters {
    align-items: end; display: grid; gap: 12px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.filters .search { grid-column: span 2; }
.filter-actions { min-height: 38px; }

/* PAYMENT GRID */
.payment-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.payment-card {
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: var(--radius); display: grid; gap: 10px; padding: 14px;
}
.payment-card strong, .payment-card span, .payment-card em { display: block; }
.payment-card em { color: var(--muted); font-style: normal; font-size: 13px; }
.payment-status { display: flex; flex-wrap: wrap; gap: 6px; }

/* MONTH/WEEK DETAILS */
.month, .week {
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius-lg); box-shadow: var(--shadow);
    margin-bottom: 12px; overflow: hidden;
}
.month > summary, .week > summary {
    align-items: center; cursor: pointer; display: flex;
    gap: 12px; justify-content: space-between;
    list-style: none; padding: 13px 16px;
}
.month > summary { background: #e8ecf8; color: var(--navy); }
.week > summary { background: #f0f3fc; color: var(--navy-mid); }
.month > summary::-webkit-details-marker,
.week > summary::-webkit-details-marker { display: none; }
.month > summary::before, .week > summary::before {
    align-items: center; background: #fff;
    border: 1.5px solid var(--line-strong); border-radius: 999px;
    content: "+"; display: inline-flex; flex: 0 0 auto;
    font-weight: 900; height: 22px; justify-content: center; width: 22px;
}
.month[open] > summary::before, .week[open] > summary::before { content: "−"; }
.month summary span, .week summary span { display: grid; gap: 2px; margin-right: auto; }
.month summary strong, .week summary strong { font-size: 15px; font-weight: 700; }
.month summary em, .week summary em { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 600; }
.month summary b, .week summary b {
    background: #fff; border-radius: 999px;
    color: var(--navy); font-size: 12px; padding: 4px 10px; white-space: nowrap;
    border: 1px solid var(--line-strong);
}
.month-body { padding: 14px; }

/* TABLE */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.week-table { border: 0; border-radius: 0; }
table { border-collapse: collapse; min-width: 760px; width: 100%; }
th, td { border-bottom: 1px solid #e8ebf4; padding: 10px 12px; text-align: left; vertical-align: top; }
th {
    background: #f4f5fb; color: var(--navy);
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
}
.day-row td { background: #f8f9fd; color: var(--navy-mid); }
.day-row strong { margin-right: 10px; }
.day-row span { color: var(--muted); font-size: 12px; font-weight: 600; }

/* BADGES */
.badge {
    background: #edf0fa; border-radius: 999px;
    color: #4a5580; display: inline-flex; font-size: 11px;
    font-weight: 700; margin: 0 3px 3px 0; padding: 3px 9px; white-space: nowrap;
    letter-spacing: .04em; text-transform: uppercase;
}
.badge.good { background: #e8faf1; color: var(--good); }
.badge.warn { background: #fff8e0; color: var(--warn); }
.badge.neutral { background: #edf0fa; color: #4a5580; }

.tiny-link { display: inline-block; font-size: 12px; font-weight: 600; margin-top: 4px; }
.empty { color: var(--muted); padding: 20px; text-align: center; }

/* DIVIDER TAGLINE */
.tagline-divider {
    display: flex; align-items: center; gap: 10px;
    color: var(--muted); font-size: 12px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase; margin: 4px 0 16px;
}
.tagline-divider::before, .tagline-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--line);
}

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

@media (max-width: 760px) {
    .sidebar {
        box-shadow: 4px 0 24px rgba(15,27,53,.25);
        transform: translateX(-105%);
        transition: transform .2s ease;
    }
    .nav-open .sidebar { transform: translateX(0); }
    .main { margin-left: 0; padding: 16px; }
    .nav-toggle {
        background: var(--navy); border-color: var(--navy);
        color: #fff; display: inline-flex;
    }
    .topbar { justify-content: flex-start; gap: 12px; }
    .metric-grid, .form-grid, .filters { grid-template-columns: 1fr; }
    .filters .search { grid-column: auto; }
    .toolbar { align-items: flex-start; flex-direction: column; }
    .month > summary, .week > summary { align-items: flex-start; }
    .month summary b, .week summary b { display: none; }
}

/* AUTH BRAND - keep original span markup but restyle */
.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: var(--navy);
}
.auth-brand:hover { text-decoration: none; color: var(--navy); }
.auth-brand span {
    width: 52px; height: 52px; flex-shrink: 0;
    background: var(--navy);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -.01em;
    border: 3px solid var(--line-strong);
    position: relative;
    overflow: hidden;
}
.auth-brand span::after {
    content: '';
    position: absolute;
    bottom: 4px; right: 4px;
    width: 16px; height: 3px;
    background: var(--blue-light);
    border-radius: 2px;
    transform: rotate(-20deg);
}
.auth-brand strong {
    display: block;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--navy);
}
.auth-brand small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    display: block;
    margin-top: 3px;
}
