:root {
    --ink: #10243a;
    --muted: #64748b;
    --line: rgba(12, 158, 213, .18);
    --panel: rgba(255, 255, 255, .88);
    --bg: #eef8fc;
    --blue: #079bd3;
    --blue-deep: #0578ad;
    --red: #ed1c24;
    --red-deep: #b9151c;
    --danger: #b91c1c;
    --shadow: 0 24px 70px rgba(8, 55, 86, .14);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
img { max-width: 100%; }
body {
    min-height: 100vh;
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    background:
        linear-gradient(120deg, rgba(7, 155, 211, .10), transparent 34%),
        linear-gradient(300deg, rgba(237, 28, 36, .08), transparent 30%),
        var(--bg);
    color: var(--ink);
    overflow-x: hidden;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(7, 155, 211, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(7, 155, 211, .055) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at 50% 20%, black, transparent 70%);
}

.ambient {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.ambient span {
    position: absolute;
    width: 26rem;
    height: 26rem;
    border-radius: 999px;
    filter: blur(12px);
    opacity: .22;
    animation: floatGlow 16s ease-in-out infinite;
}
.ambient span:nth-child(1) { background: var(--blue); left: -8rem; top: 5rem; }
.ambient span:nth-child(2) { background: var(--red); right: -10rem; top: 18rem; animation-delay: -5s; }
.ambient span:nth-child(3) { background: #ffffff; left: 40%; bottom: -14rem; animation-delay: -9s; }

@keyframes floatGlow {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(2.2rem, -1.4rem, 0) scale(1.08); }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseLine {
    0% { transform: translateX(-70%); opacity: .15; }
    50% { opacity: .72; }
    100% { transform: translateX(120%); opacity: .15; }
}
@keyframes logoBreath {
    0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 14px 34px rgba(7, 155, 211, .20); }
    50% { transform: translateY(-3px) scale(1.015); box-shadow: 0 20px 45px rgba(237, 28, 36, .16); }
}

a { color: var(--blue-deep); text-decoration: none; font-weight: 700; }
button, .button, .actions a, .link-button {
    border: 0;
    background: linear-gradient(135deg, var(--blue), var(--blue-deep));
    color: white;
    padding: 11px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 28px rgba(7, 155, 211, .18);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
button:hover, .button:hover, .actions a:hover, .link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(7, 155, 211, .26);
    filter: saturate(1.08);
}
.danger-button { background: linear-gradient(135deg, var(--red), var(--red-deep)); padding: 7px 10px; margin-left: 8px; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
    background: rgba(255,255,255,.92);
    color: var(--ink);
    font: inherit;
    outline: 0;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: rgba(7, 155, 211, .65);
    box-shadow: 0 0 0 4px rgba(7, 155, 211, .12);
    background: #fff;
}
textarea { min-height: 90px; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid rgba(12, 158, 213, .13); padding: 12px 11px; text-align: left; vertical-align: middle; }
th { color: #24415c; font-size: 13px; background: rgba(7, 155, 211, .07); }
tbody tr { transition: background .18s ease, transform .18s ease; }
tbody tr:hover { background: rgba(7, 155, 211, .045); }
small, p { color: var(--muted); }

.app-frame, .shell {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}
.sidebar {
    width: 282px;
    padding: 22px;
    color: white;
    background:
        linear-gradient(155deg, rgba(3, 110, 158, .96), rgba(5, 32, 55, .96) 64%),
        var(--blue-deep);
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 14px 0 42px rgba(8, 55, 86, .18);
    position: sticky;
    top: 0;
    height: 100vh;
    flex: 0 0 282px;
    overflow: hidden;
}
.sidebar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.13), transparent 62%);
    animation: pulseLine 7s ease-in-out infinite;
    pointer-events: none;
}
.brand {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
    background: rgba(255,255,255,.08);
}
.brand small { display: block; color: #d8f5ff; }
.brand-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 3px;
    animation: logoBreath 4.8s ease-in-out infinite;
}
.sidebar nav, .menu-scroll {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 8px;
    overflow-y: auto;
    padding-right: 4px;
}
.sidebar a {
    color: #f3fbff;
    padding: 11px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    transition: background .2s ease, transform .2s ease, border-color .2s ease;
}
.sidebar a:hover {
    background: rgba(255,255,255,.16);
    border-color: rgba(255,255,255,.22);
    transform: translateX(4px);
}
.sidebar a.active {
    background: rgba(255,255,255,.22);
    border-color: rgba(255,255,255,.3);
}
.menu-group {
    position: relative;
    z-index: 1;
}
.menu-group summary {
    list-style: none;
    cursor: pointer;
    color: #f3fbff;
    padding: 11px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    transition: background .2s ease, border-color .2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.menu-group summary::-webkit-details-marker { display: none; }
.menu-group summary::after {
    content: "\25BE";
    margin-left: 8px;
    transition: transform .2s ease;
    opacity: .8;
}
.menu-group[open] > summary {
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.2);
}
.menu-group[open] > summary::after { transform: rotate(180deg); }
.menu-group summary:hover {
    background: rgba(255,255,255,.16);
    border-color: rgba(255,255,255,.22);
}
.menu-sub {
    display: grid;
    gap: 6px;
    padding: 8px 0 2px 14px;
}
.menu-sub a {
    font-size: 14px;
    padding: 9px 12px;
}
.sidebar form { position: relative; z-index: 1; }
.ghost { background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.25); box-shadow: none; }
.full { width: 100%; }
.main-shell {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}
.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 24px;
    background: rgba(255,255,255,.82);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 3;
}
.menu-toggle { width: 44px; height: 44px; padding: 0; }
.digital-clock {
    font-size: clamp(18px, 2vw, 26px);
    font-weight: 900;
    color: var(--blue-deep);
    margin-right: auto;
    letter-spacing: 0;
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-link {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(7,155,211,.09);
}
.top-logout { margin: 0; }
.top-link-button {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(237, 28, 36, .09);
    color: var(--red-deep);
    box-shadow: none;
}
.user-menu { position: relative; }
.user-chip {
    background: rgba(255,255,255,.9);
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: none;
    gap: 8px;
    max-width: 280px;
    overflow: hidden;
}
.user-chip img {
    width: 34px !important;
    height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 34px;
}
.user-chip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 230px;
    padding: 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    z-index: 10;
}
.user-dropdown.open { display: grid; gap: 8px; }
.upload-photo {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(7,155,211,.08);
    cursor: pointer;
    font-weight: 800;
}
.upload-photo input { display: none; }
.footer {
    padding: 10px 20px;
    text-align: center;
    font-weight: 800;
    color: #31506b;
    background: rgba(255,255,255,.78);
    border-top: 1px solid var(--line);
}
.content {
    flex: 1;
    padding: 30px;
    overflow: auto;
    animation: slideIn .55s ease both;
    position: relative;
}
.auth-content { min-height: 100vh; }
.content > * { position: relative; z-index: 1; }
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.page-head h1, .panel h2 {
    margin: 0;
    letter-spacing: 0;
}
.page-head h1 {
    font-size: clamp(28px, 3vw, 42px);
    color: #0c3a5a;
}
.panel, .auth-card, .stats > div {
    background: var(--panel);
    border: 1px solid rgba(255,255,255,.74);
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
.panel {
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.panel::before, .auth-card::before, .stats > div::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--blue), #fff, var(--red));
}
.narrow { max-width: 640px; }
.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.stats > div {
    position: relative;
    overflow: hidden;
    padding: 20px;
    animation: slideIn .6s ease both;
}
.stats > div:nth-child(2) { animation-delay: .06s; }
.stats > div:nth-child(3) { animation-delay: .12s; }
.stats > div:nth-child(4) { animation-delay: .18s; }
.stats strong { display: block; font-size: 36px; color: var(--blue-deep); }
.stats span { color: var(--muted); font-weight: 700; }
.stat-icon { display: inline-flex; font-size: 24px; margin-bottom: 8px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.actions a {
    background: linear-gradient(135deg, rgba(7,155,211,.12), rgba(237,28,36,.09));
    color: var(--blue-deep);
    border: 1px solid rgba(7,155,211,.18);
    box-shadow: none;
}
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid[hidden] { display: none; }
.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.permission-grid h2 { grid-column: 1 / -1; margin: 0; }
.permission-group {
    grid-column: 1 / -1;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.permission-group h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
}
.permission-group-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
@media (max-width: 640px) {
    .permission-group-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.password-wrap { display: flex; gap: 8px; }
.eye-button { width: 48px; padding: 0; }
.plain-link { display: inline-flex; margin-top: 12px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { width: 150px; }
.notice {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(255, 247, 237, .92);
    border: 1px solid #fed7aa;
    box-shadow: 0 10px 30px rgba(180, 83, 9, .08);
}
.notice.success { background: rgba(236,253,245,.92); border-color: #a7f3d0; }
.notice.danger { background: rgba(254,242,242,.94); border-color: #fecaca; color: var(--danger); }
.auth-panel {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}
.auth-card {
    position: relative;
    width: min(440px, 100%);
    padding: 30px;
    overflow: hidden;
    animation: slideIn .65s ease both;
}
.auth-card::after {
    content: "";
    position: absolute;
    width: 13rem;
    height: 13rem;
    border: 18px solid rgba(237, 28, 36, .11);
    border-right-color: transparent;
    border-radius: 50%;
    right: -5.5rem;
    top: -4.5rem;
    animation: logoBreath 6s ease-in-out infinite;
}
.auth-logo {
    width: 118px;
    height: 118px;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    background: #fff;
    padding: 5px;
    margin-bottom: 18px;
    box-shadow: 0 18px 42px rgba(7, 155, 211, .18);
    animation: logoBreath 4.8s ease-in-out infinite;
}
.auth-card h1 { margin: 0; font-size: 32px; color: #0c3a5a; }
.auth-card p { margin: 8px 0 18px; }
.link-button { margin-top: 12px; background: linear-gradient(135deg, var(--red), var(--red-deep)); }
.right { text-align: right; }
.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.row-actions form, td form { margin: 0; }
.wide { grid-column: 1 / -1; }
.stack-top { margin-top: 16px; }
.table-scroll { overflow-x: auto; }
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.info-grid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.62);
    padding: 12px;
}
.info-grid strong,
.info-grid span,
.info-grid code {
    display: block;
}
.info-grid code {
    margin-top: 6px;
    overflow-wrap: anywhere;
    color: var(--blue-deep);
    font-weight: 800;
}
.save-bar { margin-top: 14px; }
.status {
    display: inline-flex;
    min-width: 74px;
    justify-content: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    text-transform: capitalize;
    font-weight: 800;
}
.status.present { background: #dcfce7; color: #166534; }
.status.late { background: #fef3c7; color: #92400e; }
.status.absent { background: #fee2e2; color: #991b1b; }
.status.extra { background: #dbeafe; color: #1d4ed8; }
.status.paid { background: #dcfce7; color: #166534; }
.status.unpaid { background: #fee2e2; color: #991b1b; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

@media (max-width: 900px) {
    html, body {
        width: 100%;
        overflow-x: hidden;
    }
    .app-frame, .shell {
        display: block;
        min-height: 100vh;
        height: auto;
        overflow: visible;
    }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(82vw, 300px);
        height: 100vh;
        max-height: none;
        flex-basis: auto;
        z-index: 30;
        transform: translateX(-105%);
        transition: transform .25s ease;
    }
    .mobile-menu-open .sidebar {
        transform: translateX(0);
    }
    .mobile-menu-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 20;
        background: rgba(2, 20, 35, .45);
    }
    .menu-scroll { max-height: calc(100vh - 120px); }
    .main-shell {
        min-height: 100vh;
        display: grid;
        grid-template-rows: auto 1fr auto;
    }
    .topbar {
        position: sticky;
        min-height: 64px;
        flex-wrap: nowrap;
        padding: 8px 10px;
        gap: 8px;
        /* Must stay ABOVE the dim overlay (z-index 20) or the hamburger
           becomes un-tappable and the menu can never be closed again. */
        z-index: 35;
    }
    .menu-toggle {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        position: relative;
        z-index: 36;
    }
    .digital-clock {
        font-size: 18px;
        margin-right: 0;
        white-space: nowrap;
    }
    .top-actions {
        margin-left: auto;
        min-width: 0;
        gap: 6px;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }
    .top-link, .top-logout { display: none; }
    .desktop-logout { display: none; }
    .user-chip {
        min-width: 48px;
        max-width: 48px;
        padding: 6px;
    }
    .user-chip img {
        width: 32px !important;
        height: 32px !important;
        max-width: 32px !important;
        max-height: 32px !important;
        flex-basis: 32px;
    }
    .user-chip span { display: none; }
    .user-dropdown {
        position: fixed;
        right: 10px;
        top: 64px;
        max-width: calc(100vw - 20px);
        z-index: 40;
    }
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .stats strong { font-size: 28px; }
    .form-grid.two, .permission-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
    .page-head { align-items: stretch; flex-direction: column; }
    .page-head h1 { font-size: 30px; }
    .content {
        padding: 16px 12px 72px;
        overflow: visible;
    }
    .panel {
        padding: 14px;
        overflow-x: auto;
    }
    .actions { gap: 8px; }
    .actions a, .actions button, button, .button {
        min-height: 42px;
        padding: 9px 11px;
    }
    .inline-form { align-items: stretch; flex-direction: column; }
    .inline-form input { width: 100%; }
    .footer {
        position: static;
        padding: 10px;
    }
}

@media (max-width: 520px) {
    .brand-logo {
        width: 46px;
        height: 46px;
    }
    .brand strong { font-size: 15px; }
    .brand small { font-size: 12px; }
    th, td { padding: 9px 8px; }
}

@media (min-width: 901px) {
    .sidebar-collapsed .sidebar {
        width: 94px;
        flex-basis: 94px;
    }
    .sidebar-collapsed .brand div,
    .sidebar-collapsed .sidebar a,
    .sidebar-collapsed .menu-group summary {
        font-size: 0;
    }
    .sidebar-collapsed .sidebar a::first-letter,
    .sidebar-collapsed .menu-group summary::first-letter {
        font-size: 18px;
    }
    .sidebar-collapsed .menu-group summary::after { display: none; }
    .sidebar-collapsed .menu-sub { display: none; }
}

/* Searchable staff dropdown (applied to every select[name="staff_id"]) */
.ss-wrapper { position: relative; }
.ss-wrapper select.ss-native-select {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    pointer-events: none;
}
.ss-trigger {
    width: 100%;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.92);
    color: var(--ink);
    font: inherit;
    font-weight: 400;
    padding: 11px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: none;
    text-align: left;
}
.ss-trigger:hover { transform: none; box-shadow: none; filter: none; }
.ss-trigger::after { content: "\25BE"; color: var(--muted); flex-shrink: 0; }
.ss-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-panel {
    display: none;
    z-index: 9999;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 8px;
}
.ss-panel.open { display: block; }
.ss-panel .ss-search { margin-bottom: 6px; }
.ss-options { max-height: 240px; overflow-y: auto; }
.ss-option { padding: 9px 10px; border-radius: 6px; cursor: pointer; }
.ss-option:hover { background: rgba(7, 155, 211, .10); }
.ss-option.selected { background: rgba(7, 155, 211, .18); font-weight: 700; }
.ss-option.ss-active { background: rgba(7, 155, 211, .16); }
.ss-option.ss-no-results { color: var(--muted); cursor: default; }
.ss-option.ss-no-results:hover { background: none; }

/* ================= Dark Mode ================= */
html[data-theme="dark"] {
    --ink: #e6edf5;
    --muted: #94a3b8;
    --line: rgba(56, 189, 248, .22);
    --panel: rgba(19, 30, 48, .85);
    --bg: #0a1120;
    --blue: #22a6e0;
    --blue-deep: #0b84bd;
    --red: #ff4d55;
    --red-deep: #d81e26;
    --danger: #f87171;
    --shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
html[data-theme="dark"] body::before {
    background-image:
        linear-gradient(rgba(34, 166, 224, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 166, 224, .07) 1px, transparent 1px);
}
html[data-theme="dark"] .ambient span:nth-child(3) { background: #16324c; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: rgba(15, 23, 42, .75);
    border-color: var(--line);
    color: var(--ink);
}
/* Native picker icons stay interactive. The filter gives the browser-drawn
   clock/calendar the accent colour while dark mode is active. */
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(48%) sepia(35%) saturate(2341%) hue-rotate(159deg) brightness(90%) contrast(90%);
}
/* The browser keeps date values in YYYY-MM-DD, but this overlay presents every
   date input in the requested dd/mm/yyyy form without breaking its calendar. */
.localized-date-picker {
    position: relative;
    display: block;
    width: 100%;
}
.inline-form .localized-date-picker {
    width: 150px;
    flex: 0 0 150px;
}
.localized-date-picker input[type="date"] {
    color: transparent !important;
    caret-color: transparent;
}
.localized-date-picker input[type="date"]::-webkit-datetime-edit,
.localized-date-picker input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.localized-date-picker input[type="date"]::-webkit-datetime-edit-text,
.localized-date-picker input[type="date"]::-webkit-datetime-edit-month-field,
.localized-date-picker input[type="date"]::-webkit-datetime-edit-day-field,
.localized-date-picker input[type="date"]::-webkit-datetime-edit-year-field {
    color: transparent;
}
.localized-date-value {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 13px;
    right: 42px;
    transform: translateY(-50%);
    overflow: hidden;
    color: var(--ink);
    white-space: nowrap;
    pointer-events: none;
}
html[data-theme="dark"] .localized-date-value { color: var(--ink); }
html[data-theme="dark"] .localized-date-picker input[type="date"]:disabled + .localized-date-value { color: var(--muted); }
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
    background: rgba(15, 23, 42, .95);
}
html[data-theme="dark"] th {
    color: #cfe8f7;
    background: rgba(34, 166, 224, .10);
}
html[data-theme="dark"] th,
html[data-theme="dark"] td {
    border-bottom-color: rgba(56, 189, 248, .14);
}
html[data-theme="dark"] tbody tr:hover { background: rgba(34, 166, 224, .07); }
html[data-theme="dark"] .topbar { background: rgba(10, 17, 32, .82); }
html[data-theme="dark"] .user-chip { background: rgba(15, 23, 42, .85); }
html[data-theme="dark"] .user-dropdown { background: #0f1728; }
html[data-theme="dark"] .footer {
    color: #b9d3e6;
    background: rgba(10, 17, 32, .85);
}
html[data-theme="dark"] .page-head h1,
html[data-theme="dark"] .auth-card h1 { color: #d7ecf9; }
html[data-theme="dark"] .ss-trigger { background: rgba(15, 23, 42, .75); }
html[data-theme="dark"] .ss-panel { background: #0f1728; }
html[data-theme="dark"] .ss-option:hover { background: rgba(34, 166, 224, .16); }
html[data-theme="dark"] .ss-option.selected { background: rgba(34, 166, 224, .24); }
html[data-theme="dark"] .ss-option.ss-active { background: rgba(34, 166, 224, .22); }
html[data-theme="dark"] .notice {
    background: rgba(69, 46, 14, .55);
    border-color: #78502a;
    color: #fde3c4;
}
html[data-theme="dark"] .notice.success {
    background: rgba(6, 60, 40, .55);
    border-color: #1f6b4a;
    color: #bff5da;
}
html[data-theme="dark"] .notice.danger {
    background: rgba(70, 15, 15, .55);
    border-color: #8a2a2a;
    color: #ffc9c9;
}
html[data-theme="dark"] .status { background: #1e293b; color: #cbd5e1; }
html[data-theme="dark"] .status.present,
html[data-theme="dark"] .status.paid { background: rgba(22, 101, 52, .35); color: #86efac; }
html[data-theme="dark"] .status.late { background: rgba(146, 64, 14, .35); color: #fcd34d; }
html[data-theme="dark"] .status.absent,
html[data-theme="dark"] .status.unpaid { background: rgba(153, 27, 27, .35); color: #fca5a5; }
html[data-theme="dark"] .status.extra { background: rgba(29, 78, 216, .35); color: #93c5fd; }
html[data-theme="dark"] .info-grid div { background: rgba(15, 23, 42, .6); }

/* Dark mode toggle button (floating, visible on every page) */
.theme-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    font-size: 21px;
    line-height: 1;
    background: linear-gradient(135deg, var(--blue), var(--blue-deep));
    box-shadow: 0 14px 28px rgba(7, 155, 211, .28);
}

/* 15-minute inactivity lock screen. It intentionally blocks the application
   without navigating away; Reload then performs the logout in JavaScript. */
.page-timeout[hidden] { display: none; }
.page-timeout {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 10, 22, .76);
    backdrop-filter: blur(7px);
}
.page-timeout-card {
    width: min(430px, 100%);
    padding: 36px;
    text-align: center;
    color: #e8f4ff;
    background: #102138;
    border: 1px solid rgba(17, 140, 197, .75);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
.page-timeout-icon { font-size: 34px; margin-bottom: 8px; }
.page-timeout-card h2 { margin: 0; color: #fff; }
.page-timeout-card p { margin: 12px 0 24px; line-height: 1.6; color: #b8cbe0; }
.page-timeout-card button { min-width: 190px; background: #118CC5; }
.page-is-timed-out { overflow: hidden; }
@media (max-width: 900px) {
    .theme-toggle {
        right: 14px;
        bottom: 14px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}
otice.danger {
    background: rgba(70, 15, 15, .55);
    border-color: #8a2a2a;
    color: #ffc9c9;
}
html[data-theme="dark"] .status { background: #1e293b; color: #cbd5e1; }
html[data-theme="dark"] .status.present,
html[data-theme="dark"] .status.paid { background: rgba(22, 101, 52, .35); color: #86efac; }
html[data-theme="dark"] .status.late { background: rgba(146, 64, 14, .35); color: #fcd34d; }
html[data-theme="dark"] .status.absent,
html[data-theme="dark"] .status.unpaid { background: rgba(153, 27, 27, .35); color: #fca5a5; }
html[data-theme="dark"] .status.extra { background: rgba(29, 78, 216, .35); color: #93c5fd; }
html[data-theme="dark"] .info-grid div { background: rgba(15, 23, 42, .6); }

/* Dark mode toggle button (floating, visible on every page) */
.theme-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    font-size: 21px;
    line-height: 1;
    background: linear-gradient(135deg, var(--blue), var(--blue-deep));
    box-shadow: 0 14px 28px rgba(7, 155, 211, .28);
}
@media (max-width: 900px) {
    .theme-toggle {
        right: 14px;
        bottom: 14px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}
