:root {
  color-scheme: light;
  --ink: #1c3030;
  --muted: #748181;
  --paper: #f3f6f5;
  --surface: #fff;
  --line: #e3eae8;
  --brand: #125654;
  --brand-dark: #0e4140;
  --brand-pale: #e7f2ef;
  --accent: #c49352;
  --danger: #ac3d3d;
  --shadow: 0 8px 26px rgb(23 53 51 / 5%);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Segoe UI", Arial, sans-serif; font-size: 15px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.viewer .admin-only { display: none !important; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { background: var(--brand-dark); color: #fff; padding: 28px 17px 18px; display: flex; flex-direction: column; min-height: 100vh; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 0 8px 35px; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: "Segoe UI", Arial, sans-serif; font-size: 15px; }
.brand small { color: #a9c5c2; margin-top: 3px; font-size: 12px; }
.brand-mark { width: 40px; height: 40px; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: var(--brand-dark); background: #e0c290; font: 800 14px "Segoe UI", Arial, sans-serif; letter-spacing: -.08em; }
.resort-logo { width: 43px; height: 43px; object-fit: cover; border-radius: 9px; }
.login-logo { display: block; width: min(100%, 240px); height: 74px; object-fit: contain; object-position: left center; margin-bottom: 24px; }
.navigation { display: grid; gap: 6px; }
.nav-link { border: 0; border-radius: 9px; color: #bed0ce; background: transparent; padding: 12px 13px; text-align: left; transition: .15s ease; }
.nav-link span { display: inline-block; width: 27px; color: #a5c4c0; font-size: 17px; }
.nav-link:hover, .nav-link.active { background: #245c59; color: #fff; }
.nav-link.active span { color: #e0c290; }
.sidebar-footer { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid #32625f; display: flex; align-items: center; gap: 8px; color: #c3d6d3; font-size: 12px; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #8bc59b; }
.text-button { color: #d3e2e0; border: 0; background: transparent; margin-left: auto; padding: 5px 0; font-size: 12px; }
.main-content { width: min(100%, 1500px); margin: 0 auto; padding: 32px clamp(20px, 4vw, 58px) 60px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-bottom: 27px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--brand); font-size: 10px; font-weight: 700; letter-spacing: .13em; margin: 0 0 7px; }
.topbar h1 { font: 700 25px "Segoe UI", Arial, sans-serif; margin: 0; }
.topbar-actions { display: flex; gap: 9px; }
.page { padding-top: 27px; }
.page-intro { display: flex; justify-content: space-between; align-items: center; margin-bottom: 19px; }
.page-intro h2 { font: 700 19px "Segoe UI", Arial, sans-serif; margin: 0 0 4px; }
.page-intro p, .card-heading p, .backup-card p { color: var(--muted); font-size: 13px; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.filters { display: flex; align-items: end; gap: 14px; padding: 17px; margin-bottom: 17px; }
label { display: grid; gap: 7px; color: #526262; font-size: 12px; font-weight: 600; }
input, select { width: 100%; min-height: 42px; border: 1px solid #dce5e2; border-radius: 7px; outline: 0; background: #fff; color: var(--ink); padding: 9px 11px; }
input:focus, select:focus { border-color: #39817c; box-shadow: 0 0 0 3px rgb(57 129 124 / 12%); }
.filters label { width: min(270px, 34%); }
.button { min-height: 40px; border: 1px solid transparent; border-radius: 7px; padding: 9px 14px; font-weight: 600; font-size: 12px; transition: .15s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--brand); }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { color: var(--brand); border-color: #d5e4e0; background: #f8fbfa; }
.button.danger { color: var(--danger); background: #fff6f5; border-color: #f1d4d1; }
.button.full-width { width: 100%; }
.chart-card, .table-card { padding: 19px; margin-bottom: 17px; }
.card-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 15px; }
.card-heading h3, .form-card h3, .backup-card h3 { margin: 0 0 4px; font: 700 14px "Segoe UI", Arial, sans-serif; }
.chart { width: 100%; height: auto; min-height: 220px; overflow: visible; }
.chart text { fill: var(--muted); font: 11px "Segoe UI", Arial, sans-serif; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .data-line { fill: none; stroke: var(--brand); stroke-width: 3; }
.chart .data-bar { fill: #62a29a; }
.chart .data-dot { fill: var(--brand); stroke: white; stroke-width: 2; }
.chart .axis-title { fill: var(--ink); font-weight: 600; }
.empty-state { color: var(--muted); padding: 20px; text-align: center; font-size: 13px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: #687878; background: #f7f9f8; text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td input { min-width: 115px; min-height: 35px; padding: 6px 8px; }
.form-card { padding: 22px; }
.form-card > h3 { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; align-items: end; }
.full-row { grid-column: 1 / -1; }
.reading-status { min-height: 22px; color: #496664; background: var(--brand-pale); border-radius: 7px; padding: 10px 12px; white-space: pre-line; font-size: 12px; line-height: 1.6; }
.management-layout { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(370px, 1.2fr); align-items: start; gap: 17px; }
.unit-list-card { padding: 17px; }
.unit-list { max-height: 580px; overflow: auto; }
.unit-choice { width: 100%; display: flex; gap: 12px; align-items: center; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 11px 8px; text-align: left; color: var(--ink); }
.unit-choice:hover, .unit-choice.selected { background: var(--brand-pale); border-radius: 6px; }
.unit-number { color: var(--brand); min-width: 31px; font-weight: 700; }
.unit-choice small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.check-row { display: flex; gap: 20px; }
.check-label { display: flex; grid-auto-flow: column; align-items: center; gap: 8px; }
.check-label input { width: 16px; min-height: 16px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 9px; }
.inline-label { min-width: 155px; }
.backup-card { padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.notice { position: sticky; top: 12px; z-index: 4; margin-top: 14px; padding: 12px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); }
.notice.success { color: #1b604d; background: #e7f5ed; border: 1px solid #c5e8d2; }
.notice.error { color: #8a3030; background: #fff0ef; border: 1px solid #f1d0cd; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 30% 20%, #edf4ef, transparent 40%), var(--paper); }
.login-card { width: min(100%, 410px); padding: 35px; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 20px 60px rgb(23 53 51 / 10%); }
.login-card .brand-mark { margin-bottom: 24px; }
.login-card h1 { margin: 0 0 6px; font: 800 25px "Segoe UI", Arial, sans-serif; }
.login-card .muted { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.login-card label { margin-bottom: 15px; }
.login-card .button { margin-top: 7px; }
.form-error { min-height: 17px; color: var(--danger); font-size: 12px; margin: 10px 0 0; }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 17px; color: white; background: #234f4c; border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; }
body.dark { color-scheme: dark; --ink: #e1ece9; --muted: #9fb0ad; --paper: #152120; --surface: #1c2a29; --line: #314240; --brand: #79b9af; --brand-dark: #102928; --brand-pale: #243b38; --shadow: 0 8px 26px rgb(0 0 0 / 12%); }
body.dark input, body.dark select { color: var(--ink); background: #243331; border-color: #3a4c49; }
body.dark th { background: #243331; }
body.dark .button.secondary { color: var(--ink); background: #263634; border-color: #405450; }
body.dark .unit-choice { color: var(--ink); }

@media (max-width: 850px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; min-height: 0; padding: 14px; }
  .brand { padding: 0 5px 12px; }
  .navigation { display: flex; overflow-x: auto; gap: 5px; }
  .nav-link { flex: 0 0 auto; padding: 9px 11px; font-size: 12px; }
  .nav-link span { width: 18px; }
  .sidebar-footer { display: none; }
  .main-content { padding: 20px 16px 40px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-direction: column; }
  .management-layout { grid-template-columns: 1fr; }
  .unit-list { max-height: 260px; }
}
@media (max-width: 560px) {
  .topbar { gap: 10px; }
  .topbar h1 { font-size: 20px; }
  .topbar-actions .button { padding: 8px; }
  .filters { align-items: stretch; flex-wrap: wrap; }
  .filters label { width: calc(50% - 8px); flex: 1 1 140px; }
  .filters > .button { flex: 1 1 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .full-row { grid-column: 1; }
  .backup-card { align-items: flex-start; flex-direction: column; }
  .card-heading { align-items: flex-start; }
  .chart-card, .table-card, .form-card { padding: 15px; }
  .login-card { padding: 27px 22px; }
}
