/* dadBUDGET Styles */
:root {
    --navy:      #0c2340;
    --teal:      #00a3c1;
    --teal-dark: #0082a0;
    --slate:     #4a5568;
    --light:     #f7fafc;
    --white:     #ffffff;
    --border:    #e2e8f0;
    --border-2:  #cbd5e0;
    --text-1:    #1a202c;
    --text-2:    #4a5568;
    --text-3:    #718096;
    --surface:   #ffffff;
    --surface-2: #f7fafc;
    --page-bg:   #f0f4f8;
    --red:       #e53e3e;
    --red-bg:    #fff5f5;
    --green:     #38a169;
    --green-bg:  #f0fff4;
    --yellow:    #d69e2e;
    --yellow-bg: #fffff0;
    --radius:    6px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --shadow:    0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --ease:      0.15s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9rem;
    color: var(--text-1);
    background: var(--page-bg);
    line-height: 1.5;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-dark); }

/* ── Topnav ── */
.topnav {
    background: var(--navy);
    min-height: 54px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
    flex-wrap: nowrap;
}
.topnav-brand {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    white-space: nowrap;
    flex-shrink: 0;
}
.topnav-brand span { color: var(--teal); }
.topnav-links {
    display: flex;
    gap: 2px;
    flex: 1;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    align-items: center;
}
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-links a {
    color: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius);
    transition: background var(--ease), color var(--ease);
    white-space: nowrap;
    flex-shrink: 0;
}
.topnav-links a:hover, .topnav-links a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.topnav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    flex-shrink: 0;
    white-space: nowrap;
}
.topnav-user a { color: rgba(255,255,255,0.6); font-size: 0.8rem; text-decoration: none; }
.topnav-user a:hover { color: #fff; }
.topnav-profile-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.85) !important;
    font-size: 0.82rem !important;
    padding: 3px 6px;
    border-radius: var(--radius);
    transition: background var(--ease);
}
.topnav-profile-link:hover { background: rgba(255,255,255,0.12); color: #fff !important; }
.topnav-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
    display: block;
    flex-shrink: 0;
}
.topnav-avatar-initials {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.topnav-username { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Nav Dropdown (Admin) ── */
.nav-dropdown { position: relative; flex-shrink: 0; }
.nav-dropdown-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background var(--ease), color var(--ease);
}
.nav-dropdown-btn:hover, .nav-dropdown-btn.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--navy);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    padding: 6px;
    z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: block;
    color: rgba(255,255,255,0.75);
    font-size: 0.83rem;
    padding: 7px 12px;
    border-radius: var(--radius);
    transition: background var(--ease), color var(--ease);
    white-space: nowrap;
}
.nav-dropdown-menu a:hover, .nav-dropdown-menu a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* ── Layout ── */
.page { max-width: 1200px; margin: 0 auto; padding: 28px 24px; }
.page-sm  { max-width: 640px;  margin: 0 auto; padding: 40px 24px; }
.page-md  { max-width: 900px;  margin: 0 auto; padding: 28px 24px; }

/* ── Page Header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--navy); }
.page-header p  { color: var(--text-2); font-size: 0.85rem; margin-top: 2px; }

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-body { padding: 20px; }

/* ── Stat Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}
.stat-card .label { font-size: 0.78rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-card .value { font-size: 1.6rem; font-weight: 700; color: var(--navy); }
.stat-card .sub   { font-size: 0.78rem; color: var(--text-3); margin-top: 4px; }
.stat-card.teal   { border-left: 4px solid var(--teal); }
.stat-card.green  { border-left: 4px solid var(--green); }
.stat-card.red    { border-left: 4px solid var(--red); }
.stat-card.yellow { border-left: 4px solid var(--yellow); }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 0.73rem; font-weight: 600; }
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-teal   { background: #e6f7fb;          color: var(--teal-dark); }
.badge-slate  { background: #edf2f7;          color: var(--slate); }
.badge-orange { background: #fff3e0;          color: #c07000; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: background var(--ease), box-shadow var(--ease), opacity var(--ease);
    white-space: nowrap;
    text-decoration: none;
}
.btn-primary   { background: var(--teal);  color: #fff; }
.btn-primary:hover { background: var(--teal-dark); color: #fff; box-shadow: var(--shadow-md); }
.btn-navy      { background: var(--navy);  color: #fff; }
.btn-navy:hover { background: #0e2d52; color: #fff; }
.btn-outline   { background: transparent; color: var(--teal); border: 1px solid var(--teal); }
.btn-outline:hover { background: var(--teal); color: #fff; }
.btn-ghost     { background: transparent; color: var(--text-2); border: 1px solid var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger    { background: var(--red);   color: #fff; }
.btn-danger:hover { opacity: 0.88; }
.btn-sm        { padding: 5px 10px; font-size: 0.78rem; }
.btn-group     { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--text-1);
    background: var(--surface);
    transition: border-color var(--ease), box-shadow var(--ease);
    outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(0,163,193,0.12);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 20px; display: flex; align-items: flex-start; gap: 10px; }
.alert-success { background: var(--green-bg); color: #276749; border: 1px solid #9ae6b4; }
.alert-error   { background: var(--red-bg);   color: #c53030; border: 1px solid #feb2b2; }
.alert-info    { background: #ebf8ff;          color: #2c5282; border: 1px solid #bee3f8; }

/* ── Progress bar ── */
.progress { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress-bar { height: 100%; border-radius: 99px; transition: width 0.3s ease; }
.progress-bar.green  { background: var(--green); }
.progress-bar.yellow { background: var(--yellow); }
.progress-bar.red    { background: var(--red); }

/* ── Misc ── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-3); }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.82rem; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-3); }
.empty-state h3 { font-size: 1rem; margin-bottom: 6px; color: var(--text-2); }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Year selector ── */
.year-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}
.year-bar label { color: var(--text-2); font-weight: 600; white-space: nowrap; }
.year-bar select { width: auto; padding: 6px 10px; }

/* ── Line items table ── */
.line-items-table th, .line-items-table td { padding: 8px 10px; }
.line-items-table tfoot td { font-weight: 700; background: var(--surface-2); }

/* ── Login ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.login-card-header { background: var(--navy); padding: 32px 36px 24px; text-align: center; }
.login-card-header .brand { font-size: 1.4rem; font-weight: 900; color: #fff; letter-spacing: -0.02em; }
.login-card-header .brand span { color: var(--teal); }
.login-card-header p { color: rgba(255,255,255,0.5); font-size: 0.8rem; margin-top: 4px; }
.login-card-body { padding: 28px 36px 32px; }
.login-footer { text-align: center; padding: 12px; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--text-3); }

/* ── No rounded edges ── */
:root { --radius: 0; --radius-lg: 0; --radius-xl: 0; }
*, *::before, *::after { border-radius: 0 !important; }

/* ── Breadcrumbs ── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-3);
    margin-bottom: 16px;
}
.breadcrumb a { color: var(--teal-dark); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--border-2); }

/* ── Page-specific Help Button ── */
.help-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    cursor: pointer;
    white-space: nowrap;
}
.help-page-btn:hover {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.help-page-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--teal);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    border-radius: 50% !important;
    flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .topnav { padding: 0 16px; gap: 16px; }
    .topnav-links { display: none; }
    .page, .page-md { padding: 20px 16px; }
    .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
