@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
    color-scheme: light;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --bg-color: #f5f7fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text-main: #101828;
    --text-muted: #667085;
    --border-color: #e4e7ec;
    --success: #067647;
    --danger: #b42318;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --primary: #82aaff;
    --primary-hover: #a4c1ff;
    --primary-soft: #1b2b45;
    --bg-color: #0c1118;
    --surface: #121923;
    --surface-muted: #18212c;
    --text-main: #f2f4f7;
    --text-muted: #98a2b3;
    --border-color: #293443;
    --success: #75e0a7;
    --danger: #f97066;
    --shadow: 0 1px 2px rgba(0, 0, 0, .22), 0 10px 28px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    padding: 36px 28px;
    color: var(--text-main);
    background-color: var(--bg-color);
    background-image: radial-gradient(ellipse at 50% -18%, rgba(219, 234, 254, .82), transparent 54%);
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); font-weight: 600; text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

.container {
    width: min(100%, 1240px);
    margin: 0 auto;
    animation: page-enter .35s ease-out both;
}

.dentist-dashboard, .student-dashboard { max-width: 1240px; }

.app-layout {
    display: grid;
    width: min(100%, 1480px);
    grid-template-columns: 232px minmax(0, 1fr);
    align-items: start;
    gap: 28px;
    margin: 0 auto;
}

.sidebar {
    position: sticky;
    top: 24px;
    display: flex;
    height: calc(100vh - 48px);
    min-height: 520px;
    flex-direction: column;
    gap: 22px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; color: var(--text-main); font-weight: 700; }
.sidebar-brand:hover { color: var(--text-main); text-decoration: none; }
.brand-logo { display: block; width: 38px; height: 38px; flex: none; border: 1px solid var(--border-color); border-radius: 7px; object-fit: cover; }
.sidebar-user { padding: 0 2px 16px; border-bottom: 1px solid var(--border-color); }
.sidebar-user span { display: block; color: var(--text-muted); font-size: .75rem; }
.sidebar-user strong { display: block; margin-top: 3px; color: var(--text-main); font-size: .9rem; overflow-wrap: anywhere; }
.sidebar-nav { display: grid; gap: 4px; }
.sidebar-nav a { display: flex; min-height: 40px; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 6px; color: var(--text-muted); font-size: .875rem; font-weight: 600; }
.sidebar-nav a:hover, .sidebar-nav a.is-active { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.sidebar-nav .lucide, .theme-toggle .lucide { width: 17px; height: 17px; flex: none; stroke-width: 1.8; }
.sidebar-footer { display: grid; gap: 9px; margin-top: auto; }
.sidebar-footer form { margin: 0; }
.sidebar-footer form button { width: 100%; }
.main-content { min-width: 0; padding: 4px 0; }
.theme-toggle { width: 100%; justify-content: flex-start; border-color: var(--border-color); background: var(--surface-muted); color: var(--text-main); }
.theme-toggle:hover { border-color: var(--border-color); background: var(--primary-soft); color: var(--primary); }
.theme-floating { position: fixed; z-index: 30; right: 22px; bottom: 20px; width: auto; box-shadow: var(--shadow); }

.auth-container, .maintenance-container, .record-editor, .welcome-container {
    width: min(100%, 480px);
    margin: 5vh auto 0;
    padding: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    animation: page-enter .35s ease-out both;
}

.maintenance-container { width: min(100%, 920px); margin-top: 2vh; }
.record-editor { width: min(100%, 720px); margin-top: 3vh; }
.welcome-container { width: min(100%, 700px); margin-top: 10vh; text-align: center; padding: 52px; }

.landing-page { width: min(100%, 1440px); margin: 0 auto; }
.landing-header { display: flex; min-height: 74px; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.landing-brand { display: flex; min-width: 0; align-items: center; gap: 12px; color: var(--text-main); }
.landing-brand:hover { color: var(--text-main); text-decoration: none; }
.landing-logo { display: block; width: 48px; height: 48px; flex: none; border: 1px solid var(--border-color); border-radius: 7px; object-fit: cover; }
.landing-brand-copy { display: grid; gap: 2px; }
.landing-brand-copy strong { color: var(--text-main); font-size: .98rem; line-height: 1.2; }
.landing-brand-copy small { color: var(--text-muted); font-size: .75rem; }
.landing-nav { display: flex; align-items: center; gap: 20px; }
.landing-nav > a:not(.button-link) { color: var(--text-muted); font-size: .875rem; }
.landing-nav > a:not(.button-link):hover { color: var(--primary); text-decoration: none; }
.landing-nav form { margin: 0; }
.landing-nav form button { min-height: 38px; }
.landing-nav .button-link { min-height: 38px; padding: 8px 12px; }
.landing-hero { position: relative; display: flex; min-height: 520px; align-items: center; overflow: hidden; border-radius: 8px; background: #294453; isolation: isolate; }
.landing-hero-image, .landing-hero-shade { position: absolute; z-index: -1; inset: 0; width: 100%; height: 100%; }
.landing-hero-image { object-fit: cover; object-position: center 48%; }
.landing-hero-shade { background: linear-gradient(90deg, rgba(9, 24, 34, .82) 0%, rgba(12, 31, 42, .65) 43%, rgba(12, 31, 42, .12) 100%); }
.landing-hero-content { width: min(100%, 720px); padding: 58px 64px; color: #fff; animation: page-enter .45s ease-out both; }
.landing-kicker { display: flex; align-items: center; gap: 9px; margin: 0 0 18px; color: #d3e2e8; font-size: .76rem; font-weight: 700; text-transform: uppercase; }
.landing-kicker span { width: 8px; height: 8px; border-radius: 50%; background: #78d5ba; box-shadow: 0 0 0 4px rgba(120, 213, 186, .18); }
.landing-hero h1 { margin: 0; color: #fff; font-size: 3.25rem; line-height: 1.04; }
.landing-lede { max-width: 52ch; margin: 18px 0 0; color: #e2e9ed; font-size: 1.05rem; }
.landing-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; margin-top: 28px; }
.landing-primary { min-height: 46px; padding: 12px 16px; }
.landing-secondary { color: #fff; font-size: .9rem; font-weight: 600; }
.landing-secondary:hover { color: #fff; text-decoration: underline; }
.landing-welcome { color: #e2e9ed; font-size: .875rem; }
.landing-image-caption { position: absolute; right: 18px; bottom: 14px; color: rgba(255, 255, 255, .76); font-size: .6875rem; }
.landing-paths { display: grid; grid-template-columns: minmax(210px, .75fr) repeat(2, minmax(0, 1fr)); gap: 28px; padding: 34px 8px 24px; }
.landing-section-heading { padding-top: 4px; }
.landing-section-heading .eyebrow { margin-bottom: 7px; }
.landing-section-heading h2 { max-width: 240px; margin: 0; font-size: 1.35rem; }
.landing-path { display: grid; grid-template-columns: 38px minmax(0, 1fr) 24px; align-items: start; gap: 12px; padding-top: 8px; border-top: 1px solid var(--border-color); }
.landing-path-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 6px; background: var(--primary-soft); color: var(--primary); }
.landing-path-icon .lucide { width: 18px; height: 18px; }
.landing-path h3 { margin: 1px 0 5px; font-size: .95rem; }
.landing-path p { margin: 0; color: var(--text-muted); font-size: .83rem; }
.landing-path > a { display: grid; width: 24px; height: 24px; place-items: center; color: var(--text-muted); }
.landing-path > a:hover { color: var(--primary); }
.landing-path > a .lucide { width: 16px; height: 16px; }
.landing-footer { display: flex; justify-content: space-between; gap: 12px; margin: 10px 8px 0; padding: 16px 0 0; border-top: 1px solid var(--border-color); color: var(--text-muted); font-size: .75rem; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 0 0 28px;
    padding: 4px 0 22px;
    border-bottom: 1px solid var(--border-color);
}

.page-header p { margin: 5px 0 0; color: var(--text-muted); }
.page-header form { margin: 0; }
.page-header h1, .page-header h2 { margin: 0; }
.header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.header-actions form { margin: 0; }
.form-panel { margin: 18px 0 30px; padding: 20px; border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 2px rgba(16, 24, 40, .025); }
.form-panel h3 { margin-top: 0; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: .75rem; font-weight: 700; text-transform: uppercase; }

h1, h2, h3 { color: var(--text-main); line-height: 1.25; }
h1 { margin: 0 0 12px; font-size: 2rem; font-weight: 700; }
h2 { margin: 0 0 12px; font-size: 1.5rem; font-weight: 700; }
h3 { margin: 26px 0 14px; font-size: 1.05rem; font-weight: 650; }
p { color: #475467; }
hr { height: 1px; margin: 28px 0; border: 0; background: var(--border-color); }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 24px 0 30px;
}

.summary-item {
    display: flex;
    min-height: 108px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 18px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .025);
}

.summary-item strong { color: var(--text-main); font-size: 1.75rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.summary-item span { color: var(--text-muted); font-size: .875rem; }
.summary-link { color: inherit; text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.summary-link:hover { transform: translateY(-2px); border-color: #b2ccff; box-shadow: var(--shadow); text-decoration: none; }
.summary-link span { color: var(--text-muted); }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.overview-grid .section-heading { margin-top: 0; }
.overview-grid .section-heading h2 { margin: 0; font-size: 1rem; }
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.quick-action { display: flex; min-width: 0; min-height: 76px; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--surface); color: var(--text-main); }
.quick-action:hover { border-color: #b2ccff; background: var(--primary-soft); text-decoration: none; }
.quick-action > .lucide { width: 19px; height: 19px; flex: none; color: var(--primary); }
.quick-action > span { display: grid; min-width: 0; gap: 3px; }
.quick-action strong { overflow: hidden; color: var(--text-main); font-size: .875rem; text-overflow: ellipsis; white-space: nowrap; }
.quick-action small { color: var(--text-muted); font-size: .75rem; }
.quick-action > .lucide:last-child { width: 15px; height: 15px; margin-left: auto; }
.table-scroll { width: 100%; overflow-x: auto; }
.backup-page > h2 { margin-top: 26px; }
.report-period-note { margin: 14px 0 0; color: var(--text-muted); font-size: .8125rem; }
.prd-page { max-width: 980px; }
.prd-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 14px; }
.prd-toolbar p { margin: 0; color: var(--text-muted); font-size: .8125rem; font-weight: 700; text-transform: uppercase; }
.prd-toc { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 16px; padding: 12px 0; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.prd-toc a { font-size: .85rem; }
.prd-document { padding: 0 4px; }
.prd-document section { padding: 24px 0; border-bottom: 1px solid var(--border-color); scroll-margin-top: 20px; }
.prd-document section:first-child { padding-top: 8px; }
.prd-document section:last-child { border-bottom: 0; }
.prd-document h2 { margin: 0 0 12px; font-size: 1.35rem; }
.prd-document h3 { margin: 22px 0 8px; font-size: .98rem; }
.prd-document p, .prd-document li { max-width: 78ch; color: var(--text-muted); }
.prd-document ol, .prd-document ul { display: grid; gap: 8px; padding-left: 22px; }
.prd-document .table-scroll { margin-top: 14px; }
.prd-document table { margin: 0; }
.prd-document th, .prd-document td { white-space: normal; }
.prd-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 22px 0 0; }
.prd-facts > div { padding: 14px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--surface); }
.prd-facts dt { margin-bottom: 5px; color: var(--text-main); font-size: .8rem; font-weight: 700; }
.prd-facts dd { margin: 0; color: var(--text-muted); font-size: .84rem; }
.prd-checklist li::marker { color: var(--primary); }
.chart-section { margin: 28px 0 34px; }
.chart-section h3 { margin-top: 0; }
.bar-chart { display: grid; max-width: 740px; gap: 12px; }
.chart-row { display: grid; grid-template-columns: 100px minmax(60px, 1fr) 36px; align-items: center; gap: 12px; color: #475467; font-size: .875rem; }
.chart-row strong { text-align: right; color: var(--text-main); font-variant-numeric: tabular-nums; }
.chart-track { height: 8px; overflow: hidden; border-radius: 99px; background: #eaecf0; }
.chart-bar { height: 100%; min-width: 2px; border-radius: inherit; background: #2563eb; }
.chart-bar.status-pending { background: #f79009; }
.chart-bar.status-confirmed { background: #2e90fa; }
.chart-bar.status-completed { background: #12b76a; }
.chart-bar.status-cancelled { background: #f04438; }
.analytics-section { margin: 0 0 34px; scroll-margin-top: 24px; }
.analytics-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.analytics-heading h2 { margin: 0; }
.analytics-heading p:last-child { margin: 6px 0 0; color: var(--text-muted); }
.analytics-heading .eyebrow { margin-bottom: 5px; }
.analytics-heading button { flex: 0 0 auto; }
.analytics-section .summary-grid { margin: 0 0 16px; }
.analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 14px; }
.chart-panel { min-width: 0; padding: 18px; border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 2px rgba(16, 24, 40, .025); }
.chart-panel h3 { margin: 0 0 18px; }
.month-chart { display: grid; height: 170px; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding-top: 8px; }
.month-chart-item { display: grid; min-width: 0; grid-template-rows: 18px minmax(0, 1fr) 20px; gap: 5px; color: var(--text-muted); font-size: .75rem; text-align: center; }
.month-chart-item strong { overflow: hidden; color: var(--text-main); font-size: .75rem; font-variant-numeric: tabular-nums; }
.month-chart-track { display: flex; min-height: 0; align-items: flex-end; overflow: hidden; border-radius: 5px 5px 3px 3px; background: var(--surface-muted); }
.month-chart-bar { width: 100%; min-height: 0; border-radius: 4px 4px 0 0; background: #3978f6; transition: height .25s ease; }
.records-chart .month-chart-bar { background: #12a875; }
.summary-report { margin-top: 14px; padding: 18px; border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--surface); }
.summary-report .section-heading { margin: 0 0 12px; }
.summary-report .section-heading h3 { margin: 0; }
.summary-report .section-heading span { color: var(--text-muted); font-size: .8125rem; }
.summary-report table { margin: 0; }
.summary-report tfoot th { border-top: 1px solid var(--border-color); background: var(--surface-muted); color: var(--text-main); }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 26px; }
.section-heading h3 { margin: 0; }

label { display: block; margin: 0 0 6px; color: #344054; font-size: .875rem; font-weight: 600; }
input, select, textarea {
    width: 100%;
    min-height: 42px;
    margin: 0 0 16px;
    padding: 9px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    outline: none;
    background: var(--surface);
    color: var(--text-main);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 88px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #98a2b3; }
input:focus, select:focus, textarea:focus { border-color: #84adff; box-shadow: 0 0 0 3px rgba(46, 144, 250, .14); }

button, .button-link {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
button:hover, .button-link:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }
button:focus-visible, .button-link:focus-visible, a:focus-visible { outline: 3px solid rgba(46, 144, 250, .32); outline-offset: 2px; }
form:not(.filter-bar) > button[type="submit"]:not(.button-compact):not(.button-secondary):not(.button-danger) { width: 100%; }
.button-secondary { border-color: #d0d5dd; background: #fff; color: #344054; }
.button-secondary:hover { border-color: #b2b8c2; background: #f9fafb; color: #101828; }
.button-danger { background: #d92d20; color: #fff; }
.button-danger:hover { background: #b42318; }
.button-compact { min-height: 34px; padding: 6px 10px; font-size: .8125rem; }
.button-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.button-row .button-link { min-width: 140px; }

.filter-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr)) auto auto;
    align-items: end;
    gap: 12px;
    margin: 16px 0;
}
.filter-bar > div { min-width: 0; }
.filter-bar label { font-size: .8125rem; }
.filter-bar input, .filter-bar select { margin: 0; }
.filter-bar button, .filter-bar .filter-reset { width: auto; min-height: 42px; padding: 9px 13px; white-space: nowrap; }
.filter-reset { display: inline-flex; align-items: center; justify-content: center; }

table {
    width: 100%;
    margin: 14px 0 24px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    border-spacing: 0;
    background: var(--surface);
    text-align: left;
}
th, td { padding: 12px 14px; border-bottom: 1px solid #eaecf0; text-align: left; vertical-align: middle; }
th { background: #f9fafb; color: #475467; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
td { color: #344054; font-size: .875rem; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfc; }
.report-table small { color: var(--text-muted); }
.action-cell { white-space: nowrap; }
.action-cell form { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.action-cell select { width: auto; min-height: 34px; margin: 0; padding: 5px 8px; font-size: .8125rem; }

.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-pending { background: #fffaeb; color: #b54708; }
.badge-confirmed { background: #eff8ff; color: #175cd3; }
.badge-completed { background: #ecfdf3; color: #027a48; }
.badge-cancelled { background: #fef3f2; color: #b42318; }
.success, .error { margin: 16px 0; padding: 12px 14px; border: 1px solid transparent; border-radius: 6px; font-size: .9rem; }
.success { border-color: #abefc6; background: #ecfdf3; color: #067647; }
.error { border-color: #fecdca; background: #fef3f2; color: #b42318; }
.demo-accounts { margin-top: 26px; padding: 18px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--surface-muted); text-align: left; }
.demo-accounts h3 { margin: 0 0 12px; font-size: .9rem; }
.demo-accounts p { margin: 0 0 10px; color: #475467; font-size: .85rem; line-height: 1.55; overflow-wrap: anywhere; }
.demo-accounts p:last-child { margin-bottom: 0; }
.demo-accounts code { color: #344054; font-family: 'DM Sans', sans-serif; font-size: .85rem; }
.backup-warning { padding: 12px 14px; border-left: 3px solid #f79009; background: #fffaeb; color: #93370d; }

html[data-theme="dark"] body { background-image: radial-gradient(ellipse at 50% -18%, rgba(32, 54, 83, .55), transparent 56%); }
html[data-theme="dark"] p, html[data-theme="dark"] .chart-row { color: #aeb8c7; }
html[data-theme="dark"] label { color: #d0d5dd; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { border-color: #3a4656; background: #111821; color: var(--text-main); }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #788599; }
html[data-theme="dark"] input:focus, html[data-theme="dark"] select:focus, html[data-theme="dark"] textarea:focus { border-color: #528bff; box-shadow: 0 0 0 3px rgba(82, 139, 255, .2); }
html[data-theme="dark"] .button-secondary { border-color: #3a4656; background: #1a2430; color: #e4e7ec; }
html[data-theme="dark"] .button-secondary:hover { border-color: #526174; background: #222e3c; color: #fff; }
html[data-theme="dark"] th { background: #18212c; color: #aeb8c7; }
html[data-theme="dark"] th, html[data-theme="dark"] td { border-color: #293443; }
html[data-theme="dark"] td { color: #d0d5dd; }
html[data-theme="dark"] tbody tr:hover td { background: #18212c; }
html[data-theme="dark"] .chart-track { background: #293443; }
html[data-theme="dark"] .badge-pending { background: #3b2b16; color: #fec84b; }
html[data-theme="dark"] .badge-confirmed { background: #172f51; color: #84caff; }
html[data-theme="dark"] .badge-completed { background: #14332a; color: #75e0a7; }
html[data-theme="dark"] .badge-cancelled { background: #3b2022; color: #fda29b; }
html[data-theme="dark"] .success { border-color: #135d42; background: #102b22; color: #75e0a7; }
html[data-theme="dark"] .error { border-color: #7a271a; background: #351b1a; color: #fda29b; }
html[data-theme="dark"] .demo-accounts code { color: #d0d5dd; }
html[data-theme="dark"] .backup-warning { border-left-color: #dc6803; background: #332313; color: #fec84b; }
html[data-theme="dark"] .sidebar-nav a { color: #aeb8c7; }
html[data-theme="dark"] .sidebar-nav a:hover, html[data-theme="dark"] .sidebar-nav a.is-active { color: #a4c1ff; }
html[data-theme="dark"] .records-chart .month-chart-bar { background: #34d399; }

@keyframes page-enter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
    body { padding: 26px 20px; }
    .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 620px) {
    body { padding: 18px 14px; }
    .auth-container, .maintenance-container, .record-editor, .welcome-container { margin-top: 12px; padding: 24px 20px; }
    .page-header { align-items: flex-start; flex-direction: column; gap: 14px; }
    .page-header form { width: 100%; }
    .page-header form button { width: 100%; }
    .section-heading { align-items: flex-start; flex-wrap: wrap; }
    .header-actions { width: 100%; }
    .header-actions form { flex: 1; }
    .header-actions > a, .header-actions form button { width: 100%; }
    .form-panel { padding: 16px; }
    .field-row { grid-template-columns: 1fr; gap: 0; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .summary-item { min-height: 92px; padding: 14px; }
    .analytics-heading { align-items: flex-start; flex-direction: column; }
    .analytics-heading button { width: 100%; }
    .analytics-grid { grid-template-columns: 1fr; }
    .chart-panel, .summary-report { padding: 14px; }
    .overview-grid, .quick-actions { grid-template-columns: 1fr; }
    .quick-actions { gap: 9px; }
    .prd-toolbar { align-items: flex-start; flex-direction: column; }
    .prd-toolbar button { width: 100%; }
    .prd-facts { grid-template-columns: 1fr; gap: 8px; }
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .filter-bar button { width: 100%; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
    th, td { padding: 10px 12px; }
    .welcome-container h1 { font-size: 1.7rem; }
}

@media (max-width: 760px) {
    body { padding: 16px; }
    .landing-header { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 14px; }
    .landing-nav { width: 100%; flex-wrap: wrap; gap: 10px 16px; }
    .landing-nav form button { width: auto; }
    .landing-hero { min-height: 500px; align-items: flex-end; }
    .landing-hero-image { object-position: 58% center; }
    .landing-hero-shade { background: linear-gradient(0deg, rgba(9, 24, 34, .86) 0%, rgba(12, 31, 42, .45) 62%, rgba(12, 31, 42, .12) 100%); }
    .landing-hero-content { padding: 42px 26px; }
    .landing-hero h1 { font-size: 2.55rem; }
    .landing-lede { font-size: .98rem; }
    .landing-paths { grid-template-columns: 1fr; gap: 18px; padding: 26px 4px 20px; }
    .landing-section-heading h2 { max-width: none; }
    .landing-path { padding-top: 14px; }
    .landing-footer { margin-right: 4px; margin-left: 4px; }
    .app-layout { display: block; }
    .sidebar { position: static; height: auto; min-height: 0; gap: 12px; margin-bottom: 20px; padding: 12px; }
    .sidebar-user { display: none; }
    .sidebar-nav { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 2px; scrollbar-width: thin; }
    .sidebar-nav a { flex: 0 0 auto; }
    .sidebar-footer { display: flex; align-items: center; margin-top: 0; }
    .sidebar-footer form { flex: 1; }
    .sidebar-footer form button { width: 100%; }
    .sidebar-footer .theme-toggle { width: auto; }
    .main-content { padding: 0; }
}

@media (max-width: 420px) {
    .landing-nav { column-gap: 12px; }
    .landing-nav > a:not(.button-link) { font-size: .8125rem; }
    .landing-nav .button-link { min-height: 36px; padding: 7px 10px; }
    .landing-hero { min-height: 480px; }
    .landing-hero-content { padding: 34px 20px; }
    .landing-hero h1 { font-size: 2.25rem; }
    .landing-actions { align-items: flex-start; flex-direction: column; gap: 14px; }
    .landing-primary { width: 100%; white-space: normal; }
}

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

@media print {
    body { padding: 0; background: #fff; color: #000; }
    .landing-header, .landing-nav, .landing-actions, .landing-footer, .landing-image-caption { display: none !important; }
    .landing-hero { min-height: 360px; border-radius: 0; }
    .landing-hero-content { padding: 32px; }
    .container, .auth-container, .maintenance-container, .record-editor { width: auto; max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; }
    .no-print, .sidebar, .prd-toc, button, form { display: none !important; }
    .app-layout { display: block; width: auto; }
    .main-content { padding: 0; }
    table, tr { break-inside: avoid; }
}