/* NSofts Stay theme.
   Layout: a floating deep-teal sidebar (the one bold element, with faint hill contours) beside a calm mist canvas of
   white panels. Titles in a warm serif, the interface in a clean sans. Phones get a bottom tab bar.
   Every colour is a token; dark mode redefines the tokens only. */

:root {
  --bg: #ECF1F0;
  --surface: #FFFFFF;
  --surface-2: #F5F8F7;
  --ink: #0E2326;
  --ink-2: #44595C;
  --ink-3: #7A8E90;
  --line: #E0E8E6;
  --line-2: #CBD8D5;
  --accent: #0A8A73;
  --accent-ink: #076A59;
  --accent-soft: #D7F1EA;
  --sun: #F3B13E;
  --pos: #12805C;   --pos-soft: #D8F1E5;
  --neg: #B93A0B;   --neg-soft: #FCE4D8;
  --warn: #8F5A00;  --warn-soft: #FBEBC8;
  --side-1: #11393D; --side-2: #0A2023;
  --side-ink: #DCEBE9; --side-dim: #86A3A1; --side-hover: rgba(255, 255, 255, .07); --side-active: rgba(255, 255, 255, .13);
  --radius: 20px; --radius-sm: 13px; --radius-xs: 10px;
  --shadow: 0 1px 2px rgba(14, 35, 38, .05), 0 10px 28px -14px rgba(14, 35, 38, .22);
  --shadow-lg: 0 2px 6px rgba(14, 35, 38, .08), 0 24px 60px -20px rgba(14, 35, 38, .38);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #081416; --surface: #10252A; --surface-2: #0D1F23; --ink: #E4F0EE; --ink-2: #A5BDBB; --ink-3: #6F8C8B;
    --line: #1C3338; --line-2: #2A464B; --accent: #2FC7AA; --accent-ink: #7BE0CB; --accent-soft: #123A37;
    --pos: #4FD19A; --pos-soft: #12372A; --neg: #F08A5D; --neg-soft: #3C2216; --warn: #E8B24E; --warn-soft: #3A2E12;
    --side-1: #0C2A2E; --side-2: #061113; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #081416; --surface: #10252A; --surface-2: #0D1F23; --ink: #E4F0EE; --ink-2: #A5BDBB; --ink-3: #6F8C8B;
  --line: #1C3338; --line-2: #2A464B; --accent: #2FC7AA; --accent-ink: #7BE0CB; --accent-soft: #123A37;
  --pos: #4FD19A; --pos-soft: #12372A; --neg: #F08A5D; --neg-soft: #3C2216; --warn: #E8B24E; --warn-soft: #3A2E12;
  --side-1: #0C2A2E; --side-2: #061113; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 14.5px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font: 500 30px/1.15 var(--display); letter-spacing: -.02em; }
h2 { font-size: 18px; } h3 { font-size: 15.5px; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
.spacer { flex: 1; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 13px; }
.hint { color: var(--ink-3); font-size: 13px; margin: 6px 0 0; }
.muted { color: var(--ink-3); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- layout */
.layout { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  position: sticky; top: 12px; align-self: flex-start; flex: none; width: 252px; height: calc(100vh - 24px);
  margin: 12px 0 12px 12px; padding: 18px 12px 14px; border-radius: 24px; overflow: hidden auto;
  display: flex; flex-direction: column; color: var(--side-ink);
  background: linear-gradient(168deg, var(--side-1) 0%, var(--side-2) 100%);
  box-shadow: var(--shadow-lg);
}
.sidebar::after { /* hill contours, very faint */
  content: ""; position: absolute; left: -30%; right: -30%; bottom: -26%; height: 62%; pointer-events: none; opacity: .5;
  background: repeating-radial-gradient(ellipse at 40% 100%, transparent 0 15px, rgba(255, 255, 255, .055) 15px 16px);
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar { scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; flex: none; display: block; }
.brand-name { font-weight: 700; font-size: 14.5px; line-height: 1.2; color: #fff; overflow-wrap: anywhere; }
.brand-sub { font-size: 12px; color: var(--side-dim); }
.nav-group { padding: 16px 10px 6px; font-size: 12px; font-weight: 600; color: var(--side-dim); letter-spacing: .02em; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0; border-radius: 13px;
  color: var(--side-ink); font-weight: 500; font-size: 14px; text-decoration: none; position: relative;
}
.nav-item svg { width: 19px; height: 19px; flex: none; opacity: .8; }
.nav-item:hover { background: var(--side-hover); text-decoration: none; }
.nav-item.active { background: var(--side-active); color: #fff; font-weight: 600; }
.nav-item.active svg { opacity: 1; color: var(--sun); }
.nav-foot { margin-top: auto; padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; border-top: 1px solid rgba(255, 255, 255, .1); }
.nav-user { flex: 1; min-width: 0; }
.nav-user-name { font-weight: 600; font-size: 13.5px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user-role { font-size: 12px; color: var(--side-dim); }
.sidebar .btn { background: rgba(255, 255, 255, .1); border-color: transparent; color: #fff; }
.sidebar .btn:hover { background: rgba(255, 255, 255, .18); }

.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 22px 36px 14px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px);
}
.page-sub { color: var(--ink-3); font-size: 13.5px; margin-top: 4px; }
.content { padding: 8px 36px 48px; max-width: 1180px; width: 100%; }
.lic-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 36px; padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; }
.lic-banner.warn { background: var(--warn-soft); color: var(--warn); }
.lic-banner.bad { background: var(--neg-soft); color: var(--neg); }
.lic-banner button { background: none; border: 0; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; }

/* ----------------------------------------------------------------- panels */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.grid { display: grid; gap: 18px; }

/* ----------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 14px 20px 10px; white-space: nowrap; }
td { padding: 14px 20px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
td:first-child { font-weight: 600; }
.empty { padding: 56px 24px; text-align: center; color: var(--ink-3); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  font: 600 14px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .12s, box-shadow .12s, background .12s;
}
.topbar { flex-wrap: wrap; row-gap: 10px; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { height: 32px; padding: 0 13px; font-size: 13px; border-radius: var(--radius-xs); }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -10px var(--accent); }
.btn-primary:hover { background: var(--accent-ink); transform: translateY(-1px); }
.btn-danger { background: var(--neg); border-color: transparent; color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------------------ chips */
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; }
.tag.pos { background: var(--pos-soft); color: var(--pos); border-color: transparent; }
.tag.neg { background: var(--neg-soft); color: var(--neg); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* ------------------------------------------------------------------ forms */
.field { margin-bottom: 16px; }
.field-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; height: 44px; padding: 0 14px; font: 500 14.5px var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 12px 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[disabled] { background: var(--surface-2); color: var(--ink-2); }
input[type="checkbox"] { width: auto; height: auto; accent-color: var(--accent); }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; }
.alert-error { background: var(--neg-soft); color: var(--neg); font-weight: 600; }
.alert ul { margin: 6px 0 0; padding-left: 18px; font-weight: 500; }

/* ------------------------------------------------------------ modal, toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(6, 20, 22, .5); backdrop-filter: blur(5px); }
.modal { width: 100%; max-width: 480px; max-height: 92vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg); animation: pop .16s ease-out; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; padding: 20px 24px 8px; }
.modal-head h2 { font: 500 22px var(--display); }
.modal-body { padding: 12px 24px 8px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; padding: 16px 24px 22px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.toast-host { position: fixed; z-index: 60; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 11px 20px; border-radius: 999px; background: #0E2326; color: #fff; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-lg); }
.toast.err { background: var(--neg); }

/* ---------------------------------------------------------- room calendar */
:root { --info: #2B5FA6; --info-soft: #DCE8F8; --block: #C6D1CF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --info: #7FB0F0; --info-soft: #17304F; --block: #2A3F42; } }
:root[data-theme="dark"] { --info: #7FB0F0; --info-soft: #17304F; --block: #2A3F42; }

.cal-wrap { overflow-x: auto; border-radius: var(--radius); }
.cal { min-width: 880px; }
.cal-row { display: grid; grid-template-columns: 132px repeat(var(--days), minmax(44px, 1fr)); position: relative; align-items: stretch; }
.cal-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line-2); }
.cal-head .d { text-align: center; padding: 8px 0 7px; font-size: 12px; color: var(--ink-3); line-height: 1.25; border-left: 1px solid var(--line); }
.cal-head .d b { display: block; font-size: 15px; color: var(--ink); font-weight: 700; }
.cal-head .d.today b { background: var(--accent); color: #fff; width: 26px; height: 26px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; font-size: 13px; }
.cal-head .d.we { background: var(--surface-2); }
.cal-label { padding: 0 12px; display: flex; align-items: center; font-weight: 600; font-size: 13.5px; background: var(--surface); position: sticky; left: 0; z-index: 2; border-top: 1px solid var(--line); }
.cal-group { background: var(--surface-2); }
.cal-group .cal-label { background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; }
.cal-group .n { text-align: center; font-size: 12px; font-weight: 700; padding: 8px 0; border-left: 1px solid var(--line); border-top: 1px solid var(--line); color: var(--ink-2); }
.cal-group .n.low { color: var(--warn); } .cal-group .n.out { color: var(--neg); background: var(--neg-soft); }
.cal-cell { height: 46px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); grid-row: 1; }
.cal-cell.we { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.cal-cell.today { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.cal-label { grid-row: 1; grid-column: 1; }
.cal-bar {
  grid-row: 1; z-index: 1; margin: 6px 2px; padding: 0 10px; border-radius: 10px; display: flex; align-items: center; gap: 6px; min-width: 0;
  font: 600 12.5px var(--font); text-align: left; cursor: pointer; border: 0; color: var(--accent-ink); background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.cal-bar span { overflow: hidden; text-overflow: ellipsis; }
.cal-bar:hover { filter: brightness(.96); }
.cal-bar.in { background: var(--accent); color: #fff; box-shadow: none; }
.cal-bar.bdc { background: var(--info-soft); color: var(--info); box-shadow: inset 3px 0 0 var(--info); }
.cal-bar.over { background: var(--neg-soft); color: var(--neg); box-shadow: inset 3px 0 0 var(--neg); }
.cal-bar.blk { background: repeating-linear-gradient(135deg, var(--block) 0 6px, transparent 6px 12px); color: var(--ink-2); box-shadow: none; border: 1px dashed var(--line-2); }
.cal-bar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-bar.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--ink-3); margin: 12px 4px 0; }
.cal-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 5px; margin-right: 6px; vertical-align: -3px; }

/* ----------------------------------------------------------- rooms free grid */
.av { border-collapse: separate; border-spacing: 0; min-width: 760px; }
.av th, .av td { padding: 0; text-align: center; border: 0; font-size: 13px; }
.av th { position: sticky; top: 0; background: var(--surface); padding: 10px 4px; z-index: 2; border-bottom: 1px solid var(--line-2); }
.av th.we { background: var(--surface-2); }
.av td:first-child, .av th:first-child { text-align: left; padding-left: 16px; min-width: 150px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.av td.c { height: 44px; min-width: 42px; font-weight: 700; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.av td.c.low { background: var(--warn-soft); color: var(--warn); }
.av td.c.zero { background: var(--neg-soft); color: var(--neg); }
.av td.c.over { background: var(--neg); color: #fff; }

/* ------------------------------------------------------------------ phone */
@media (max-width: 820px) {
  .layout { display: block; }
  .sidebar {
    position: fixed; z-index: 20; top: auto; bottom: 10px; left: 10px; right: 10px; width: auto; height: auto; margin: 0;
    padding: 8px; border-radius: 22px; flex-direction: row; align-items: center; overflow-x: auto; gap: 2px;
  }
  .sidebar::after, .brand, .nav-group { display: none; }
  .nav-item { flex-direction: column; gap: 3px; padding: 8px 12px; font-size: 11.5px; min-width: 66px; margin: 0; }
  .nav-foot { margin: 0 0 0 auto; padding: 0 4px 0 8px; border: 0; }
  .nav-user { display: none; }
  .topbar { padding: 18px 18px 10px; }
  h1 { font-size: 25px; }
  .content { padding: 6px 18px 120px; }
  .lic-banner { margin: 0 18px; }
  th, td { padding-left: 14px; padding-right: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
