:root {
    --bg-base: #e7d8b5;
    --bg-tint: #f7f1e2;
    --ink-strong: #1f2f2c;
    --ink-soft: #53645f;
    --accent-deep: #1f4b43;
    --accent-mid: #8f653c;
    --accent-wine: #7b3f50;
    --line-soft: rgba(31, 47, 44, 0.12);
    --line-strong: rgba(31, 47, 44, 0.24);
    --white-soft: rgba(255, 255, 255, 0.78);
    --shadow-lg: 0 22px 60px rgba(41, 28, 14, 0.22);
    --shadow-md: 0 14px 34px rgba(41, 28, 14, 0.16);
    --shadow-sm: 0 10px 18px rgba(41, 28, 14, 0.1);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink-strong);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 30%),
        radial-gradient(circle at bottom right, rgba(120, 84, 47, 0.16), transparent 28%),
        linear-gradient(135deg, #efe1bd 0%, #d8c29b 100%);
}

h1,
h2,
h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0.02em;
}

p {
    margin: 0;
    color: var(--ink-soft);
}

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

.login-body,
.dashboard-body {
    min-height: 100vh;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
}

.login-brand-panel,
.login-form-panel {
    padding: 48px;
}

.login-brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    color: #f6f1e7;
    background:
        linear-gradient(180deg, rgba(20, 45, 41, 0.35), rgba(20, 45, 41, 0.82)),
        linear-gradient(135deg, #416a60 0%, #163833 100%);
    position: relative;
    overflow: hidden;
}

.login-brand-panel::before,
.login-brand-panel::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.login-brand-panel::before {
    width: 280px;
    height: 280px;
    right: -80px;
    top: 10%;
}

.login-brand-panel::after {
    width: 420px;
    height: 420px;
    left: -160px;
    bottom: -120px;
}

.login-brand-top,
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.78);
}

.login-brand-panel h1 {
    font-size: clamp(2.8rem, 4vw, 4.6rem);
    line-height: 0.95;
}

.login-brand-panel p {
    max-width: 520px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.05rem;
    line-height: 1.7;
}

.login-brand-badge {
    display: inline-flex;
    width: fit-content;
    padding: 14px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
}

.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card,
.panel,
.sidebar {
    border: 1px solid var(--line-soft);
    box-shadow: var(--shadow-lg);
}

.login-card {
    width: min(100%, 460px);
    padding: 38px;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(250, 246, 239, 0.96)),
        linear-gradient(135deg, rgba(124, 76, 47, 0.08), rgba(23, 56, 51, 0.08));
}

.login-card h2 {
    margin-top: 10px;
    font-size: 2rem;
}

.muted {
    margin-top: 10px;
    line-height: 1.6;
}

.alert-error,
.flash-message {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.alert-error,
.flash-message.error {
    background: rgba(123, 63, 80, 0.12);
    color: #6d2236;
    border: 1px solid rgba(123, 63, 80, 0.25);
}

.flash-message.success {
    background: rgba(31, 75, 67, 0.12);
    color: #17453e;
    border: 1px solid rgba(31, 75, 67, 0.24);
}

.hidden {
    display: none;
}

.login-form {
    margin-top: 24px;
}

label,
.checkbox-cluster,
.upload-label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.94rem;
    color: var(--ink-strong);
}

.field-hint {
    font-size: 0.82rem;
    color: #6a7973;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid rgba(31, 47, 44, 0.18);
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink-strong);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(31, 75, 67, 0.5);
    box-shadow: 0 0 0 4px rgba(31, 75, 67, 0.08);
}

.field-error {
    border-color: rgba(123, 63, 80, 0.5) !important;
    box-shadow: 0 0 0 4px rgba(123, 63, 80, 0.08) !important;
}

textarea {
    resize: vertical;
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 13px 22px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover,
.mini-btn:hover,
.nav-link:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #f7f4ee;
    background: linear-gradient(135deg, #1f4b43, #2a6b60);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    color: #f7f4ee;
    background: linear-gradient(135deg, #7b3f50, #9d596b);
    box-shadow: var(--shadow-sm);
}

.btn-ghost {
    color: var(--ink-strong);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--line-soft);
}

.btn-block {
    width: 100%;
    margin-top: 10px;
}

.dashboard-shell {
    display: grid;
    grid-template-columns: 290px 1fr;
    align-items: start;
    gap: 24px;
    min-height: 100vh;
    padding: 20px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-self: start;
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 24px 20px;
    border-radius: 30px;
    color: #f6f1e7;
    background:
        linear-gradient(180deg, rgba(31, 75, 67, 0.98), rgba(18, 46, 40, 0.98)),
        linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent);
}

.brand-mark {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    letter-spacing: 0.05em;
}

.brand-subtitle {
    margin-top: 8px;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
}

.nav-link {
    display: block;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.06);
    color: #f6f1e7;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(143, 101, 60, 0.28));
    border-color: rgba(255, 255, 255, 0.18);
}

.sidebar-note {
    margin-top: 24px;
    padding: 16px;
    border-radius: 18px;
    line-height: 1.7;
    font-size: 0.92rem;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
}

.sidebar-logo-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-note-title {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-note-copy {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.88rem;
    line-height: 1.5;
}

.sidebar-logo-preview {
    width: 100%;
    min-height: 120px;
    border-radius: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-logo-preview img {
    display: block;
    width: 100%;
    max-height: 130px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.92);
}

.sidebar-logo-placeholder {
    color: rgba(255, 255, 255, 0.56);
    font-size: 0.88rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-logo-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-logo-actions {
    display: flex;
    gap: 10px;
}

.sidebar-logo-panel .flash-message {
    margin-top: 0;
}

.powered-by-link {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.powered-by-link:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-powered-by {
    margin-top: 16px;
    align-self: flex-start;
}

.main-content {
    min-width: 0;
    padding: 14px 0 24px;
}

.content-stack {
    display: block;
}

.panel.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    padding: 18px 20px;
    background:
        linear-gradient(135deg, rgba(31, 75, 67, 0.92), rgba(73, 119, 104, 0.82)),
        linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent);
    color: #f8f2e7;
}

.panel.dashboard-hero h2 {
    margin-top: 6px;
    font-size: clamp(1.55rem, 2.2vw, 2.2rem);
    line-height: 1.08;
    color: #fff8ef;
}

.panel.dashboard-hero p,
.panel.dashboard-hero .dashboard-eyebrow {
    color: rgba(248, 242, 231, 0.84);
}

.dashboard-hero-copy {
    max-width: 860px;
}

.dashboard-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.dashboard-hero-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 248, 239, 0.14);
    border: 1px solid rgba(255, 248, 239, 0.16);
    font-size: 0.82rem;
    color: #fff8ef;
}

.dashboard-hero-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.panel.dashboard-hero .btn-ghost {
    background: rgba(255, 248, 239, 0.92);
    color: #1f2f2c;
    border-color: rgba(255, 255, 255, 0.22);
}

.panel.dashboard-hero .btn-secondary {
    background: linear-gradient(135deg, #8a4d5e, #a56375);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.kpi-card {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, rgba(31, 75, 67, 0.92), rgba(143, 101, 60, 0.55));
}

.kpi-label {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #667772;
}

.kpi-value {
    margin: 2px 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.3rem, 1.8vw, 1.9rem);
    line-height: 1;
    color: var(--accent-deep);
}

.kpi-card p {
    font-size: 0.8rem;
    line-height: 1.3;
}

.dashboard-full-panel {
    margin-bottom: 18px;
}

.dashboard-secondary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.batch-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.batch-overview-card {
    padding: 15px;
    border-radius: 18px;
    border: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.52);
}

.batch-overview-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.batch-overview-top h3 {
    font-size: 1.05rem;
}

.batch-overview-top p {
    margin-top: 2px;
    font-size: 0.9rem;
}

.batch-overview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 12px;
}

.batch-meta-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid var(--line-soft);
    font-size: 0.78rem;
    color: #54655f;
}

.batch-overview-count {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.batch-overview-count strong {
    font-size: 1.45rem;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--accent-deep);
}

.batch-overview-count span {
    font-size: 0.9rem;
    color: #5f706a;
}

.occupancy-track {
    margin-top: 10px;
    height: 8px;
    border-radius: 999px;
    background: rgba(31, 47, 44, 0.1);
    overflow: hidden;
}

.occupancy-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, #1f4b43, #8f653c);
}

.occupancy-caption {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #60716c;
}

.batch-overview-actions {
    margin-top: 10px;
}

.assignment-snapshot,
.summary-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.snapshot-row,
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.5);
}

.summary-row strong,
.snapshot-row strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    color: var(--accent-deep);
}

.dashboard-empty {
    padding: 16px;
    border-radius: 16px;
    border: 1px dashed var(--line-strong);
    color: #65756f;
    text-align: center;
    background: rgba(255, 255, 255, 0.4);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.page-header h1 {
    margin-top: 8px;
    font-size: clamp(2.1rem, 3vw, 3rem);
}

.page-header p {
    margin-top: 8px;
    line-height: 1.7;
    max-width: 760px;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(420px, 0.9fr) minmax(580px, 1.3fr);
    gap: 22px;
    align-items: start;
}

.panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 241, 229, 0.95)),
        linear-gradient(145deg, rgba(143, 101, 60, 0.08), rgba(31, 75, 67, 0.04));
    border-radius: 28px;
    padding: 22px;
}

.header-actions,
.toolbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.assignment-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.attendance-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}

.assignment-toolbar-compact {
    align-items: end;
}

.compact-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
}

.compact-field span {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #66756f;
}

.compact-field-grow {
    flex: 1;
}

.assignment-select {
    min-width: 260px;
}

.assignment-search {
    min-width: 280px;
}

.assignment-summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    margin: 14px 0 18px;
}

.batch-students-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 8px 0 18px;
}

.attendance-summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 18px;
}

.summary-pill {
    min-width: 140px;
    padding: 10px 14px;
    border-radius: 16px;
    border: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.64);
}

.summary-label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6c7b75;
    margin-bottom: 4px;
}

.assignment-quick-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
    align-items: center;
}

.attendance-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-left: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-header p {
    margin-top: 6px;
}

.search-input {
    max-width: 280px;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.6);
}

.assignment-panel {
    margin-top: 22px;
}

.batch-register-panel {
    width: 100%;
}

.assignment-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 18px;
}

.assignment-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.assignment-block-compact {
    padding: 14px;
    border-radius: 20px;
    border: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.42);
}

.sub-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.subtle-caption {
    font-size: 0.9rem;
    color: #6b7b75;
}

.assignment-table-wrap {
    max-height: 480px;
    overflow: auto;
}

.assignment-table th,
.assignment-table td {
    padding: 11px 12px;
}

.assignment-table .sub-text {
    margin-top: 2px;
}

.attendance-table td {
    vertical-align: middle;
    transition: background-color 0.18s ease;
}

.attendance-table tr.status-present td {
    background: rgba(47, 145, 95, 0.07);
}

.attendance-table tr.status-absent td {
    background: rgba(191, 79, 97, 0.08);
}

.attendance-table tr.status-leave td {
    background: rgba(211, 154, 50, 0.1);
}

.attendance-status-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.attendance-status-chip {
    position: relative;
    display: inline-flex;
}

.attendance-status-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.attendance-status-circle,
.attendance-remark-input {
    border: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.84);
    color: var(--ink-strong);
    font: inherit;
}

.attendance-status-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.attendance-status-chip.present .attendance-status-circle {
    color: #1b6949;
    background: rgba(31, 139, 85, 0.14);
    border-color: rgba(31, 139, 85, 0.24);
}

.attendance-status-chip.absent .attendance-status-circle {
    color: #8a2432;
    background: rgba(176, 52, 74, 0.14);
    border-color: rgba(176, 52, 74, 0.24);
}

.attendance-status-chip.leave .attendance-status-circle {
    color: #8a641f;
    background: rgba(207, 146, 40, 0.16);
    border-color: rgba(207, 146, 40, 0.28);
}

.attendance-status-input:checked + .attendance-status-circle {
    color: #fff;
    box-shadow: 0 10px 18px rgba(31, 47, 44, 0.16);
    transform: translateY(-1px);
}

.attendance-status-chip.present .attendance-status-input:checked + .attendance-status-circle {
    background: linear-gradient(135deg, #2f915f, #1f6d49);
    border-color: #1f6d49;
}

.attendance-status-chip.absent .attendance-status-input:checked + .attendance-status-circle {
    background: linear-gradient(135deg, #bf4f61, #8f3042);
    border-color: #8f3042;
}

.attendance-status-chip.leave .attendance-status-input:checked + .attendance-status-circle {
    background: linear-gradient(135deg, #d39a32, #9b6f18);
    border-color: #9b6f18;
}

.attendance-status-input:focus-visible + .attendance-status-circle {
    outline: 3px solid rgba(31, 75, 67, 0.18);
    outline-offset: 3px;
}

.attendance-remark-input {
    width: 100%;
    min-width: 200px;
    border-radius: 12px;
    padding: 10px 12px;
}

.attendance-report-table td {
    vertical-align: middle;
}

.report-count-chip {
    display: inline-flex;
    min-width: 36px;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.report-count-chip.present {
    color: #1b6949;
    background: rgba(31, 139, 85, 0.14);
    border-color: rgba(31, 139, 85, 0.22);
}

.report-count-chip.absent {
    color: #8a2432;
    background: rgba(176, 52, 74, 0.14);
    border-color: rgba(176, 52, 74, 0.22);
}

.report-count-chip.leave {
    color: #8a641f;
    background: rgba(207, 146, 40, 0.16);
    border-color: rgba(207, 146, 40, 0.24);
}

@media print {
    body.dashboard-body {
        background: #fff;
    }

    .sidebar,
    .page-header,
    .attendance-toolbar,
    .header-actions,
    .toolbar-actions,
    .flash-message {
        display: none !important;
    }

    .dashboard-shell,
    .main-content,
    .content-stack {
        display: block;
        padding: 0;
        margin: 0;
    }

    .panel {
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
        background: #fff;
    }

    .table-wrap {
        border: none;
        background: #fff;
        overflow: visible;
    }

    .records-table {
        min-width: 0;
    }

    .records-table th,
    .records-table td {
        padding: 10px 12px;
    }

    .attendance-summary-bar {
        margin: 0 0 16px;
    }
}

body.modal-open {
    overflow: hidden;
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 1;
    transition: opacity 0.22s ease;
}

.modal-shell.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(23, 34, 31, 0.56);
    backdrop-filter: blur(4px);
    opacity: 1;
    transition: opacity 0.22s ease;
}

.modal-card {
    position: relative;
    z-index: 1;
    width: min(100%, 900px);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 24px;
    border-radius: 28px;
    border: 1px solid var(--line-soft);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 241, 229, 0.97)),
        linear-gradient(145deg, rgba(143, 101, 60, 0.08), rgba(31, 75, 67, 0.04));
    box-shadow: var(--shadow-lg);
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: transform 0.24s ease, opacity 0.24s ease;
}

.modal-shell.is-closing {
    opacity: 0;
}

.modal-shell.is-closing .modal-backdrop {
    opacity: 0;
}

.modal-shell.is-closing .modal-card {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
}

.modal-large {
    width: min(100%, 980px);
}

.modal-xlarge {
    width: min(100%, 1320px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.modal-header p {
    margin-top: 6px;
}

.modal-close {
    border: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink-strong);
    padding: 10px 14px;
    border-radius: 999px;
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    .modal-shell,
    .modal-backdrop,
    .modal-card {
        transition: none;
    }
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 740px;
}

.records-table th,
.records-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(31, 47, 44, 0.08);
    vertical-align: top;
    text-align: left;
}

.records-table th {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #5a6b66;
    background: rgba(31, 75, 67, 0.05);
}

.table-empty {
    text-align: center;
    color: #61706b;
    padding: 28px 16px;
}

.sub-text {
    display: block;
    margin-top: 4px;
    color: #677874;
    font-size: 0.88rem;
}

.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mini-btn {
    padding: 8px 12px;
    border: 1px solid rgba(31, 47, 44, 0.16);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
}

.mini-btn.danger {
    color: #6d2236;
    border-color: rgba(123, 63, 80, 0.18);
    background: rgba(123, 63, 80, 0.08);
}

.status-badge,
.batch-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    line-height: 1;
    border: 1px solid rgba(31, 47, 44, 0.12);
    background: rgba(255, 255, 255, 0.68);
}

.batch-badge {
    margin: 2px 6px 2px 0;
    color: #24564c;
}

.status-badge.active {
    color: #1d5a50;
    background: rgba(31, 75, 67, 0.12);
}

.status-badge.inactive {
    color: #7b3f50;
    background: rgba(123, 63, 80, 0.12);
}

.status-badge.completed {
    color: #715223;
    background: rgba(143, 101, 60, 0.16);
}

.admission-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-section {
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--line-soft);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.34)),
        linear-gradient(145deg, rgba(143, 101, 60, 0.06), rgba(31, 75, 67, 0.03));
}

.section-title {
    margin-bottom: 16px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
    color: var(--accent-deep);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.section-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.section-head .section-title {
    margin-bottom: 0;
}

.section-note {
    font-size: 0.92rem;
    color: #66756f;
}

.form-grid {
    display: grid;
    gap: 16px;
}

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

.full-span {
    grid-column: 1 / -1;
}

.checkbox-cluster {
    justify-content: flex-start;
}

.checkbox-cluster.has-error,
.course-card.has-error,
.education-wrap.has-error {
    border-radius: 16px;
    box-shadow: 0 0 0 2px rgba(123, 63, 80, 0.14);
}

.checkbox-cluster label,
.course-card label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    color: var(--ink-soft);
}

.checkbox-cluster input,
.course-card input {
    width: auto;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.course-card {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(31, 75, 67, 0.06), rgba(255, 255, 255, 0.62));
}

.course-card h3 {
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 18px;
}

.photo-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.photo-preview-frame {
    position: relative;
    width: 100%;
    min-height: 250px;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    background:
        linear-gradient(135deg, rgba(31, 75, 67, 0.12), rgba(143, 101, 60, 0.18)),
        #f2e5cb;
}

.photo-preview-frame img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: none;
}

.photo-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.82rem;
    color: #6b756e;
}

.upload-label {
    padding: 14px;
    border-radius: 16px;
    border: 1px dashed rgba(31, 47, 44, 0.24);
    background: rgba(255, 255, 255, 0.48);
}

.education-wrap .records-table {
    min-width: 980px;
}

.education-table input {
    min-width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.92);
}

.education-action-cell {
    white-space: nowrap;
}

.remove-row-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-small {
    padding: 10px 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .assignment-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-secondary-grid,
    .batch-card-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 960px) {
    .login-shell,
    .dashboard-shell,
    .profile-grid,
    .course-grid,
    .two-columns {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        overflow: visible;
        min-height: auto;
    }

    .page-header {
        flex-direction: column;
    }

    .section-head,
    .header-actions,
    .toolbar-actions,
    .panel-header,
    .assignment-toolbar,
    .attendance-toolbar,
    .attendance-toolbar-actions,
    .sub-panel-header,
    .modal-header,
    .dashboard-hero,
    .dashboard-hero-actions,
    .batch-overview-top {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        max-width: none;
    }

    .assignment-select,
    .assignment-search {
        min-width: 0;
    }
}

@media (max-width: 640px) {
    .login-brand-panel,
    .login-form-panel,
    .dashboard-shell {
        padding: 18px;
    }

    .panel,
    .sidebar,
    .login-card {
        border-radius: 22px;
    }

    .panel {
        padding: 18px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .records-table {
        min-width: 640px;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn,
    .nav-link {
        width: 100%;
    }

    .modal-shell {
        padding: 12px;
    }

    .modal-card {
        padding: 18px;
        border-radius: 22px;
        max-height: calc(100vh - 24px);
    }

    .education-wrap {
        overflow: visible;
        border: none;
        background: transparent;
    }

    .education-table,
    .education-table thead,
    .education-table tbody,
    .education-table tr,
    .education-table th,
    .education-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .education-table thead {
        display: none;
    }

    .education-table tr {
        margin-bottom: 14px;
        padding: 14px;
        border-radius: 16px;
        border: 1px solid var(--line-soft);
        background: rgba(255, 255, 255, 0.68);
    }

    .education-table td {
        padding: 0;
        border-bottom: none;
        margin-bottom: 12px;
    }

    .education-table td:last-child {
        margin-bottom: 0;
    }

    .education-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: #687873;
    }

    .education-action-cell .mini-btn {
        width: 100%;
    }
}
