/*
  Hand-written admin stylesheet for the Hotel ERP.
  No build step, no CDN, works fully offline: design tokens + plain CSS only.
*/

/* ------------------------------------------------------------------ tokens */

:root {
  color-scheme: light;

  /* Neutrals */
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #fafbff;
  --border: #e4e8f1;
  --border-strong: #cfd7e6;
  --text: #101828;
  --text-soft: #344054;
  --muted: #6b7691;

  /* Brand */
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-ink: #ffffff;
  --accent-soft: #eef1fe;
  --accent-hover: #4338ca;
  --grad-accent: linear-gradient(135deg, #4f46e5 0%, #6d3ae8 55%, #7c3aed 100%);

  /* Semantic */
  --green: #047857;
  --green-soft: #e7f7ef;
  --green-line: #b6e6cf;
  --amber: #a35a06;
  --amber-soft: #fff5e0;
  --amber-line: #f5dfae;
  --red: #c8203a;
  --red-soft: #fdecef;
  --red-line: #f6c6cf;
  --sky: #0d6b96;
  --sky-soft: #e6f4fb;
  --grey-soft: #eef0f5;

  /* Ink on the dark shell */
  --shell: #0e1428;
  --shell-2: #17203c;
  --shell-ink: #c3cde4;
  --shell-ink-soft: #7f8db3;

  /* Shape + depth */
  --r-xs: 6px;
  --r-sm: 9px;
  --r: 13px;
  --r-lg: 18px;
  --pill: 999px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 22px -14px rgba(16, 24, 40, .18);
  --shadow-md: 0 2px 4px rgba(16, 24, 40, .05), 0 16px 32px -18px rgba(16, 24, 40, .28);
  --shadow-lg: 0 24px 60px -26px rgba(16, 24, 40, .38);
  --ring: 0 0 0 3px rgba(var(--accent-rgb), .22);
  --ring-red: 0 0 0 3px rgba(200, 32, 58, .2);

  /* Surfaces that a theme may re-tint wholesale */
  --glass: rgba(255, 255, 255, .82);
  --tint: #f7f9fd;
  --tint-2: #fcfdff;
  --hover: #f3f6fc;
  --hover-line: #b9c4da;
  --accent-line: #d6ddf7;
  --accent-rgb: 79, 70, 229;
  --accent-edge: rgba(var(--accent-rgb), .3);
  --accent-tint-2: #eef1fe;
  --stripe: rgba(15, 23, 42, .014);
  --placeholder: #9aa5bd;
  --scroll: #c6cee0;
  --scroll-hover: #a9b4cc;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7691' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

  /* Dark shell */
  --shell-3: #1b2647;
  --shell-glow: rgba(124, 58, 237, .38);
  --shell-active-a: rgba(99, 91, 255, .95);
  --shell-active-b: rgba(124, 58, 237, .85);
  --shell-mark: #a78bfa;

  /* Page glows behind the content */
  --glow-a: rgba(124, 58, 237, .09);
  --glow-b: rgba(var(--accent-rgb), .07);

  /* Motion */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --swing: cubic-bezier(.16, .84, .44, 1);
  --fast: .16s;
  --mid: .3s;
  --slow: .48s;

  /* Comfortable defaults: one rem is deliberately larger than the browser's 16px
     baseline times nothing — every size below is in rem, so this single number is
     what makes the whole screen bigger or smaller without touching a rule. */
  --base: 15px;

  /* Shell measures */
  --pad: 1.7rem;
  --rail: 292px;
  --header: 76px;
  --touch: 44px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html { font-size: var(--base); }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.55 system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02", "ss01", "tnum" 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(var(--accent-rgb), .18); }

body {
  background-image:
    radial-gradient(1100px 420px at 100% -8%, var(--glow-a), transparent 60%),
    radial-gradient(900px 400px at 12% 0%, var(--glow-b), transparent 62%);
  background-attachment: fixed;
}

/* Slim, quiet scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--scroll); border: 3px solid transparent; background-clip: content-box; border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); background-clip: content-box; }

a { color: var(--accent); text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { color: var(--accent-hover); text-decoration: none; }

h1, h2, h3 { margin: 0 0 .55rem; font-weight: 680; line-height: 1.25; letter-spacing: -.016em; }
h1 { font-size: 1.62rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .65rem; }
small { color: var(--muted); font-size: .82rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

svg.ic { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ------------------------------------------------------------------ shell */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--rail);
  flex: 0 0 var(--rail);
  background: linear-gradient(178deg, var(--shell) 0%, var(--shell-2) 62%, var(--shell-3) 100%);
  color: var(--shell-ink);
  padding: 1.3rem 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 210px;
  background: radial-gradient(200px 130px at 22% -10%, var(--shell-glow), transparent 70%);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .35rem .6rem 1.15rem;
  position: relative;
  z-index: 1;
}
.brand-name { display: grid; font-size: 1.1rem; font-weight: 720; color: #fff; letter-spacing: -.016em; line-height: 1.2; }
.brand-tag { font-size: .66rem; font-weight: 600; color: var(--shell-ink-soft); letter-spacing: .1em; text-transform: uppercase; margin-top: .22rem; }
.brand-mark {
  width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: 13px;
  background: var(--grad-accent);
  box-shadow: 0 10px 20px -9px rgba(124, 58, 237, .9), inset 0 1px 0 rgba(255, 255, 255, .35);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 1.05rem;
}
.brand-mark svg { width: 23px; height: 23px; stroke: #fff; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* A hotel's own mark is drawn for white paper, so it sits on a light plate. */
.brand-mark.branded {
  width: auto; height: 44px; flex: 0 0 auto; min-width: 44px; max-width: 104px;
  padding: 4px 6px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 20px -11px rgba(2, 6, 23, .85), inset 0 0 0 1px rgba(2, 6, 23, .07);
}
.brand-mark.branded img { display: block; max-width: 100%; max-height: 36px; width: auto; height: auto; object-fit: contain; }

.nav-group {
  margin-top: 1.4rem;
  font-size: .69rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--shell-ink-soft);
  padding: 0 .7rem .45rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .72rem;
  min-height: 44px;
  padding: .58rem .78rem;
  border-radius: var(--r-sm);
  color: var(--shell-ink);
  font-size: .925rem;
  font-weight: 540;
  position: relative;
  z-index: 1;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.nav-link .ic { width: 20px; height: 20px; flex: 0 0 20px; opacity: .82; transition: opacity var(--fast) var(--ease), transform var(--mid) var(--swing); }
.nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; transform: translateX(3px); }
.nav-link:hover .ic { transform: scale(1.08); }
.nav-link:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); color: #fff; }
.nav-link:active { transform: translateX(3px) scale(.99); }
.nav-link.active {
  background: linear-gradient(100deg, var(--shell-active-a), var(--shell-active-b));
  color: #fff;
  font-weight: 660;
  box-shadow: 0 8px 16px -13px rgba(var(--accent-rgb), .8), inset 0 1px 0 rgba(255, 255, 255, .22);
  transform: none;
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -11px; top: 20%; bottom: 20%;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--shell-mark);
}
.nav-link.active .ic { opacity: 1; }

.sidebar-foot { margin-top: auto; padding: 1rem .35rem .1rem; position: relative; z-index: 1; }
.btn-shell {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: var(--touch);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .13);
  color: #dbe3f4;
  border-radius: var(--r-sm);
  padding: .55rem .9rem;
  font: inherit;
  font-size: .885rem;
  font-weight: 620;
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn-shell:hover { background: rgba(255, 255, 255, .15); color: #fff; border-color: rgba(255, 255, 255, .3); transform: translateY(-1px); }
.btn-shell:active { transform: translateY(0) scale(.99); }
.btn-shell:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: .85rem var(--pad);
  display: flex;
  align-items: center;
  gap: 1.1rem;
  justify-content: space-between;
  min-height: var(--header);
}
.topbar .who { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .84rem; text-align: left; }
.topbar .who strong { display: block; color: var(--text); font-size: .93rem; font-weight: 650; line-height: 1.3; }
.topbar .avatar {
  width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: var(--pill);
  background: var(--grad-accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: .85rem; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 10px 18px -10px rgba(var(--accent-rgb), .9);
  transition: transform var(--mid) var(--swing), box-shadow var(--mid) var(--ease);
}
.topbar .who:hover .avatar { transform: scale(1.06) rotate(-3deg); box-shadow: 0 14px 22px -10px rgba(var(--accent-rgb), .95); }
.topbar .prop-name { font-weight: 670; font-size: 1.02rem; letter-spacing: -.014em; }

/* Property switcher pill */
.prop-switch, .prop-static {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  min-height: 44px;
  padding: .4rem .6rem .4rem .95rem;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--muted);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.prop-switch { padding-right: .4rem; }
.prop-switch:hover, .prop-static:hover { border-color: var(--hover-line); box-shadow: var(--shadow); }
.prop-switch select {
  width: auto;
  max-width: 46vw;
  border: 0;
  background: transparent;
  padding: .3rem 1.7rem .3rem .2rem;
  font-weight: 640;
  font-size: .93rem;
  color: var(--text);
  cursor: pointer;
  box-shadow: none;
}
.prop-switch select:focus-visible { box-shadow: var(--ring); border-radius: var(--r-xs); }
.prop-static { padding: .42rem .95rem; }
.prop-static .ic { color: var(--accent); }

.content { padding: var(--pad); flex: 1 1 auto; }

/* Entrance for each block on the page, slightly staggered. */
.content > * { animation: fade-up .46s both var(--ease); }
.content > *:nth-child(2) { animation-delay: .05s; }
.content > *:nth-child(3) { animation-delay: .1s; }
.content > *:nth-child(4) { animation-delay: .15s; }
.content > *:nth-child(5) { animation-delay: .2s; }
.content > *:nth-child(n + 6) { animation-delay: .25s; }

@keyframes fade-up {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(.955) translate3d(0, 8px, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes slide-right {
  from { opacity: 0; transform: translate3d(-14px, 0, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pulse-soft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .28); }
  50%      { box-shadow: 0 0 0 7px rgba(var(--accent-rgb), 0); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes alert-out {
  to { opacity: 0; transform: translate3d(0, -6px, 0); }
}
/* The travelling head of the request bar: one band running left to right. */
@keyframes progress-run {
  0%   { transform: translate3d(-110%, 0, 0) scaleX(.4); }
  50%  { transform: translate3d(15%, 0, 0) scaleX(.85); }
  100% { transform: translate3d(115%, 0, 0) scaleX(.4); }
}

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: box-shadow var(--mid) var(--ease), transform var(--mid) var(--ease), border-color var(--mid) var(--ease);
}
.card > header {
  padding: 1.05rem 1.3rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .9rem;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--surface-2), rgba(248, 250, 255, .4));
}
.card > header h2, .card > header h3 { margin: 0; }
.card > .body { padding: 1.3rem; }
.card > .body.tight { padding: 0; }

/* Property card heading: the hotel's mark beside its name. */
.logo-head { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.logo-thumb {
  width: 38px; height: 38px; flex: 0 0 38px;
  object-fit: contain;
  padding: 3px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  box-shadow: var(--shadow-xs);
}

/* Footer strip for row-level actions (property cards, detail panels). */
.card-foot {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  padding: .9rem 1.3rem;
  border-top: 1px dashed var(--border);
  background: var(--surface-2);
}
.card-foot .spacer { flex: 1 1 auto; }
.card-foot .sweep { flex: 1 1 100%; margin: 0; justify-content: flex-end; font-size: .82rem; color: var(--muted); }
.card-foot form { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.card:hover { box-shadow: var(--shadow-md); }
.card.is-active { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-edge), var(--shadow); }
.grid > .card:hover { transform: translateY(-3px); }

/* ---------------------------------------------------------------- headings */

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.35rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.72rem; }
.page-head .sub { color: var(--muted); font-size: .89rem; margin-top: .15rem; }
.page-head .actions { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------ grids */

.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); }

.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.05rem 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease), border-color var(--mid) var(--ease);
  animation: pop-in .44s both var(--ease);
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--grad-accent);
  opacity: .9;
  transform-origin: left center;
  animation: grow-x .7s var(--ease) both;
}
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--accent-line); }
.stat .label { text-transform: uppercase; letter-spacing: .075em; font-size: .69rem; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 1.95rem; font-weight: 720; margin-top: .3rem; letter-spacing: -.034em; font-variant-numeric: tabular-nums; color: var(--text); }
.stat .foot { font-size: .81rem; color: var(--muted); margin-top: .2rem; }
.stat.tone-green::before { background: linear-gradient(90deg, #047857, #10b981); }
.stat.tone-amber::before { background: linear-gradient(90deg, #b45309, #f59e0b); }
.stat.tone-red::before { background: linear-gradient(90deg, #be123c, #f43f5e); }
.stat.tone-sky::before { background: linear-gradient(90deg, #0369a1, #38bdf8); }
.stat.tone-violet::before { background: linear-gradient(90deg, #6d28d9, #a78bfa); }
.stat.tone-slate::before { background: linear-gradient(90deg, #334155, #94a3b8); }

/* ------------------------------------------------------------------ tables */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
th, td { padding: .78rem .95rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
  background: var(--tint);
  font-weight: 680;
  font-size: .735rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  white-space: nowrap;
}
tbody tr { transition: background var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
tbody tr:nth-child(even) { background: var(--tint-2); }
tbody tr:hover { background: var(--accent-soft); }
tbody tr:last-child > td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td a { font-weight: 570; }
/* Definition rows (a th sitting beside its value) read as labels, not column heads. */
tbody th {
  width: 32%;
  background: transparent;
  font-weight: 640;
  font-size: .86rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  white-space: normal;
}
tbody tr:has(th):hover { background: transparent; }
.empty { padding: 3.2rem 1rem; text-align: center; color: var(--muted); font-size: .93rem; background: repeating-linear-gradient(180deg, transparent, transparent 24px, var(--stripe) 24px, var(--stripe) 48px); }
.empty strong { display: block; color: var(--text-soft); font-size: 1.02rem; margin-bottom: .25rem; }

/* ------------------------------------------------------------------ badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  padding: .23rem .68rem;
  border-radius: var(--pill);
  font-size: .77rem;
  font-weight: 660;
  letter-spacing: .005em;
  white-space: nowrap;
  background: var(--grey-soft);
  color: var(--text-soft);
  border: 1px solid transparent;
  vertical-align: middle;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; flex: 0 0 6px; }
.badge:empty::before { display: none; }
.badge-green { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.badge-amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.badge-red { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.badge-grey { background: var(--grey-soft); color: var(--muted); border-color: var(--border); }
.badge-live { animation: pulse-soft 2.4s ease-in-out infinite; }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 40px;
  padding: .55rem 1.05rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: .885rem;
  font-weight: 630;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              color var(--fast) var(--ease), transform var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease), filter var(--fast) var(--ease);
}
.btn:hover { background: var(--hover); border-color: var(--hover-line); color: var(--text); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
.btn-primary { background: var(--grad-accent); border-color: transparent; color: var(--accent-ink); box-shadow: 0 10px 20px -12px rgba(var(--accent-rgb), .95); }
.btn-primary:hover { background: var(--grad-accent); filter: brightness(1.07); color: #fff; border-color: transparent; box-shadow: 0 14px 26px -12px rgba(var(--accent-rgb), .95); }
.btn-primary:focus-visible { box-shadow: var(--ring), 0 10px 20px -12px rgba(var(--accent-rgb), .95); }
.btn-danger { background: var(--surface); border-color: var(--red-line); color: var(--red); }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 12px 22px -14px rgba(200, 32, 58, .95); }
.btn-danger:focus-visible { box-shadow: var(--ring-red); }
.btn-danger-solid { background: linear-gradient(135deg, #dc2b45, #be123c); border-color: transparent; color: #fff; }
.btn-danger-solid:hover { background: linear-gradient(135deg, #e0394f, #c9184a); border-color: transparent; color: #fff; }
.btn-sm { padding: .34rem .72rem; font-size: .815rem; min-height: 34px; border-radius: var(--r-xs); gap: .36rem; }
.btn-sm .ic { width: 15px; height: 15px; flex: 0 0 15px; }
.btn[disabled], .btn:disabled { opacity: .48; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
/* The button that sent the form spins until the response lands. */
.btn.is-busy { pointer-events: none; }
.btn.is-busy::after {
  content: "";
  width: 14px; height: 14px; flex: 0 0 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin .7s linear infinite;
}
form.inline { display: inline; }

/* ------------------------------------------------------------------ forms */

.field { margin-bottom: 1.1rem; }
.field > label { display: block; font-size: .825rem; font-weight: 660; color: var(--text-soft); margin-bottom: .35rem; letter-spacing: .005em; }
.field .req { color: var(--red); font-weight: 700; }
.input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: .58rem .85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font: inherit;
  font-size: .93rem;
  color: var(--text);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
.input::placeholder, textarea::placeholder { color: var(--placeholder); }
.input:hover, select:hover, textarea:hover { border-color: var(--hover-line); }
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.15rem;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right .72rem center;
}
textarea.input { min-height: 100px; resize: vertical; }
input[type="date"], input[type="time"] { min-height: 42px; }

/* A file picker in its own box, matching the other controls. */
input[type="file"] {
  min-height: 44px;
  font-size: .88rem;
  color: var(--muted);
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  margin: 0 .7rem 0 0;
  padding: .4rem .85rem;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-xs);
  background: var(--accent-tint-2);
  color: var(--accent);
  font: inherit;
  font-size: .85rem;
  font-weight: 660;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
input[type="file"]:hover::file-selector-button { background: var(--accent-soft); border-color: var(--accent-edge); }

/* Logo picker on the property form: the current mark beside the control. */
.logo-row { display: flex; align-items: flex-start; gap: 1.2rem; flex-wrap: wrap; }
.logo-row > .field { flex: 1 1 300px; margin-bottom: 0; }
.logo-preview {
  flex: 0 0 auto;
  width: 170px; height: 104px;
  display: block;
  object-fit: contain;
  padding: .55rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-xs);
}
.logo-preview-empty {
  display: grid; place-items: center;
  color: var(--muted);
  font-size: .78rem;
  border-style: dashed;
  border-color: var(--border-strong);
  box-shadow: none;
}
.checkline { display: inline-flex; align-items: center; gap: .55rem; font-size: .9rem; color: var(--text-soft); cursor: pointer; min-height: 30px; }
.checkline input { width: auto; accent-color: var(--accent); height: 17px; }
input[type="checkbox"], input[type="radio"] { cursor: pointer; }

/* Bulk toolbar sitting above a table with selectable rows. */
.bulk-bar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .72rem 1.05rem; margin-bottom: .85rem;
  background: linear-gradient(180deg, var(--surface-2), var(--accent-tint-2));
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-xs);
  animation: fade-up .38s both var(--ease);
}
.bulk-bar .input, .bulk-bar select { width: auto; min-height: 36px; padding: .3rem .7rem; font-size: .85rem; }
.bulk-bar > :last-child { margin-left: auto; }
.bulk-bar b { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 720; }
.bulk-bar .checkline { font-size: .87rem; }
.bulk-cell { width: 2.8rem; text-align: center; }
.bulk-cell input { width: auto; height: 17px; }

.hint { color: var(--muted); font-size: .82rem; margin-top: .35rem; }
.fields { display: grid; gap: 0 1.15rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.fields .full { grid-column: 1 / -1; }

/* ---------------------------------------------------- which hotel am I editing */

/* Screens whose data belongs to one hotel name that hotel, so two identical
   looking lists are never mistaken for one shared list. */
/* The band is the whole card on a scoped screen, so it carries no inner rule. */
.scope-bar {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  padding: .95rem 1.3rem;
  background: var(--accent-soft);
}
.scope-who { display: flex; align-items: center; gap: .6rem; min-width: 0; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.scope-who .scope-name { color: var(--text); font-size: 1.06rem; }
.scope-who .mono { color: var(--muted); }
.scope-bar .prop-switch { background: var(--surface); }
.list-hotel { font-size: .84rem; font-weight: 560; color: var(--muted); white-space: nowrap; }

/* -------------------------------------------------------------- staff access */

/* Jobs as chips, so a growing role list stays one short band instead of a column. */
.check-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.check-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 38px;
  padding: .35rem .8rem .35rem .62rem; border-radius: var(--pill);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: .87rem; font-weight: 620; color: var(--text-soft); cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease),
              color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.check-chip input { width: auto; height: 16px; margin: 0; accent-color: var(--accent); }
.check-chip:hover { border-color: var(--accent-edge); background: var(--accent-tint-2); transform: translateY(-1px); }
.check-chip:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }

/* A scope with nothing to choose still reads as a filled field, not a missing one. */
.pick-static {
  display: flex; align-items: center; min-height: 42px; padding: .4rem .85rem;
  border: 1px dashed var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface-2); font-size: .9rem; font-weight: 620; color: var(--text-soft);
}

/* One job at one hotel. A pill per grant keeps the staff list narrow however many
   hotels the platform carries, where a role x hotel grid did not. */
.access-pills { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.access-pill {
  display: inline-flex; align-items: baseline; gap: .4rem;
  padding: .22rem .65rem; border-radius: var(--pill);
  border: 1px solid var(--accent-line); background: var(--accent-tint-2);
  font-size: .78rem; font-weight: 660; color: var(--accent); white-space: nowrap;
}
.access-pill .where { color: var(--muted); font-weight: 540; }
.access-pill .where::before { content: "@"; opacity: .65; margin-right: .15rem; }

td.cell-form, td.cell-access { vertical-align: top; }

.filters {
  display: flex; gap: .85rem; flex-wrap: wrap; align-items: flex-end;
  padding: 1.05rem 1.2rem;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.filters .field { margin: 0; min-width: 168px; }

/* Only ever shown on narrow screens, where the panel above would fill a screen. */
.filters-toggle {
  display: none; align-items: center; justify-content: space-between; gap: .6rem;
  width: 100%; min-height: var(--touch);
  padding: .5rem .8rem;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink);
  font: inherit; font-weight: 650; letter-spacing: .01em;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.filters-toggle::after {
  content: ""; flex: 0 0 9px; width: 9px; height: 9px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--mid) var(--swing);
}
.filters-toggle:active { transform: scale(.995); }
.body.filters-open .filters-toggle::after { transform: rotate(-135deg) translate(-2px, -2px); }

/* ------------------------------------------------------------------ alerts */

.alerts { margin-bottom: 1.25rem; display: grid; gap: .65rem; }
.alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: .9rem 1rem .9rem 1.15rem;
  font-size: .9rem;
  overflow: hidden;
  animation: slide-right .38s both var(--ease);
  box-shadow: var(--shadow-xs);
}
.alert::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: currentColor; opacity: .85; }
.alert-out { animation: alert-out .3s var(--ease) both; }
.alert-x {
  flex: 0 0 26px;
  width: 26px; height: 26px;
  margin-left: auto;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: currentColor;
  font: inherit; font-size: 1.15rem; line-height: 1;
  cursor: pointer; opacity: .55;
  transition: opacity var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.alert-x:hover { opacity: 1; background: rgba(2, 6, 23, .08); transform: rotate(90deg); }
.alert-success { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.alert-error { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.alert-warning { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.alert-info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.alert a { color: inherit; font-weight: 640; text-decoration: underline; }

/* ------------------------------------------------------------------ pieces */

.pager {
  display: flex; gap: .5rem; align-items: center; justify-content: space-between;
  padding: .95rem 1.3rem; border-top: 1px solid var(--border);
  font-size: .87rem; color: var(--muted); background: var(--surface-2);
  flex-wrap: wrap;
}
.pager .pager-pages { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.pg-cur {
  display: inline-grid; place-items: center;
  min-width: 32px; height: 32px; padding: 0 .45rem;
  border-radius: var(--r-xs);
  background: var(--grad-accent);
  color: #fff; font-weight: 700; font-size: .84rem;
  box-shadow: 0 8px 16px -10px rgba(var(--accent-rgb), .95);
}

.calendar td, .calendar th { text-align: center; padding: .5rem .4rem; font-size: .83rem; }
.calendar .type { text-align: left; white-space: nowrap; font-weight: 640; }
.cell {
  border-radius: var(--r-xs);
  padding: .38rem .25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.cell:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.cell-ok { background: var(--green-soft); color: var(--green); }
.cell-thin { background: var(--amber-soft); color: var(--amber); }
.cell-none { background: var(--red-soft); color: var(--red); }

.boards { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--mid) var(--ease), transform var(--mid) var(--ease);
}
.board:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.board > h3 {
  padding: .85rem 1rem; margin: 0;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(180deg, var(--surface-2), rgba(248, 250, 255, .3));
  font-size: .95rem;
}
.board ul { list-style: none; margin: 0; padding: .45rem .6rem; }
.board li {
  padding: .62rem .55rem;
  border-bottom: 1px dashed var(--border);
  font-size: .88rem;
  border-radius: var(--r-xs);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.board li:hover { background: var(--accent-soft); transform: translateX(3px); }
.board li:last-child { border-bottom: 0; }
.board .count { color: var(--muted); font-weight: 550; font-variant-numeric: tabular-nums; }

.ledger td { font-variant-numeric: tabular-nums; }
.total-row td { font-weight: 720; background: var(--accent-soft); color: var(--text); border-top: 1px solid var(--accent-line); }

.timeline { list-style: none; margin: 0; padding: 0; font-size: .885rem; }
.timeline li { padding: .7rem .25rem; border-bottom: 1px solid var(--border); transition: background var(--fast) var(--ease); }
.timeline li:hover { background: var(--surface-2); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-size: .79rem; letter-spacing: .01em; }

.bar { height: 9px; background: var(--grey-soft); border-radius: var(--pill); overflow: hidden; box-shadow: inset 0 1px 2px rgba(16, 24, 40, .07); }
.bar > i {
  display: block; height: 100%;
  background: var(--grad-accent);
  border-radius: var(--pill);
  transform-origin: left center;
  animation: grow-x .9s var(--ease) both;
  transition: width var(--mid) var(--ease);
}

/* ------------------------------------------------------------------ utils */

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace; font-size: .865rem; letter-spacing: -.01em; }
code { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace; font-size: .84em; background: var(--grey-soft); border: 1px solid var(--border); border-radius: 5px; padding: .08rem .35rem; }
.stack { display: grid; gap: 1.1rem; }
.btn-row { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }
/* An inline editor inside a table cell must not fold into one control per line;
   the surrounding .table-scroll absorbs the extra width instead. */
td .btn-row { flex-wrap: nowrap; }
td .btn-row .input { min-width: 9rem; }
td .btn-row .input[type="number"] { flex: 0 0 auto; width: 5rem; min-width: 4.5rem; }
td .btn-row .btn { flex: 0 0 auto; }
/* Action bar that stays in view while a long form scrolls. */
.form-actions {
  position: sticky;
  bottom: .9rem;
  z-index: 10;
  margin-top: 1.1rem;
  padding: .85rem 1.05rem;
  display: flex; gap: .55rem; flex-wrap: wrap; align-items: center;
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
}

/* ------------------------------------------------------------------ auth */

.auth-wrap {
  display: grid; place-items: center; min-height: 100vh; padding: 2rem;
  background: linear-gradient(140deg, #0e1428 0%, #221a52 48%, #4f46e5 100%);
  position: relative; overflow: hidden;
}
.auth-wrap::before, .auth-wrap::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55;
  animation: drift 16s ease-in-out infinite alternate;
}
.auth-wrap::before { width: 460px; height: 460px; background: rgba(124, 58, 237, .7); top: -120px; left: -90px; }
.auth-wrap::after { width: 380px; height: 380px; background: rgba(56, 189, 248, .45); bottom: -110px; right: -70px; animation-delay: -8s; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(60px, 40px, 0) scale(1.15); }
}
.auth-card {
  position: relative; z-index: 1;
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: var(--r-lg);
  padding: 2.4rem;
  width: 100%; max-width: 430px;
  box-shadow: var(--shadow-lg);
  animation: pop-in .55s both var(--ease);
}
.auth-card h1 { font-size: 1.45rem; }
.auth-card .sub { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.auth-card .btn { min-height: 46px; font-size: .95rem; }

/* ------------------------------------------------------------------ print */

.print-body { background: #fff; }
.invoice-sheet { max-width: 800px; margin: 0 auto; padding: 1.5rem; }
.invoice-sheet header { display: flex; justify-content: space-between; gap: 2rem; border-bottom: 2px solid #101828; padding-bottom: 1rem; margin-bottom: 1.25rem; }
.invoice-sheet .party { font-size: .85rem; }
.invoice-sheet .party strong { display: block; font-size: 1rem; }
.invoice-sheet .invoice-logo {
  display: block;
  max-width: 190px; max-height: 78px;
  width: auto; height: auto;
  object-fit: contain;
  margin: 0 0 .55rem;
  /* Keep the mark's own colours on paper. */
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.invoice-sheet .toolrow { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.invoice-sheet .digital-copy {
  margin-top: 1.6rem; padding-top: .7rem; border-top: 1px solid #d7dbe3;
  font-size: .78rem; color: #475467; text-align: center; font-style: italic;
}

@media print {
  .no-print, .sidebar, .topbar, .nav-toggle, .scrim, .progress-bar, .working, .filters-toggle { display: none !important; }
  body { background: #fff; font-size: 12px; background-image: none; }
  .content { padding: 0; }
  .content > * { animation: none; }
  .invoice-sheet { margin: 0; padding: 0; max-width: none; }
  .card, .stat, .board { box-shadow: none; border-color: #d7dbe3; }
  a { color: inherit; }
}

/* ------------------------------------------- request bar, drawer, scrim */

/* A plain PHP screen reloads for every action, so "did the server get this?" is
   never obvious. The bar appears the instant a request goes out; the heavier veil
   only follows if the round trip is still running after a beat. */
.progress-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 90;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--fast) linear;
}
.progress-bar > i {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 42%;
  border-radius: var(--pill);
  background: var(--grad-accent);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), .75);
  transform: translate3d(-110%, 0, 0);
}
body.is-loading .progress-bar { opacity: 1; }
body.is-loading .progress-bar > i { animation: progress-run 1.2s var(--ease) infinite; }

.working {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(10, 15, 30, .28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--mid) var(--ease), visibility var(--mid);
}
body.is-loading.working-on .working { opacity: 1; visibility: visible; }
.working > span {
  display: inline-flex; align-items: center; gap: .75rem;
  padding: .95rem 1.5rem;
  border-radius: var(--pill);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: .95rem; font-weight: 650; color: var(--text-soft);
  animation: pop-in .3s both var(--ease);
}
.spin {
  width: 19px; height: 19px; flex: 0 0 19px;
  border-radius: 50%;
  border: 2.5px solid var(--accent-line);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}

/* Opens the navigation rail on screens too narrow to keep it beside the page. */
.nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: 0 0 44px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease),
              background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.nav-toggle .ic { width: 22px; height: 22px; flex: 0 0 22px; }
.nav-toggle:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-tint-2); transform: translateY(-1px); }
.nav-toggle:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
/* The hamburger turns into a cross while the rail is open. */
.nav-toggle .to-x { display: none; }
.nav-open .nav-toggle .to-menu { display: none; }
.nav-open .nav-toggle .to-x { display: block; }

.scrim { display: none; }

.topbar-left { display: flex; align-items: center; gap: .8rem; min-width: 0; }

/* ------------------------------------------------------------------ narrow */

@media (max-width: 1280px) {
  :root { --rail: 264px; --pad: 1.4rem; --header: 72px; }
}

@media (max-width: 1024px) {
  :root { --base: 14.5px; --pad: 1.15rem; }

  .shell { flex-direction: column; }

  /* Without script the rail stays what it has always been here: a strip of
     links across the top, because nothing can open a drawer. */
  .sidebar {
    position: static;
    width: auto; flex: none; height: auto;
    flex-direction: row; align-items: center; flex-wrap: wrap; gap: .35rem;
    overflow-x: auto;
    padding: .7rem .9rem;
  }
  .sidebar::after { display: none; }
  .brand { padding: 0 .5rem .2rem; }
  .nav-group { display: none; }
  .nav-link { white-space: nowrap; min-height: 40px; padding: .5rem .8rem; }
  .nav-link.active::before { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; }
  .btn-shell { width: auto; }
  .content > * { animation: none; }

  /* With script it slides in over the page instead. */
  .js .nav-toggle { display: inline-flex; }
  .js .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(86vw, 330px);
    flex: none;
    height: 100vh;
    height: 100dvh;
    flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: .2rem;
    overflow-x: hidden; overflow-y: auto;
    padding: 1.2rem .95rem calc(1.2rem + env(safe-area-inset-bottom, 0));
    transform: translate3d(-102%, 0, 0);
    visibility: hidden;
    box-shadow: none;
    transition: transform var(--mid) var(--swing), visibility var(--mid), box-shadow var(--mid) var(--ease);
  }
  .js .sidebar::after { display: block; }
  .js .brand { padding: .35rem .6rem 1.15rem; }
  .js .nav-group { display: block; }
  .js .nav-link { white-space: normal; min-height: 46px; font-size: .95rem; }
  .js .sidebar-foot { margin: 0; padding: 1rem .35rem .1rem; }
  .js .btn-shell { width: 100%; }
  .js.nav-open .sidebar {
    transform: none;
    visibility: visible;
    box-shadow: 30px 0 70px -34px rgba(2, 6, 23, .8);
  }
  .js.nav-open { overflow: hidden; }
  .js .scrim {
    display: block;
    position: fixed; inset: 0;
    z-index: 55;
    background: rgba(6, 10, 24, .55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden;
    border: 0; padding: 0;
    transition: opacity var(--mid) var(--ease), visibility var(--mid);
  }
  .js.nav-open .scrim { opacity: 1; visibility: visible; }

  /* Rail items arrive one after the other as it opens. */
  .js.nav-open .sidebar .nav-link { animation: slide-right .32s both var(--ease); }
  .js.nav-open .sidebar .nav-link:nth-of-type(2) { animation-delay: .03s; }
  .js.nav-open .sidebar .nav-link:nth-of-type(3) { animation-delay: .06s; }
  .js.nav-open .sidebar .nav-link:nth-of-type(4) { animation-delay: .09s; }
  .js.nav-open .sidebar .nav-link:nth-of-type(5) { animation-delay: .12s; }
  .js.nav-open .sidebar .nav-link:nth-of-type(6) { animation-delay: .15s; }
  .js.nav-open .sidebar .nav-link:nth-of-type(n + 7) { animation-delay: .18s; }
}

@media (max-width: 860px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .boards { grid-template-columns: 1fr; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .topbar { padding: .7rem 1rem; }
  .topbar .who-text { display: none; }
  .filters .field { flex: 1 1 calc(50% - .85rem); min-width: 0; }
}

@media (max-width: 640px) {
  :root { --base: 14px; --pad: .95rem; }
  h1, .page-head h1 { font-size: 1.35rem; }
  .stat .value { font-size: 1.6rem; }
  .card > header, .card > .body, .card-foot, .scope-bar, .pager, .filters { padding-left: 1rem; padding-right: 1rem; }
  th, td { padding: .62rem .72rem; }
  .btn { padding-left: .85rem; padding-right: .85rem; }
  .prop-switch, .prop-static { min-height: 40px; }
  .prop-switch .ic, .prop-static .ic { display: none; }
  .prop-switch select { max-width: 52vw; font-size: .88rem; }
  .prop-switch, .prop-static { padding-left: .8rem; }
  .auth-wrap { padding: 1.1rem; }
  .auth-card { padding: 1.6rem; }
  .filters .field { flex: 1 1 100%; }
  /* A phone screen is shorter than one open filter panel, so it starts folded. */
  .js .filters-toggle { display: flex; }
  .js .body.has-filters:not(.filters-open) > form.filters { display: none; }
  .body.has-filters { padding: .7rem .85rem; }
  .js .body.has-filters.filters-open form.filters { padding: .9rem 0 0; background: none; }
  .fields { grid-template-columns: 1fr; }
  /* The save bar becomes an edge-to-edge strip the thumb can reach. */
  .form-actions {
    bottom: 0;
    margin-left: calc(-1 * var(--pad));
    margin-right: calc(-1 * var(--pad));
    border-radius: var(--r) var(--r) 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
    padding-bottom: calc(.85rem + env(safe-area-inset-bottom, 0));
  }
  .form-actions .btn { flex: 1 1 auto; min-height: var(--touch); }
}

/* Below this even two tiles side by side get unreadable. */
@media (max-width: 380px) {
  .grid.cols-4 { grid-template-columns: 1fr; }
  .bulk-bar > :last-child { margin-left: 0; width: 100%; justify-content: center; }
  .topbar-right { gap: .6rem; }
}

/* ------------------------------------------------------------------ themes */

.topbar-right { display: flex; align-items: center; gap: 1rem; }

.theme-menu { position: relative; }
.theme-menu > summary {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: var(--pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  box-shadow: var(--shadow-xs);
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease),
              transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.theme-menu > summary::-webkit-details-marker { display: none; }
.theme-menu > summary:hover { color: var(--accent); border-color: var(--accent-line); transform: translateY(-2px) rotate(-12deg); box-shadow: var(--shadow); }
.theme-menu[open] > summary { color: var(--accent); border-color: var(--accent); box-shadow: var(--ring); }
.theme-pop {
  position: absolute;
  right: 0; top: calc(100% + .55rem);
  z-index: 40;
  min-width: 214px;
  padding: .6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  animation: pop-in .24s both var(--ease);
}
.theme-cap { margin: .2rem .4rem .55rem; font-size: .71rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.theme-pop form { margin: 0; }
.theme-swatch {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  min-height: 42px;
  padding: .48rem .62rem;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; color: var(--text-soft);
  font: inherit; font-size: .885rem; font-weight: 560; text-align: left; cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.theme-swatch:hover { background: var(--accent-soft); border-color: var(--accent-line); transform: translateX(3px); }
.theme-swatch.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 660; }
.theme-chip {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 9px;
  background: linear-gradient(135deg, var(--sw1), var(--sw2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), var(--shadow-xs);
}
.theme-swatch.active::after {
  content: ""; margin-left: auto; width: 8px; height: 8px;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

option { background: var(--surface); color: var(--text); }

html[data-theme="emerald"] {
  --accent: #047857;
  --accent-2: #0d9488;
  --accent-hover: #065f46;
  --accent-soft: #e4f5ee;
  --accent-tint-2: #effaf5;
  --accent-line: #c4e9d9;
  --accent-rgb: 4, 120, 87;
  --accent-edge: rgba(4, 120, 87, .3);
  --grad-accent: linear-gradient(135deg, #047857 0%, #0a8f6d 55%, #0d9488 100%);
  --ring: 0 0 0 3px rgba(4, 120, 87, .22);
  --bg: #f2f7f5;
  --glow-a: rgba(13, 148, 136, .11);
  --glow-b: rgba(4, 120, 87, .08);
  --shell-active-a: rgba(16, 185, 129, .95);
  --shell-active-b: rgba(13, 148, 136, .85);
  --shell-mark: #6ee7b7;
  --shell-glow: rgba(13, 148, 136, .4);
}

html[data-theme="sunset"] {
  --accent: #d9540c;
  --accent-2: #db2777;
  --accent-hover: #b8430a;
  --accent-soft: #fdece0;
  --accent-tint-2: #fdf2e9;
  --accent-line: #f6d8c2;
  --accent-rgb: 217, 84, 12;
  --accent-edge: rgba(217, 84, 12, .3);
  --grad-accent: linear-gradient(135deg, #ea580c 0%, #e0413f 55%, #db2777 100%);
  --ring: 0 0 0 3px rgba(217, 84, 12, .22);
  --bg: #fbf6f1;
  --text: #221812;
  --text-soft: #453126;
  --muted: #7d6a5e;
  --border: #eee2d8;
  --border-strong: #dcc8b9;
  --grey-soft: #f3eae2;
  --tint: #fbf5ef;
  --tint-2: #fdf9f5;
  --hover: #f8efe6;
  --hover-line: #dcc0aa;
  --glow-a: rgba(219, 39, 119, .1);
  --glow-b: rgba(234, 88, 12, .09);
  --shell: #24120a;
  --shell-2: #3b1a12;
  --shell-3: #4d1d19;
  --shell-ink: #f0dccc;
  --shell-ink-soft: #b99180;
  --shell-glow: rgba(234, 88, 12, .42);
  --shell-active-a: rgba(249, 115, 22, .95);
  --shell-active-b: rgba(219, 39, 119, .85);
  --shell-mark: #fdba74;
}

html[data-theme="midnight"] {
  color-scheme: dark;

  --bg: #0b1120;
  --surface: #141d33;
  --surface-2: #18223b;
  --border: #26324c;
  --border-strong: #37486a;
  --text: #e9eefb;
  --text-soft: #cbd6ea;
  --muted: #92a2c2;
  --grey-soft: #1f2b45;

  --accent: #6d75f5;
  --accent-2: #22d3ee;
  --accent-hover: #8a91ff;
  --accent-soft: rgba(109, 117, 245, .17);
  --accent-tint-2: rgba(109, 117, 245, .1);
  --accent-line: rgba(138, 145, 255, .34);
  --accent-rgb: 109, 117, 245;
  --accent-edge: rgba(109, 117, 245, .42);
  --grad-accent: linear-gradient(135deg, #6366f1 0%, #7c6cf8 55%, #22d3ee 140%);
  --ring: 0 0 0 3px rgba(138, 145, 255, .3);

  --green: #34d399;
  --green-soft: rgba(52, 211, 153, .15);
  --green-line: rgba(52, 211, 153, .32);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, .14);
  --amber-line: rgba(251, 191, 36, .32);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, .15);
  --red-line: rgba(251, 113, 133, .32);
  --sky: #38bdf8;
  --sky-soft: rgba(56, 189, 248, .15);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 10px 24px -16px rgba(0, 0, 0, .85);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, .5), 0 18px 34px -18px rgba(0, 0, 0, .9);
  --shadow-lg: 0 26px 60px -26px rgba(0, 0, 0, .95);

  --glass: rgba(20, 29, 51, .82);
  --tint: #18223b;
  --tint-2: #16203a;
  --hover: #21304e;
  --hover-line: #43567b;
  --placeholder: #6f81a6;
  --stripe: rgba(255, 255, 255, .035);
  --scroll: #2c3a58;
  --scroll-hover: #3d5177;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2392a2c2' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

  --shell: #090f1e;
  --shell-2: #101a31;
  --shell-3: #142043;
  --shell-glow: rgba(99, 102, 241, .34);
  --shell-active-a: rgba(99, 102, 241, .9);
  --shell-active-b: rgba(34, 211, 238, .55);
  --shell-mark: #67e8f9;

  --glow-a: rgba(99, 102, 241, .16);
  --glow-b: rgba(34, 211, 238, .08);
}

/* Native date pickers and the sign-in stage follow the theme too. */
html[data-theme="midnight"] input::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.65); }
html[data-theme="midnight"] .auth-wrap { background: linear-gradient(140deg, #060a16 0%, #131c3a 48%, #3b3f8f 100%); }
html[data-theme="midnight"] .auth-card { background: rgba(20, 29, 51, .96); border-color: var(--border); }
html[data-theme="midnight"] .btn-danger-solid { background: linear-gradient(135deg, #e11d48, #9f1239); }
html[data-theme="sunset"] .auth-wrap { background: linear-gradient(140deg, #2a1108 0%, #6b1f2a 48%, #db2777 100%); }
html[data-theme="emerald"] .auth-wrap { background: linear-gradient(140deg, #06231b 0%, #0b4a43 48%, #0d9488 100%); }

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
    scroll-behavior: auto !important;
  }
}
