/* Hotel Manager — design system (no build step, no external dependencies) */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-ink: #ffffff;
  --primary-soft: #e8efff;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --success: #16a34a;
  --success-soft: #e8f7ee;
  --warning: #d97706;
  --warning-soft: #fdf3e3;

  --st-ready: #16a34a;     --st-ready-bg: #e6f6ec;
  --st-occupied: #2563eb;  --st-occupied-bg: #e8efff;
  --st-dirty: #dc2626;     --st-dirty-bg: #fdecec;
  --st-cleaning: #d97706;  --st-cleaning-bg: #fdf3e3;
  --st-oos: #64748b;       --st-oos-bg: #eef1f5;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .05);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #0f172a;
    --border: #243045;
    --text: #e5e9f0;
    --muted: #94a3b8;
    --primary: #60a5fa;
    --primary-ink: #0b1120;
    --primary-soft: #172554;
    --danger: #f87171;     --danger-soft: #3a1414;
    --success: #4ade80;    --success-soft: #0f2e1b;
    --warning: #fbbf24;    --warning-soft: #3a2a0a;
    --st-ready: #4ade80;    --st-ready-bg: #0f2e1b;
    --st-occupied: #60a5fa; --st-occupied-bg: #172554;
    --st-dirty: #f87171;    --st-dirty-bg: #3a1414;
    --st-cleaning: #fbbf24; --st-cleaning-bg: #3a2a0a;
    --st-oos: #94a3b8;      --st-oos-bg: #1e293b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; font-size: 17px;
}
.nav { display: flex; gap: .25rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: .45rem .75rem; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.user-menu { display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--primary-soft); color: var(--primary);
}
.user-name { font-size: 13px; line-height: 1.2; }
.user-name small { display: block; }

.container { max-width: 1280px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.container.narrow { max-width: 860px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head p { margin: 0; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: .25rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cols { display: grid; gap: 1rem; grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 960px) { .cols { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .8rem; }
.card-head h2 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 1rem 1.2rem 0; }

/* ---------- KPIs ---------- */
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.kpi .hint { font-size: 12px; color: var(--muted); }
.kpi.ready .value { color: var(--st-ready); }
.kpi.occupied .value { color: var(--st-occupied); }
.kpi.dirty .value { color: var(--st-dirty); }
.kpi.cleaning .value { color: var(--st-cleaning); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: .4rem; }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

/* ---------- Status badges & room tiles ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: 12px; font-weight: 600; padding: .2rem .55rem; border-radius: 99px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.st-ready { background: var(--st-ready-bg); color: var(--st-ready); }
.st-occupied { background: var(--st-occupied-bg); color: var(--st-occupied); }
.st-dirty { background: var(--st-dirty-bg); color: var(--st-dirty); }
.st-cleaning { background: var(--st-cleaning-bg); color: var(--st-cleaning); }
.st-oos { background: var(--st-oos-bg); color: var(--st-oos); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.info { background: var(--primary-soft); color: var(--primary); }

.legend { display: flex; flex-wrap: wrap; gap: .4rem; }
.rooms { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.room-tile {
  display: block; position: relative;
  border-radius: 12px; padding: .7rem .8rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 5px solid var(--st-oos);
  transition: transform .08s ease, box-shadow .08s ease;
}
.room-tile:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.room-tile .num { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
.room-tile .type { font-size: 12px; color: var(--muted); }
.room-tile .who { font-size: 12px; margin-top: .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-tile .badge { margin-top: .35rem; }
.room-tile.ready { border-left-color: var(--st-ready); }
.room-tile.occupied { border-left-color: var(--st-occupied); }
.room-tile.dirty { border-left-color: var(--st-dirty); }
.room-tile.cleaning { border-left-color: var(--st-cleaning); }
.room-tile.oos { border-left-color: var(--st-oos); opacity: .8; }

/* ---------- Tabs / chips ---------- */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip {
  padding: .35rem .8rem; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-weight: 500; font-size: 14px;
}
.chip:hover { text-decoration: none; color: var(--text); }
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: .75rem; align-items: center; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .sub { font-size: 13px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 1.5rem .5rem; }
.empty .icon { font-size: 2rem; display: block; margin-bottom: .3rem; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.3rem; border-left: 2px solid var(--border); margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.timeline li:last-child { padding-bottom: 0; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: .3rem; }
.field { margin-bottom: .9rem; }
.field .help { font-size: 12px; color: var(--muted); margin-top: .25rem; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .6rem .75rem; min-height: 42px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.check { display: flex; align-items: center; gap: .45rem; font-weight: 500; font-size: 14px; }
.check input { width: 18px; height: 18px; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.filters { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.filters .field { margin: 0; }
.inline-form { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.inline-form select, .inline-form input { min-height: 34px; padding: .3rem .5rem; width: auto; font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 600; font-size: 14px;
  padding: .6rem 1rem; min-height: 42px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.sm { min-height: 32px; padding: .3rem .65rem; font-size: 13px; }
.btn.lg { min-height: 52px; padding: .8rem 1.4rem; font-size: 16px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-weight: 500; }
.alert.ok { background: var(--success-soft); color: var(--success); }
.alert.err { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--primary-soft); color: var(--primary); }
.alert.warn { background: var(--warning-soft); color: var(--warning); }
.alert ul { margin: 0; padding-left: 1.1rem; }

/* ---------- Auth pages ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(37, 99, 235, .18), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, rgba(124, 58, 237, .16), transparent 60%), var(--bg);
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; font-size: 1.25rem; margin-bottom: 1.25rem; }
.auth-card .brand-logo { width: 42px; height: 42px; font-size: 22px; border-radius: 12px; }
.demo { font-size: 13px; margin-top: 1rem; }
.demo code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 5px; }

/* ---------- Housekeeping (mobile first) ---------- */
.steps { display: flex; gap: .5rem; margin-bottom: 1rem; }
.step { flex: 1; padding: .55rem .7rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.step b { display: block; color: var(--text); font-size: 14px; }
.step.done { border-color: var(--st-ready); }
.step.done b::after { content: " ✓"; color: var(--st-ready); }
.step.current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.item-group + .item-group { margin-top: 1rem; }
.item-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .4rem; }
.item-row { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: center; padding: .55rem 0; border-bottom: 1px dashed var(--border); }
.item-row:last-child { border-bottom: 0; }
.item-row .name { font-weight: 600; }
.item-row .meta { font-size: 12px; color: var(--muted); }
.item-row .inputs { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.item-row .inputs .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { width: 38px; height: 38px; border: 0; background: var(--surface-2); color: var(--text); font-size: 18px; cursor: pointer; }
.stepper button:active { background: var(--border); }
.stepper input { width: 46px; min-height: 38px; border: 0; border-radius: 0; text-align: center; padding: 0; font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; }
.stepper.changed { border-color: var(--primary); }

.photo-picker { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; background: var(--surface-2); }
.photo-picker.has-photos { text-align: left; }
.photo-picker .actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.photo-picker input[type=file] { display: none; }
.thumbs { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); margin-top: .75rem; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.photo-count { font-size: 13px; color: var(--muted); margin-top: .5rem; }

.sticky-actions {
  position: sticky; bottom: 0; z-index: 10;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 1rem 0 .5rem; margin-top: 1rem;
}

.task-card { display: flex; gap: .75rem; align-items: center; padding: .8rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); }
.task-card:hover { text-decoration: none; box-shadow: var(--shadow); }
.task-card .big { font-size: 1.4rem; font-weight: 700; min-width: 3.2rem; text-align: center; }
.task-card .grow { flex: 1; min-width: 0; }
.task-list { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---------- Gallery & lightbox ---------- */
.gallery { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.gallery a { display: block; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--border); }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s ease; }
.gallery a:hover img { transform: scale(1.03); }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
.lightbox::backdrop { background: rgba(0, 0, 0, .85); }
.lightbox img { max-width: 96vw; max-height: 88vh; display: block; border-radius: 8px; }
.lightbox .caption { color: #fff; text-align: center; padding: .5rem; font-size: 14px; }
.lightbox .close { position: fixed; top: 12px; right: 16px; background: rgba(255, 255, 255, .15); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; }
.compare .down { color: var(--danger); font-weight: 600; }
.compare .up { color: var(--success); font-weight: 600; }
.note { background: var(--surface-2); border-radius: var(--radius-sm); padding: .7rem .85rem; white-space: pre-wrap; }
.issue { background: var(--warning-soft); color: var(--warning); border-radius: var(--radius-sm); padding: .7rem .85rem; font-weight: 500; }

details.admin-edit summary { cursor: pointer; color: var(--primary); font-size: 13px; font-weight: 600; list-style: none; }
details.admin-edit summary::-webkit-details-marker { display: none; }
details.admin-edit[open] { background: var(--surface-2); border-radius: 10px; padding: .6rem; margin-top: .3rem; }

.pager { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1.2rem; border-top: 1px solid var(--border); }

@media (max-width: 720px) {
  body { font-size: 15px; }
  h1 { font-size: 1.35rem; }
  .user-name { display: none; }
  .topbar-inner { flex-wrap: wrap; gap: .5rem; }
  .nav { order: 3; flex-basis: 100%; }
  .container { padding-top: 1rem; }
  .card { padding: 1rem; }
  .hide-sm { display: none; }
  .item-row { grid-template-columns: 1fr; }
  .item-row .inputs { justify-content: flex-start; }
}

/* ---------- Print (audit reports) ---------- */
@media print {
  .topbar, .no-print, .btn, .sticky-actions { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .container { padding: 0; max-width: none; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
}

.narrow { max-width: 860px; margin-left: auto; margin-right: auto; }

/* ---------- Language switcher ---------- */
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 99px; overflow: hidden; font-size: 12px; font-weight: 600; }
.lang-switch a { padding: .25rem .6rem; color: var(--muted); }
.lang-switch a:hover { text-decoration: none; color: var(--text); }
.lang-switch a.active { background: var(--primary-soft); color: var(--primary); }
