/* ————————————————————————————— tokens ————————————————————————————— */
:root {
  /* Estate Green & Brass — green-washed ivory ground, deep botanical green panels, brass accent */
  --bg: #eaeedd;
  --surface: #f8f9ef;
  --surface-2: #e6ebd6;
  --ink: #1d251f;
  --ink-2: #586355;
  --ink-3: #8b9384;
  --line: #d5dabf;
  --accent: #a67c2e;
  --accent-soft: #f0e6d0;
  --hero-bg: #1f3627;
  --hero-bg-2: #2a4634;
  --hero-ink: #f3f1e8;
  --hero-ink-2: #c4cdb9;
  --gold: #c0994b;
  --done: #2e8053;
  --done-soft: #dceee3;
  --progress: #3a6ea5;
  --progress-soft: #e2ebf6;
  --critical: #b54334;
  --critical-soft: #f7e6de;
  --pending: #7a776e;
  --pending-soft: #eeede6;
  /* premium pastels */
  --pastel-sage: #e9efdf;
  --pastel-mint: #dceee3;
  --pastel-sky: #e2ebf6;
  --pastel-blush: #f7e6de;
  --pastel-champagne: #f3ead5;
  --ring-track: #ecefe2;
  --shadow: 0 1px 2px rgb(29 37 31 / .05), 0 8px 28px rgb(29 37 31 / .07);
  --radius: 14px;
  --serif: "Palatino", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131a15;
    --surface: #1a231c;
    --surface-2: #212c23;
    --ink: #eaede3;
    --ink-2: #a9b2a3;
    --ink-3: #7d8578;
    --line: #2c372e;
    --accent: #c99f52;
    --accent-soft: #33301f;
    --hero-bg: #182a1e;
    --hero-bg-2: #21382a;
    --hero-ink: #f3f1e8;
    --hero-ink-2: #a9b8a1;
    --gold: #c99f52;
    --done: #63b888;
    --done-soft: #1e3427;
    --progress: #7fa8d9;
    --progress-soft: #1e2a3a;
    --critical: #e08273;
    --critical-soft: #3c241f;
    --pending: #99968b;
    --pending-soft: #272b24;
    /* pastels sit deep and muted on the dark ground */
    --pastel-sage: #222c20;
    --pastel-mint: #1e2f27;
    --pastel-sky: #202b38;
    --pastel-blush: #33251f;
    --pastel-champagne: #322b1c;
    --ring-track: #28322a;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 28px rgb(0 0 0 / .35);
  }
}

/* ————————————————————————————— base ————————————————————————————— */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(120% 50% at 50% 0%, color-mix(in srgb, var(--hero-bg) 9%, var(--bg)) 0%, var(--bg) 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.55;
  min-height: 100dvh;
}
.serif { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; }
.muted { color: var(--ink-2); }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input { font: inherit; }
img { max-width: 100%; }

.eyebrow {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--accent);
  font-weight: 600;
}
.eyebrow-light { color: var(--gold); }

/* ————————————————————————————— monogram ————————————————————————————— */
.monogram {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--hero-bg);
  position: relative;
  flex: none;
}
.monogram::before, .monogram::after {
  content: "";
  position: absolute; inset: 0;
  margin: auto;
  transform: rotate(45deg);
}
.monogram::before {
  width: 52%; height: 52%;
  border: 2px solid var(--gold);
}
.monogram::after {
  width: 16%; height: 16%;
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--hero-bg), 0 0 0 4.5px rgb(243 241 232 / .55);
}
.monogram-lg { width: 84px; height: 84px; border-radius: 24px; }
.monogram-sm { width: 40px; height: 40px; border-radius: 12px; }

/* ————————————————————————————— overlays ————————————————————————————— */
.overlay {
  position: fixed; inset: 0;
  background: var(--hero-bg);
  color: var(--hero-ink);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  z-index: 50;
  padding: 24px;
  text-align: center;
}
.overlay-card {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 36px 28px;
  max-width: 360px; width: 100%;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.overlay-card form { display: flex; gap: 8px; width: 100%; margin-top: 6px; }
.overlay-card input {
  flex: 1; min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  text-align: center;
  letter-spacing: .2em;
}
.error { color: var(--critical); font-size: .85rem; }

/* splash */
#splash { background: radial-gradient(120% 120% at 50% 0%, var(--hero-bg-2) 0%, var(--hero-bg) 65%); }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; animation: rise .8s ease both; }
.splash-title { font-size: clamp(2rem, 7vw, 3.2rem); color: var(--hero-ink); font-weight: 600; text-wrap: balance; }
.splash-sub { color: var(--hero-ink-2); letter-spacing: .06em; }
.splash-note { color: var(--hero-ink-2); font-size: .8rem; opacity: .8; }
#splash.leaving { animation: fadeOut .6s ease both; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeOut { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .splash-inner, #splash.leaving { animation-duration: .01s; }
}

/* ————————————————————————————— buttons ————————————————————————————— */
.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 32px;
  font-weight: 600;
  letter-spacing: .04em;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-gold {
  background: var(--gold);
  color: #241b07;
  font-size: 1.05rem;
  box-shadow: 0 6px 24px rgb(192 153 75 / .4);
  margin-top: 10px;
}
.btn-primary { background: var(--hero-bg); color: var(--hero-ink); padding: 10px 22px; }
@media (prefers-color-scheme: dark) {
  .btn-primary { background: var(--gold); color: #241b07; }
}
.icon-btn {
  background: none; border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: 10px;
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
:is(button, input, a, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ————————————————————————————— topbar ————————————————————————————— */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  background: color-mix(in srgb, var(--hero-bg) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid color-mix(in srgb, var(--gold) 55%, transparent);
  color: var(--hero-ink);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title { font-size: 1.05rem; white-space: nowrap; color: var(--hero-ink); }
.topbar-sub { font-size: .74rem; color: var(--hero-ink-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.topbar .monogram { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--gold) 60%, transparent); }
.topbar .icon-btn { color: var(--hero-ink-2); border-color: rgb(255 255 255 / .22); }
.topbar .icon-btn:hover { color: var(--hero-ink); border-color: rgb(255 255 255 / .5); }
.topbar .important-alert { color: var(--hero-ink-2); border-color: rgb(255 255 255 / .22); }
.topbar .role-badge { background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold); border-color: var(--gold); }
@media (max-width: 600px) {
  .topbar-title { font-size: .95rem; }
  .important-word { display: none; }
  .important-alert { padding: 6px 10px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .topbar-left { gap: 8px; }
  .topbar .monogram-sm { width: 34px; height: 34px; border-radius: 10px; }
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--done);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--done) 25%, transparent);
}

/* ————————————————————————————— layout ————————————————————————————— */
main { max-width: 980px; margin: 0 auto; padding: 20px 18px 120px; display: grid; gap: 28px; }

/* hero */
.hero {
  background: linear-gradient(150deg, var(--hero-bg-2), var(--hero-bg) 70%);
  color: var(--hero-ink);
  border-radius: 20px;
  padding: 28px 26px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-content { position: relative; z-index: 2; display: grid; gap: 20px; }

/* date · time · weather widgets */
.widgets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.widget {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 16px 12px;
  display: grid; gap: 2px;
  align-content: start;
  position: relative;
  overflow: hidden;
}
.widget::before {
  content: "";
  position: absolute; top: 0; left: 14px; right: 14px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .5;
}
.widget-label {
  font-size: .62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .16em;
  color: var(--accent);
}
.widget-value {
  font-size: clamp(1.15rem, 4.6vw, 1.6rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}
.widget-unit { font-size: .7em; color: var(--ink-2); margin-left: 3px; }
.widget-sub { font-size: .72rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-glyph { font-size: .85em; margin-right: 6px; }
.widget-weather { background: linear-gradient(150deg, var(--surface), var(--pastel-sky)); }
@media (max-width: 480px) {
  .widgets { gap: 8px; }
  .widget { padding: 11px 12px 10px; border-radius: 14px; }
}
.hero-slides { position: absolute; inset: 0; z-index: 0; }
.hero-slides img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.hero-slides img.active { opacity: 1; }
/* With slideshow images the hero becomes a tall image banner:
   photo fills the card, content sits at the bottom over a soft gradient. */
.hero.has-slides {
  min-height: min(52vh, 440px);
  display: flex;
  align-items: flex-end;
}
.hero.has-slides .hero-content { width: 100%; }
.hero.has-slides::before {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgb(20 36 26 / .3) 0%, rgb(20 36 26 / .5) 42%, rgb(20 36 26 / .9) 82%);
}
.hero.has-slides .hero-content { text-shadow: 0 1px 14px rgb(10 20 14 / .6); }
.hero.has-slides .meter { background: rgb(0 0 0 / .45); }
.hero.has-slides .tile { background: rgb(16 28 20 / .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
@media (prefers-reduced-motion: reduce) { .hero-slides img { transition: opacity .01s; } }
.hero-row { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.hero-number { line-height: 1; }
.hero-percent { font-family: var(--serif); font-size: clamp(3.4rem, 10vw, 5rem); font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-unit { font-family: var(--serif); font-size: 1.8rem; color: var(--gold); }
.hero-caption { color: var(--hero-ink-2); font-size: .85rem; margin-top: 4px; }
.hero-meter { flex: 1; min-width: 220px; display: grid; gap: 10px; }
.hero-deadline { color: var(--hero-ink-2); font-size: .85rem; }
.hero-deadline strong { color: var(--gold); font-weight: 600; }

.meter {
  background: rgb(0 0 0 / .25);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}
.meter-lg { height: 14px; }
.meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), #e3c684);
  border-radius: 999px;
  transition: width .9s cubic-bezier(.2,.7,.2,1);
  min-width: 4px;
}

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.tile {
  background: rgb(255 255 255 / .07);
  border: 1px solid rgb(255 255 255 / .12);
  border-radius: 12px;
  padding: 10px 12px;
}
.tile .tile-num { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .tile-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--hero-ink-2); display: flex; align-items: center; gap: 6px; }
.tile-mark { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* filters */
.filters { display: grid; gap: 12px; }
#search {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
#search::placeholder { color: var(--ink-3); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  border: 1px solid color-mix(in srgb, var(--hero-bg) 20%, var(--line));
  background: color-mix(in srgb, var(--pastel-sage) 60%, var(--surface));
  color: var(--ink-2);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .82rem;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px;
}
.pill .pill-count { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: .75rem; }
.pill.active { background: var(--hero-bg); border-color: var(--hero-bg); color: var(--hero-ink); }
.pill.active .pill-count { color: var(--hero-ink-2); }

/* ————————————————————————————— area cards ————————————————————————————— */
#areas { display: grid; gap: 14px; }
.area-card {
  background: linear-gradient(120deg, var(--surface) 55%, color-mix(in srgb, var(--pastel-sage) 55%, var(--surface)) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.area-card::before {
  content: "";
  position: absolute; top: 0; left: 16px; right: 16px;
  height: 2px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--gold) 65%, transparent), transparent);
}
.area-head {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: none; border: none; text-align: left;
  color: var(--ink);
}
.area-head-main { flex: 1; min-width: 0; display: grid; gap: 7px; }
.area-name { font-family: var(--serif); font-size: 1.08rem; font-weight: 600; }
.area-meta { font-size: .78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.area-meter { background: var(--surface-2); border-radius: 999px; height: 6px; overflow: hidden; max-width: 340px; }
.area-meter .meter-fill { background: var(--done); transition: width .7s ease; }
.area-percent { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chev { transition: transform .25s ease; color: var(--ink-3); flex: none; }
.area-card.open .chev { transform: rotate(180deg); }

.area-items { display: none; border-top: 1px solid var(--line); }
.area-card.open .area-items { display: block; }

.item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: none; }
.item.dim { opacity: .38; }
.item-desc { font-weight: 500; }
.item-sub { grid-column: 2; font-size: .78rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.item-sub .sep { color: var(--ink-3); }
.item-photos { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.item-photos img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line);
  cursor: zoom-in;
}

/* status chips — color + icon + label, never color alone */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  align-self: start;
  margin-top: 2px;
}
.chip-done { background: var(--done-soft); color: var(--done); }
.chip-progress { background: var(--progress-soft); color: var(--progress); }
.chip-critical { background: var(--critical-soft); color: var(--critical); }
.chip-pending { background: var(--pending-soft); color: var(--pending); }

/* ————————————————————————————— action items ————————————————————————————— */
.section-title { font-size: 1.35rem; }
.section-sub { font-size: .85rem; margin-top: 2px; }
.action-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 14px; }
.action-card {
  background: linear-gradient(160deg, var(--surface) 60%, color-mix(in srgb, var(--pastel-champagne) 65%, var(--surface)) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.action-card::before {
  content: "";
  position: absolute; top: 0; left: 16px; right: 16px;
  height: 2px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--gold) 55%, transparent), transparent);
}
.action-card h3 { font-family: var(--serif); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.action-card.owner { border-color: var(--accent); }
.action-card.owner h3::after { content: "Owner"; font-family: var(--sans); font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 999px; }
.action-card ul { list-style: none; display: grid; gap: 8px; }
.action-card li { font-size: .86rem; color: var(--ink-2); padding-left: 18px; position: relative; }
.action-card li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 7px; height: 7px; transform: rotate(45deg); background: var(--gold); opacity: .7; }

/* ————————————————————————————— chat ————————————————————————————— */
.chat-fab {
  position: fixed;
  right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 8px;
  background: var(--hero-bg);
  color: var(--hero-ink);
  border: 1px solid var(--hero-bg-2);
  border-radius: 999px;
  padding: 13px 20px;
  font-weight: 600;
  box-shadow: 0 8px 30px rgb(0 0 0 / .3);
  z-index: 30;
}
.chat-fab svg { color: var(--gold); }

.chat-panel {
  position: fixed;
  right: 14px; bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(400px, calc(100vw - 28px));
  height: min(560px, calc(100dvh - 90px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 60px rgb(0 0 0 / .35);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 40;
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--hero-bg);
  color: var(--hero-ink);
}
.chat-title { font-size: 1rem; }
.chat-sub { font-size: .72rem; color: var(--hero-ink-2); }
.chat-head .icon-btn { color: var(--hero-ink-2); border-color: transparent; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 10px; align-content: start; }
.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .9rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg-user { justify-self: end; background: var(--hero-bg); color: var(--hero-ink); border-bottom-right-radius: 4px; }
.msg-bot { justify-self: start; background: var(--surface-2); color: var(--ink); border-bottom-left-radius: 4px; }
.msg-bot.typing { color: var(--ink-3); font-style: italic; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input {
  flex: 1; min-width: 0;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

/* ————————————————————————————— chart ————————————————————————————— */
.chart-card {
  background:
    radial-gradient(130% 120% at 100% 0%, var(--pastel-champagne) 0%, transparent 45%),
    radial-gradient(120% 130% at 0% 100%, var(--pastel-sage) 0%, transparent 50%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 26px 24px;
  display: grid; gap: 22px;
  position: relative;
  overflow: hidden;
}
.chart-card::before {
  content: "";
  position: absolute; top: 0; left: 24px; right: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .55;
}
.chart-head { display: grid; gap: 3px; }
.chart-sub { font-size: .84rem; }
.chart-row { display: flex; gap: 30px; align-items: center; flex-wrap: wrap; }
.donut-wrap { position: relative; width: 190px; flex: none; margin-inline: auto; }
.donut-wrap svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 16px rgb(29 37 31 / .10)); }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
.donut-num { font-size: 2.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.donut-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .16em; color: var(--accent); font-weight: 600; }
.donut-sub { font-size: .72rem; color: var(--ink-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.area-bars {
  flex: 1; min-width: 260px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 14px 8px;
}
.ring-cell {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  display: grid; justify-items: center; gap: 5px;
  padding: 12px 4px 10px;
  border-radius: 16px;
  color: inherit;
  cursor: pointer;
  box-shadow: 0 1px 3px rgb(29 37 31 / .05);
  transition: transform .18s ease, box-shadow .18s ease;
}
.ring-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgb(29 37 31 / .12);
  background: var(--surface);
}
.ring-name {
  font-size: .7rem; font-weight: 600; color: var(--ink-2);
  text-align: center; line-height: 1.25;
  max-width: 110px;
}
.ring-count { font-size: .66rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ring-text {
  fill: var(--ink);
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
}
.area-ring { flex: none; }
.area-ring .ring-text { font-size: 30px; }
.chart-legend { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.legend-item {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .74rem; font-weight: 600; color: var(--ink-2);
  padding: 6px 14px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.legend-item.l-done { background: var(--done-soft); color: var(--done); }
.legend-item.l-progress { background: var(--progress-soft); color: var(--progress); }
.legend-item.l-critical { background: var(--critical-soft); color: var(--critical); }
.legend-item.l-pending { background: var(--pending-soft); color: var(--pending); }
.legend-swatch { width: 9px; height: 9px; border-radius: 50%; }

/* ————————————————————————————— roles / alerts ————————————————————————————— */
.topbar-right { display: flex; align-items: center; gap: 8px; }
.role-badge {
  font-size: .64rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent);
  padding: 3px 10px; border-radius: 999px;
}
.important-alert {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: 999px; padding: 6px 12px;
  font-size: .74rem; font-weight: 600;
}
.pulse-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold);
  animation: pulse 2.2s ease-in-out infinite;
  flex: none;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 55%, transparent); opacity: 1; }
  50% { box-shadow: 0 0 0 6px transparent; opacity: .55; }
}
@media (prefers-reduced-motion: reduce) { .pulse-dot { animation: none; } }
.chip-important {
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; gap: 5px;
}

/* ————————————————————————————— admin panel ————————————————————————————— */
.admin-panel {
  border: 1px dashed var(--accent);
  border-radius: 14px;
  padding: 16px;
  display: grid; gap: 16px;
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
}
.admin-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; color: var(--accent); }
.admin-group { display: grid; gap: 8px; justify-items: start; }
.admin-label { font-size: .74rem; font-weight: 600; color: var(--ink-2); }
.status-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.status-btn {
  border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px; padding: 7px 14px;
  font-size: .78rem; font-weight: 600;
}
.status-btn.sel-done { border-color: var(--done); color: var(--done); background: var(--done-soft); }
.status-btn.sel-progress { border-color: var(--progress); color: var(--progress); background: var(--progress-soft); }
.status-btn.sel-pending { border-color: var(--pending); color: var(--pending); background: var(--pending-soft); }
.status-btn.sel-critical { border-color: var(--critical); color: var(--critical); background: var(--critical-soft); }
.important-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 500; cursor: pointer; }
.important-toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
#admin-note {
  width: 100%;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  padding: 10px 12px; font: inherit; font-size: .88rem;
  resize: vertical;
}
.btn-sm { padding: 8px 16px; font-size: .8rem; }
.upload-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.wa-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.wa-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: #128c50; color: #fff;
  border: none; border-radius: 999px;
  padding: 8px 16px; font-size: .8rem; font-weight: 600;
  text-decoration: none;
}
.wa-btn svg { width: 15px; height: 15px; }
.modal-technote { border-left-color: var(--progress); background: var(--progress-soft); }
.gallery .media-cell { position: relative; }
.gallery video {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line);
  background: #000;
}
.media-del {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px;
  border: none; border-radius: 50%;
  background: rgb(0 0 0 / .6); color: #fff;
  font-size: .8rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

/* ————————————————————————————— item detail ————————————————————————————— */
.item { cursor: pointer; transition: background .15s ease; }
.item:hover { background: var(--surface-2); }
.photo-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; color: var(--accent); font-weight: 600;
}
.photo-badge svg { width: 14px; height: 14px; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgb(10 16 12 / .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 45;
  display: flex; align-items: flex-end; justify-content: center;
}
.item-sheet {
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  max-height: 88dvh;
  border-radius: 22px 22px 0 0;
  display: flex; flex-direction: column;
  animation: sheetUp .3s ease both;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .item-sheet { max-width: 640px; border-radius: 20px; max-height: 84dvh; }
}
.sheet-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.sheet-head-text { display: grid; gap: 6px; }
.sheet-head h3 { font-size: 1.25rem; text-wrap: balance; }
.sheet-body { overflow-y: auto; padding: 18px 22px 26px; display: grid; gap: 20px; }
.modal-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.modal-meta .mm { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.modal-meta .mm-k { font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); }
.modal-meta .mm-v { font-size: .9rem; font-weight: 500; margin-top: 2px; }
.modal-reason {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
}
.modal-reason h4, .modal-gallery h4 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--ink-2); margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.modal-reason p { font-size: .92rem; }
.after-badge {
  background: var(--done-soft); color: var(--done);
  border-radius: 50%; width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .7rem;
}
/* Large lead image at the top of the item detail view */
.modal-hero { display: grid; gap: 6px; }
.modal-hero img, .modal-hero video {
  width: 100%;
  max-height: 340px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #000;
}
.modal-hero img { cursor: zoom-in; }
.modal-hero .hero-cap { font-size: .76rem; color: var(--ink-2); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gallery figure { display: grid; gap: 4px; }
.gallery img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line);
  cursor: zoom-in;
}
.gallery figcaption { font-size: .72rem; color: var(--ink-2); }

/* ————————————————————————————— lightbox ————————————————————————————— */
#lightbox { background: rgb(0 0 0 / .9); }
.lb-stage {
  width: 100vw;
  height: 74dvh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  touch-action: none;               /* our own pinch/pan handling */
  cursor: grab;
}
.lb-stage.zoomed { cursor: grabbing; }
#lightbox img {
  max-height: 74dvh; max-width: 94vw;
  border-radius: 10px;
  transform-origin: center center;
  will-change: transform;
  user-select: none; -webkit-user-select: none;
}
.lightbox-tools {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top)); right: 14px;
  display: flex; gap: 8px;
  z-index: 2;
}
.lb-btn {
  color: #fff;
  border-color: rgb(255 255 255 / .3);
  background: rgb(0 0 0 / .4);
  width: 42px; height: 42px;
  font-size: 1.15rem;
  text-decoration: none;
}
.lb-btn:hover { color: #fff; border-color: rgb(255 255 255 / .7); }
.lightbox-caption { color: #ccd2d8; margin-top: 12px; font-size: .9rem; max-width: 640px; }
.lb-hint { color: rgb(255 255 255 / .45); font-size: .72rem; margin-top: 6px; }
@media (hover: hover) and (pointer: fine) { .lb-hint { display: none; } } /* desktop: not needed */

/* ————————————————————————————— footer ————————————————————————————— */
.footer { text-align: center; font-size: .82rem; color: var(--ink-2); display: grid; gap: 4px; padding-top: 8px; }

@media (max-width: 560px) {
  .hero { padding: 22px 18px; }
  .hero-row { gap: 16px; }
  main { padding: 16px 12px 120px; }
  .chat-panel { right: 8px; width: calc(100vw - 16px); }
}
