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

:root {
    --bg:          #000000;
    --card:        #1a1a1a;
    --card-border: #2a2a2a;
    --text:        #e8e8e8;
    --muted:       #9a9a9a;
    --accent:      #ff6a00;   /* placeholder brand accent — happy to change */
    --accent-d:    #e05f00;
    --danger:      #ef4444;
    --danger-bg:   rgba(239, 68, 68, .12);
    --danger-border: rgba(239, 68, 68, .4);

    /* Top bar is its own palette, independent of the page below. */
    --nav-h:      56px;
    --nav-bg:     #4e4e55;
    --nav-text:   #ffffff;
    --nav-muted:  #c7c7cf;
    --nav-border: #5e5e66;
}

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

/* ── Login ──────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.login-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .5);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}
.login-card h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.75rem; color: var(--text); }

.field { margin-bottom: 1.1rem; }
.field label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: .4rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.field input {
    width: 100%;
    padding: .65rem .9rem;
    background: #111;
    color: var(--text);
    border: 1.5px solid var(--card-border);
    border-radius: 7px;
    font-size: 1rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 106, 0, .18);
}
.alert-error {
    background: var(--danger-bg);
    color: #fca5a5;
    border: 1px solid var(--danger-border);
    border-radius: 7px;
    padding: .6rem .9rem;
    font-size: .9rem;
    margin-bottom: 1rem;
}
.btn-primary {
    display: block;
    width: 100%;
    padding: .7rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.btn-primary:hover { background: var(--accent-d); }

/* ── Navbar ─────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: var(--nav-bg);
    color: var(--nav-text);
    border-bottom: 1px solid var(--nav-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 200;
    gap: .5rem;
}
.nav-home {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: var(--nav-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
    flex-shrink: 0;
    padding: .35rem .65rem;
    border-radius: 7px;
    transition: background .15s;
}
.nav-home:hover { background: rgba(255, 255, 255, .12); }
.nav-home-icon { font-size: 1.25rem; line-height: 1; }
.nav-right {
    display: flex;
    align-items: center;
    gap: .6rem;
    overflow: hidden;
    flex-shrink: 1;
    min-width: 0;
}
.nav-time {
    font-size: .78rem;
    color: var(--nav-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.nav-sep { opacity: .5; font-size: .8rem; flex-shrink: 0; color: var(--nav-muted); }
.nav-username {
    font-weight: 600;
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}
.nav-logout {
    color: var(--nav-text);
    background: transparent;
    border: 1.5px solid rgba(255, 255, 255, .3);
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
    padding: .3rem .65rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    flex-shrink: 0;
    font-family: inherit;
}
.nav-logout:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

@media (max-width: 480px) {
    .nav-time { display: none; }
    .nav-sep  { display: none; }
    .nav-username { max-width: 90px; }
}

/* ── Page shell ─────────────────────────────────────── */
.page-wrap {
    padding-top: calc(var(--nav-h) + var(--tabs-h) + 1.5rem);
    padding-bottom: 3rem;
    min-height: 100vh;
}

/* ── Tabs ───────────────────────────────────────────── */
/* Section tabs live in the top bar, centred on the page (absolute, so the
   left/right bar contents' differing widths don't push them off-centre).
   On narrow screens there isn't room, so they drop into a strip under the bar. */
:root { --tabs-h: 0px; }
.nav-tabs {
    position: absolute;
    left: 50%;
    top: 0;
    height: var(--nav-h);
    transform: translateX(-50%);
    display: flex;
    align-items: stretch;
    gap: .25rem;
}
.tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--nav-muted);
    font-family: inherit;
    font-size: .95rem;
    font-weight: 600;
    padding: 0 1rem;
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
}
.tab-btn:hover { color: var(--nav-text); background: rgba(255, 255, 255, .08); }
.tab-btn.active { color: var(--nav-text); border-bottom-color: var(--accent); }
@media (max-width: 720px) {
    :root { --tabs-h: 44px; }
    .nav-tabs {
        position: fixed;
        top: var(--nav-h);
        left: 0; right: 0;
        transform: none;
        height: var(--tabs-h);
        background: var(--nav-bg);
        border-bottom: 1px solid var(--nav-border);
        justify-content: center;
    }
}
.tab-panel[hidden] { display: none; }

/* ── Subpage sections ─────────────────────────────────── */
.subpage { max-width: 900px; margin: 0 auto; padding: 0 1rem; }
.subpage-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
}
.subpage-icon { font-size: 2rem; line-height: 1; }
.subpage-title { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.subpage-subtitle { font-size: .9rem; color: var(--muted); margin-top: .1rem; }
.subpage-body {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .4);
    padding: 2rem;
    color: var(--muted);
    font-size: .95rem;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Tables ────────────────────────────────────────────── */
.history-table-wrap { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; overflow: hidden; }
.history-table th, .history-table td { padding: .65rem .9rem; text-align: left; font-size: .88rem; border-bottom: 1px solid var(--card-border); }
.history-table th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .72rem; letter-spacing: .03em; }
.history-table tr:last-child td { border-bottom: none; }

/* ── Session expiry warning ────────────────────────────── */
.session-warning {
    position: fixed;
    top: calc(var(--nav-h) + var(--tabs-h)); left: 0; right: 0;
    z-index: 500;
    background: #92400e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: .6rem 1rem;
    font-size: .88rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
.session-warning.hidden { display: none; }
.session-warning-btn {
    background: #fff;
    color: #92400e;
    border: none;
    border-radius: 6px;
    padding: .35rem .8rem;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
}
.session-warning-dismiss {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .25rem;
    opacity: .8;
}
.session-warning-dismiss:hover { opacity: 1; }

/* ── Month select ─────────────────────────────────────── */
.log-month {
    margin-left: auto;
    background: var(--card); color: var(--text);
    border: 1px solid var(--card-border); border-radius: 7px;
    padding: .35rem .6rem; font-family: inherit; font-size: .85rem;
}

/* Centred nav tabs need the room the clock would take on mid-size screens. */
@media (max-width: 1000px) {
    .nav-time, .nav-time + .nav-sep { display: none; }
}

/* ── Users ─────────────────────────────────────────────────── */
.user-you { margin-left: .4rem; padding: .05rem .45rem; border-radius: 999px; font-size: .7rem; background: var(--accent); color: #000; font-weight: 600; }

/* ── Activity ──────────────────────────────────────────────── */
.activity-controls { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.activity-controls .log-month { margin-left: 0; }
.activity-filter { background: var(--card); color: var(--text); border: 1px solid var(--card-border); border-radius: 8px; padding: .45rem .7rem; font-size: .88rem; min-width: 12rem; outline: none; }
.activity-filter:focus { border-color: var(--accent); }
.activity-count { margin-left: auto; font-size: .82rem; color: var(--muted); }
.activity-time { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.activity-user { font-weight: 600; }
.activity-badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.activity-login           { background: #064e3b; color: #a7f3d0; }
.activity-logout          { background: #7f1d1d; color: #fecaca; }
.activity-login_failed    { background: #78350f; color: #fde68a; }
.activity-session_expired { background: #333; color: #ccc; }
.activity-other           { background: #2a2a2a; color: var(--muted); }

