:root {
    color-scheme: light;
    --ink: #17202a;
    --muted: #647282;
    --line: #d9e0e7;
    --surface: #ffffff;
    --soft: #f4f7fa;
    --primary: #156b7a;
    --primary-dark: #0f4f5b;
    --accent: #b8602f;
    --good: #137b45;
    --warn: #956313;
    --bad: #b33636;
    --shadow: 0 18px 40px rgba(23, 32, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

html {
    min-width: 768px;
}

body {
    margin: 0;
    min-height: 100vh;
    min-width: 768px;
    color: var(--ink);
    background: #edf6f9;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-x: auto;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 450px;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0,0 C30,20 40,40 10,70 C-10,90 20,100 0,100 Z' fill='rgba(9, 166, 179, 0.05)'/%3E%3Cpath d='M0,10 C20,30 30,50 5,75 C-15,95 10,100 0,100 Z' fill='rgba(135, 206, 250, 0.08)'/%3E%3C/svg%3E") no-repeat left top;
    background-size: cover;
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    top: 100px;
    right: 40px;
    width: 120px;
    height: 180px;
    background-image: radial-gradient(rgba(9, 166, 179, 0.12) 2px, transparent 2px);
    background-size: 15px 15px;
    z-index: -1;
    pointer-events: none;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 80px;
    padding: 0.85rem clamp(1rem, 4vw, 3rem);
    background: linear-gradient(135deg, rgba(15, 34, 64, 0.97) 0%, rgba(24, 49, 83, 0.97) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(10, 28, 51, 0.15);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    max-width: 100%;
    flex: 0 0 auto;
}

.brand-logo {
    height: 52px;
    width: 72px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    border-radius: 8px;
    background: #ffffff;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s ease;
}

.brand:hover .brand-logo {
    transform: scale(1.05);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 0 0 auto;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.5px;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.brand-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.1;
    color: #81e6d9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.brand-school {
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.55rem;
    min-width: 0;
    margin-left: auto;
}

.nav {
    display: flex;
    align-items: center;
    gap: clamp(0.18rem, 0.45vw, 0.5rem);
    flex-wrap: nowrap;
    justify-content: flex-end;
    min-width: 0;
    white-space: nowrap;
}

.nav a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem clamp(0.48rem, 0.75vw, 0.82rem);
    color: rgba(255, 255, 255, 0.86);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.045));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-weight: 650;
    font-size: clamp(0.78rem, 0.85vw, 0.95rem);
    text-align: center;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.nav a:hover {
    color: #ffffff;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
    border-color: rgba(129, 230, 217, 0.35);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

.nav a.active {
    color: #ffffff;
    background: linear-gradient(135deg, #07b7c7, #0a8fa3);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 22px rgba(0, 162, 177, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tabs a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.8rem;
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 650;
    text-align: center;
    transition: all 0.2s ease;
}

.tabs a:hover,
.tabs .active {
    color: var(--primary-dark);
    background: #e9f4f6;
    border-color: #c6e1e6;
}

.shell {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: clamp(1.4rem, 4vw, 3rem) 0 4rem;
}

.site-footer {
    width: min(1180px, calc(100% - 2rem));
    margin: -2rem auto 1.25rem;
    padding: 0.85rem 1rem;
    color: rgba(75, 89, 104, 0.78);
    font-size: 0.78rem;
    font-weight: 650;
    text-align: center;
    border-top: 1px solid rgba(217, 224, 231, 0.8);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    align-items: center;
    gap: clamp(1rem, 4vw, 3rem);
    min-height: calc(100vh - 150px);
    padding: clamp(1rem, 3vw, 2rem) 0;
}

.hero h1,
.section h1 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(2rem, 5vw, 4.6rem);
    line-height: 1.05;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.section h1 {
    font-size: clamp(1.8rem, 3vw, 3rem);
}

.lead {
    max-width: 680px;
    margin: 1rem 0 0;
    color: #3f4d5b;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.eyebrow {
    margin: 0 0 0.65rem;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.actions,
.form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.35rem;
}

.actions.compact {
    margin-top: 0;
}

.button,
.mini-button {
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 750;
    border-radius: 8px;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    text-align: center;
}

.button:hover,
.mini-button:hover {
    transform: translateY(-1px);
}

.primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 10px 22px rgba(21, 107, 122, 0.2);
}

.primary:hover {
    background: var(--primary-dark);
}

.primary.alt {
    background: var(--accent);
    box-shadow: 0 10px 22px rgba(184, 96, 47, 0.18);
}

.primary.alt:hover {
    background: #93491f;
}

.secondary {
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
}

.approve {
    color: #fff;
    background: var(--good);
}

.reject {
    color: #fff;
    background: var(--bad);
}

.summary-panel {
    display: grid;
    gap: 0.75rem;
}

.summary-panel div {
    min-height: 112px;
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.summary-panel span {
    display: block;
    color: var(--muted);
    font-weight: 700;
}

.summary-panel strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 2.4rem;
}

.section {
    padding: clamp(1rem, 3vw, 2rem);
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.section+.section {
    margin-top: 1.25rem;
}

.section.narrow {
    width: min(860px, 100%);
    margin-inline: auto;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
    min-width: 0;
}

.section-head h2 {
    margin: 0;
    font-size: 1.35rem;
}

.section-head.subhead {
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
}

.section-head.subhead p {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-weight: 650;
}

.section-head>a:not(.button) {
    color: var(--primary-dark);
    font-weight: 750;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

.teacher-tools {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.teacher-tools form {
    margin: 0;
}

.alert {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-weight: 700;
}

.alert.success {
    color: #0d5a34;
    background: #eaf7ef;
    border-color: #bde5cb;
}

.alert.error {
    color: #8d2525;
    background: #fff0f0;
    border-color: #f1c8c8;
}

.form {
    display: grid;
    gap: 1rem;
}

.form-block {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    background: #f7f9fb;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.form-block-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.form-block-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.form-block-head span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.form-block-actions {
    display: flex;
    justify-content: center;
}

.form-block-actions .mini-button {
    min-height: 46px;
    padding-inline: 1.2rem;
}

.teacher-grid {
    display: grid;
    gap: 0.75rem;
}

.outside-student-grid {
    display: grid;
    gap: 1rem;
}

.teacher-row {
    display: grid;
    grid-template-columns: 2.2rem minmax(0, 1fr) minmax(0, 1fr) minmax(9rem, 0.7fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.outside-student-row {
    display: grid;
    grid-template-columns: 3.2rem repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: end;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.teacher-row>strong {
    display: grid;
    place-items: center;
    min-height: 46px;
    color: var(--primary-dark);
    background: #e9f4f6;
    border: 1px solid #c6e1e6;
    border-radius: 8px;
}

.outside-student-row>strong {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    align-self: end;
    justify-self: center;
    color: var(--primary-dark);
    background: #e9f4f6;
    border: 1px solid #c6e1e6;
    border-radius: 999px;
}

.outside-student-row label:nth-of-type(odd) {
    grid-column: 2;
}

.outside-student-row label:nth-of-type(even) {
    grid-column: 3;
}

.teacher-row [data-remove-teacher-row] {
    min-height: 46px;
}

.teacher-row [data-remove-teacher-row]:disabled,
.outside-student-row [data-remove-outside-student]:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.outside-student-row [data-remove-outside-student] {
    grid-column: 2 / -1;
    min-height: 46px;
    justify-content: center;
}

.auth-form {
    max-width: 420px;
}

.student-login-help {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    text-align: center;
    border: 1px solid rgba(20, 184, 166, 0.2);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(59, 130, 246, 0.08));
    color: #1f3b4d;
    font-size: 0.9rem;
    line-height: 1.55;
}

.student-login-help strong,
.student-login-help span {
    display: block;
}

.student-login-help span {
    color: #0f6674;
    font-weight: 750;
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label span {
    display: block;
    margin-bottom: 0.4rem;
    color: #344252;
    font-weight: 750;
}

.field-note {
    display: block;
    margin: 0 0 0.75rem;
    padding: 0.85rem 1rem;
    color: #80550f;
    background: #fff7e8;
    border-left: 4px solid #d9a520;
    border-radius: 0 8px 8px 0;
    font-weight: 750;
}

.choice-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    min-width: 0;
    min-height: 46px;
    margin: 0;
    padding: 0.55rem 0.75rem;
    border: 1px solid #c9d3dd;
    border-radius: 8px;
    background: #fff;
}

.choice-group legend {
    padding: 0 0.25rem;
    color: #344252;
    font-weight: 750;
}

.choice-group label {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
}

.choice-group input {
    width: auto;
    min-height: auto;
}

.choice-group span {
    margin: 0;
}

.review-role-fieldset {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 1.15rem;
    border: 1px solid #bfd0e4;
    border-radius: 10px;
    background: #f8fbff;
}

.review-role-fieldset legend {
    padding: 0 0.5rem;
    color: #0f5fa8;
    font-size: 0.95rem;
    font-weight: 850;
}

.review-role-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 0.85rem;
    align-items: stretch;
    min-height: 84px;
}

.review-role-option {
    display: block;
    position: relative;
    margin: 0;
    min-width: 0;
    cursor: pointer;
}

.review-role-option input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.review-role-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    min-height: 72px;
    padding: 0.85rem 1rem;
    border: 2px solid #9bb5d3;
    border-radius: 8px;
    background: #ffffff;
    color: #243244;
    box-shadow: 0 6px 14px rgba(15, 95, 168, 0.08);
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.review-role-card:hover {
    border-color: #1d68b6;
    background: #eef7ff;
    box-shadow: 0 10px 20px rgba(29, 104, 182, 0.16);
    transform: translateY(-1px);
}

.review-role-option input:focus-visible + .review-role-card {
    outline: 3px solid rgba(29, 104, 182, 0.24);
    outline-offset: 3px;
}

.review-role-option input:checked + .review-role-card {
    border-color: #15803d;
    background: #eafaf0;
    color: #14532d;
    box-shadow: 0 0 0 4px rgba(21, 128, 61, 0.14), 0 10px 22px rgba(21, 128, 61, 0.14);
}

.review-role-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border: 2px solid #94a9c2;
    border-radius: 50%;
    background: #ffffff;
}

.review-role-option input:checked + .review-role-card .review-role-check {
    border-color: #15803d;
    background: #15803d;
}

.review-role-option input:checked + .review-role-card .review-role-check::after {
    content: "";
    width: 7px;
    height: 12px;
    border: solid #ffffff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.review-role-text {
    display: block;
    font-size: clamp(1rem, 1.7vw, 1.18rem);
    font-weight: 850;
    line-height: 1.3;
    text-align: center;
}

.review-role-approved {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 72px;
    padding: 0.85rem 1rem;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    background: #ecfdf5;
    color: #047857;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.35;
}

.review-role-approved svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    fill: currentColor;
}

@media (max-width: 640px) {
    .review-role-fieldset {
        padding: 0.9rem;
    }

    .review-role-options {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .review-role-card,
    .review-role-approved {
        min-height: 64px;
        justify-content: flex-start;
        text-align: left;
    }

    .review-role-text {
        text-align: left;
    }
}

.travel-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    padding: 0.9rem;
    background: #eef5fb;
    border-color: #d7e5f2;
}

.travel-options legend {
    margin-bottom: 0.2rem;
}

.travel-options label {
    min-height: 50px;
    padding: 0.6rem 0.75rem;
    background: #fff;
    border-radius: 8px;
    font-weight: 800;
}

input,
textarea,
select {
    width: 100%;
    min-height: 46px;
    padding: 0.75rem 0.85rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid #c9d3dd;
    border-radius: 8px;
    font: inherit;
    font-size: 16px !important;
    min-width: 0;
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 12px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 2.3rem;
}

textarea {
    resize: vertical;
    line-height: 1.6;
}

canvas:focus {
    outline: 3px solid rgba(21, 107, 122, 0.18);
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(21, 107, 122, 0.18);
    border-color: var(--primary);
}

.search-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

th,
td {
    padding: 0.9rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}

th {
    color: #4b5968;
    background: #f7f9fb;
    font-size: 0.84rem;
    font-weight: 800;
}

td strong,
td small {
    display: block;
}

td small,
.muted {
    margin-top: 0.2rem;
    color: var(--muted);
}

tr:last-child td {
    border-bottom: 0;
}

.tracking {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0.28rem 0.55rem;
    color: #17333b;
    background: #e9f4f6;
    border: 1px solid #c6e1e6;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.86rem;
    font-weight: 800;
    word-break: break-word;
}

.type-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0.28rem 0.6rem;
    color: #5f341b;
    background: #fff0e6;
    border: 1px solid #f1c7a8;
    border-radius: 8px;
    font-weight: 800;
    white-space: nowrap;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0.28rem 0.6rem;
    border-radius: 8px;
    font-weight: 800;
    white-space: nowrap;
}

.status-pending {
    color: #6f4308;
    background: #fff3d7;
}

.status-approved {
    color: #0d5a34;
    background: #e8f7ee;
}

.status-rejected {
    color: #8d2525;
    background: #ffecec;
}

.status-cancelled {
    color: #7c2d12;
    background: #ffedd5;
}

.row-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.row-actions form {
    margin: 0;
}

.mini-button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.65rem;
    color: var(--primary-dark);
    background: #e9f4f6;
}

.mini-button.primary:hover {
    color: #ffffff;
    background: var(--primary);
}

.mini-button.danger {
    color: #8d2525;
    background: #ffecec;
}

.empty {
    display: grid;
    place-items: center;
    min-height: 150px;
    padding: 1.2rem;
    color: var(--muted);
    text-align: center;
    background: #fff;
    border: 1px dashed #c9d3dd;
    border-radius: 8px;
}

.signature-field {
    display: grid;
    gap: 0.55rem;
}

.signature-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.signature-head span {
    color: #344252;
    font-weight: 750;
}

.signature-field canvas {
    width: 100%;
    height: 250px;
    background: #fff;
    border: 1px solid #c9d3dd;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
}

.signature-field small {
    color: var(--muted);
}

.signature-field.needs-signature canvas {
    border-color: var(--bad);
    box-shadow: 0 0 0 3px rgba(179, 54, 54, 0.12);
}

.signature-field.needs-signature small {
    color: var(--bad);
    font-weight: 750;
}

.signature-preview {
    grid-column: 1 / -1;
}

.teacher-list-preview {
    grid-column: 1 / -1;
}

.teacher-list-preview dd {
    display: grid;
    gap: 0.35rem;
}

.signature-preview img {
    display: block;
    width: min(420px, 100%);
    height: auto;
    margin-top: 0.5rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.review-list {
    display: grid;
    gap: 1rem;
}

.review-item {
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.request-main {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
}

.request-main h2 {
    margin: 0.55rem 0 0.2rem;
    font-size: 1.25rem;
    overflow-wrap: anywhere;
}

.request-main p {
    margin: 0;
    color: var(--muted);
}

.details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem 1rem;
    margin: 1rem 0;
}

.details div {
    padding: 0.8rem;
    background: #f7f9fb;
    border-radius: 8px;
}

.details dt {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.details dd {
    margin: 0.25rem 0 0;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.review-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto auto;
    gap: 0.6rem;
    align-items: center;
}

.reviewer-signature {
    grid-column: 1 / -1;
    padding: 0.75rem;
    background: #f7f9fb;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.reviewer-signature canvas {
    height: clamp(230px, 34vh, 340px);
    touch-action: none;
}

.report-page {
    display: grid;
    gap: 1rem;
}

.report-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.request-report {
    position: relative;
    overflow: hidden;
    width: min(980px, 100%);
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem);
    color: #10263a;
    background:
        radial-gradient(circle at 0 0, rgba(21, 107, 122, 0.12) 0 2px, transparent 2px) 0 0 / 18px 18px,
        radial-gradient(circle at 100% 100%, rgba(21, 107, 122, 0.1) 0 2px, transparent 2px) 0 0 / 18px 18px,
        #fff;
    border: 1px solid #bcd3e8;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.report-header {
    text-align: center;
}

.report-header img {
    width: min(170px, 46vw);
    height: auto;
}

.report-header p {
    margin: 0.25rem 0;
    color: #10263a;
    font-weight: 750;
}

.report-header h1 {
    margin: 0.75rem auto;
    max-width: 760px;
    font-size: clamp(1.45rem, 3vw, 2.25rem);
    line-height: 1.25;
}

.report-divider {
    width: min(540px, 78%);
    height: 2px;
    margin: 0.9rem auto;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.report-card {
    position: relative;
    margin-top: 1.4rem;
    padding: 2rem 1rem 1rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #a9c6de;
    border-radius: 8px;
}

.report-card-title {
    position: absolute;
    top: -0.85rem;
    left: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    color: #fff;
    background: var(--primary-dark);
    border-radius: 8px;
    font-weight: 850;
}

.report-card-title b {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    color: var(--primary-dark);
    background: #fff;
    border-radius: 999px;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
}

.report-kv {
    display: grid;
    grid-template-columns: minmax(8rem, 0.45fr) minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.65rem;
    background: #f7fbfc;
    border-radius: 8px;
}

.report-kv span {
    color: #415368;
    font-weight: 800;
}

.report-kv strong {
    font-weight: 750;
    overflow-wrap: anywhere;
}

.report-table-wrap {
    border-color: #a9c6de;
}

.report-table-wrap table {
    min-width: 720px;
}

.report-table-wrap th {
    color: #fff;
    background: var(--primary-dark);
}

.report-signatures {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.report-signature-box {
    display: grid;
    gap: 0.55rem;
    padding: 1rem;
    background: #f7fbfc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.report-signature-box h3,
.report-signature-box p {
    margin: 0;
}

.report-signature-line {
    display: grid;
    place-items: center;
    min-height: 110px;
    background: #fff;
    border: 1px dashed #9fbdd7;
    border-radius: 8px;
}

.report-signature-line img {
    max-width: 100%;
    max-height: 130px;
}

.report-result {
    display: grid;
    grid-template-columns: 5rem minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: #f7fbfc;
    border: 1px solid #a9c6de;
    border-radius: 8px;
}

.result-mark {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    color: #fff;
    background: var(--primary);
    border-radius: 999px;
    font-size: 2.4rem;
    font-weight: 900;
}

.report-result span {
    color: var(--muted);
    font-weight: 800;
}

.report-result strong {
    display: block;
    margin: 0.15rem 0;
    font-size: clamp(1.35rem, 3vw, 2rem);
}

.report-result p {
    margin: 0.2rem 0 0;
}

.result-approved .result-mark {
    background: var(--good);
}

.result-rejected .result-mark {
    background: var(--bad);
}

.result-cancelled .result-mark {
    background: #c2410c;
}

.result-pending .result-mark {
    background: var(--warn);
}

.pdf-export-stage,
.pdf-export-stage * {
    box-shadow: none !important;
    text-shadow: none !important;
}

.pdf-export-stage .pdf-export-report {
    font-size: 10px;
    line-height: 1.25;
}

.pdf-export-stage .report-header img {
    width: 72px;
}

.pdf-export-stage .report-header p {
    margin: 1px 0;
    font-size: 10px;
}

.pdf-export-stage .report-divider {
    height: 1px;
    margin: 4px auto;
}

.pdf-export-stage .report-header h1 {
    margin: 4px auto;
    font-size: 18px;
    line-height: 1.15;
}

.pdf-export-stage .tracking {
    padding: 2px 8px;
    font-size: 10px;
}

.pdf-export-stage .dialog-body-container {
    gap: 6px;
    padding: 0 !important;
    overflow: visible;
    background: #ffffff;
}

.pdf-export-stage .dialog-profile-card {
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    align-items: center;
}

.pdf-export-stage .avatar-circle,
.pdf-export-stage .info-card-icon,
.pdf-export-stage .signature-title svg,
.pdf-export-stage .badge-icon {
    display: none !important;
}

.pdf-export-stage .profile-left {
    gap: 8px;
}

.pdf-export-stage .profile-info h3 {
    font-size: 13px;
}

.pdf-export-stage .profile-meta {
    gap: 6px;
    margin-top: 2px;
}

.pdf-export-stage .profile-meta span,
.pdf-export-stage .status-label-prefix,
.pdf-export-stage .status-badge {
    font-size: 9px;
}

.pdf-export-stage .status-badge {
    padding: 3px 8px;
    border-radius: 999px;
}

.pdf-export-stage .dialog-info-grid {
    gap: 5px;
    margin-top: 6px !important;
}

.pdf-export-stage .info-card {
    gap: 4px;
    padding: 6px 8px;
    border-radius: 6px;
}

.pdf-export-stage .info-card-key {
    font-size: 8px;
    letter-spacing: 0;
}

.pdf-export-stage .info-card-val {
    margin-top: 1px;
    font-size: 10px;
    line-height: 1.25;
}

.pdf-export-stage .dialog-table-card {
    margin-top: 6px !important;
    padding: 6px;
    border-radius: 6px;
}

.pdf-export-stage .table-card-title {
    margin-bottom: 4px;
    font-size: 10px;
}

.pdf-export-stage .compact-table table {
    min-width: 0;
    font-size: 8px;
}

.pdf-export-stage .compact-table th,
.pdf-export-stage .compact-table td {
    padding: 3px 4px;
}

.pdf-export-stage .dialog-signatures-grid {
    gap: 6px;
    margin-top: 6px !important;
}

.pdf-export-stage .signature-box-card {
    padding: 6px;
    border-radius: 6px;
}

.pdf-export-stage .signature-title {
    margin-bottom: 4px;
    font-size: 10px;
}

.pdf-export-stage .signature-display-area {
    min-height: 72px;
    padding: 4px;
    border-radius: 6px;
}

.pdf-export-stage .signature-line-wrap-print {
    height: 36px;
    margin-bottom: 0;
}

.pdf-export-stage .signature-img-overlay {
    bottom: 8px;
    max-height: 34px;
}

.pdf-export-stage .signature-rejection-stamp {
    min-width: 74px;
    min-height: 28px;
    margin: 2px 0 1px;
    padding: 2px 8px;
    border-width: 2px;
    border-radius: 4px;
    font-size: 11px;
}

.pdf-export-stage .dotted-line-print {
    bottom: 6px;
}

.pdf-export-stage .signature-owner-name-print,
.pdf-export-stage .signature-date-print {
    margin-top: 1px;
    font-size: 8px;
}

@media (max-width: 980px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-right {
        width: 100%;
        align-items: flex-end;
        gap: 0.45rem;
    }

    .nav {
        width: 100%;
        justify-content: flex-end;
        gap: 0.35rem;
        overflow-x: visible;
    }

    .nav a {
        min-height: 36px;
        padding: 0.45rem 0.55rem;
        font-size: 0.78rem;
        border-radius: 9px;
    }

    .user-badge {
        min-width: 0;
        width: fit-content;
        max-width: 100%;
        margin-left: 0;
        align-self: flex-end;
    }

    .summary-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    th,
    td {
        padding: 0.75rem 0.6rem;
    }
}


@media (max-width: 640px) {
    .shell {
        width: min(100% - 1rem, 1180px);
        padding-top: 0.75rem;
        padding-bottom: 2rem;
    }

    .site-stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .site-stat-card {
        min-height: 78px;
        padding: 0.85rem;
    }

    .site-stat-value {
        font-size: 1.35rem;
    }

    .site-footer {
        width: min(100% - 1rem, 1180px);
        margin-top: -1rem;
        font-size: 0.72rem;
    }

    .tabs a {
        min-height: 42px;
        padding: 0.55rem 0.45rem;
        font-size: 0.92rem;
    }

    .hero {
        gap: 1rem;
        padding: 0.75rem 0;
    }

    .hero h1,
    .section h1 {
        font-size: 1.85rem;
        line-height: 1.15;
    }

    .lead {
        font-size: 1rem;
        line-height: 1.65;
    }

    .summary-panel div {
        min-height: 92px;
        padding: 1rem;
    }

    .summary-panel strong {
        font-size: 2rem;
    }

    .section {
        padding: 1rem;
    }

    .tabs,
    .teacher-tools {
        width: 100%;
    }

    .tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-card {
        padding: 2.25rem 0.75rem 0.75rem;
    }


    .request-main .status {
        align-self: flex-start;
    }

    .details div {
        padding: 0.75rem;
    }

    .signature-field canvas {
        height: 200px;
    }
}

@media (max-width: 420px) {
    .shell {
        width: min(100% - 0.75rem, 1180px);
    }

    .section {
        padding: 0.85rem;
    }

    .button {
        padding-inline: 0.75rem;
    }
}

@media print {
    @page {
        margin: 8mm 12mm;
    }

    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 12px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .topbar,
    .report-actions,
    .alert {
        display: none !important;
    }

    .shell {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    .request-report {
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: 0 !important;
        background: #fff !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Compact Header */
    .report-header img {
        width: 90px !important;
        margin-bottom: 2px !important;
    }

    .report-header p {
        margin: 1px 0 !important;
        font-size: 11px !important;
    }

    .report-header h1 {
        margin: 4px auto !important;
        font-size: 16px !important;
    }

    .report-divider {
        margin: 4px auto !important;
        height: 1px !important;
    }

    .tracking {
        font-size: 10px !important;
    }

    /* Force the desktop grid columns layout in print */
    .dialog-info-grid {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
        margin-top: 8px !important;
    }

    .info-card.span-1 {
        grid-column: span 1 !important;
    }

    .info-card.span-2,
    .info-card.span-3 {
        grid-column: span 1 !important;
    }

    .dialog-signatures-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        margin-top: 8px !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .dialog-signatures-grid.three-cols {
        grid-template-columns: 1fr 1fr 1fr !important;
    }

    .dialog-profile-card {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 8px 12px !important;
        margin-top: 8px !important;
    }

    .profile-left {
        display: flex !important;
        align-items: center !important;
        gap: 1.25rem !important;
    }

    /* Print styling optimization for profile & info cards */
    .dialog-profile-card,
    .info-card,
    .signature-box-card,
    .dialog-table-card {
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
        background: #fff !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .avatar-circle {
        width: 40px !important;
        height: 40px !important;
    }

    .avatar-circle svg {
        width: 22px !important;
        height: 22px !important;
    }

    .profile-info h3 {
        font-size: 13px !important;
    }

    .profile-meta {
        margin-top: 2px !important;
        gap: 8px !important;
    }

    .profile-meta span {
        font-size: 10px !important;
    }

    .info-card {
        padding: 6px 8px !important;
        gap: 6px !important;
    }

    .info-card-icon {
        width: 28px !important;
        height: 28px !important;
    }

    .info-card-icon svg {
        width: 14px !important;
        height: 14px !important;
    }

    .info-card-key {
        font-size: 9px !important;
    }

    .info-card-val {
        font-size: 11px !important;
        margin-top: 1px !important;
    }

    .dialog-table-card {
        margin-top: 8px !important;
        padding: 8px 12px !important;
    }

    .table-card-title {
        margin: 0 0 6px 0 !important;
        font-size: 12px !important;
    }

    .compact-table table th,
    .compact-table table td {
        padding: 4px 6px !important;
        font-size: 11px !important;
    }

    .signature-box-card {
        padding: 8px 12px !important;
    }

    .signature-title {
        margin: 0 0 6px 0 !important;
        font-size: 12px !important;
    }

    .signature-display-area {
        background: #fff !important;
        border: 1px solid #94a3b8 !important;
        box-shadow: none !important;
        padding: 8px !important;
        min-height: 110px !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .signature-line-wrap-print {
        height: 50px !important;
        margin-bottom: 2px !important;
    }

    .signature-img-overlay {
        bottom: 10px !important;
        max-height: 45px !important;
    }

    .dotted-line-print {
        bottom: 8px !important;
    }

    /* Ensure text colors are dark enough for print */
    .info-card-val,
    .profile-info h3,
    .signature-owner-name-print {
        color: #000 !important;
        font-size: 11px !important;
    }

    .info-card-key,
    .signature-title {
        color: #1d68b6 !important;
    }

    .signature-date-print {
        font-size: 10px !important;
    }
}

/* Dialog overlay styling */
dialog.details-dialog {
    border: none;
    border-radius: 16px;
    background: var(--surface);
    color: var(--ink);
    padding: 2rem;
    max-width: 700px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

dialog.details-dialog[open] {
    transform: scale(1);
    opacity: 1;
}

/* Backdrop glassmorphism */
dialog.details-dialog::backdrop {
    background-color: rgba(23, 32, 42, 0.4);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

dialog.details-dialog[open]::backdrop {
    opacity: 1;
}

/* Modal header and custom structures */
.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.dialog-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.dialog-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    font-weight: 800;
    cursor: pointer;
    color: var(--muted);
    padding: 0;
    line-height: 1;
}

.dialog-close-btn:hover {
    color: var(--bad);
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.dialog-meta-wrap {
    margin-bottom: 1.5rem;
}

.dialog-type-pill {
    margin-bottom: 0.5rem;
    display: inline-block;
}

.dialog-student-title {
    margin: 0;
    font-size: 1.15rem;
}

.dialog-student-desc {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.dialog-details-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.dialog-review-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--line);
    padding-top: 1.5rem;
}

.dialog-review-form .form-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}


.dialog-review-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.dialog-review-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.dialog-review-form .reviewer-signature {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem 1rem 1.25rem;
}

.dialog-review-form .reviewer-signature canvas {
    background: #ffffff;
    border: 1px dashed var(--line);
    border-radius: 6px;
    width: 100%;
    height: clamp(230px, 34vh, 340px);
    cursor: crosshair;
    touch-action: none;
}

.dialog-review-form .dialog-actions {
    display: flex;
    gap: 1rem;
}

.dialog-review-form .dialog-actions button {
    flex: 1;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Redesigned details dialog popup */
dialog.details-dialog {
    border: none;
    border-radius: 16px;
    background: var(--surface);
    color: var(--ink);
    padding: 0;
    /* Clear default padding to use banner full-width */
    max-width: 860px;
    width: 95%;
    box-shadow: 0 24px 72px rgba(16, 38, 58, 0.22);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    overflow: hidden;
    /* Prevent scrolling on container itself; scroll is inside body */
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    height: min(850px, 90vh);
}

dialog.details-dialog:not([open]) {
    display: none;
}

dialog.details-dialog[open] {
    transform: scale(1);
    opacity: 1;
    display: flex;
}

/* Dialog Header Banner */
.dialog-banner {
    background: linear-gradient(135deg, #1d68b6 0%, #0d4680 100%);
    color: #ffffff;
    padding: 1.5rem 2rem;
    position: relative;
    box-shadow: 0 4px 12px rgba(13, 70, 128, 0.1);
    flex-shrink: 0;
}

.dialog-banner h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.dialog-banner p {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    opacity: 0.85;
}

.dialog-close-btn-top {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.2s ease;
    padding: 0;
}

.dialog-close-btn-top:hover {
    opacity: 1;
}

/* Dialog Scrollable Body Container */
.dialog-body-container {
    padding: 1.75rem 2rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: #f8fafc;
    /* Subtle light background to pop the white cards */
}

/* 1. Student Profile Card */
.dialog-profile-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.profile-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.avatar-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #e0ecf8;
    color: #1d68b6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-circle svg {
    width: 32px;
    height: 32px;
}

.profile-info h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #10263a;
}

.profile-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}

.profile-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #64748b;
}

.profile-meta svg {
    width: 16px;
    height: 16px;
    color: #1d68b6;
}

.profile-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.status-label-prefix {
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.status-badge.status-pending {
    background: #fef3c7;
    color: #d97706;
}

.status-badge.status-approved {
    background: #dcfce7;
    color: #15803d;
}

.status-badge.status-rejected {
    background: #fee2e2;
    color: #b91c1c;
}

.status-badge.status-cancelled {
    background: #ffedd5;
    color: #c2410c;
}

.status-badge svg.badge-icon {
    width: 14px;
    height: 14px;
}

/* 2. Grid of Info Cards */
.dialog-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.info-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.info-card:hover {
    border-color: #cbd5e1;
}

.info-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #f0f6fc;
    color: #1d68b6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-card-icon svg {
    width: 20px;
    height: 20px;
}

.info-card-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.info-card-key {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1d68b6;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.info-card-val {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    margin-top: 0.15rem;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.info-card.span-1 {
    grid-column: span 1;
}

.info-card.span-2 {
    grid-column: span 1;
}

.info-card.span-3 {
    grid-column: span 1;
}

.info-card.span-2 .info-card-val,
.info-card.span-3 .info-card-val {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* 3. Signature Boxes styling */
.dialog-signatures-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.dialog-signatures-grid.three-cols {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 768px) {
    .dialog-signatures-grid.three-cols {
        grid-template-columns: 1fr;
    }
}

.signature-box-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.signature-title {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1d68b6;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.signature-title svg {
    width: 18px;
    height: 18px;
}

.signature-display-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #b0c9f0;
    /* Thin blue border */
    border-radius: 12px;
    padding: 1.5rem 1rem;
    min-height: 160px;
    background: #ffffff;
    /* White background */
    position: relative;
}

.signature-line-wrap-print {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.25rem;
    height: 80px;
}

.signature-img-overlay {
    position: absolute;
    bottom: 20px;
    max-height: 70px;
    max-width: 80%;
    object-fit: contain;
    z-index: 2;
}

.signature-rejection-stamp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    min-height: 54px;
    margin: 0.6rem 0 0.35rem;
    padding: 0.35rem 1.25rem;
    color: #b91c1c;
    border: 3px solid #ef4444;
    border-radius: 8px;
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1;
    text-align: center;
    transform: rotate(-4deg);
    background: rgba(254, 242, 242, 0.72);
    box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.12);
}

.dotted-line-print {
    position: absolute;
    bottom: 15px;
    width: 80%;
    border-bottom: 1.5px dotted #94a3b8;
    height: 1px;
    z-index: 1;
}

.signature-owner-name-print {
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
}

.signature-date-print {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    color: #64748b;
    text-align: center;
}

/* Custom Table Cards inside dialog */
.dialog-table-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.table-card-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #1d68b6;
}

.compact-table table {
    font-size: 0.9rem;
}

.compact-table th {
    background: #f0f6fc;
    color: #1d68b6;
    font-weight: 700;
    padding: 0.6rem 0.8rem;
}

.compact-table td {
    padding: 0.6rem 0.8rem;
}

/* Form inputs for review mode */
.dialog-review-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    margin-top: 0.5rem;
}

.review-inputs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.review-inputs-row .input-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.review-inputs-row label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1d68b6;
}

.review-inputs-row input {
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--ink);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.review-inputs-row input:focus {
    outline: none;
    border-color: #1d68b6;
    background-color: #ffffff;
}

.locked-reviewer-name,
.review-inputs-row input.locked-reviewer-name {
    color: #1e293b;
    background: #f1f5f9;
    border-color: #cbd5e1;
    cursor: not-allowed;
    font-weight: 700;
}

.locked-reviewer-name:focus,
.review-inputs-row input.locked-reviewer-name:focus {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.dialog-review-form .reviewer-signature {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 1rem 1rem 1.25rem;
}

.dialog-review-form .reviewer-signature canvas {
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    width: 100%;
    height: clamp(230px, 34vh, 340px);
    cursor: crosshair;
    touch-action: none;
}

.dialog-actions-review {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.dialog-actions-review button {
    flex: 1;
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 8px;
}

.dialog-actions-review button svg {
    width: 16px;
    height: 16px;
}

.dialog-actions-review button.approve-btn {
    background: #107c41;
    color: #ffffff;
}

.dialog-actions-review button.reject-btn {
    background: #a80000;
    color: #ffffff;
}

/* Header Action Buttons Bar */
.dialog-header-actions {
    background: #ffffff;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

@media (max-width: 768px) {
    .dialog-header-actions {
        padding: 0.75rem 0.5rem;
        justify-content: center;
        gap: 0.4rem;
    }
}

.dialog-btn {
    padding: 0.6rem 1.25rem;
    font-size: 0.88rem;
    white-space: nowrap;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: 8px;
    cursor: pointer;
    border: none;
}

.dialog-btn svg {
    width: 16px;
    height: 16px;
}

.dialog-btn.approve-btn {
    background: #198754;
    color: #ffffff;
}

.dialog-btn.approve-btn:hover:not(:disabled) {
    background: #157347;
}

.dialog-btn.reject-btn {
    background: #dc3545;
    color: #ffffff;
}

.dialog-btn.reject-btn:hover:not(:disabled) {
    background: #c82333;
}

.dialog-btn.print-btn {
    background: #106ebe;
    color: #ffffff;
}

.dialog-btn.print-btn:hover {
    background: #0b5a9e;
}

.dialog-btn.pdf-btn {
    background: #8764b8;
    color: #ffffff;
}

.dialog-btn.pdf-btn:hover {
    background: #7252a1;
}

.dialog-btn.close-btn {
    background: #e81123;
    color: #ffffff;
}

.dialog-btn.close-btn:hover {
    background: #c50f1f;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    dialog.details-dialog {
        height: 100vh;
        max-height: 100vh;
        width: 100%;
        border-radius: 0;
    }

    .dialog-banner {
        padding: 1.25rem 1.5rem;
    }

    .dialog-body-container {
        padding: 1.25rem 1.5rem;
        gap: 1.25rem;
    }

    .track-card {
        padding: 1.25rem 0.5rem !important;
    }

    .track-card table {
        min-width: 100% !important;
    }

    .track-card thead th {
        padding: 0.8rem 0.35rem !important;
        font-size: 0.85rem !important;
    }

    .track-card tbody td {
        padding: 1rem 0.35rem !important;
    }

    .type-badge {
        width: 104px !important;
        padding: 0.35rem 0.5rem !important;
        font-size: 0.75rem !important;
        gap: 4px !important;
    }

    .type-badge .type-icon {
        width: 14px !important;
        height: 14px !important;
    }

    .status-pill {
        padding: 0.35rem 0.5rem !important;
        font-size: 0.76rem !important;
        gap: 4px !important;
    }

    .status-pill-icon {
        width: 14px !important;
        height: 14px !important;
    }

    .view-details-btn {
        padding: 0.35rem 0.5rem !important;
        font-size: 0.76rem !important;
        min-height: 32px !important;
        gap: 4px !important;
    }

    .view-details-btn .btn-icon {
        width: 14px !important;
        height: 14px !important;
    }

    .student-name {
        font-size: 0.88rem !important;
    }

    .student-info {
        font-size: 0.76rem !important;
    }

    .date-cell {
        font-size: 0.8rem !important;
    }

    .date-time-note {
        font-size: 0.72rem !important;
        white-space: normal;
    }
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(.disabled) {
    border-color: #cbd5e1;
    background-color: #f8fafc;
    color: #0f172a;
}

.pagination-btn.active {
    background-color: #00a2b1;
    border-color: #00a2b1;
    color: #ffffff;
}

.pagination-btn.disabled {
    color: #cbd5e1;
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- Tracking Page Redesign --- */

.track-card {
    background:
        radial-gradient(circle at 92% 4%, rgba(34, 211, 238, 0.13), transparent 28%),
        radial-gradient(circle at 6% 14%, rgba(59, 130, 246, 0.09), transparent 24%),
        #ffffff;
    border-radius: 24px;
    padding: 2.5rem clamp(1rem, 4vw, 3rem);
    box-shadow: 0 10px 40px rgba(9, 166, 179, 0.08);
    border: 1px solid rgba(9, 166, 179, 0.12);
    margin-top: 1.5rem;
    position: relative;
    overflow: hidden;
    animation: track-shell-in 0.55s ease both;
    isolation: isolate;
}

.track-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(9, 166, 179, 0.08) 1px, transparent 1px);
    background-size: 18px 18px;
    opacity: 0.45;
    pointer-events: none;
    z-index: -1;
}

.track-card::after {
    content: '';
    position: absolute;
    top: -90px;
    right: -120px;
    width: 260px;
    height: 260px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.18), rgba(6, 182, 212, 0));
    pointer-events: none;
    animation: track-glow-pulse 5s ease-in-out infinite;
}

.tracking-header-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.tracking-header-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: track-rise-in 0.55s ease 0.08s both;
}

.tracking-eyebrow {
    font-size: 0.78rem;
    font-weight: 750;
    color: #00a2b1;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.eyebrow-dot {
    width: 6px;
    height: 6px;
    background: #00a2b1;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(0, 162, 177, 0.28);
    animation: track-dot-pulse 1.8s ease-in-out infinite;
}

.tracking-title {
    font-size: 2.4rem;
    font-weight: 850;
    color: #0c2b48;
    margin: 0;
    line-height: 1.1;
}

.tracking-header-illustration {
    flex-shrink: 0;
    animation: track-illustration-in 0.7s ease 0.16s both, track-float 4.5s ease-in-out 1.1s infinite;
    transform-origin: center;
}

.track-search-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    animation: track-rise-in 0.55s ease 0.16s both;
}

.search-input-wrapper,
.search-date-wrapper {
    position: relative;
}

.search-input-wrapper {
    flex: 1;
}

.search-date-wrapper {
    flex: 0 0 220px;
}

.search-field-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #a0aec0;
    pointer-events: none;
}

.search-input-wrapper input,
.search-date-wrapper input {
    width: 100%;
    height: 52px;
    padding: 0.5rem 1rem 0.5rem 3.25rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    color: #2d3748;
    background: #ffffff;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.25s ease;
    box-sizing: border-box;
}

.search-input-wrapper:focus-within .search-field-icon,
.search-date-wrapper:focus-within .search-field-icon {
    color: #00a2b1;
}

.search-input-wrapper input:focus,
.search-date-wrapper input:focus {
    border-color: #00a2b1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 162, 177, 0.15);
}

.track-search-btn {
    height: 52px;
    padding: 0 1.75rem;
    background: #00a2b1;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(0, 162, 177, 0.3);
    position: relative;
    overflow: hidden;
}

.track-search-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.26) 45%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.55s ease;
}

.track-search-btn:hover {
    background: #008b99;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 162, 177, 0.4);
}

.track-search-btn:hover::after {
    transform: translateX(120%);
}

.track-search-btn:active {
    transform: translateY(0);
}

.track-search-btn .btn-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

.track-subhead {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    animation: track-rise-in 0.52s ease 0.22s both;
}

.subhead-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #0c2b48;
}

.subhead-icon {
    width: 22px;
    height: 22px;
    color: #00a2b1;
}

.track-subhead h2 {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
    color: #0c2b48;
}

.subhead-desc {
    font-size: 0.88rem;
    color: #718096;
    margin: 0;
}

.track-card thead th {
    background: #f1f6fa !important;
    color: #0c2b48 !important;
    font-size: 0.9rem !important;
    font-weight: 800 !important;
    padding: 1rem 0.75rem !important;
    text-align: left;
    border: none !important;
}

.track-card thead tr th:first-child {
    border-radius: 12px 0 0 12px;
}

.track-card thead tr th:last-child {
    border-radius: 0 12px 12px 0;
}

.track-card tbody td {
    padding: 1.1rem 0.75rem !important;
    border-bottom: 1px solid #edf2f7 !important;
    vertical-align: middle !important;
}

.track-card tbody tr {
    animation: track-row-in 0.44s ease both;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.track-card tbody tr:nth-child(1) {
    animation-delay: 0.26s;
}

.track-card tbody tr:nth-child(2) {
    animation-delay: 0.31s;
}

.track-card tbody tr:nth-child(3) {
    animation-delay: 0.36s;
}

.track-card tbody tr:nth-child(4) {
    animation-delay: 0.41s;
}

.track-card tbody tr:nth-child(5) {
    animation-delay: 0.46s;
}

.track-card tbody tr:nth-child(6) {
    animation-delay: 0.51s;
}

.track-card tbody tr:hover {
    background-color: rgba(240, 253, 250, 0.74);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px -22px rgba(15, 23, 42, 0.35);
}

.track-card tbody tr:last-child td {
    border-bottom: none !important;
}

.student-name {
    font-size: 1rem;
    font-weight: 750;
    color: #2d3748;
    display: block;
    line-height: 1.2;
}

.student-info {
    font-size: 0.82rem;
    color: #718096;
    display: block;
    margin-top: 2px;
}

.date-cell {
    font-size: 0.9rem;
    color: #2d3748;
    line-height: 1.35;
}

.date-time-note {
    display: grid;
    gap: 2px;
    margin-top: 0.35rem;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.35;
}

.date-time-note span {
    display: block;
    white-space: nowrap;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 128px;
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    font-weight: 750;
    font-size: 0.82rem;
    line-height: 1.1;
    white-space: nowrap;
    box-sizing: border-box;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.track-card tbody tr:hover .type-badge,
.track-card tbody tr:hover .status-pill {
    transform: translateY(-1px);
}

.type-badge .type-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.type-badge .type-text {
    display: flex;
    flex-direction: column;
    gap: 0;
    text-align: center;
}

.type-home {
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    color: #0369a1;
}

.type-outside {
    background: #fff5eb;
    border: 1px solid #fed7aa;
    color: #c05621;
}

.type-sick {
    background: #f3e8ff;
    border: 1px solid #d8b4fe;
    color: #6b21a8;
}

.type-personal {
    background: #fdf2f8;
    border: 1px solid #fbcfe8;
    color: #be185d;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    font-weight: 750;
    font-size: 0.88rem;
    line-height: 1;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.status-pill-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
    flex-shrink: 0;
}

.status-pill.status-pending {
    background: #fffaf0;
    border: 1px solid #fbd38d;
    color: #dd6b20;
}

.status-pill.status-approved {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #38a169;
}

.status-pill.status-rejected {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #e53e3e;
}

.status-pill.status-cancelled {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #c2410c;
}

/* Small content dialogs should shrink to their content instead of inheriting
   the fixed height used by the full request-details dialog. */
dialog.details-dialog.compact-dialog {
    display: none !important;
    height: auto !important;
    block-size: auto !important;
    min-height: 0 !important;
    max-height: calc(100vh - 2rem) !important;
    max-height: calc(100dvh - 2rem) !important;
    overflow-y: auto !important;
}

dialog.details-dialog.compact-dialog[open] {
    display: block !important;
}

.view-details-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0.45rem 0.9rem;
    background: #ebf8ff;
    border: 1.5px solid #bee3f8;
    color: #2b6cb0;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.view-details-btn:hover {
    background: #d2e9ff;
    border-color: #90cdf4;
    color: #2b6cb0;
    transform: translateY(-2px);
    box-shadow: 0 10px 18px -12px rgba(43, 108, 176, 0.55);
}

.view-details-btn:active {
    transform: translateY(0);
}

.view-details-btn .btn-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2.2;
    flex-shrink: 0;
}

@keyframes track-shell-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes track-rise-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes track-row-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes track-illustration-in {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.92) rotate(-3deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0);
    }
}

@keyframes track-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@keyframes track-dot-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 162, 177, 0.28);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(0, 162, 177, 0);
    }
}

@keyframes track-glow-pulse {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.08);
    }
}

/* Responsive adjustment for tracking card */
@media (max-width: 768px) {
    .tracking-header-illustration {
        display: none;
    }
    .track-search-form {
        flex-direction: column;
        align-items: stretch;
    }
    .search-date-wrapper {
        flex: none;
        width: 100%;
    }
}

/* --- Admin Console Custom Styles --- */
.admin-tab-btn:hover {
    color: var(--primary) !important;
    background-color: var(--soft);
}

.admin-tab-btn.active {
    color: var(--primary) !important;
    border-bottom-color: var(--primary) !important;
    background-color: var(--surface);
}

.admin-teachers-layout {
    display: grid;
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.teacher-admin-sidebar,
.teacher-admin-list,
.teacher-list-card {
    min-width: 0;
}

.teacher-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.teacher-search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 1 560px;
    min-width: 0;
    margin: 0;
}

.teacher-search-form input[name="teacher_search"] {
    flex: 1 1 300px;
    min-width: 260px;
    max-width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.teacher-search-form .button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.teacher-table-wrap {
    overflow-x: hidden;
}

.teacher-members-table {
    min-width: 0;
    table-layout: fixed;
}

.teacher-members-table th,
.teacher-members-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.teacher-members-table th:nth-child(1),
.teacher-members-table td:nth-child(1) {
    width: 18%;
}

.teacher-members-table th:nth-child(2),
.teacher-members-table td:nth-child(2) {
    width: 16%;
}

.teacher-members-table th:nth-child(3),
.teacher-members-table td:nth-child(3) {
    width: 28%;
}

.teacher-members-table th:nth-child(4),
.teacher-members-table td:nth-child(4) {
    width: 24%;
}

.teacher-members-table th:nth-child(5),
.teacher-members-table td:nth-child(5) {
    width: 14%;
}

.teacher-phone-form {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.teacher-phone-form input[name="phone"] {
    width: 100%;
    min-width: 0;
    max-width: 128px;
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.teacher-phone-form .button,
.teacher-actions .button {
    flex: 0 0 auto;
    white-space: normal;
    line-height: 1.2;
}

.teacher-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr !important;
    }

    .admin-teachers-layout {
        grid-template-columns: 1fr;
    }

    .teacher-list-head {
        align-items: stretch;
        flex-direction: column;
    }

    .teacher-search-form {
        width: 100%;
    }

    .teacher-search-form input[name="teacher_search"] {
        min-width: 0;
    }
}

.home-shell {
    padding-top: 1rem !important;
}

.site-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 0.25rem 0 1.5rem;
}

.site-stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 86px;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(9, 166, 179, 0.14);
    border-radius: 14px;
    background:
        radial-gradient(circle at 92% 12%, rgba(34, 211, 238, 0.16), transparent 28%),
        rgba(255, 255, 255, 0.92);
    box-shadow: 0 14px 28px -22px rgba(15, 23, 42, 0.35);
    animation: home-fade-rise 0.52s ease both;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.site-stat-card:nth-child(2) {
    animation-delay: 0.08s;
}

.site-stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(6, 182, 212, 0.34);
    box-shadow: 0 18px 34px -24px rgba(15, 23, 42, 0.45);
}

.site-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    flex-shrink: 0;
}

.site-stat-card.active-users .site-stat-icon {
    color: #0f766e;
    background: rgba(20, 184, 166, 0.12);
}

.site-stat-card.total-visits .site-stat-icon {
    color: #2563eb;
    background: rgba(59, 130, 246, 0.12);
}

.site-stat-label {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.site-stat-value {
    color: #0c2b48;
    font-size: 1.65rem;
    font-weight: 850;
    line-height: 1.1;
    margin-top: 0.18rem;
}

.site-stat-value span {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 700;
}

/* Homepage Dashboard & Menu Grid */
.home-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin: 0.5rem 0 2rem 0;
}

.menu-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.home-shell .menu-card,
.home-shell .chart-card,
.home-shell>.section {
    animation: home-fade-rise 0.58s ease both;
}

.home-shell .menu-card:nth-child(1) {
    animation-delay: 0.04s;
}

.home-shell .menu-card:nth-child(2) {
    animation-delay: 0.1s;
}

.home-shell .menu-card:nth-child(3) {
    animation-delay: 0.16s;
}

.home-shell .menu-card:nth-child(4) {
    animation-delay: 0.22s;
}

.home-shell .menu-card:nth-child(5) {
    animation-delay: 0.28s;
}

.home-shell .menu-card:nth-child(6) {
    animation-delay: 0.34s;
}

.home-shell .chart-card:nth-child(1) {
    animation-delay: 0.16s;
}

.home-shell .chart-card:nth-child(2) {
    animation-delay: 0.24s;
}

.home-shell>.section {
    animation-delay: 0.32s;
}

.menu-card::before {
    content: '';
    position: absolute;
    inset: -35% -45% auto auto;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0));
    opacity: 0;
    transform: translate3d(18px, -18px, 0) scale(0.8);
    transition: opacity 0.28s ease, transform 0.28s ease;
    pointer-events: none;
    z-index: 0;
}

.menu-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0.8;
    z-index: 1;
}

.menu-card.sick-leave::after {
    background: linear-gradient(to bottom, #3b82f6, #60a5fa);
}

.menu-card.go-home::after {
    background: linear-gradient(to bottom, #ec4899, #f472b6);
}

.menu-card.outside::after {
    background: linear-gradient(to bottom, #ef4444, #f87171);
}

.menu-card.teacher::after {
    background: linear-gradient(to bottom, #10b981, #34d399);
}

.menu-card.admin::after {
    background: linear-gradient(to bottom, #4b5563, #9ca3af);
}

.menu-card.track::after {
    background: linear-gradient(to bottom, #06b6d4, #22d3ee);
}

.menu-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.menu-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--soft);
    color: var(--primary);
    transition: transform 0.25s ease;
}

.menu-card.sick-leave .menu-card-icon {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.menu-card.go-home .menu-card-icon {
    color: #ec4899;
    background: rgba(236, 72, 153, 0.08);
}

.menu-card.outside .menu-card-icon {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.menu-card.teacher .menu-card-icon {
    color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

.menu-card.admin .menu-card-icon {
    color: #4b5563;
    background: rgba(75, 85, 99, 0.08);
}

.menu-card.track .menu-card-icon {
    color: #0891b2;
    background: rgba(6, 182, 212, 0.1);
}

.menu-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 34px -18px rgba(15, 23, 42, 0.24);
    border-color: var(--primary);
}

.menu-card:hover::before {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.menu-card.sick-leave:hover {
    border-color: #3b82f6;
}

.menu-card.go-home:hover {
    border-color: #ec4899;
}

.menu-card.outside:hover {
    border-color: #ef4444;
}

.menu-card.teacher:hover {
    border-color: #10b981;
}

.menu-card.admin:hover {
    border-color: #4b5563;
}

.menu-card.track:hover {
    border-color: #06b6d4;
}

.menu-card:hover .menu-card-icon {
    transform: translateY(-2px) scale(1.1);
}

.menu-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.menu-card-desc {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.4;
}

/* Charts Layout Grid */
.charts-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

@media (max-width: 992px) {
    .charts-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    min-width: 0;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.chart-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #ec4899, #ef4444);
    opacity: 0.78;
}

.chart-card:hover {
    transform: translateY(-3px);
    border-color: rgba(6, 182, 212, 0.28);
    box-shadow: 0 18px 34px -22px rgba(15, 23, 42, 0.28);
}

.chart-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 280px;
}

.home-shell .table-wrap tbody tr {
    animation: home-row-in 0.42s ease both;
}

.home-shell .table-wrap tbody tr:nth-child(1) {
    animation-delay: 0.08s;
}

.home-shell .table-wrap tbody tr:nth-child(2) {
    animation-delay: 0.13s;
}

.home-shell .table-wrap tbody tr:nth-child(3) {
    animation-delay: 0.18s;
}

.home-shell .table-wrap tbody tr:nth-child(4) {
    animation-delay: 0.23s;
}

.home-shell .table-wrap tbody tr:nth-child(5) {
    animation-delay: 0.28s;
}

.home-shell .table-wrap tbody tr:nth-child(6) {
    animation-delay: 0.33s;
}

@keyframes home-fade-rise {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes home-row-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-shell .menu-card,
    .home-shell .chart-card,
    .home-shell>.section,
    .home-shell .table-wrap tbody tr,
    .site-stat-card,
    .track-card,
    .tracking-header-content,
    .tracking-header-illustration,
    .track-search-form,
    .track-subhead,
    .track-card tbody tr,
    .eyebrow-dot,
    .track-card::after {
        animation: none !important;
    }

    .menu-card,
    .chart-card,
    .site-stat-card,
    .menu-card::before,
    .menu-card-icon,
    .track-search-btn,
    .track-search-btn::after,
    .view-details-btn,
    .track-card tbody tr,
    .type-badge,
    .status-pill {
        transition: none !important;
    }
}

/* Dynamic Navbar User Badges */
.user-badge {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: min(100%, 360px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.user-badge.student {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.user-badge.teacher {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.user-badge.admin {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.logout-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.38rem 0.75rem;
    color: #dc2626 !important;
    background: linear-gradient(180deg, rgba(254, 226, 226, 0.95), rgba(254, 202, 202, 0.78));
    border: 1px solid rgba(248, 113, 113, 0.45);
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 750;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.58);
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.logout-link:hover {
    color: #ffffff !important;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 10px 22px rgba(220, 38, 38, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}
