:root {
    --bg: #f4f7ff;
    --panel: #f1f5f9;
    --card: #ffffff;
    --border: #d7dde8;
    --text: #0f172a;
    --muted: #475569;
    --danger: #dc2626;
    --ok: #16a34a;
    --warn: #d97706;
    --accent: #ee2a36;
    --fs: 14px;
    --fsS: 12px;
    --fsL: 16px;
    --r: 14px;
    --pad: 14px;
    --shadow: 0 12px 30px rgba(15, 23, 42, .14);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs);
    line-height: 1.35;
    background: #f4f7ff;
    display: block;
    height: 100vh;
    overflow: hidden;
}

body[data-page="login"] {
    background: #f4f7ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden,
.d-none {
    display: none !important;
}

.loginBackground {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 10% 20%, rgba(254, 219, 221, 0.8) 0%, transparent 40%), radial-gradient(circle at 90% 80%, rgba(244, 247, 255, 0.8) 0%, #f4f7ff 100%);
}

.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, rgba(238, 42, 54, 0.1), rgba(15, 23, 42, 0.05));
    filter: blur(80px);
    border-radius: 50%;
    z-index: -1;
    animation: blobFloat 20s infinite alternate ease-in-out;
}

.blob-1 {
    top: -100px;
    left: -100px;
}

.blob-2 {
    bottom: -100px;
    right: -100px;
    animation-duration: 25s;
}

@keyframes blobFloat {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(100px, 50px) scale(1.1);
    }
}

/* Layout */
.shell {
    width: 100%;
    height: 100vh;
    margin: 0;
    border: none;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    background: rgba(255, 255, 255, .72);
    display: flex;
}

@media (min-width: 1400px) {
    .shell {
        max-width: 1600px;
        margin: 20px auto;
        height: calc(100vh - 40px);
        min-height: 0;
        border: 1px solid rgba(15, 23, 42, .07);
        border-radius: 18px;
        box-shadow: var(--shadow);
    }
}

.sidebar {
    width: 260px;
    background: rgba(255, 255, 255, .95);
    border-right: 1px solid rgba(15, 23, 42, .07);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.3s ease, width 0.3s ease, opacity 0.3s ease;
    overflow-y: auto;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

/* Sidebar Backdrop for mobile */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 90;
    display: none;
    backdrop-filter: blur(4px);
}

@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.1);
    }

    .shell.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .shell.sidebar-open .sidebar-backdrop {
        display: block;
    }
}

/* Sidebar collapsed state */
/* Sidebar collapsed state (desktop) */
@media (min-width: 993px) {
    .shell.sidebar-collapsed .sidebar {
        width: 0;
        padding: 0;
        opacity: 0;
        border-right: none;
        pointer-events: none;
    }

    .shell.sidebar-collapsed .main {
        flex: 1;
    }
}

/* Sidebar toggle button in topbar */
.sidebar-toggle {
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px;
    border: 1px solid rgba(15, 23, 42, .10);
    border-radius: 18px;
    background: rgba(15, 23, 42, .04);
}

.brand .left {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand .title {
    font-size: 20px;
    font-weight: 850;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.brand .sub {
    font-size: 14px;
    color: var(--muted);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.brand .brandUser {
    color: rgba(15, 23, 42, .92);
    font-weight: 750;
}

.brand .badge {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fedbdd;
    border: 1px solid rgba(238, 42, 54, .22);
}

.brand .badge i {
    font-size: 18px;
}

.brand .badge .brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.navbtn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(15, 23, 42, .04);
    color: rgba(15, 23, 42, .85);
    cursor: pointer;
    font-weight: 650;
    text-align: left;
    text-decoration: none;
}

.navbtn i {
    width: 18px;
    text-align: center;
}

.navbtn.active {
    background: #fedbdd;
    border-color: rgba(238, 42, 54, .25);
    color: var(--text);
}

.navbtn:active {
    transform: translateY(1px);
}

.sidebarfooter {
    margin-top: auto;
    display: flex;
    gap: 10px;
}

.iconbtn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(15, 23, 42, .05);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.iconbtn:active {
    transform: translateY(1px);
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    min-width: 0;
    /* Important for preventing overflow */
    transition: flex 0.25s ease;
    background: var(--bg);
    overflow: hidden;
}

.topbar {
    height: 58px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, .07);
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar .left {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.topbar .h1 {
    font-size: 16px;
    font-weight: 750;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 720px;
}

.topbar .h2 {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 720px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(15, 23, 42, .04);
    font-size: 12px;
    color: rgba(15, 23, 42, .92);
    white-space: nowrap;
}

.pill.ok {
    border-color: rgba(22, 163, 74, .45);
}

.pill.warn {
    border-color: rgba(217, 119, 6, .45);
}

.pill.danger {
    border-color: rgba(220, 38, 38, .45);
}

.content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 16px 18px;
}

@media (max-width: 600px) {
    .content {
        padding: 10px 10px 14px;
    }
}

.content::-webkit-scrollbar {
    width: 10px;
}

.content::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, .18);
    border-radius: 999px;
}

/* Cards, tables, form */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.card {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: var(--r);
    padding: 12px;
}

.card .label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.card .value {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 12px;
}

.row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

@media (max-width: 800px) {
    .toolbar-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-actions .searchWrap {
        width: 100%;
    }
}

.dashboard-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
    flex-wrap: wrap;
}

.flex-large {
    flex: 1.2 1 500px;
}

.flex-small {
    flex: 0.8 1 340px;
}

@media (max-width: 900px) {

    .flex-large,
    .flex-small {
        flex: 1 1 100%;
    }
}

@media (max-width: 600px) {
    .toolbar>div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .toolbar .btn {
        width: 100%;
    }
}

input,
select,
textarea {
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(255, 255, 255, .80);
    color: var(--text);
    font-size: 14px;
    outline: none;
}

textarea {
    min-height: 90px;
    resize: vertical;
    width: 100%;
}

.btn {
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: #fedbdd;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
}

.btn.secondary {
    background: rgba(15, 23, 42, .05);
    border-color: rgba(15, 23, 42, .10);
}

.btn.danger {
    background: rgba(220, 38, 38, .14);
    border-color: rgba(220, 38, 38, .35);
}

.btn:active {
    transform: translateY(1px);
}

/* Loading button styles to prevent duplicate clicks */
.btn-loading,
.btn.btn-loading,
.btn-premium.btn-loading {
    position: relative !important;
    color: transparent !important;
    pointer-events: none !important;
    cursor: default !important;
}

.btn-loading * {
    opacity: 0 !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: calc(50% - 9px);
    left: calc(50% - 9px);
    border: 2px solid rgba(15, 23, 42, 0.15);
    border-top-color: var(--accent, #ee2a36);
    border-radius: 50%;
    animation: btn-spin-load 0.6s linear infinite;
    z-index: 2;
}

@keyframes btn-spin-load {
    to {
        transform: rotate(360deg);
    }
}


.table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(255, 255, 255, .92);
    margin-bottom: 10px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 600px;
}

th,
td {
    padding: 10px 10px;
    font-size: 13px;
    border-bottom: 1px solid rgba(15, 23, 42, .06);
    vertical-align: top;
}

th {
    text-align: left;
    color: rgba(15, 23, 42, .92);
    font-weight: 750;
    background: rgba(15, 23, 42, .04);
    position: sticky;
    top: 0;
    z-index: 1;
}

tr:last-child td {
    border-bottom: none;
}

td .chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(15, 23, 42, .04);
    font-size: 12px;
    color: rgba(15, 23, 42, .92);
    margin-right: 6px;
    margin-top: 4px;
}

.chip.ok {
    border-color: rgba(22, 163, 74, .35);
}

.chip.warn {
    border-color: rgba(217, 119, 6, .35);
}

.chip.danger {
    border-color: rgba(220, 38, 38, .35);
}

.sectionTitle {
    font-size: 16px;
    font-weight: 800;
    margin: 0 0 10px;
}

.sectionSub {
    font-size: 12px;
    color: var(--muted);
    margin: -6px 0 12px;
}

/* Login view */
/* Login view - Modern Centered Layout */
.loginWrap {
    width: 100%;
    max-width: 440px;
    margin: auto;
    border: 1px solid rgba(255, 255, 255, 1);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    padding: 48px 40px;
    gap: 32px;
}

.loginHeader {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.loginHeader h1 {
    margin: 0;
    font-size: 36px;
    font-weight: 900;
    font-family: var(--font-heading);
    color: var(--text);
    letter-spacing: -1.5px;
    line-height: 1;
}

.loginHeader p {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.6;
    max-width: 320px;
    margin: 0 auto;
}

.loginRight {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.field .label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 8px;
    padding-left: 12px;
}

.loginRight input {
    width: 100%;
    padding: 16px 20px;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text);
    font-size: 16px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.loginRight input:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(238, 42, 54, 0.5);
    box-shadow: 0 0 0 4px rgba(238, 42, 54, 0.1);
    outline: none;
}

.loginActions {
    margin-top: 8px;
}

.btn-premium {
    width: 100%;
    padding: 16px;
    border-radius: 18px;
    border: none;
    background: linear-gradient(135deg, #ee2a36, #8b131b);
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-heading);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(238, 42, 54, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.btn-premium::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.btn-premium:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(238, 42, 54, 0.4);
}

.btn-premium:hover::after {
    left: 100%;
}

.btn-premium:active {
    transform: scale(0.98);
}

.loginCard {
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(255, 255, 255, .92);
    padding: 16px;
}

.field {
    margin-bottom: 10px;
}

.field .label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.loginActions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

/* Modal */
.modalOverlay {
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.modalOverlay.show {
    display: flex;
    z-index: 55;
}

.modal {
    width: 860px;
    max-width: 100%;
    max-height: calc(100vh - 58px - 36px);
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(255, 255, 255, .98);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (max-width: 600px) {
    .modal {
        border-radius: 0;
        max-height: calc(100vh - 58px);
        height: 100%;
    }
}

.modalHeader {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
    background: rgba(15, 23, 42, .03);
}

.modalHeader .title {
    font-weight: 800;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 640px;
}

.modalBody {
    padding: 14px;
    flex: 1;
    overflow-y: auto;
}

.modalFooter {
    padding: 12px 14px;
    border-top: 1px solid rgba(15, 23, 42, .08);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: rgba(15, 23, 42, .03);
}

.twoCol {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .twoCol {
        grid-template-columns: 1fr;
    }
}

.full {
    grid-column: 1 / -1;
}

.notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(238, 42, 54, .25);
    background: #fedbdd;
    margin-top: 10px;
}

.notice i {
    margin-top: 2px;
}

.dangerNote {
    border-color: rgba(220, 38, 38, .30);
    background: rgba(220, 38, 38, .10);
}

/* -----------------------------
      UI/UX Enhancements (v2)
      - Info icon notes with expand/collapse
      - Filter panels for tables
      - Exception resolution controls
      - Custom interval input (value + unit + presets)
      - Toast notifications
      - Modal focus handling
    ----------------------------- */
.srOnly {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

.noteWrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.noteIcon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(238, 42, 54, .28);
    background: #fedbdd;
    color: #ee2a36;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
    flex: 0 0 auto;
}

.noteIcon:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(2, 6, 23, .10);
}

.noteIcon.warn {
    border-color: rgba(220, 38, 38, .30);
    background: rgba(220, 38, 38, .10);
    color: rgba(220, 38, 38, .92);
}

.notePanel {
    flex: 1;
    border-radius: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(238, 42, 54, .22);
    background: #fedbdd;
}

.notePanel.warn {
    border-color: rgba(220, 38, 38, .20);
    background: rgba(220, 38, 38, .06);
}

.noteTitle {
    font-weight: 800;
}

.notePanel .small {
    line-height: 1.45;
}

.searchWrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border: 1px solid rgba(15, 23, 42, .14);
    border-radius: 14px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 10px 18px rgba(2, 6, 23, .06);
}

.searchWrap i {
    color: rgba(15, 23, 42, .55);
}

.searchWrap input {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 10px 4px !important;
    width: 100% !important;
    margin: 0 !important;
}

.searchWrap input:focus {
    outline: none;
}

.iconOnly {
    width: 42px;
    padding: 0;
    display: grid;
    place-items: center;
    height: 38px;
}

.filterPanel {
    margin-top: 12px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 20px 34px rgba(2, 6, 23, .10);
    padding: 12px;
}

.filterHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.filterTitle {
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filterGrid {
    display: grid;
    grid-template-columns: repeat(5, minmax(180px, 1fr));
    gap: 12px;
}

@media (max-width:1200px) {
    .filterGrid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

.filterFooter {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.filterChips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.filterChip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, .14);
    background: rgba(15, 23, 42, .04);
    font-size: 12px;
    color: rgba(15, 23, 42, .90);
}

.filterChip button {
    border: none;
    background: transparent;
    cursor: pointer;
    color: rgba(15, 23, 42, .55);
}

.filterChip button:hover {
    color: rgba(15, 23, 42, .92);
}

.intervalRow {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.intervalInput {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, .14);
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 10px 18px rgba(2, 6, 23, .06);
}

.intervalInput input {
    width: 120px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .14);
    background: rgba(255, 255, 255, .98);
}

.intervalInput select {
    width: 160px;
}

.inlineError {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(220, 38, 38, .30);
    background: rgba(220, 38, 38, .10);
    color: rgba(220, 38, 38, .92);
    font-size: 12px;
    line-height: 1.35;
}

.resolutionWrap {
    display: grid;
    gap: 10px;
}

.radioCard {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border-radius: 16px;
    padding: 10px 12px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .90);
    cursor: pointer;
    transition: box-shadow .12s ease, transform .12s ease;
}

.radioCard:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 26px rgba(2, 6, 23, .10);
}

.radioCard input {
    margin-top: 4px;
    accent-color: var(--accent);
}

.radioTitle {
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 10px;
}

.resolutionSub {
    margin-top: 10px;
    border-radius: 16px;
    padding: 12px;
    border: 1px dashed rgba(15, 23, 42, .18);
    background: rgba(15, 23, 42, .03);
}

body.modalOpen {
    overflow: hidden;
}

.toastHost {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 60;
    max-width: 360px;
}

.toast {
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 20px 34px rgba(2, 6, 23, .18);
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: toastIn .16s ease-out;
}

.toast .toastTitle {
    font-weight: 900;
}

.toast .toastBody {
    font-size: 12px;
    color: rgba(15, 23, 42, .72);
    margin-top: 4px;
}

@keyframes toastIn {
    from {
        transform: translateY(8px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.hiddentext {
    visibility: hidden;
    /* 只隐藏，仍占位 */
}

/* Attendance detail page */
.detail-card {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 16px;
    overflow: hidden;
}

.detail-header {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
    background: rgba(15, 23, 42, .03);
}

.detail-title {
    font-size: 18px;
    font-weight: 850;
}

.detail-subtitle {
    margin-top: 4px;
}

.detail-body {
    padding: 18px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 900px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-section {
    background: rgba(15, 23, 42, .03);
    border: 1px solid rgba(15, 23, 42, .06);
    border-radius: 14px;
    padding: 14px;
}

.detail-section-title {
    font-weight: 800;
    font-size: 13px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(15, 23, 42, .80);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(15, 23, 42, .05);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.detail-value {
    font-size: 13px;
    font-weight: 750;
}

.detail-map {
    border-radius: 12px;
    overflow: hidden;
    min-height: 80px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(15, 23, 42, .02);
    /* Isolate Leaflet's stacking context to prevent map overlapping sidebar */
    position: relative;
    isolation: isolate;
    z-index: 0;
}

.map-tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    background: rgba(15, 23, 42, .05);
    border-radius: 12px;
    padding: 4px;
    width: 100%;
    box-sizing: border-box;
}

.map-tab-btn {
    flex: 1;
    text-align: center;
    padding: 8px 18px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: rgba(15, 23, 42, .55);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.map-tab-btn:hover {
    color: rgba(15, 23, 42, .80);
    background: rgba(15, 23, 42, .04);
}

.map-tab-btn.active {
    background: #fedbdd;
    color: #ee2a36;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(238, 42, 54, 0.15);
}

.dashboard-map {
    border-radius: 12px;
    overflow: hidden;
    height: 430px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(15, 23, 42, .02);
    position: relative;
    isolation: isolate;
    z-index: 0;
}

.dashboard-map .detail-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-placeholder {
    padding: 24px;
    text-align: center;
    font-size: 13px;
}

.detail-photo-wrap {
    min-height: 80px;
}

.selfie-photo {
    width: 100%;
    max-width: 320px;
    height: auto;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .10);
    object-fit: cover;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .10);
}


/* ── Group 4 total work time card ── */
.total-work-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fedbdd;
    border: 1px solid rgba(238, 42, 54, .25);
    border-radius: 12px;
    padding: 12px 16px;
    margin-top: 16px;
}

.total-work-card .tw-label {
    font-weight: 700;
    font-size: 13px;
    color: #b91c1c;
}

.total-work-card .tw-value {
    font-size: 20px;
    font-weight: 900;
    color: #991b1b;
    letter-spacing: .5px;
}

/* ── Total Over Time card ── */
.total-ot-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #dcfce7;
    /* Light green background */
    border: 1px solid rgba(5, 150, 105, .25);
    /* Green border */
    border-radius: 12px;
    padding: 12px 16px;
    margin-top: 12px;
}

.total-ot-card .to-label {
    font-weight: 700;
    font-size: 13px;
    color: #166534;
    /* Dark green color */
}

.total-ot-card .to-value {
    font-size: 20px;
    font-weight: 900;
    color: #14532d;
    /* Darker green color */
    letter-spacing: .5px;
}

/* ── Group 4 total late time card ── */
.total-late-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fef9c3;
    /* Light yellow background */
    border: 1px solid rgba(234, 179, 8, .25);
    /* Yellow border */
    border-radius: 12px;
    padding: 12px 16px;
    margin-top: 12px;
}

.total-late-card .tl-label {
    font-weight: 700;
    font-size: 13px;
    color: #a16207;
    /* Dark yellow/amber color */
}

.total-late-card .tl-value {
    font-size: 20px;
    font-weight: 900;
    color: #854d0e;
    /* Darker amber color */
    letter-spacing: .5px;
}

/* ── Attendance Detail Timeline Redesign ── */
.detail-timeline-wrap {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    padding-left: 20px;
    margin-top: 10px;
}

.detail-timeline-wrap::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: rgba(15, 23, 42, .08);
    border-radius: 2px;
}

.timeline-item {
    position: relative;
}

.timeline-dot {
    position: absolute;
    left: -19px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #0f172a;
    border: 3px solid #fff;
    box-shadow: 0 0 0 4px rgba(15, 23, 42, .04);
    z-index: 2;
}

.timeline-card {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .03);
    transition: all .2s ease;
}

.timeline-card:hover {
    border-color: rgba(15, 23, 42, .15);
    box-shadow: 0 10px 25px rgba(15, 23, 42, .08);
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px dashed rgba(15, 23, 42, .08);
}

.timeline-type {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 850;
    font-size: 15px;
    color: #0f172a;
}

.timeline-type i {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, .05);
    font-size: 14px;
}

.timeline-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.timeline-info-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(15, 23, 42, .50);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.timeline-value {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}

.timeline-media {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 800px) {
    .timeline-media {
        grid-template-columns: 1fr;
    }
}

.timeline-map-box {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, .08);
    height: 240px;
    /* Isolate Leaflet's stacking context to prevent map overlapping sidebar */
    isolation: isolate;
    position: relative;
    z-index: 0;
}

.timeline-photo-box {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, .08);
    height: 240px;
}

.timeline-photo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Location Tracker Section (inside timeline-card) ── */
.tracker-section {
    margin-top: 20px;
    border-top: 1px dashed rgba(15, 23, 42, .08);
    padding-top: 14px;
}

.tracker-toggle-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(15, 23, 42, .03);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: rgba(15, 23, 42, .70);
    transition: all .2s ease;
    font-family: inherit;
}

.tracker-toggle-btn:hover {
    background: rgba(15, 23, 42, .06);
    border-color: rgba(15, 23, 42, .16);
    color: rgba(15, 23, 42, .90);
}

.tracker-toggle-btn.open {
    background: rgba(238, 42, 54, .06);
    border-color: rgba(238, 42, 54, .20);
    color: #b91c1c;
}

.tracker-toggle-btn i:first-child {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, .06);
    font-size: 12px;
}

.tracker-toggle-btn.open i:first-child {
    background: rgba(238, 42, 54, .12);
    color: #ee2a36;
}

.tracker-toggle-btn span {
    flex: 1;
    text-align: left;
}

.tracker-chevron {
    transition: transform .25s ease;
    font-size: 11px;
}

.tracker-toggle-btn.open .tracker-chevron {
    transform: rotate(180deg);
}

.tracker-content {
    margin-top: 12px;
    animation: trackerSlideIn .2s ease-out;
}

@keyframes trackerSlideIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tracker-loading {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: rgba(15, 23, 42, .55);
}

.tracker-empty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: rgba(15, 23, 42, .50);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tracker-count {
    font-size: 12px;
    font-weight: 700;
    color: rgba(15, 23, 42, .50);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tracker-table-wrap {
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .08);
    overflow: hidden;
}

.tracker-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.tracker-table thead {
    background: rgba(15, 23, 42, .04);
}

.tracker-table th {
    padding: 8px 12px;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: rgba(15, 23, 42, .50);
    text-align: left;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
}

.tracker-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(15, 23, 42, .04);
    color: rgba(15, 23, 42, .80);
}

.tracker-table tbody tr:last-child td {
    border-bottom: none;
}

.tracker-table tbody tr:hover {
    background: rgba(15, 23, 42, .02);
}

.tracker-td-num {
    font-weight: 700;
    color: rgba(15, 23, 42, .35);
    width: 36px;
}

.tracker-td-coords {
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 11px;
    letter-spacing: .3px;
}

.tracker-td-time {
    font-weight: 600;
    white-space: nowrap;
}

.tracker-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.tracker-status-in {
    background: rgba(5, 150, 105, .10);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, .20);
}

.tracker-status-out {
    background: rgba(220, 38, 38, .10);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, .20);
}

.tracker-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border-radius: 10px;
    border: 1px dashed rgba(15, 23, 42, .14);
    background: rgba(15, 23, 42, .02);
    color: rgba(15, 23, 42, .60);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s ease;
    font-family: inherit;
}

.tracker-load-more:hover {
    background: rgba(15, 23, 42, .05);
    border-color: rgba(15, 23, 42, .22);
    color: rgba(15, 23, 42, .85);
}

/* ─────────────────────────────────────
   Employee Settings Button & Modal
   ───────────────────────────────────── */

/* Settings button in the table (replaces old status dropdown) */
.emp-settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(15, 23, 42, .04);
    color: rgba(15, 23, 42, .70);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.emp-settings-btn i {
    font-size: 12px;
    transition: transform .3s ease;
}

.emp-settings-btn:hover {
    background: rgba(15, 23, 42, .08);
    border-color: rgba(15, 23, 42, .20);
    color: rgba(15, 23, 42, .90);
}

.emp-settings-btn:hover i {
    transform: rotate(90deg);
}

.emp-settings-btn:active {
    transform: translateY(1px);
}

/* Color variants — status-aware */
.emp-settings-btn.ok {
    border-color: rgba(16, 185, 129, .35);
    color: #10b981;
    background: rgba(16, 185, 129, .06);
}

.emp-settings-btn.ok:hover {
    background: rgba(16, 185, 129, .12);
    border-color: rgba(16, 185, 129, .50);
}

.emp-settings-btn.danger {
    border-color: rgba(244, 63, 94, .35);
    color: #f43f5e;
    background: rgba(244, 63, 94, .06);
}

.emp-settings-btn.danger:hover {
    background: rgba(244, 63, 94, .12);
    border-color: rgba(244, 63, 94, .50);
}

/* ── Settings Modal Internals ── */

.settings-section {
    margin-bottom: 4px;
}

.settings-section-label {
    font-size: 13px;
    font-weight: 750;
    color: rgba(15, 23, 42, .80);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.settings-select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .80);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease;
    font-family: inherit;
}

.settings-select:focus {
    border-color: rgba(238, 42, 54, .40);
    box-shadow: 0 0 0 3px rgba(238, 42, 54, .08);
    outline: none;
}

.settings-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(15, 23, 42, .10), transparent);
    margin: 16px 0;
}

/* ── Special Case Schedule (formerly Night Shift Schedule) ── */

.night-shift-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.night-shift-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(15, 23, 42, .02);
    transition: border-color .2s ease, box-shadow .2s ease;
    animation: nsRowIn .25s ease;
}

.night-shift-row:hover {
    border-color: rgba(15, 23, 42, .16);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}

@keyframes nsRowIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ns-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.ns-time-field {
    flex: 0 0 110px;
}

.ns-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: rgba(15, 23, 42, .45);
}

.ns-date-input,
.ns-time-input {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .90);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    font-family: inherit;
    width: 100%;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.ns-date-input:focus,
.ns-time-input:focus {
    border-color: rgba(238, 42, 54, .40);
    box-shadow: 0 0 0 3px rgba(238, 42, 54, .08);
    outline: none;
}

.ns-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(15, 23, 42, .30);
    font-size: 12px;
    padding-bottom: 8px;
    flex-shrink: 0;
}

.ns-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(220, 38, 38, .15);
    background: rgba(220, 38, 38, .05);
    color: rgba(220, 38, 38, .50);
    cursor: pointer;
    flex-shrink: 0;
    transition: all .2s ease;
    margin-bottom: 1px;
    font-size: 13px;
}

.ns-delete-btn:hover {
    background: rgba(220, 38, 38, .12);
    border-color: rgba(220, 38, 38, .35);
    color: #dc2626;
}

.ns-delete-btn:active {
    transform: scale(.92);
}

/* Read-only End Date — greyed out to show it's auto-computed */
.ns-date-readonly {
    background: rgba(15, 23, 42, .04) !important;
    color: rgba(15, 23, 42, .55) !important;
    cursor: not-allowed;
    pointer-events: none;
}

/* End Time AM/PM display wrapper */
.ns-time-display-wrap {
    position: relative;
    width: 100%;
}

.ns-time-hidden-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.ns-time-display {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .90);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    font-family: inherit;
    width: 100%;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease;
    user-select: none;
    position: relative;
    z-index: 0;
    white-space: nowrap;
}

.ns-time-display i,
.deto-time-display i {
    margin-left: auto;
    font-size: 13px;
    color: rgba(15, 23, 42, .35);
}

.ns-time-display-wrap:hover .ns-time-display {
    border-color: rgba(15, 23, 42, .22);
}

.ns-time-display-wrap:focus-within .ns-time-display {
    border-color: rgba(238, 42, 54, .40);
    box-shadow: 0 0 0 3px rgba(238, 42, 54, .08);
}

/* Add shift button */
.btn-add-shift {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px dashed rgba(16, 185, 129, .40);
    background: rgba(16, 185, 129, .06);
    color: #10b981;
    cursor: pointer;
    font-size: 14px;
    transition: all .2s ease;
}

.btn-add-shift:hover {
    background: rgba(16, 185, 129, .14);
    border-color: rgba(16, 185, 129, .60);
    transform: scale(1.05);
}

.btn-add-shift:active {
    transform: scale(.95);
}

/* Empty state */
.night-shift-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 14px;
    border-radius: 12px;
    border: 1px dashed rgba(15, 23, 42, .10);
    background: rgba(15, 23, 42, .02);
    color: rgba(15, 23, 42, .35);
    font-size: 13px;
    font-weight: 500;
    margin-top: 12px;
}

.night-shift-empty i {
    font-size: 16px;
}

/* ── Responsive: Night Shift Row ── */
@media (max-width: 520px) {
    .night-shift-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .ns-field {
        flex: 1 1 calc(50% - 20px);
    }

    .ns-time-field {
        flex: 1 1 calc(50% - 20px);
    }

    .ns-arrow {
        display: none;
    }

    .ns-delete-btn {
        width: 100%;
        height: 32px;
        flex: 1 1 100%;
        border-radius: 8px;
    }
}

/* ─────────────────────────────────────
   Night Shift Schedule (formerly Day End Time Override)
   ───────────────────────────────────── */

.deto-description {
    font-size: 12px;
    color: rgba(15, 23, 42, .50);
    margin-top: 8px;
    margin-bottom: 14px;
    line-height: 1.5;
}

/* Day chips row */
.deto-day-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.deto-day-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(15, 23, 42, .03);
    color: rgba(15, 23, 42, .60);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s ease;
    font-family: inherit;
    user-select: none;
}

.deto-day-chip:hover {
    background: rgba(15, 23, 42, .08);
    border-color: rgba(15, 23, 42, .20);
    color: rgba(15, 23, 42, .85);
}

.deto-day-chip.active {
    background: rgba(238, 42, 54, .10);
    border-color: rgba(238, 42, 54, .40);
    color: #ee2a36;
    box-shadow: 0 0 0 3px rgba(238, 42, 54, .06);
}

.deto-day-chip.active:hover {
    background: rgba(238, 42, 54, .16);
    border-color: rgba(238, 42, 54, .55);
}

/* Override rows list */
.deto-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.deto-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(15, 23, 42, .02);
    transition: border-color .2s ease, box-shadow .2s ease;
    animation: detoRowIn .25s ease;
}

.deto-row:hover {
    border-color: rgba(15, 23, 42, .16);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}

@keyframes detoRowIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Field container — mirrors .ns-field */
.deto-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.deto-time-field {
    flex: 0 0 110px;
}

/* Label — mirrors .ns-label */
.deto-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: rgba(15, 23, 42, .45);
}

/* Day name display (readonly, looks like a date input) */
.deto-day-display {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(15, 23, 42, .04);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    font-family: inherit;
    width: 100%;
    user-select: none;
}

/* Arrow — mirrors .ns-arrow */
.deto-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(15, 23, 42, .30);
    font-size: 12px;
    padding-bottom: 8px;
    flex-shrink: 0;
}

/* Time input — mirrors .ns-time-input */
.deto-time-input {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .90);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    font-family: inherit;
    width: 100%;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.deto-time-input:focus {
    border-color: rgba(238, 42, 54, .40);
    box-shadow: 0 0 0 3px rgba(238, 42, 54, .08);
    outline: none;
}

/* End Time AM/PM display wrapper — mirrors .ns-time-display-wrap */
.deto-time-display-wrap {
    position: relative;
    width: 100%;
}

.deto-time-hidden-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.deto-time-display {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .90);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    font-family: inherit;
    width: 100%;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease;
    user-select: none;
    position: relative;
    z-index: 0;
    white-space: nowrap;
}

.deto-time-display-wrap:hover .deto-time-display {
    border-color: rgba(15, 23, 42, .22);
}

.deto-time-display-wrap:focus-within .deto-time-display {
    border-color: rgba(238, 42, 54, .40);
    box-shadow: 0 0 0 3px rgba(238, 42, 54, .08);
}

/* Delete button — mirrors .ns-delete-btn */
.deto-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(220, 38, 38, .15);
    background: rgba(220, 38, 38, .05);
    color: rgba(220, 38, 38, .50);
    cursor: pointer;
    flex-shrink: 0;
    transition: all .2s ease;
    margin-bottom: 1px;
    font-size: 13px;
}

.deto-delete-btn:hover {
    background: rgba(220, 38, 38, .12);
    border-color: rgba(220, 38, 38, .35);
    color: #dc2626;
}

.deto-delete-btn:active {
    transform: scale(.92);
}

/* Empty state */
.deto-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 14px;
    border-radius: 12px;
    border: 1px dashed rgba(15, 23, 42, .10);
    background: rgba(15, 23, 42, .02);
    color: rgba(15, 23, 42, .35);
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
}

.deto-empty i {
    font-size: 16px;
}

/* ── Responsive: Day End Time Override Row ── */
@media (max-width: 520px) {
    .deto-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .deto-field {
        flex: 1 1 calc(50% - 20px);
    }

    .deto-time-field {
        flex: 1 1 calc(50% - 20px);
    }

    .deto-arrow {
        display: none;
    }

    .deto-delete-btn {
        width: 100%;
        height: 32px;
        flex: 1 1 100%;
        border-radius: 8px;
    }
}

/* ─────────────────────────────────────
   Custom Schedules — Mini Calendar
   ───────────────────────────────────── */

.custom-cal-wrap {
    position: relative;
    margin-top: 16px;
    margin-bottom: 12px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #ffffff;
    padding: 20px 18px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.03), 0 1px 3px rgba(15, 23, 42, 0.01);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

.custom-cal-wrap:hover {
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06), 0 1px 8px rgba(15, 23, 42, 0.02);
    border-color: rgba(15, 23, 42, 0.12);
}

.custom-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.custom-cal-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
    font-family: var(--font-heading);
}

.custom-cal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.custom-cal-nav:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.18);
    transform: translateY(-1px);
}

.custom-cal-nav:active {
    transform: translateY(0);
}

.custom-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
    padding-bottom: 4px;
}

.custom-cal-weekdays span {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    padding: 6px 0;
    font-family: var(--font-heading);
}

.custom-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

/* ── Calendar Day Cells ── */
.custom-cal-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 2px;
    border-radius: 1px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    min-height: 46px;
    transition: background-color 0.15s ease, color 0.15s ease, border-radius 0.15s ease;
    position: relative;
    cursor: pointer;
    user-select: none;
}

.custom-cal-day:hover:not(.other-month):not(.past-date) {
    background: rgba(15, 23, 42, 0.04);
}

.custom-cal-day.other-month {
    color: rgba(15, 23, 42, 0.15);
    cursor: default;
    pointer-events: none;
}

.custom-cal-day.past-date {
    color: #cbd5e1;
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.custom-cal-day.past-date span {
    text-decoration: none;
}

.custom-cal-day.today {
    z-index: 1;
}

.custom-cal-day.today span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #ee2a36;
    color: #ffffff !important;
    border-radius: 50%;
    font-weight: 700;
}

/* ── Selection States ── */
.custom-cal-day.sel-start {
    background: var(--accent) !important;
    color: #ffffff !important;
    border-radius: 0;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(238, 42, 54, 0.20);
    z-index: 2;
}

.custom-cal-day.sel-end {
    background: var(--accent) !important;
    color: #ffffff !important;
    border-radius: 0;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(238, 42, 54, 0.20);
    z-index: 2;
}

.custom-cal-day.sel-start.sel-end {
    border-radius: 0;
}

.custom-cal-day.sel-in-range {
    background: rgba(238, 42, 54, 0.07) !important;
    color: var(--accent) !important;
    border-radius: 0;
    font-weight: 600;
}

/* Hover preview during selection */
.custom-cal-day.sel-hover-preview {
    background: rgba(238, 42, 54, 0.04);
    border-radius: 0;
}

.custom-cal-day.sel-hover-end {
    background: rgba(238, 42, 54, 0.10);
    border-radius: 0;
    color: var(--accent);
    font-weight: 700;
}

/* Today within saved schedule selection range */
.custom-cal-day.today.sel-start span,
.custom-cal-day.today.sel-end span {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff !important;
}

.custom-cal-day.today.sel-in-range span {
    background: transparent;
    color: var(--accent) !important;
}

/* ── Custom Schedule Row — Job select dropdown ── */
.cs-job-select {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .90);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    font-family: inherit;
    width: 100%;
    transition: border-color .2s ease, box-shadow .2s ease;
    cursor: pointer;
}

.cs-job-select:focus {
    border-color: rgba(238, 42, 54, .35);
    box-shadow: 0 0 0 3px rgba(238, 42, 54, .08);
    outline: none;
}

/* Custom schedule row accent */
.night-shift-row.custom-schedule-row {
    border-left: 3px solid rgba(13, 148, 136, .40);
}

.night-shift-row.custom-schedule-row:hover {
    border-color: rgba(13, 148, 136, .30);
    border-left-color: rgba(13, 148, 136, .60);
    box-shadow: 0 2px 8px rgba(13, 148, 136, .08);
}

/* Read-only date display in custom schedule rows */
.cs-date-readonly {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(13, 148, 136, .04);
    font-size: 13px;
    font-weight: 600;
    color: #0d7d73;
    font-family: inherit;
    text-align: center;
    cursor: default;
    min-width: 90px;
    white-space: nowrap;
}

/* ── Custom Calendar — Day / Night Shift Colors ── */

/* Day Shift — warm yellow */
.custom-cal-day.cal-day-shift {
    background: rgba(245, 158, 11, 0.08) !important;
    color: #b45309 !important;
    font-weight: 600;
}

.custom-cal-day.cal-day-shift:hover {
    background: rgba(245, 158, 11, 0.14) !important;
}

.custom-cal-day.cal-day-shift.cal-range-start {
    border-radius: 1px 1px 1px 1px;
    background: rgba(245, 158, 11, 0.16) !important;
    box-shadow: inset 3px 0 0 0 #f59e0b;
}

.custom-cal-day.cal-day-shift.cal-range-end {
    border-radius: 1px 1px 1px 1px;
    background: rgba(245, 158, 11, 0.16) !important;
    box-shadow: inset -3px 0 0 0 #f59e0b;
}

.custom-cal-day.cal-day-shift.cal-range-start.cal-range-end {
    border-radius: 1px;
    box-shadow: inset 3px 0 0 0 #f59e0b, inset -3px 0 0 0 #f59e0b;
}

/* Night Shift — deep purple */
.custom-cal-day.cal-night-shift {
    background: rgba(139, 92, 246, 0.08) !important;
    color: #6d28d9 !important;
    font-weight: 600;
}

.custom-cal-day.cal-night-shift:hover {
    background: rgba(139, 92, 246, 0.14) !important;
}

.custom-cal-day.cal-night-shift.cal-range-start {
    border-radius: 1px 1px 1px 1px;
    background: rgba(139, 92, 246, 0.16) !important;
    box-shadow: inset 3px 0 0 0 #8b5cf6;
}

.custom-cal-day.cal-night-shift.cal-range-end {
    border-radius: 1px 1px 1px 1px;
    background: rgba(139, 92, 246, 0.16) !important;
    box-shadow: inset -3px 0 0 0 #8b5cf6;
}

.custom-cal-day.cal-night-shift.cal-range-start.cal-range-end {
    border-radius: 1px;
    box-shadow: inset 3px 0 0 0 #8b5cf6, inset -3px 0 0 0 #8b5cf6;
}

/* ─────────────────────────────────────
   Custom Calendar — Floating Popup Editor
   ───────────────────────────────────── */

.custom-cal-popup {
    position: absolute;
    z-index: 100;
    min-width: 280px;
    max-width: 310px;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    border: 1px solid rgba(15, 23, 42, .10);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, .12), 0 2px 8px rgba(15, 23, 42, .06);
    padding: 16px 18px 14px;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(6px) scale(.97);
    transition: opacity .2s ease, transform .2s ease;
}

.custom-cal-popup.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.custom-cal-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(15, 23, 42, .06);
}

.custom-cal-popup-title {
    font-size: 13px;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--text);
    letter-spacing: -.2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.custom-cal-popup-title .popup-shift-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.popup-shift-badge.day-badge {
    background: rgba(234, 179, 8, .12);
    color: #92400e;
    border: 1px solid rgba(234, 179, 8, .25);
}

.popup-shift-badge.night-badge {
    background: rgba(147, 51, 234, .10);
    color: #5b21b6;
    border: 1px solid rgba(147, 51, 234, .20);
}

.popup-shift-badge.unset-badge {
    background: rgba(15, 23, 42, .05);
    color: rgba(15, 23, 42, .45);
    border: 1px solid rgba(15, 23, 42, .10);
}

.custom-cal-popup-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid rgba(220, 38, 38, .12);
    background: rgba(220, 38, 38, .04);
    color: rgba(220, 38, 38, .50);
    cursor: pointer;
    font-size: 11px;
    transition: all .18s ease;
}

.custom-cal-popup-close:hover {
    background: rgba(220, 38, 38, .12);
    border-color: rgba(220, 38, 38, .35);
    color: #dc2626;
    transform: scale(1.08);
}

.custom-cal-popup-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.popup-field-row {
    display: flex;
    gap: 10px;
}

.popup-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.popup-field-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: rgba(15, 23, 42, .45);
}

.popup-field-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(15, 23, 42, .03);
    border: 1px solid rgba(15, 23, 42, .06);
}

.popup-time-wrap {
    position: relative;
    width: 100%;
}

.popup-time-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.popup-time-display {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .95);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease;
    user-select: none;
    white-space: nowrap;
}

.popup-time-display i {
    margin-left: auto;
    font-size: 12px;
    color: rgba(15, 23, 42, .30);
}

.popup-time-wrap:hover .popup-time-display {
    border-color: rgba(15, 23, 42, .22);
}

.popup-time-wrap:focus-within .popup-time-display {
    border-color: rgba(238, 42, 54, .40);
    box-shadow: 0 0 0 3px rgba(238, 42, 54, .08);
}

.popup-job-select {
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .95);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    font-family: inherit;
    width: 100%;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.popup-job-select:focus {
    border-color: rgba(238, 42, 54, .35);
    box-shadow: 0 0 0 3px rgba(238, 42, 54, .08);
    outline: none;
}

.custom-cal-popup-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid rgba(15, 23, 42, .06);
}

.popup-delete-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(220, 38, 38, .15);
    background: rgba(220, 38, 38, .05);
    color: rgba(220, 38, 38, .60);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    transition: all .2s ease;
}

.popup-delete-btn:hover {
    background: rgba(220, 38, 38, .12);
    border-color: rgba(220, 38, 38, .35);
    color: #dc2626;
}

.popup-delete-btn:active {
    transform: scale(.95);
}

.popup-delete-btn i {
    font-size: 11px;
}