:root {
    color-scheme: light;
    --ink: #18303b;
    --muted: #617680;
    --line: #dce7e8;
    --surface: #ffffff;
    --canvas: #f4f8f8;
    --primary: #0b6670;
    --primary-dark: #084b55;
    --green: #16836d;
    --red: #c23c4b;
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgb(11 102 112 / 35%); outline-offset: 2px; }
.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 5; display: flex; width: 252px; flex-direction: column;
    padding: 22px 16px 16px; background: linear-gradient(180deg, #092f45 0%, #0d4654 58%, #123d4c 100%); color: #eef8f5;
}
.brand { display: block; width: 148px !important; max-width: 148px; padding: 4px; border: 2px solid #d5a928; border-radius: 9px; background: white; }
.brand img { display: block; width: 100%; max-width: 142px; height: auto; }
.sidebar .brand { align-self: center; }
.user-badge small { display: block; margin-top: 3px; color: #b6cbcc; font: 500 11px 'DM Sans', sans-serif; letter-spacing: .25px; }
.nav-label { margin: 32px 10px 12px; color: #e7c253; font-size: 10px; font-weight: 700; letter-spacing: 1.3px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: #c4d6d7; font-size: 13px; font-weight: 600; transition: background .15s, color .15s; }
.nav-link:hover { background: rgb(255 255 255 / 10%); color: #fff; }
.nav-link.active { background: #e7bd3d; color: #092f45; }
.nav-icon { display: grid; width: 21px; place-items: center; color: #f0c84f; font-size: 16px; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid rgb(209 230 225 / 25%); padding-top: 17px; }
.user-badge { display: flex; align-items: center; gap: 10px; margin: 0 4px 15px; font-size: 12px; font-weight: 700; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #f0c84f; color: #09344a; font-weight: 800; }
.logout-button { width: 100%; padding: 9px 11px; border: 1px solid rgb(255 255 255 / 22%); border-radius: 8px; background: rgb(255 255 255 / 4%); color: #d1dfe0; text-align: left; font-size: 12px; }
.logout-button:hover { border-color: #7179a0; color: #fff; }

.main-content { min-height: 100vh; margin-left: 252px; padding: 0 clamp(24px, 3.5vw, 48px) 48px; }
.topbar { display: flex; min-height: 64px; align-items: center; justify-content: space-between; border-bottom: 1px solid #e0e9e9; }
.eyebrow { color: #71858d; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; }
.topbar-date { color: #627780; font-size: 12px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 28px 0 20px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font: 800 28px 'DM Sans', 'Segoe UI', sans-serif; letter-spacing: -.8px; }
h2 { margin-bottom: 5px; font: 700 16px 'DM Sans', 'Segoe UI', sans-serif; letter-spacing: -.2px; }
.muted, .panel-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 6px; padding: 0 15px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; font-weight: 700; transition: background .15s, transform .15s, box-shadow .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: linear-gradient(135deg, #0b6670, #16836d); color: white; }
.button-primary:hover { background: #084751; }
.button-quiet { border-color: var(--line); background: white; color: #48536a; }
.button-quiet:hover { background: #f8f9fc; }
.button-danger { background: #b73e4c; color: white; }
.button-danger:hover { background: #a32f3c; }
.full-width { width: 100%; }
.text-link { color: var(--primary); font-size: 12px; font-weight: 700; }
.text-link:hover { color: var(--primary-dark); text-decoration: underline; }
.text-danger { padding: 0; border: 0; background: none; color: #b23d4a; font-size: 11px; font-weight: 600; }
.text-danger:hover { text-decoration: underline; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 4px 14px rgb(9 47 69 / 5%); }
.stat-card { position: relative; display: flex; min-height: 128px; flex-direction: column; padding: 16px 17px; }
.stat-icon { position: absolute; top: 16px; right: 16px; display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; font-size: 16px; }
.stat-icon.indigo { background: #dceff0; color: #0b5d68; }
.stat-icon.green { background: #e5f6ef; color: #168b65; }
.stat-icon.amber { background: #fff3cc; color: #a57700; }
.stat-icon.blue { background: #e6f2ff; color: #3285c9; }
.stat-label { color: #66738b; font-size: 11px; font-weight: 600; }
.stat-card strong { margin: 12px 0 5px; font: 800 26px 'DM Sans', 'Segoe UI', sans-serif; letter-spacing: -.7px; }
.stat-card .stat-value-small { max-width: 100%; overflow: hidden; margin-top: 15px; font-size: 15px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.stat-caption { color: #71858d; font-size: 11px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .85fr); gap: 16px; margin-bottom: 16px; }
.panel { margin-bottom: 16px; padding: 20px; }
.content-grid .panel { margin-bottom: 0; }
.content-grid > .panel { min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: #6c818a; font-size: 10px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; }
td { padding: 12px; border-bottom: 1px solid #edf2f2; color: #4d626b; font-size: 12px; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f7fbfa; }
tbody tr:last-child td { border-bottom: 0; }
td strong { display: block; color: #263d47; font-size: 12px; font-weight: 700; }
.table-sub { display: block; margin-top: 4px; color: #71858d; font-size: 11px; }
.count-pill, .date-badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 20px; background: #dceff0; color: #0b5d68; font-size: 10px; font-weight: 700; }
.date-badge { background: #f5f6fa; color: #66738b; }
.empty-state { padding: 28px 10px; color: #929bad; text-align: center; font-size: 12px; line-height: 1.7; }
.activity-list { display: grid; gap: 17px; margin: 0; padding: 6px 0 2px; list-style: none; }
.activity-list li { display: flex; gap: 11px; }
.activity-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: #d5a928; box-shadow: 0 0 0 4px #fff3cc; }
.activity-list strong { display: block; color: #344e58; font-size: 12px; line-height: 1.45; }
.activity-list small { display: block; margin-top: 4px; color: #71858d; font-size: 11px; }
.chart-block { display: grid; gap: 11px; margin-top: 18px; padding-top: 15px; border-top: 1px solid #eff1f5; }
.chart-block h3 { margin: 0 0 1px; color: #66738b; font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.chart-row { display: grid; grid-template-columns: minmax(70px, 1fr) minmax(65px, 1.5fr) 28px; align-items: center; gap: 10px; color: #6e7890; font-size: 10px; }
.chart-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-row strong { color: #47536b; text-align: right; font-size: 10px; }
.bar-track { display: block; overflow: hidden; height: 7px; border-radius: 8px; background: #efeff9; }
.bar-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d5a928, #17856e); }
.form-panel { padding-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
label { display: grid; gap: 7px; color: #49556c; font-size: 11px; font-weight: 700; }
input:not([type=checkbox]), select, textarea { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #d5e1e2; border-radius: 8px; outline: none; background: white; color: #263d47; font-size: 13px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: #0b7b82; box-shadow: 0 0 0 3px rgb(11 123 130 / 14%); }
input::placeholder, textarea::placeholder { color: #82949a; }
textarea { resize: vertical; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; grid-column: span 2; gap: 8px; margin-top: 2px; }
.actions { display: flex; align-items: center; gap: 13px; }
.actions form { display: inline; }
.search-form { display: flex; gap: 7px; }
.search-form input { width: 210px; }
.checkin-panel { border-top: 3px solid var(--primary); }
.checkin-form { display: grid; grid-template-columns: minmax(200px, 1.1fr) minmax(200px, 1fr) auto; align-items: end; gap: 13px; }
.filter-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.filter-form label { min-width: 150px; flex: 1; }
.report-panel { min-height: 200px; }
.checkbox-label { display: flex; align-items: flex-start; gap: 8px; color: #65718a; font-weight: 500; line-height: 1.5; }
.checkbox-label input { margin: 2px 0 0; }
code { padding: 2px 5px; border-radius: 4px; background: #f1f2f8; color: #4c4d79; font-size: 11px; }
.alert { margin: 16px 0 0; padding: 12px 15px; border: 1px solid; border-radius: 9px; font-size: 13px; }
.alert-success { border-color: #b9e9d7; background: #edfaf4; color: #13764f; }
.alert-error { border-color: #f3c6cb; background: #fff1f2; color: #a32f3c; }
.alert-info { border-color: #d5d8f8; background: #f2f2ff; color: #4842b5; }
.backup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 17px; }
.backup-grid .panel { display: flex; flex-direction: column; align-items: flex-start; }
.backup-grid .panel .muted { margin-bottom: 18px; }
.stack-form { display: grid; gap: 14px; }
.stack-form label { gap: 7px; }

.auth-content {
    position: relative; isolation: isolate; display: grid; min-height: 100vh; place-items: center; overflow: hidden; padding: 100px 24px 40px;
    background: radial-gradient(ellipse at 82% 18%, rgb(231 189 61 / 18%), transparent 34%), linear-gradient(135deg, #06283e 0%, #0b5d68 58%, #147b6c 100%);
}
.auth-content::before, .auth-content::after {
    position: absolute; z-index: -1; display: block; border-radius: 50%; content: '';
}
.auth-content::before {
    width: 520px; height: 520px; top: -220px; right: -120px;
    background: radial-gradient(circle, rgb(240 200 79 / 35%) 0, rgb(240 200 79 / 8%) 48%, transparent 70%);
}
.auth-content::after {
    width: 430px; height: 430px; bottom: -220px; left: -150px;
    border: 1px solid rgb(255 255 255 / 16%); box-shadow: 0 0 0 34px rgb(255 255 255 / 4%), 0 0 0 68px rgb(255 255 255 / 3%);
}
.auth-card { position: relative; z-index: 1; width: min(100%, 430px); padding: 27px 32px 23px; border: 1px solid rgb(255 255 255 / 72%); border-top: 4px solid #e7bd3d; border-radius: 18px; background: rgb(255 255 255 / 99%); box-shadow: 0 28px 80px rgb(3 30 43 / 32%); }
.auth-brand { width: 158px !important; max-width: 158px; margin: 0 auto 11px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.auth-page-header { position: absolute; z-index: 4; top: 0; right: 0; left: 0; display: flex; min-height: 76px; align-items: center; justify-content: space-between; padding: 10px clamp(18px, 5vw, 64px); border-bottom: 1px solid rgb(255 255 255 / 14%); background: rgb(5 42 57 / 30%); backdrop-filter: blur(12px); }
.auth-header-brand { display: flex; align-items: center; gap: 11px; color: white; font-size: 15px; font-weight: 800; letter-spacing: .3px; }
.auth-header-brand img { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; background: white; }
.auth-header-brand small { display: block; margin-top: 3px; color: #c1d5d5; font-size: 10px; font-weight: 500; letter-spacing: 0; }
.login-popover { position: relative; }
.login-popover > summary { min-width: 114px; gap: 9px; color: white; cursor: pointer; list-style: none; }
.login-popover > summary::-webkit-details-marker { display: none; }
.login-popover[open] > summary { background: #084751; }
.auth-popover-card { position: absolute; top: calc(100% + 13px); right: 0; width: min(430px, calc(100vw - 32px)); max-height: calc(100vh - 106px); overflow-y: auto; padding: 26px 30px 21px; animation: popover-in .16s ease-out; }
.auth-popover-card h1 { font-size: 25px; }
.auth-popover-card > .muted { margin-bottom: 17px; }
.auth-landing { width: min(100%, 700px); color: white; text-align: center; }
.auth-landing .auth-kicker { color: #f0cf69; }
.auth-landing h1 { margin: 13px 0; color: white; font-size: clamp(36px, 5vw, 58px); line-height: 1.08; letter-spacing: -1.7px; }
.auth-landing > p { max-width: 490px; margin: 0 auto; color: #d3e2e2; font-size: 15px; line-height: 1.8; }
.landing-cta { display: inline-flex; align-items: center; gap: 9px; margin-top: 27px; padding: 12px 17px; border: 1px solid rgb(255 255 255 / 35%); border-radius: 9px; color: white; font-size: 13px; font-weight: 700; transition: background .15s, border-color .15s; }
.landing-cta:hover { border-color: #e7bd3d; background: rgb(255 255 255 / 10%); }
@keyframes popover-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.auth-kicker { display: block; margin-bottom: 9px; color: #0b7b82; text-align: center; font-size: 10px; font-weight: 800; letter-spacing: 1.8px; }
.auth-card h1 { margin-bottom: 7px; color: #092f45; text-align: center; font-size: 26px; letter-spacing: -.7px; }
.auth-card > .muted { margin-bottom: 18px; text-align: center; }
.auth-card .stack-form { gap: 12px; }
.auth-card .button { margin-top: 3px; }
.demo-login { margin-top: 15px; padding: 0 12px; border: 1px solid #d7e5e5; border-radius: 10px; background: #f7fbfa; color: #526a72; font-size: 11px; }
.demo-login summary { display: flex; min-height: 42px; align-items: center; justify-content: space-between; gap: 10px; color: #24515a; cursor: pointer; font-size: 12px; font-weight: 700; list-style-position: inside; }
.demo-login summary small { color: #71858d; font-size: 10px; font-weight: 500; }
.demo-login-content { display: grid; gap: 7px; padding: 0 0 12px; }
.demo-login b { color: #092f45; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.demo-account-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 3px; }
.demo-account-actions .button { min-height: 34px; padding: 0 7px; font-size: 10px; }
.demo-login .button-quiet { border-color: #c9dfdc; background: white; color: #0b5d68; }
.demo-login .button-quiet:hover { border-color: #0b7b82; background: #f3fbfa; }
.auth-footnote { margin: 13px 0 0; color: #71858d; text-align: center; font-size: 10px; line-height: 1.6; }
.captcha-text { display: inline-block; margin-left: 7px; padding: 5px 8px; border: 1px dashed #d5a928; border-radius: 5px; background: #fff9e7; color: #876800; font: 800 13px monospace; letter-spacing: 2px; }
.setup-card { width: min(100%, 450px); }
.error-detail { overflow-wrap: anywhere; margin: 16px 0; padding: 10px; border-radius: 6px; background: #f6f7fa; color: #69748c; font: 11px/1.6 monospace; }

@media (max-width: 1080px) {
    .main-content { padding-right: 23px; padding-left: 23px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .sidebar { position: static; width: auto; padding: 12px 14px 10px; }
    .sidebar .brand { width: 120px !important; max-width: 120px; margin-bottom: 10px; }
    .nav-label { display: none; }
    .sidebar nav { display: flex; overflow-x: auto; gap: 5px; }
    .nav-link { flex: 0 0 auto; padding: 9px 10px; font-size: 11px; }
    .sidebar-bottom { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; }
    .user-badge { flex: 1; margin: 0 2px; }
    .logout-button { width: auto; min-width: 86px; text-align: center; }
    .main-content { margin-left: 0; padding: 0 15px 30px; }
    .topbar { min-height: 52px; }
    .topbar-date { font-size: 10px; }
    .page-heading { align-items: flex-start; margin: 23px 0 17px; }
    .page-heading .button { flex: 0 0 auto; }
    h1 { font-size: 23px; }
    .stats-grid { gap: 9px; }
    .stat-card { min-height: 132px; padding: 14px; }
    .stat-icon { top: 12px; right: 12px; width: 28px; height: 28px; }
    .panel { padding: 15px; }
    .form-grid, .backup-grid { grid-template-columns: 1fr; }
    .span-2, .form-actions { grid-column: auto; }
    .checkin-form { grid-template-columns: 1fr; }
    .filter-form { align-items: stretch; }
    .filter-form label { min-width: 100%; }
    .search-form input { width: min(48vw, 210px); }
    .auth-content { place-items: center; padding: 100px 16px 30px; }
    .auth-page-header { min-height: 66px; padding: 8px 14px; }
    .auth-header-brand { gap: 8px; font-size: 13px; }
    .auth-header-brand img { width: 42px; height: 42px; }
    .auth-header-brand small { font-size: 9px; }
    .auth-popover-card { top: calc(100% + 9px); right: -2px; padding: 22px 19px 18px; }
    .auth-landing h1 { font-size: clamp(34px, 10vw, 46px); }
    .auth-landing > p { font-size: 13px; }
    .auth-card { padding: 24px 22px 20px; }
    .demo-account-actions { grid-template-columns: 1fr; }
    .demo-account-actions .button { min-height: 38px; font-size: 11px; }
}
@media print {
    body { background: #fff; }
    .sidebar, .topbar, .no-print, .alert { display: none !important; }
    .main-content { margin: 0; padding: 0; }
    .page-heading { margin: 0 0 18px; }
    .panel { border: 0; box-shadow: none; padding: 0; }
    .table-wrap { overflow: visible; }
    th, td { padding: 7px 6px; color: #111; font-size: 9pt; }
    .table-sub { color: #444; }
}
