/* ── Reset & Variables ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* ── DIG Brand Kit Colors ─────────────────────────────────────────────── */
    /* Use these names when you want a specific brand color directly.          */
    /* Example: color: var(--color-dig-red);                                   */
    --color-deep-midnight:  #091528;
    --color-navy-surface:   #1b2f4e;
    --color-slate-grey:     #475569;
    --color-dig-red:        #c01b39;
    --color-safety-red:     #dc2526;
    --color-aerospace-red:  #e63311;
    --color-sky-blue:       #392f60;
    --color-white:          #ffffff;
    --color-black:          #000000;

    /* ── Additional Brand Colors ──────────────────────────────────────────── */
    --color-success-green: #1a6f3c;
    --color-warning-gold:  #c8952a;

    /* ── Semantic UI Colors (mapped to brand kit) ─────────────────────────── */
    /* Change the brand color here and it updates everywhere it's used.        */
    --primary:       var(--color-sky-blue);
    --primary-hover: #4a3d78;
    --accent:        var(--color-dig-red);
    --success:       var(--color-success-green);
    --warning:       var(--color-warning-gold);
    --bg:            #f2f5fa;
    --card:          var(--color-white);
    --border:        #d8dfe9;
    --text:          var(--color-navy-surface);
    --muted:         var(--color-slate-grey);
    --radius:        12px;
    --shadow:        0 1px 3px rgba(0,0,0,.07), 0 4px 14px rgba(0,0,0,.06);

    /* ── Gray Scale Utilities ─────────────────────────────────────────────── */
    --gray-50:  #f8f9fa;
    --gray-400: #9ba3ae;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9375rem;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Site header (shared across all DiG apps) ────────────────────────────── */
.site-header {
    background: var(--primary);
    color: var(--color-white);
    padding: 0 24px;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-dig-logo  { height: 28px; width: auto; }
.header-dig-name  { font-size: 1.1rem; font-weight: 800; color: var(--accent); letter-spacing: -.02em; }
.header-office    { font-size: .95rem; font-weight: 500; color: rgba(255,255,255,.9); }
.header-app-sep   { color: rgba(255,255,255,.4); font-size: 16px; margin: 0 4px 0 0; }
.header-logo      { font-size: 22px; }
.header-title     { font-size: 17px; font-weight: 600; letter-spacing: .01em; color: var(--color-white); }
.header-nav { display: flex; align-items: center; gap: 6px; }
.header-nav a {
    color: rgba(255,255,255,.8);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    transition: background .15s, color .15s;
}
.header-nav a:hover, .header-nav a.active {
    background: rgba(255,255,255,.15);
    color: var(--color-white);
}
.header-nav .nav-logout { color: rgba(255,255,255,.55); }
.header-nav .nav-logout:hover { color: #ff9999; background: rgba(255,0,0,.1); }
.header-nav .nav-user { color: rgba(255,255,255,.7); font-size: 13px; padding: 6px 10px; pointer-events: none; }

/* ── Font scale + nav controls (shared across all DiG apps) ─────────────── */
:root { --font-scale: 1; }
html  { font-size: calc(16px * var(--font-scale)); }

.nav-controls { display: flex; align-items: center; gap: .25rem; }
.nav-ctrl-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 4px;
    color: var(--color-white);
    cursor: pointer;
    font-size: .8rem;
    font-weight: 700;
    padding: .2rem .45rem;
    transition: background 0.15s;
}
.nav-ctrl-btn:hover { background: rgba(255,255,255,.15); }

/* ── Legacy portal header ────────────────────────────────────────────────── */
header {
    background: var(--header-bg, var(--primary));
    padding: 0 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,.25);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    display: flex;
    align-items: center;
    gap: .6rem;
}
.logo-img {
    height: 36px;
    width: auto;
}
.logo-dig {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -.02em;
}
.logo-text {
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255,255,255,.9);
}
.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.user-name {
    color: rgba(255,255,255,.8);
    font-size: .9rem;
}
.btn-signout {
    color: var(--accent);
    text-decoration: none;
    font-size: .85rem;
    border: 1px solid var(--accent);
    padding: .3rem .75rem;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.btn-signout:hover {
    background: var(--accent);
    color: var(--primary);
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 1.25rem 1rem;
    font-size: .8rem;
    background: var(--color-dig-red);
    color: var(--color-white);
    margin-top: auto;
}
footer a {
    color: var(--color-white);
    text-decoration: underline;
}
footer a:hover {
    opacity: .8;
}

/* ── Login page ──────────────────────────────────────────────────────────── */
body.login-page {
    justify-content: center;
    align-items: center;
    gap: 0;
}
body.login-page footer {
    position: fixed;
    bottom: 0;
    width: 100%;
}
.login-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}
.login-logo h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: .5rem;
}
.login-logo p {
    color: var(--muted);
    font-size: .9rem;
    margin-top: .2rem;
}
.logo-img-lg {
    height: 64px;
    width: auto;
}
.login-error {
    background: #fef2f2;
    border: 1px solid var(--color-safety-red);
    color: var(--color-dig-red);
    border-radius: 7px;
    padding: .65rem 1rem;
    font-size: .875rem;
    width: 100%;
}
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    width: 100%;
    padding: .7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--color-white);
    color: var(--color-deep-midnight);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    transition: box-shadow .15s, background .15s;
}
.btn-google:hover {
    background: #f8faff;
    box-shadow: 0 2px 8px rgba(0,0,0,.13);
}

/* ── Backdoor login form (hidden, revealed by 5-click Easter egg) ────────── */
.bd-input {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: .95rem;
}
.bd-input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.bd-pw-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.bd-pw-wrap .bd-input {
    padding-right: 2.5rem;
}
.bd-eye {
    position: absolute;
    right: .6rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
}
.bd-eye:hover { color: var(--text); }
.bd-submit {
    width: 100%;
    padding: .65rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.bd-submit:hover { opacity: .9; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem 1rem;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, box-shadow .15s;
    white-space: nowrap;
    line-height: 1.4;
}
.btn-sm   { padding: .28rem .65rem; font-size: .8rem; }
.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: rgba(0,0,0,.05); }
.btn-danger    { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger:hover { background: #a01530; border-color: #a01530; }
.btn-edit   { background: #2f6fa8; color: #fff; border-color: #2f6fa8; }
.btn-edit:hover { background: #245a8a; border-color: #245a8a; }
.btn-cancel { background: #6b7280; color: #fff; border-color: #6b7280; }
.btn-cancel:hover { background: #4b5563; border-color: #4b5563; }
html.dark .btn-secondary { border-color: rgba(255,255,255,.2); color: var(--text); }
html.dark .btn-secondary:hover { background: rgba(255,255,255,.08); }
html.dark .btn-edit   { background: #3b82c4; border-color: #3b82c4; }
html.dark .btn-edit:hover { background: #2f6fa8; border-color: #2f6fa8; }
html.dark .btn-cancel { background: #4b5563; border-color: #4b5563; }
html.dark .btn-cancel:hover { background: #374151; border-color: #374151; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.alert-success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); color: #15803d; }
.alert-error   { background: rgba(220,37,38,.1);  border: 1px solid rgba(220,37,38,.3); color: var(--accent); }
html.dark .alert-success { background: rgba(34,197,94,.15); color: #4ade80; }
html.dark .alert-error   { background: rgba(220,37,38,.15); color: #fca5a5; }

/* ── Data table ──────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th { text-align: left; padding: .5rem .75rem; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
.data-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(0,0,0,.02); }
html.dark .data-table tbody tr:hover { background: rgba(255,255,255,.03); }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.25rem; }
.page-header h2 { font-size: 1.5rem; font-weight: 800; color: var(--text); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    header { padding: 0 1rem; }
    .user-name { display: none; }
}

/* ── Tooltips ────────────────────────────────────────────────────────────── */
/*
 * Usage: add data-tooltip="Your description here" to any element.
 * The ⓘ badge is rendered via .tooltip-badge inside the element.
 * Works in Scheduler, Expense, and any other app that links dig-shared.css.
 */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e1b4b;
    color: #e0e7ff;
    font-size: .78rem;
    font-weight: 500;
    line-height: 1.4;
    padding: .4rem .65rem;
    border-radius: 6px;
    white-space: normal;
    width: max-content;
    max-width: 220px;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
    z-index: 200;
}
[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e1b4b;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
    z-index: 200;
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus-within::after,
[data-tooltip]:focus-within::before {
    opacity: 1;
}
/* Suppress parent tooltip when a nested [data-tooltip] child is hovered */
[data-tooltip]:has([data-tooltip]:hover)::after,
[data-tooltip]:has([data-tooltip]:hover)::before {
    opacity: 0;
}

/* Badge — the blue ⓘ circle rendered next to any item that has a tooltip */
.tooltip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.05em;
    height: 1.05em;
    border-radius: 50%;
    background: #4f72e8;
    color: #fff;
    font-size: .65em;
    font-weight: 700;
    font-style: normal;
    line-height: 1;
    margin-left: .35em;
    vertical-align: middle;
    flex-shrink: 0;
    cursor: default;
    user-select: none;
}
html.dark .tooltip-badge {
    background: #818cf8;
    color: #1e1b4b;
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */
html.dark {
    --bg:      var(--color-deep-midnight);
    --card:    var(--color-navy-surface);
    --border:  rgba(255,255,255,.12);
    --text:    var(--color-white);
    --muted:   #94a3b8;
    --primary: #a78bfa;          /* light purple — readable on dark bg */
    --header-bg: #2a1d55;        /* keep header dark in dark mode */

    footer {
        background: var(--color-safety-red);
    }

    .login-box .login-logo h1 {
        color: var(--color-white);
    }

    .logo-img-lg {
        content: url('/shared/images/nDIGov_FConeline_dark.png');
    }

    .login-error {
        background: rgba(220,37,38,.15);
        border-color: var(--color-safety-red);
    }

    .btn-google {
        background: var(--color-white);
        color: var(--color-deep-midnight);
        border-color: rgba(255,255,255,.2);
    }
    .btn-google:hover {
        background: #f0f0f0;
    }
}
