:root {
    --primary-color: #1f627c;
    --primary-dark: #123848;
    --primary-soft: #e7f3f8;
    --primary-tint: #2e8098;
    --accent-color: #ffcb05;
    --accent-soft: #fff5c8;
    --text-color: #19303a;
    --muted-text: #67808c;
    --surface: rgba(255, 255, 255, 0.94);
    --surface-solid: #ffffff;
    --surface-muted: #f6fafc;
    --border-color: rgba(31, 98, 124, 0.12);
    --border-strong: rgba(31, 98, 124, 0.2);
    --shadow-soft: 0 16px 40px rgba(16, 40, 52, 0.08);
    --shadow-strong: 0 24px 60px rgba(16, 40, 52, 0.16);
    --success-color: #178f59;
    --warning-color: #d88710;
    --danger-color: #c34545;
    --radius-sm: 14px;
    --radius-md: 22px;
    --radius-lg: 30px;
    --content-width: 1320px;
}

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

html {
    scroll-behavior: smooth;
}

body.portal-body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--text-color);
    background:
        radial-gradient(circle at top left, rgba(255, 203, 5, 0.28), transparent 28%),
        radial-gradient(circle at top right, rgba(31, 98, 124, 0.18), transparent 25%),
        linear-gradient(180deg, #f5f9fb 0%, #eef4f7 45%, #f9fbfc 100%);
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
    isolation: isolate;
}

.portal-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.64), transparent 50%),
        radial-gradient(circle at 20% 20%, rgba(255, 203, 5, 0.14), transparent 20%),
        radial-gradient(circle at 80% 12%, rgba(31, 98, 124, 0.12), transparent 22%);
    z-index: -1;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    color: var(--primary-dark);
    font-family: "Plus Jakarta Sans", "Manrope", sans-serif;
    letter-spacing: -0.02em;
}

p {
    color: var(--muted-text);
}

.main-header,
.main-nav,
.content-wrapper,
.main-footer,
.motivation-banner,
.nav-toggle {
    width: min(calc(100% - 24px), var(--content-width));
    margin-left: auto;
    margin-right: auto;
}

.main-header {
    margin-top: 18px;
    padding: 18px 22px;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(135deg, rgba(18, 56, 72, 0.96) 0%, rgba(31, 98, 124, 0.96) 52%, rgba(46, 128, 152, 0.92) 100%);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-strong);
    border: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
    top: auto;
    z-index: 70;
    backdrop-filter: blur(14px);
    animation: shellFloatIn 0.55s ease;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    padding: 8px;
    box-shadow: inset 0 0 0 1px rgba(18, 56, 72, 0.08);
}

.school-block {
    display: flex;
    flex-direction: column;
}

.school-name {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: clamp(1.1rem, 2vw, 1.55rem);
    font-weight: 800;
    line-height: 1.1;
}

.school-tag {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.74);
    font-size: 0.88rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.header-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.info-chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-weight: 600;
    font-size: 0.93rem;
    backdrop-filter: blur(10px);
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.logout-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    border-radius: 999px;
    color: var(--primary-dark);
    background: var(--accent-color);
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(255, 203, 5, 0.26);
}

.logout-link:hover {
    background: #ffe071;
    color: var(--primary-dark);
}

.nav-toggle {
    display: none;
    margin-top: 12px;
    padding: 14px 18px;
    border: 0;
    border-radius: 18px;
    background: var(--surface);
    color: var(--primary-dark);
    font-weight: 800;
    font-family: "Plus Jakarta Sans", sans-serif;
    box-shadow: var(--shadow-soft);
    gap: 10px;
}

.nav-toggle-icon {
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
    position: relative;
    display: inline-block;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
}

.nav-toggle-icon::before {
    top: -6px;
}

.nav-toggle-icon::after {
    top: 6px;
}

.main-nav {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
    position: relative;
    top: auto;
    z-index: 80;
    overflow: visible;
    isolation: isolate;
    animation: shellFloatIn 0.65s ease;
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.main-nav ul li {
    position: relative;
}

.main-nav .dropdown {
    position: relative;
}

.main-nav ul li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 16px;
    color: var(--primary-dark);
    font-weight: 700;
    white-space: nowrap;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.main-nav .dropbtn::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-left: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
    transition: transform 0.2s ease;
}

.main-nav .dropdown:hover > .dropbtn::after,
.main-nav .dropdown:focus-within > .dropbtn::after,
.main-nav .dropdown.dropdown-open > .dropbtn::after {
    transform: rotate(-135deg) translateY(-1px);
}

.main-nav ul li a:hover {
    background: var(--primary-soft);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.main-nav ul li.active > a {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-tint));
    color: #fff;
    box-shadow: 0 14px 24px rgba(31, 98, 124, 0.22);
}

.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    margin-left: 8px;
    padding: 0 7px;
    border-radius: 999px;
    background: #e5484d;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.main-nav .dropdown .dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 230px;
    padding: 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 20px 40px rgba(16, 40, 52, 0.14);
    border: 1px solid rgba(31, 98, 124, 0.12);
    backdrop-filter: blur(18px);
    z-index: 120;
}

@media (min-width: 721px) {
    .main-nav .dropdown:hover .dropdown-content,
    .main-nav .dropdown:focus-within .dropdown-content,
    .main-nav .dropdown.dropdown-open-desktop .dropdown-content {
        display: block;
    }

    .main-nav .dropdown {
        z-index: 20;
    }

    .main-nav .dropdown:hover,
    .main-nav .dropdown:focus-within,
    .main-nav .dropdown.dropdown-open-desktop {
        z-index: 140;
    }
}

.main-nav .dropdown-content a {
    width: 100%;
    justify-content: flex-start;
    min-height: 42px;
    border-radius: 14px;
    padding: 10px 14px;
}

.main-nav .dropdown-content a:hover {
    background: var(--primary-soft);
}

.motivation-banner {
    margin-top: 14px;
    padding: 14px 18px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(231, 243, 248, 0.96));
    color: var(--primary-dark);
    border: 1px solid rgba(31, 98, 124, 0.08);
    box-shadow: var(--shadow-soft);
    font-weight: 700;
    animation: softReveal 0.5s ease;
    position: relative;
    z-index: 10;
}

.content-wrapper {
    margin-top: 16px;
    margin-bottom: 24px;
    padding: clamp(18px, 3vw, 30px);
    border-radius: 32px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
    animation: shellFloatIn 0.75s ease;
    overflow-x: hidden;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.content-wrapper > h1:first-child {
    margin-bottom: 10px;
    font-size: clamp(1.7rem, 2.4vw, 2.5rem);
}

.content-wrapper > p:first-of-type {
    margin-top: -2px;
}

.container {
    display: grid;
    gap: 18px;
}

form {
    margin-bottom: 20px;
}

form label {
    display: block;
    margin-bottom: 8px;
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 0.95rem;
}

form input[type="text"],
form input[type="email"],
form input[type="tel"],
form input[type="password"],
form input[type="date"],
form input[type="number"],
form input[type="month"],
form input[type="time"],
form select,
form textarea {
    width: 100%;
    min-height: 52px;
    padding: 13px 15px;
    margin-bottom: 15px;
    border: 1px solid rgba(31, 98, 124, 0.14);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-color);
    font-size: 0.98rem;
    font-family: inherit;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

form textarea {
    min-height: 120px;
    resize: vertical;
}

form input:focus,
form select:focus,
form textarea:focus {
    outline: none;
    border-color: rgba(31, 98, 124, 0.5);
    box-shadow: 0 0 0 4px rgba(31, 98, 124, 0.12);
    background: #fff;
}

form button[type="submit"],
.button,
a.button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 18px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-tint));
    color: #fff;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 0.96rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 16px 26px rgba(31, 98, 124, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

form button[type="submit"]:hover,
.button:hover,
a.button:hover,
.btn:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 20px 32px rgba(31, 98, 124, 0.22);
    filter: saturate(1.05);
}

.button-secondary,
.btn.button-secondary {
    background: linear-gradient(135deg, #e8eff2, #dce8ed);
    color: var(--primary-dark);
    box-shadow: none;
}

.button-secondary:hover,
.btn.button-secondary:hover {
    color: var(--primary-dark);
    box-shadow: var(--shadow-soft);
}

.button-accent {
    background: linear-gradient(135deg, var(--accent-color), #ffd84e);
    color: var(--primary-dark);
    box-shadow: 0 18px 30px rgba(255, 203, 5, 0.22);
}

.button-accent:hover {
    color: var(--primary-dark);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
    border-radius: 20px;
    overflow: hidden;
    background: var(--surface-solid);
    box-shadow: 0 12px 26px rgba(16, 40, 52, 0.06);
    border: 1px solid rgba(31, 98, 124, 0.1);
}

table thead {
    background: linear-gradient(135deg, rgba(31, 98, 124, 0.12), rgba(255, 203, 5, 0.12));
}

table th,
table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(31, 98, 124, 0.08);
    vertical-align: middle;
}

table th {
    color: var(--primary-dark);
    font-size: 0.92rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

table tbody tr:nth-child(even) {
    background: rgba(246, 250, 252, 0.82);
}

table tbody tr:hover {
    background: rgba(231, 243, 248, 0.72);
}

table td.actions a {
    margin-right: 8px;
}

table td.currency {
    text-align: right;
    font-family: monospace;
}

.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin: 24px 0 30px;
}

.widget {
    position: relative;
    overflow: hidden;
    padding: 22px;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 253, 0.94));
    border: 1px solid rgba(31, 98, 124, 0.1);
    box-shadow: var(--shadow-soft);
}

.widget::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--primary-color), var(--accent-color));
}

.widget.accent-border::before {
    background: linear-gradient(180deg, var(--accent-color), #ffde71);
}

.widget h3 {
    margin-bottom: 10px;
    color: var(--primary-dark);
    font-size: 1.04rem;
}

.widget .value {
    font-size: 2.15rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.widget .description {
    font-size: 0.94rem;
    color: var(--muted-text);
}

.widget a.view-more {
    display: inline-flex;
    align-items: center;
    margin-top: 14px;
    color: var(--primary-color);
    font-weight: 800;
}

.message {
    padding: 16px 18px;
    margin-bottom: 20px;
    border-radius: 18px;
    border: 1px solid transparent;
    font-weight: 700;
    box-shadow: var(--shadow-soft);
}

.message-success {
    color: #0f603a;
    background: #e6f8ef;
    border-color: #b9ebce;
}

.message-error {
    color: #842f2f;
    background: #fdeeed;
    border-color: #f6cbc6;
}

.message-info {
    color: #164f63;
    background: #e8f6fb;
    border-color: #bfe4ef;
}

.message-warning {
    color: #8a5c0d;
    background: #fff5d9;
    border-color: #ffe3a2;
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-bold { font-weight: bold; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.app-shell {
    display: grid;
    gap: 20px;
}

.app-shell-narrow {
    max-width: 940px;
    margin: 0 auto;
}

.page-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
    border-radius: 30px;
    background:
        radial-gradient(circle at top right, rgba(255, 203, 5, 0.22), transparent 28%),
        linear-gradient(135deg, rgba(18, 56, 72, 0.98), rgba(31, 98, 124, 0.94), rgba(46, 128, 152, 0.9));
    color: #fff;
    box-shadow: var(--shadow-strong);
}

.page-hero h1 {
    margin: 8px 0 10px;
    font-size: clamp(1.85rem, 3vw, 2.8rem);
    color: #fff;
}

.page-hero p {
    margin: 0;
    max-width: 700px;
    color: rgba(255, 255, 255, 0.82);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-badge,
.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hero-badge {
    min-width: 190px;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-badge strong,
.hero-badge span {
    display: block;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.metric-grid-tight {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.metric-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(31, 98, 124, 0.1);
    box-shadow: var(--shadow-soft);
}

a.metric-card {
    color: inherit;
    text-decoration: none;
}

a.metric-card:hover {
    transform: translateY(-1px);
    border-color: rgba(31, 98, 124, 0.22);
}

.metric-card-success { border-color: rgba(23, 143, 89, 0.18); }
.metric-card-warning { border-color: rgba(216, 135, 16, 0.18); }
.metric-card-danger { border-color: rgba(195, 69, 69, 0.18); }

.metric-label {
    color: var(--muted-text);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.metric-value {
    color: var(--primary-dark);
    font-size: 1.8rem;
    font-weight: 800;
}

.metric-help {
    color: var(--muted-text);
    font-size: 0.92rem;
}

.scanner-layout,
.report-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.phone-card,
.report-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(31, 98, 124, 0.1);
    border-radius: 26px;
    padding: 22px;
    box-shadow: var(--shadow-soft);
}

.card-head {
    margin-bottom: 16px;
}

.card-head h2,
.report-card h2 {
    margin-bottom: 6px;
}

.card-head p,
.report-card p {
    margin: 0;
}

.scan-frame {
    position: relative;
    min-height: 290px;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 26px;
    background: linear-gradient(135deg, #102d39, #164454);
}

#qr-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.scan-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.scan-corners {
    width: 62%;
    aspect-ratio: 1;
    border-radius: 30px;
    border: 3px solid rgba(255, 203, 5, 0.92);
    box-shadow: 0 0 0 999px rgba(7, 22, 30, 0.32);
}

.stack-actions {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.scan-helper,
.input-help {
    color: var(--muted-text);
    font-size: 0.94rem;
}

.mobile-form-grid {
    display: grid;
    gap: 12px;
}

.mobile-form-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mobile-form-span {
    grid-column: 1 / -1;
}

.scan-note,
.salary-box {
    margin-top: 16px;
    padding: 15px 16px;
    background: linear-gradient(180deg, #f8fbfd, #f2f7fa);
    border-radius: 18px;
    border: 1px solid rgba(31, 98, 124, 0.08);
}

.qr-preview {
    display: grid;
    place-items: center;
    padding: 20px;
    background: #f7fbfd;
    border-radius: 22px;
    border: 1px dashed rgba(31, 98, 124, 0.24);
}

.qr-preview img {
    width: min(100%, 280px);
    height: auto;
}

.inline-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.inline-filter-bar label {
    margin-bottom: 0;
}

.inline-filter-bar input,
.inline-filter-bar select {
    min-width: 160px;
    margin-bottom: 0;
}

.daily-list,
.profile-list {
    display: grid;
    gap: 14px;
}

.daily-item,
.profile-card {
    border: 1px solid rgba(31, 98, 124, 0.1);
    border-radius: 22px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.96);
}

.daily-item-main,
.report-card-head,
.profile-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.daily-item h3,
.profile-card h3 {
    margin-bottom: 4px;
}

.daily-item p,
.profile-card p {
    margin: 0;
}

.daily-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0;
    color: var(--muted-text);
    font-size: 0.92rem;
}

.manual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr auto;
    gap: 10px;
}

.profile-switches {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.profile-switches label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 800;
}

.status-pill-present,
.day-chip-present {
    background: #e5f7ed;
    color: #1c6a3d;
}

.status-pill-late,
.day-chip-late {
    background: #fff1dc;
    color: #975c02;
}

.status-pill-absent,
.day-chip-absent {
    background: #fdeaea;
    color: #9b2f2f;
}

.status-pill-on-leave,
.day-chip-on-leave {
    background: #e7f0fb;
    color: #245c93;
}

.salary-box {
    display: grid;
    gap: 10px;
}

.salary-box div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.daily-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.day-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 800;
}

.page-stack {
    display: grid;
    gap: 18px;
}

.page-panel {
    padding: 22px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(31, 98, 124, 0.1);
    box-shadow: var(--shadow-soft);
    animation: softReveal 0.5s ease both;
    min-width: 0;
}

.page-panel > :last-child {
    margin-bottom: 0;
}

.page-intro {
    display: grid;
    gap: 8px;
}

.page-intro h1,
.page-intro h2 {
    margin-bottom: 0;
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-card {
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, #fbfdfe, #f4f9fb);
    border: 1px solid rgba(31, 98, 124, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.filter-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(16, 40, 52, 0.08);
    border-color: rgba(31, 98, 124, 0.18);
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    align-items: end;
}

.grid-auto-wide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    align-items: start;
}

.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.stat-pill {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    min-width: 120px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(31, 98, 124, 0.1);
}

.stat-pill strong {
    font-size: 1.4rem;
    color: var(--primary-dark);
}

.stat-pill span {
    font-size: 0.82rem;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 800;
}

.table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(31, 98, 124, 0.35) rgba(31, 98, 124, 0.08);
}

.table-wrap::-webkit-scrollbar {
    height: 10px;
}

.table-wrap::-webkit-scrollbar-track {
    background: rgba(31, 98, 124, 0.08);
    border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb {
    background: rgba(31, 98, 124, 0.35);
    border-radius: 999px;
}

.table-scroll-shell {
    width: 100%;
    min-width: 0;
}

.table-scroll-top {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100%;
    margin-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(31, 98, 124, 0.35) rgba(31, 98, 124, 0.08);
}

.table-scroll-top::-webkit-scrollbar {
    height: 10px;
}

.table-scroll-top::-webkit-scrollbar-track {
    background: rgba(31, 98, 124, 0.08);
    border-radius: 999px;
}

.table-scroll-top::-webkit-scrollbar-thumb {
    background: rgba(31, 98, 124, 0.35);
    border-radius: 999px;
}

.table-scroll-top-inner {
    height: 1px;
}

.table-scroll-floating {
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: min(calc(100vw - 32px), var(--content-width));
    max-width: 100%;
    padding: 8px 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(31, 98, 124, 0.12);
    box-shadow: 0 18px 34px rgba(16, 40, 52, 0.14);
    backdrop-filter: blur(14px);
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 45;
    display: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(31, 98, 124, 0.35) rgba(31, 98, 124, 0.08);
}

.table-scroll-floating::-webkit-scrollbar {
    height: 10px;
}

.table-scroll-floating::-webkit-scrollbar-track {
    background: rgba(31, 98, 124, 0.08);
    border-radius: 999px;
}

.table-scroll-floating::-webkit-scrollbar-thumb {
    background: rgba(31, 98, 124, 0.35);
    border-radius: 999px;
}

.table-scroll-floating-inner {
    height: 1px;
}

.table-fab-controls {
    position: fixed;
    right: 18px;
    bottom: 68px;
    display: none;
    gap: 10px;
    z-index: 46;
}

.table-fab-button {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-tint));
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 18px 34px rgba(16, 40, 52, 0.18);
}

.table-fab-button:hover {
    filter: brightness(1.05);
}

.table-wrap > table {
    margin-bottom: 0;
    min-width: max(100%, 760px);
}

.subtle-note {
    margin: 0;
    font-size: 0.92rem;
    color: var(--muted-text);
}

.weekly-plan-alert {
    display: grid;
    gap: 10px;
}

.weekly-plan-alert-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.weekly-plan-alert-head span {
    font-size: 0.88rem;
    font-weight: 700;
    color: #8a5c0d;
}

.weekly-plan-alert-body {
    line-height: 1.8;
}

.weekly-version-cards {
    display: none;
    gap: 14px;
}

.weekly-version-card {
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, #fbfdfe, #f4f9fb);
    border: 1px solid rgba(31, 98, 124, 0.1);
}

.weekly-version-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.weekly-version-head strong {
    color: var(--primary-dark);
}

.weekly-version-head span {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: capitalize;
}

.weekly-version-meta {
    display: grid;
    gap: 12px;
    margin: 0;
}

.weekly-version-meta div {
    display: grid;
    gap: 4px;
}

.weekly-version-meta dt {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted-text);
}

.weekly-version-meta dd {
    margin: 0;
    color: var(--primary-dark);
    font-weight: 700;
}

.weekly-feedback-list {
    gap: 14px;
}

.weekly-feedback-card {
    display: grid;
    gap: 14px;
}

.weekly-feedback-card.is-reviewer-comment {
    border-color: rgba(216, 135, 16, 0.24);
    background: linear-gradient(180deg, #fffaf0, #fffdf7);
}

.weekly-feedback-card.is-teacher-comment {
    border-color: rgba(31, 98, 124, 0.16);
}

.weekly-feedback-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.weekly-feedback-time {
    font-size: 0.85rem;
    color: var(--muted-text);
    white-space: nowrap;
}

.weekly-feedback-body {
    color: var(--text-color);
    line-height: 1.8;
}

.weekly-day-card {
    border-radius: 22px;
}

.weekly-day-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    list-style: none;
    padding: 4px 0;
}

.weekly-day-summary::-webkit-details-marker {
    display: none;
}

.weekly-day-summary-copy {
    display: grid;
    gap: 4px;
}

.weekly-day-chevron {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border-right: 3px solid var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.weekly-day-card[open] .weekly-day-chevron {
    transform: rotate(-135deg);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap;
    background: rgba(31, 98, 124, 0.1);
    color: var(--primary-dark);
}

.status-approved,
.status-aqc-approved,
.status-on-leave {
    background: rgba(29, 107, 58, 0.12);
    color: #1d6b3a;
}

.status-pending,
.status-late {
    background: rgba(255, 203, 5, 0.28);
    color: #8a6500;
}

.status-rejected,
.status-absent,
.status-cancelled {
    background: rgba(161, 36, 36, 0.12);
    color: #a12424;
}

.inline-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.button-link {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.92rem;
    line-height: 1.2;
    font-weight: 800;
    cursor: pointer;
    box-shadow: none;
    min-height: auto;
}

.danger-link {
    color: var(--danger-color);
}

.danger-link:hover {
    color: #9f2f2f;
}

.icon-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 16px;
}

.icon-actions a:hover {
    background: rgba(255, 203, 5, 0.3);
    color: var(--primary-dark);
}

@media (min-width: 1024px) {
    .table-wrap > table {
        min-width: max(100%, 680px);
    }

    table th,
    table td {
        padding: 11px 12px;
        font-size: 0.93rem;
    }

    table th {
        font-size: 0.84rem;
        letter-spacing: 0.03em;
    }

    table td.actions a,
    .icon-actions a {
        margin-right: 6px;
    }

    .icon-actions a {
        width: 30px;
        height: 30px;
        border-radius: 10px;
        font-size: 14px;
    }

    .button,
    a.button,
    .btn {
        white-space: nowrap;
    }
}

.main-footer {
    margin-bottom: 24px;
    padding: 20px 24px;
    border-radius: 26px;
    background: rgba(18, 56, 72, 0.94);
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    box-shadow: var(--shadow-strong);
}

@keyframes shellFloatIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes softReveal {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.main-footer p {
    margin: 6px 0;
    color: inherit;
}

.main-footer a {
    color: var(--accent-color);
}

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    min-height: 52px;
    border-radius: 16px;
    border: 1px solid rgba(31, 98, 124, 0.14);
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.92);
}

.select2-results__option[aria-selected] {
    padding-left: 30px;
    position: relative;
}

.select2-results__option[aria-selected]::before {
    content: "";
    display: inline-block;
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 1px solid #aaa;
    background-color: #fff;
    border-radius: 3px;
}

.select2-results__option[aria-selected="true"]::before {
    content: "✓";
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    text-align: center;
    line-height: 16px;
    font-size: 12px;
}

.select2-selection__choice.select2-selection__choice_checkbox {
    background-color: var(--primary-soft);
    border-color: var(--primary-color);
    color: var(--primary-color);
    padding: 2px 8px;
}

.pdf-primary-color { color: var(--primary-color); }
.pdf-accent-color { color: var(--accent-color); }
.pdf-primary-bg { background-color: var(--primary-color); }
.pdf-accent-bg { background-color: var(--accent-color); }

@media (max-width: 1180px) {
    .mobile-form-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .main-header,
    .main-nav,
    .content-wrapper,
    .main-footer,
    .motivation-banner,
    .nav-toggle {
        width: min(calc(100% - 18px), var(--content-width));
    }

    .main-header {
        top: 10px;
        padding: 16px 18px;
    }

    .header-info {
        justify-content: flex-start;
    }

    .page-hero,
    .scanner-layout,
    .report-grid,
    .daily-item-main,
    .report-card-head,
    .profile-card-head,
    .manual-grid,
    .mobile-form-grid-3 {
        grid-template-columns: 1fr;
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .table-scroll-floating {
        display: none !important;
    }

    .table-fab-controls {
        display: none !important;
    }

    .nav-toggle {
        display: block;
        position: static;
    }

    .main-nav {
        padding: 12px;
        position: relative;
        top: auto;
        border-radius: 22px;
    }

    .main-nav ul {
        display: none;
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        gap: 8px;
        max-height: min(68vh, 520px);
        overflow-y: auto;
        padding-right: 2px;
    }

    .main-nav ul.nav-open {
        display: flex;
    }

    .main-nav ul li,
    .main-nav ul li a {
        width: 100%;
    }

    .main-nav ul li a {
        justify-content: flex-start;
    }

    .main-nav ul li {
        position: static;
    }

    .main-nav .dropdown .dropdown-content {
        position: static;
        display: none;
        margin-top: 6px;
        min-width: 100%;
        box-shadow: none;
        padding: 8px 0 0;
        border: 0;
        background: transparent;
        max-height: none;
        overflow: visible;
    }

    .main-nav .dropdown.dropdown-open .dropdown-content {
        display: block;
    }

    .main-nav .dropdown:focus-within .dropdown-content,
    .main-nav .dropdown:hover .dropdown-content {
        display: none;
    }

    .main-nav .dropdown.dropdown-open:focus-within .dropdown-content,
    .main-nav .dropdown.dropdown-open:hover .dropdown-content {
        display: block;
    }

    .main-nav .dropdown-content a {
        background: rgba(31, 98, 124, 0.06);
        margin-top: 6px;
        padding-left: 18px;
    }

    .main-nav .dropdown > .dropbtn {
        justify-content: space-between;
    }

    .main-nav ul li a {
        min-height: 50px;
        border-radius: 18px;
    }

    .content-wrapper {
        padding: 18px;
        border-radius: 26px;
    }

    .dashboard-widgets,
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .table-wrap {
        margin-inline: -4px;
        padding-inline: 4px;
    }

    .table-wrap > table {
        min-width: 720px;
        white-space: nowrap;
    }

    form button[type="submit"],
    .button,
    a.button,
    .btn {
        width: 100%;
    }

    .header-actions,
    .info-chip {
        width: 100%;
    }

    .header-actions a {
        flex: 1 1 auto;
    }

    .page-panel,
    .filter-card {
        border-radius: 20px;
    }

    .weekly-version-cards {
        display: grid;
    }

    .weekly-version-table {
        display: none;
    }

    .weekly-feedback-head,
    .weekly-plan-alert-head {
        display: grid;
        grid-template-columns: 1fr;
    }

    .weekly-feedback-time {
        white-space: normal;
    }
}

@media (max-width: 480px) {
    .main-header {
        position: static;
        top: auto;
    }

    .main-header {
        border-radius: 24px;
    }

    .header-logo {
        width: 52px;
        height: 52px;
    }

    .school-name {
        font-size: 1rem;
    }

    .content-wrapper {
        padding: 16px;
    }

    .main-header,
    .main-nav,
    .content-wrapper,
    .main-footer,
    .motivation-banner,
    .nav-toggle {
        width: min(calc(100% - 12px), var(--content-width));
    }

    .main-header {
        padding: 14px;
    }

    .main-nav {
        padding: 10px;
    }

    .nav-toggle,
    .main-nav {
        position: relative;
        top: auto;
    }

    .page-intro h1 {
        font-size: 1.6rem;
    }

    .widget,
    .phone-card,
    .report-card,
    .metric-card {
        border-radius: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* Community experience */
.community-shell {
    container-type: inline-size;
}

.community-composer {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.98), rgba(239,248,251,0.96));
}

.community-post-card,
.community-thread-card,
.community-message-window,
.community-profile-preview,
.community-profile-form {
    border: 1px solid rgba(31, 98, 124, 0.12);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 42px rgba(16, 47, 61, 0.08);
}

.community-post-card {
    margin-bottom: 16px;
    padding: clamp(16px, 2.6vw, 24px);
}

.community-post-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.community-post-main {
    min-width: 0;
    flex: 1;
}

.community-avatar,
.community-profile-photo {
    object-fit: cover;
    background: #eaf3f7;
    border: 2px solid #fff;
    box-shadow: 0 10px 22px rgba(16, 47, 61, 0.12);
}

.community-avatar {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    flex: 0 0 auto;
}

.community-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.community-attachment,
.community-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(31, 98, 124, 0.08);
    color: var(--primary-dark);
    border: 1px solid rgba(31, 98, 124, 0.12);
    font-weight: 800;
    font-size: 0.86rem;
    text-decoration: none;
}

.community-attachment::before {
    content: "Attachment";
    margin-right: 8px;
    color: var(--primary-color);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.community-translations {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.community-translations details {
    padding: 10px 12px;
    border-radius: 14px;
    background: #f6fafc;
    border: 1px solid rgba(31, 98, 124, 0.1);
}

.community-translations summary {
    cursor: pointer;
    font-weight: 800;
    color: var(--primary-color);
}

.community-inbox-grid {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 18px;
}

.community-thread-card {
    display: block;
    margin-bottom: 10px;
    padding: 14px;
    text-decoration: none;
    color: inherit;
    box-shadow: none;
}

.community-thread-card.is-active {
    border-color: var(--primary-color);
    background: #f4fbfd;
}

.community-message-window {
    max-height: 540px;
    overflow: auto;
    padding: 14px;
    background: linear-gradient(180deg, #f8fbfc, #fff);
}

.community-message-row {
    display: flex;
    margin: 10px 0;
}

.community-message-row.is-staff {
    justify-content: flex-end;
}

.community-message-row.is-parent {
    justify-content: flex-start;
}

.community-message-bubble {
    max-width: min(78%, 620px);
    padding: 12px 14px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #c7d8df;
    box-shadow: 0 8px 18px rgba(16, 47, 61, 0.06);
}

.community-message-row.is-staff .community-message-bubble {
    background: #eaf3f7;
}

.community-profile-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.community-profile-preview,
.community-profile-form {
    padding: clamp(16px, 2.4vw, 24px);
}

.community-profile-photo {
    width: 132px;
    height: 132px;
    border-radius: 32px;
    margin-bottom: 14px;
}

.community-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.community-reaction-summary,
.community-reaction-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    margin-top: 14px;
}

.community-reaction-form {
    padding-top: 14px;
    border-top: 1px solid rgba(31, 98, 124, 0.1);
}

.community-reaction-form label {
    width: 100%;
    margin-bottom: -6px;
}

.community-reaction-form select {
    min-width: 170px;
}

.community-reaction-form input[type="text"] {
    flex: 1 1 220px;
}

.community-comments {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(31, 98, 124, 0.1);
}

.community-comments h3 {
    margin: 0;
    font-size: 1rem;
}

.community-comment {
    padding: 10px 12px;
    border-radius: 14px;
    background: #f7fbfc;
    border: 1px solid rgba(31, 98, 124, 0.09);
}

.community-comment p {
    margin: 5px 0 0;
}

.community-comment-form {
    display: grid;
    gap: 10px;
}

.community-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.community-gallery-card {
    overflow: hidden;
}

.community-gallery-cover {
    min-height: 190px;
    border-radius: 18px;
    background-size: cover;
    background-position: center;
    background-color: #eaf3f7;
    border: 1px solid rgba(31, 98, 124, 0.1);
    margin-bottom: 14px;
}

.community-gallery-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.community-gallery-items a {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(31, 98, 124, 0.12);
    background: #f6fafc;
}

.community-gallery-items img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 980px) {
    .community-inbox-grid,
    .community-profile-layout {
        grid-template-columns: 1fr;
    }

    .community-message-window {
        max-height: none;
    }
}

@media (max-width: 640px) {
    .community-post-head {
        display: grid;
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .community-avatar {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .community-message-bubble {
        max-width: 92%;
    }

    .community-gallery-grid {
        grid-template-columns: 1fr;
    }

    .community-attachment,
    .community-chip,
    .community-reaction-form select,
    .community-reaction-form input[type="text"] {
        width: 100%;
        justify-content: center;
    }
}
