/* Starlight & Stone Collective - shared dashboard design system.
Visual language sampled from the Aurora Nights concept-stage mockups
(mockups 1, 6, 8, 10) so every real screen looks like one product
instead of each page inventing its own styling. Shared across every
dashboard page via <link rel="stylesheet" href="/dashboard.css"> so a
future screen picks this up for free instead of re-styling from scratch. */

:root {
color-scheme: light;
--sidebar-bg: #1e1338;
--sidebar-bg-2: #241a42;
--sidebar-border: rgba(255, 255, 255, 0.08);
--sidebar-text: #b6acc9;
--sidebar-text-active: #ffffff;
--sidebar-active-bg: rgba(255, 255, 255, 0.09);
--brand-grad: linear-gradient(135deg, #a855f7, #ec4899);
--bg: #f5f4fa;
--card-bg: #ffffff;
--border: #e8e6f2;
--text: #170f2b;
--text-muted: #6b7280;
--purple: #7c3aed;
--purple-dark: #5b21b6;
--purple-soft: #f3eefe;
--pink: #ec4899;
--green: #22c55e;
--amber: #d97706;
--amber-bg: #fef3c7;
--red: #dc2626;
--radius: 12px;
--radius-sm: 8px;
--shadow-card: 0 1px 2px rgba(23, 15, 43, 0.05), 0 1px 1px rgba(23, 15, 43, 0.03);
--shadow-pop: 0 20px 50px rgba(20, 10, 40, 0.35);
/* Surfaces and status colors, as variables so dark mode can swap them. */
--surface: #ffffff;
--border-strong: #d9d5e8;
--text-inverse: #ffffff;
--muted-bg: #f1f0f7;
--dot-gray: #c7c2d6;
--green-bg: #dcfce7;
--green-text: #166534;
--green-strong: #15803d;
--red-bg: #fee2e2;
--red-text: #b91c1c;
--red-border: #fca5a5;
--red-hover: #fef2f2;
--amber-text: #92400e;
--pink-bg: #fce7f3;
--pink-text: #9d174d;
--blue-bg: #e0f2fe;
--blue-text: #075985;
/* Brand-colored text (links, hints). Brighter in dark mode for contrast. */
--accent-ink: var(--purple-dark);
}

* { box-sizing: border-box; }

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background: var(--bg);
color: var(--text);
-webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- App shell: dark sidebar + light main pane ---------- */

.app-shell {
display: flex;
min-height: 100vh;
align-items: stretch;
}

.sidebar {
width: 250px;
flex: 0 0 250px;
background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
color: var(--sidebar-text);
display: flex;
flex-direction: column;
padding: 1.25rem 1rem;
}

.sidebar-brand {
display: flex;
align-items: center;
gap: 0.65rem;
padding: 0.4rem 0.5rem 1.25rem;
border-bottom: 1px solid var(--sidebar-border);
margin-bottom: 1rem;
}

.brand-badge {
width: 40px;
height: 40px;
border-radius: 10px;
background: var(--brand-grad);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 0.9rem;
flex: none;
}

.sidebar-brand-text .name {
color: var(--sidebar-text-active);
font-weight: 700;
font-size: 0.95rem;
line-height: 1.2;
}

.sidebar-brand-text .sub {
font-size: 0.75rem;
color: var(--sidebar-text);
opacity: 0.8;
}

.sidebar-nav {
display: flex;
flex-direction: column;
gap: 0.15rem;
}

.sidebar-nav a {
display: flex;
align-items: center;
gap: 0.65rem;
padding: 0.55rem 0.65rem;
border-radius: var(--radius-sm);
text-decoration: none;
color: var(--sidebar-text);
font-size: 0.9rem;
}

.sidebar-nav a .icon { width: 1.1em; text-align: center; flex: none; }

.sidebar-nav a.active {
background: var(--sidebar-active-bg);
color: var(--sidebar-text-active);
font-weight: 600;
}

.sidebar-nav a:hover { color: var(--sidebar-text-active); }

.sidebar-footer {
margin-top: auto;
padding-top: 1rem;
font-size: 0.75rem;
color: var(--sidebar-text);
opacity: 0.75;
}

.main {
flex: 1;
min-width: 0;
padding: 1.75rem 2.25rem 3rem;
}

.main-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 1rem;
margin-bottom: 1.75rem;
}

.main-header h1 {
margin: 0 0 0.25rem;
font-size: 1.55rem;
font-weight: 700;
}

.main-header .sub {
margin: 0;
color: var(--text-muted);
font-size: 0.92rem;
}

/* ---------- Avatar ---------- */

.avatar-circle {
width: 40px;
height: 40px;
border-radius: 999px;
background: var(--brand-grad);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 0.85rem;
flex: none;
overflow: hidden;
}

.avatar-circle.lg { width: 72px; height: 72px; border-radius: 18px; font-size: 1.4rem; }

/* A real uploaded photo (migration 022) fills the same circle/rounded-square
box an initials fallback uses -- overflow:hidden above clips it to that
shape, so callers just swap the element's innerHTML between initials text
and this <img>, no layout differences between the two states. */
.avatar-photo { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Cards ---------- */

.card {
background: var(--card-bg);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow-card);
padding: 1.4rem 1.5rem;
margin-bottom: 1.5rem;
}

.card-header {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 1rem;
margin-bottom: 1rem;
}

.card-header h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }

.card-header .hint { font-size: 0.8rem; color: var(--accent-ink); font-weight: 600; }

/* Masonry, not a two-column grid. These cards have unrelated heights -- a
profile card next to a one-line session card, a two-field form next to six
text boxes -- and in a grid the short one in a row leaves a hole the height of
the tall one beside it. Multi-column packs them and the browser balances the
columns, so nothing sits next to an acre of nothing. Reading order becomes
column-major, which is the right order for cards that are independent of each
other anyway. */
.card-grid-2 {
columns: 2;
column-gap: 1.5rem;
}

.card-grid-2 > .card {
break-inside: avoid;
-webkit-column-break-inside: avoid;
margin-bottom: 1.5rem;
/* Multicol fragments a child that establishes its own scroll container, and
.card carries overflow-x for wide tables. Nothing in these columns has one. */
overflow: visible;
}

@media (max-width: 900px) {
.card-grid-2 { columns: 1; }
}

/* ---------- Phone and tablet ----------
   The sidebar itself becomes a drawer on phones -- that lives in
   dashboard-shell.js, hung off html.shell-mobile-nav so a page whose script
   hasn't run keeps the plain stacked layout below rather than a nav that
   can't be opened. Everything here is layout the pages share. */

/* Tablets: the sidebar still fits beside the page, just not at full width. */
@media (min-width: 721px) and (max-width: 1200px) {
.sidebar { width: 210px; flex-basis: 210px; padding: 1rem 0.75rem; }
.sidebar-nav a { font-size: 0.86rem; padding: 0.5rem 0.55rem; }
.main { padding: 1.4rem 1.4rem 2.5rem; }
.main-header { margin-bottom: 1.35rem; }
}

/* Phone widths only. The app-shell/sidebar pair here is the no-script
   fallback for the drawer -- it must stay on the same 720px breakpoint the
   shell script uses, or a phone gets neither. */
@media (max-width: 720px) {
.app-shell { flex-direction: column; }
.sidebar { width: 100%; flex-basis: auto; }
}

@media (max-width: 860px) {
.main { padding: 1rem 1rem 2.5rem; }
.main-header { flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.15rem; }
.main-header h1 { font-size: 1.3rem; }
.main-header .sub { font-size: 0.87rem; }
.card { padding: 1.1rem 1rem; margin-bottom: 1.1rem; }
.card-header { flex-wrap: wrap; gap: 0.35rem; }
/* A wide table is better scrolled sideways than squeezed to nothing. The
   scroll goes on the card, not the table: making the table itself
   display:block leaves its own anonymous table box unclipped, so the page
   picked up a sideways scroll of its own instead. */
.card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Phones proper: stop side-by-side form rows and full-width-ify the controls
   that are otherwise too small to hit. */
@media (max-width: 560px) {
.main { padding: 0.9rem 0.85rem 2.5rem; }
.card { padding: 1rem 0.85rem; border-radius: 10px; }
.main-header h1 { font-size: 1.2rem; }
.btn { padding: 0.55rem 0.85rem; }
.field > input, .field > select, .field > textarea { font-size: 16px; } /* 16px stops iOS zooming on focus */
}

/* ---------- Buttons ---------- */

.btn {
display: inline-flex;
align-items: center;
gap: 0.4rem;
border: 1px solid var(--border);
background: var(--surface);
color: var(--text);
font-size: 0.88rem;
font-weight: 600;
padding: 0.5rem 0.9rem;
border-radius: 999px;
cursor: pointer;
}

.btn:hover { border-color: var(--border-strong); }
/* The `hidden` attribute is only a UA rule of `display: none`, so ANY class
   that sets a display -- .btn's inline-flex, a flex form row, a grid cell --
   quietly beats it and the element stays on screen. That has caught us twice
   now, so it is settled here once for the whole product rather than patched
   per component. */
[hidden] { display: none !important; }
.btn[hidden] { display: none; }

.btn-primary {
background: var(--brand-grad);
border: none;
color: #fff;
}

.btn-primary:hover { filter: brightness(1.05); }

.btn-block { width: 100%; justify-content: center; padding: 0.7rem 1rem; font-size: 0.95rem; }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }

.btn:disabled { opacity: 0.55; cursor: default; }

/* ---------- Forms ---------- */

label.field {
display: block;
font-size: 0.82rem;
font-weight: 600;
color: var(--text);
margin-top: 0.9rem;
}

label.field .field-hint {
display: block;
font-weight: 400;
color: var(--text-muted);
font-size: 0.78rem;
margin-top: 0.15rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input:not([type]),
select,
textarea {
width: 100%;
margin-top: 0.35rem;
padding: 0.55rem 0.7rem;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
font-size: 0.9rem;
background: var(--surface);
color: var(--text);
font-family: inherit;
}

textarea { resize: vertical; min-height: 4.5rem; }

/* A date or time field is drawn by the browser, which gives it its own font
   and its own idea of a background -- neither of which match anything else
   on the page. These pull it back in line, including the little calendar
   button, which is otherwise a dark glyph on a dark field. */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  font-family: inherit;
  line-height: 1.35;
  min-height: 2.45rem;
}
input[type="date"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit { color: var(--text); padding: 0; }
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="time"]::-webkit-datetime-edit-fields-wrapper,
input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper { padding: 0; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.65;
  filter: invert(var(--picker-invert, 0));
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* A file input is the last control the browser still draws entirely by
   itself: an OS-grey "Choose File" button in the OS font, a filename in the
   OS colour, and no idea that dark mode exists. The field gets the same
   border, radius and surface as every text input beside it, and the button
   inside it is made to match .btn -- pill, weight, hover and all -- so an
   upload row reads as part of the page rather than a hole in it. */
input[type="file"] {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.3rem 0.45rem 0.3rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.9;
  cursor: pointer;
}
/* ::file-selector-button is the standard; ::-webkit-file-upload-button is
   what older WebKit/Blink answers to. Same declarations, listed separately on
   purpose: a browser that does not know one of these selectors throws the
   WHOLE rule away, so combining them would lose the styling everywhere. */
input[type="file"]::file-selector-button {
  margin-right: 0.6rem;
  border: 1px solid var(--border);
  background: var(--muted-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}
input[type="file"]::-webkit-file-upload-button {
  margin-right: 0.6rem;
  border: 1px solid var(--border);
  background: var(--muted-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}
input[type="file"]:hover::file-selector-button { border-color: var(--border-strong); }
input[type="file"]:hover::-webkit-file-upload-button { border-color: var(--border-strong); }
input[type="file"]:focus { outline: none; }

input:focus, select:focus, textarea:focus {
outline: none;
border-color: var(--purple);
box-shadow: 0 0 0 3px var(--purple-soft);
}

/* ---------- Tabs (role switcher) ---------- */

.tabs {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
margin-bottom: 1.25rem;
}

.tab {
border: 1px solid var(--border);
background: var(--surface);
color: var(--text);
font-size: 0.85rem;
font-weight: 600;
padding: 0.45rem 0.95rem;
border-radius: 999px;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 0.4rem;
}

.tab.active {
background: var(--text);
border-color: var(--text);
color: var(--text-inverse);
}

.tab.owner-tab {
background: var(--brand-grad);
border: none;
color: #fff;
}

.tab-delete {
background: none;
border: none;
color: inherit;
opacity: 0.55;
cursor: pointer;
font-weight: 700;
padding: 0;
line-height: 1;
font-size: 0.95em;
}

.tab-delete:hover { opacity: 1; }

.new-role-row {
display: flex;
gap: 0.5rem;
align-items: center;
margin-top: 0.5rem;
padding-top: 1rem;
border-top: 1px dashed var(--border);
}

.new-role-row input { flex: 1; margin-top: 0; }

/* ---------- Permission list ---------- */

.perm-group-label {
text-transform: uppercase;
font-size: 0.72rem;
font-weight: 700;
letter-spacing: 0.04em;
color: var(--accent-ink);
margin: 1.1rem 0 0.4rem;
}

.perm-group-label:first-child { margin-top: 0; }

/* The permission list runs to twenty-odd rows. In one column on a wide screen
every label sits a screen-width away from the box it controls; in columns they
stay together and the whole list is visible without scrolling. */
.perm-rows {
display: grid;
/* min() so the track can never be wider than the card it sits in -- a bare
minmax(19rem, …) overflows a phone, where the card is narrower than 19rem. */
grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
column-gap: 2rem;
align-items: start;
}

.perm-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.55rem 0.1rem;
border-bottom: 1px solid var(--border);
font-size: 0.9rem;
}

.perm-row:last-child { border-bottom: none; }

.perm-check {
width: 22px;
height: 22px;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.8rem;
flex: none;
cursor: default;
}

.perm-check.on { background: var(--purple); color: #fff; }
.perm-check.off { background: var(--muted-bg); color: transparent; }
.perm-check.locked { background: var(--muted-bg); color: var(--text-muted); font-size: 0.75rem; }

/* Editable permission checks (manage_roles holders, on a non-Owner role)
get a pointer cursor and a hover ring so it's clear they're clickable,
unlike the plain read-only squares everyone else sees. */
.perm-check.editable { cursor: pointer; }
.perm-check.editable:hover { box-shadow: 0 0 0 3px var(--purple-soft); }

/* A REAL checkbox wearing the same purple rounded square the Roles grid
   uses for a permission that is on (.perm-check above).
   
   The site already had two checkbox-ish controls and neither fits a list you
   tick a dozen things in: .switch is a toggle, right for one setting and far
   too heavy repeated twenty times down a menu, and .perm-check is a div in a
   grid rather than an input. So a multi-select list fell back to the raw
   browser checkbox -- the one control on this dashboard that never got
   dressed, and the one that looks worst in dark mode, where it renders as a
   flat grey square that reads as disabled.
   
   Built on the real input rather than a styled span, so it keeps its label
   click target, its keyboard handling and its focus ring for free. */
input[type="checkbox"].check {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--muted-bg);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  flex: none;
  margin: 0;
  transition: background .15s ease, border-color .15s ease;
}
input[type="checkbox"].check::after {
  content: "";
  width: 10px;
  height: 10px;
  background: #fff;
  transform: scale(0);
  transition: transform .12s ease;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
input[type="checkbox"].check:checked { background: var(--purple); border-color: var(--purple); }
input[type="checkbox"].check:checked::after { transform: scale(1); }
input[type="checkbox"].check:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
input[type="checkbox"].check:disabled { opacity: .5; cursor: default; }
@media (prefers-reduced-motion: reduce) {
  input[type="checkbox"].check, input[type="checkbox"].check::after { transition: none; }
}

/* ---------- Table / roster ---------- */

table.roster { width: 100%; border-collapse: collapse; }

table.roster th {
text-align: left;
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.03em;
color: var(--text-muted);
padding: 0 0.5rem 0.5rem;
border-bottom: 1px solid var(--border);
}

table.roster td {
padding: 0.6rem 0.5rem;
border-bottom: 1px solid var(--border);
font-size: 0.9rem;
vertical-align: middle;
}

.role-badge {
display: inline-flex;
align-items: center;
gap: 0.3rem;
background: var(--purple-soft);
color: var(--accent-ink);
border-radius: 999px;
padding: 0.15rem 0.55rem 0.15rem 0.7rem;
font-size: 0.78rem;
font-weight: 600;
margin: 0.1rem 0.25rem 0.1rem 0;
}

.role-badge button {
background: none;
border: none;
color: var(--accent-ink);
cursor: pointer;
font-weight: 700;
padding: 0;
line-height: 1;
}

/* ---------- Status dot ---------- */

.status-line { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; font-weight: 600; }

.status-dot { width: 9px; height: 9px; border-radius: 999px; flex: none; }
.status-dot.green { background: var(--green); }
.status-dot.amber { background: var(--amber); }
.status-dot.gray { background: var(--dot-gray); }

/* ---------- Preview box (floating text) ---------- */

.preview-box {
background: #0d0817;
color: #f4c9de;
border-radius: var(--radius-sm);
padding: 1.1rem 1rem;
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
font-size: 0.85rem;
text-align: center;
line-height: 1.7;
}

.preview-box .accent { color: #fbbf24; }

/* ---------- Progress / goal bar (mockup 4 & 8's session goal bar) ---------- */

.progress-track {
background: var(--border);
border-radius: 999px;
height: 10px;
overflow: hidden;
margin: 0.5rem 0 0;
}

.progress-fill {
height: 100%;
background: var(--brand-grad);
border-radius: 999px;
}

/* ---------- At-a-glance stat boxes (mockup 8) ---------- */

.stat-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.75rem;
margin-top: 0.75rem;
}

.stat-box {
background: var(--bg);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
padding: 0.75rem 0.9rem;
}

.stat-box .stat-label {
font-size: 0.68rem;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--text-muted);
font-weight: 700;
}

.stat-box .stat-value {
font-size: 1.3rem;
font-weight: 700;
margin-top: 0.2rem;
}

/* ---------- Notices ---------- */

#error, .error-banner {
color: #fff;
background: var(--red);
border-radius: var(--radius-sm);
padding: 0.6rem 0.85rem;
font-size: 0.85rem;
margin-bottom: 1rem;
display: none;
}

#error:not(:empty), .error-banner:not(:empty) { display: block; }

#saved, .saved-banner {
color: var(--green-text);
background: var(--green-bg);
border-radius: var(--radius-sm);
padding: 0.6rem 0.85rem;
font-size: 0.85rem;
margin-bottom: 1rem;
display: none;
}

#saved:not(:empty), .saved-banner:not(:empty) { display: block; }

.note { color: var(--text-muted); font-size: 0.82rem; margin: 0.3rem 0 0; }

/* ---------- Auth screens (login / first-login / change password) ---------- */

.auth-page {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 2rem 1rem;
background: radial-gradient(circle at 30% 20%, #4c1d95, #1e1338 55%, #120a24);
}

.auth-card {
background: var(--surface);
border-radius: 20px;
box-shadow: var(--shadow-pop);
padding: 2.4rem 2.2rem 2rem;
width: 100%;
max-width: 400px;
text-align: center;
}

.auth-eyebrow {
text-transform: uppercase;
letter-spacing: 0.06em;
font-size: 0.72rem;
font-weight: 700;
color: var(--accent-ink);
margin-bottom: 0.6rem;
}

.auth-title { font-size: 1.4rem; font-weight: 700; margin: 0 0 0.6rem; }

.auth-subtitle { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1.5rem; line-height: 1.45; }

.auth-card .field { text-align: left; }

.auth-card .btn-primary { margin-top: 1.4rem; }

.auth-foot-note { color: var(--text-muted); font-size: 0.78rem; margin-top: 1.1rem; line-height: 1.4; }

/* ---------- Standalone ops pages (Live Monitor / Pause Control) ----------
These aren't part of the session-login app-shell (see dashboard.html and
admin.html's own header comments for why), so they don't use .app-shell's
sidebar layout -- just the shared color/type/button/table language above,
in a simple centered column. */

.ops-page {
max-width: 1000px;
margin: 0 auto;
padding: 2rem 1.5rem 4rem;
}

.ops-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 1rem;
margin-bottom: 1.75rem;
}

.ops-header h1 { margin: 0 0 0.3rem; font-size: 1.4rem; font-weight: 700; }
.ops-header .sub { margin: 0; color: var(--text-muted); font-size: 0.88rem; max-width: 60ch; line-height: 1.5; }

.badge {
display: inline-flex;
align-items: center;
gap: 0.35rem;
padding: 0.15rem 0.65rem;
border-radius: 999px;
font-size: 0.75rem;
font-weight: 700;
}

.badge.on { background: var(--green-bg); color: var(--green-text); }
.badge.off { background: var(--muted-bg); color: var(--text-muted); }
.badge.paused { background: var(--amber-bg); color: var(--amber); }

/* ---------- Role checkbox lists (Staff page: multi-role assignment,
per-person role editing) ---------- */

.role-checkbox-list {
display: flex;
flex-wrap: wrap;
gap: 0.4rem 1.1rem;
margin: 0.5rem 0 0.75rem;
}

.role-checkbox {
display: flex;
align-items: center;
gap: 0.4rem;
font-size: 0.88rem;
font-weight: 500;
cursor: pointer;
}

.role-checkbox input { width: auto; margin: 0; }

.edit-roles-row td {
background: var(--bg);
border-bottom: 1px solid var(--border);
padding: 0.9rem 0.75rem 1rem;
}

.edit-roles-row .btn { margin-right: 0.5rem; }

/* ---------- Overview / Live Monitor / Time Clock (shared pieces) ---------- */

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
/* The venue's on/off switch. Lived in jar-management.html until Settings
   needed one too; one definition beats two that drift.
   position:relative on the label matters -- the checkbox below is
   visually hidden rather than removed, and without it that input resolves
   against the page instead of the label and ends up outside the card,
   which gave one page a sideways scrollbar of its own on a phone. */
.switch { position: relative; display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; user-select: none; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.switch .track { position: relative; flex: none; width: 42px; height: 24px; border-radius: 99px; background: var(--border);
  transition: background .18s ease; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s ease; }
.switch input:checked + .track { background: var(--brand-grad, var(--purple)); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--purple); outline-offset: 2px; }
.switch .switch-text { font-size: 0.85rem; color: var(--text-muted); min-width: 4.8rem; }
.switch input:checked ~ .switch-text { color: inherit; }
/* A switch on its own line with a sentence beside it, rather than a word:
   the label has to be allowed to wrap, and the track sits with the first
   line of it rather than centred against three. */
.switch-row { display: flex; align-items: flex-start; white-space: normal; margin-top: 0.9rem; font-size: 0.9rem; line-height: 1.45; }
.switch-row .track { margin-top: 0.1rem; }
@media (prefers-reduced-motion: reduce) { .switch .track, .switch .track::after { transition: none; } }

.kpi { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 1rem 1.2rem; min-width: 0; }
.kpi .kpi-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.kpi .kpi-value { font-size: 1.65rem; font-weight: 750; margin-top: 0.3rem; line-height: 1.15; overflow-wrap: anywhere; }
.kpi .kpi-foot { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }
.kpi .kpi-foot.up { color: var(--green-strong); font-weight: 600; }
.kpi .kpi-foot.down { color: var(--red); font-weight: 600; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpi-grid { grid-template-columns: 1fr; } }

.pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.pill.green { background: var(--green-bg); color: var(--green-text); }
.pill.red { background: var(--red-bg); color: var(--red-text); }
.pill.amber { background: var(--amber-bg); color: var(--amber-text); }
.pill.purple { background: var(--purple-soft); color: var(--accent-ink); }
.pill.pink { background: var(--pink-bg); color: var(--pink-text); }
.pill.blue { background: var(--blue-bg); color: var(--blue-text); }
.pill.gray { background: var(--muted-bg); color: var(--text-muted); }

.btn-danger { color: var(--red); border-color: var(--red-border); background: var(--surface); }
.btn-danger:hover { background: var(--red-hover); }

/* Segmented filter buttons (Staff Hours: Met / Not Met) */
.seg { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 0.85rem; font-weight: 600; padding: 0.35rem 0.9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--text-inverse); }
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1.25rem 2rem; margin-bottom: 1.25rem; }
.filter-row .filter-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.4rem; }

/* Week picker: calendar drop-down in the header of My Hours / Staff Hours */
.week-pick { position: relative; }
.week-pick-btn { font: inherit; font-weight: 650; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.8rem; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); border-radius: 999px; cursor: pointer; white-space: nowrap; }
.week-pick-btn:hover, .week-pick-btn[aria-expanded="true"] { border-color: var(--purple); }
.week-pick-btn .wp-caret { font-size: 0.7rem; color: var(--text-muted); }
.week-pop { position: fixed; z-index: 60; background: var(--card-bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 0.8rem; }
.week-pop[hidden] { display: none; }
.wp-quick { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.wp-quick button { font: inherit; font-size: 0.78rem; font-weight: 600; padding: 0.3rem 0.65rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); cursor: pointer; }
.wp-quick button:hover { border-color: var(--purple); color: var(--accent-ink); }
.wp-month { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 0.92rem; margin-bottom: 0.4rem; }
.wp-nav { font: inherit; font-size: 1.1rem; line-height: 1; width: 1.9rem; height: 1.9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); cursor: pointer; }
.wp-nav:disabled { opacity: 0.35; cursor: default; }
.wp-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 3px; }
.wp-dow span { text-align: center; font-size: 0.68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; padding: 0.2rem 0; }
.wp-day { font: inherit; font-size: 0.82rem; height: 2.1rem; border: 0; background: transparent; color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums; }
.wp-day.out { color: var(--text-muted); opacity: 0.6; }
.wp-day:disabled { opacity: 0.28; cursor: default; }
.wp-day.today { font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.wp-day.hov { background: var(--muted-bg); }
.wp-day.sel { background: var(--purple-soft); color: var(--accent-ink); font-weight: 700; opacity: 1; }
.wp-day.wk-first, .wp-grid .wp-day:nth-child(7n+1) { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.wp-day.wk-last, .wp-grid .wp-day:nth-child(7n) { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }
.wp-day:focus-visible { outline: 2px solid var(--purple); outline-offset: -2px; }
.wp-foot { margin-top: 0.6rem; font-size: 0.75rem; color: var(--text-muted); }
@media (max-width: 600px) { .week-pick-btn { font-size: 0.82rem; padding: 0.4rem 0.65rem; } .week-pick-btn .wp-pre { display: none; } }

.person { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.person .avatar-circle { width: 32px; height: 32px; font-size: 0.72rem; }
.person .person-name { font-weight: 650; }
.person .person-sub { font-size: 0.78rem; color: var(--text-muted); }

.table-scroll { overflow-x: auto; }
.empty-note { color: var(--text-muted); font-size: 0.9rem; padding: 0.75rem 0; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); vertical-align: middle; }
.btn.armed { background: var(--red); border-color: var(--red); color: #fff; }


/* ---------- Dark mode ----------
   Turned on from the account menu (dashboard-shell.js), which sets
   <html data-theme="dark"> and remembers the choice in this browser. Every
   color above is a variable, so dark mode only has to swap the variables,
   plus a few page-specific tints below. The sidebar is already dark and stays
   as it is. */
html[data-theme="dark"] {
color-scheme: dark;
--bg: #0f0b19;
--card-bg: #1a1427;
--surface: #221a33;
--border: #30274a;
--border-strong: #463a66;
--text: #ece8f6;
--text-muted: #a49dba;
--text-inverse: #120d1f;
--purple-soft: #2a1f45;
--amber: #f59e0b;
--amber-bg: #3a2a0c;
--amber-text: #fcd34d;
--red: #ef4444;
--muted-bg: #2a2240;
--dot-gray: #5c5476;
--green-bg: #0f2e1b;
--green-text: #86efac;
--green-strong: #4ade80;
--red-bg: #3b1515;
--red-text: #fca5a5;
--red-border: #7f1d1d;
--red-hover: #2c1212;
--pink-bg: #3b1330;
--pink-text: #f9a8d4;
--blue-bg: #0c2a3d;
--blue-text: #7dd3fc;
--accent-ink: color-mix(in srgb, var(--purple) 55%, #ffffff);
--shadow-card: 0 1px 2px rgba(0, 0, 0, 0.45), 0 1px 1px rgba(0, 0, 0, 0.3);
--shadow-pop: 0 20px 50px rgba(0, 0, 0, 0.6);
}
/* The calendar button is a dark glyph -- invert it on a dark field. */
html[data-theme="dark"] { --picker-invert: 1; }
html[data-theme="dark"] .preview-box { border: 1px solid var(--border); }
html[data-theme="dark"] .jar-card.idle { background: var(--card-bg); opacity: 0.85; }
html[data-theme="dark"] .lm-control { border-color: var(--border-strong); }
html[data-theme="dark"] .lm-paused { color: var(--amber-text); }
html[data-theme="dark"] .live-count { background: var(--green-bg); color: var(--green-text); }
html[data-theme="dark"] .chart-grid { border-top-color: var(--border); }
html[data-theme="dark"] .chart-tip { background: #000; border: 1px solid var(--border-strong); }
html[data-theme="dark"] .jar-top .avatar-circle.pool { background: #475569; }
