:root {
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  --text-2xl: clamp(2.5rem, 1.6rem + 3.5vw, 4.5rem);

  --bg: #0a0908;
  --surface: #121110;
  --surface-2: #181715;
  --border: #2a2825;
  --divider: #1f1e1b;
  --text: #ece9e3;
  --muted: #9a978f;
  --faint: #5d5a55;
  --gold: #c9a84c;
  --gold-light: #e2c46c;
  --ok: #8fb79a;
  --ok-bg: rgba(143, 183, 154, 0.12);
  --flag: #e8896b;
  --flag-bg: rgba(232, 137, 107, 0.12);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Switzer', 'Helvetica Neue', Arial, sans-serif;

  --r: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; font-weight: 400; }
p { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }

/* sample bar */
.sample-bar {
  background: var(--gold);
  color: #17140c;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 1rem;
}

/* header */
.top { border-bottom: 1px solid var(--divider); background: rgba(10, 9, 8, 0.92); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { color: var(--text); display: block; width: 150px; }
.logo svg { width: 100%; height: auto; }
.owner-chip { display: inline-flex; align-items: center; gap: 0.6rem; font-size: var(--text-sm); color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; font-size: var(--text-xs); color: var(--gold); letter-spacing: 0.04em; }

/* hero */
.hero { position: relative; height: clamp(260px, 38vw, 420px); overflow: hidden; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,9,8,0.15) 0%, rgba(10,9,8,0.35) 50%, rgba(10,9,8,0.95) 100%); }
.hero-content { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 2rem; }
.eyebrow { font-size: var(--text-xs); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-light); margin-bottom: 0.5rem; }
.hero h1 { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 300; letter-spacing: 0.01em; }
.hero-meta { color: #cfccc5; font-size: var(--text-sm); margin-top: 0.5rem; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.5rem; }

.status-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; margin-top: -1rem; position: relative; z-index: 2; }
.status-side { display: grid; gap: 1rem; align-content: start; }

/* live card */
.live-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.live-pill { display: inline-flex; align-items: center; gap: 0.5rem; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-light); border: 1px solid rgba(201,168,76,0.4); border-radius: 999px; padding: 0.3rem 0.75rem; }
.live-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 0 rgba(201,168,76,0.6); animation: pulse 1.8s infinite; }
.live-pill.done { color: var(--ok); border-color: rgba(143,183,154,0.4); }
.live-pill.done .dot { background: var(--ok); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(201,168,76,0.55); } 70% { box-shadow: 0 0 0 8px rgba(201,168,76,0); } 100% { box-shadow: 0 0 0 0 rgba(201,168,76,0); } }
.live-time { font-size: var(--text-sm); color: var(--muted); }
.live-title { font-family: var(--font-display); font-size: var(--text-xl); }
.live-sub { color: var(--muted); font-size: var(--text-sm); margin-top: 0.35rem; }
.progress { height: 3px; background: var(--divider); border-radius: 3px; margin: 1.25rem 0 0.75rem; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: var(--gold); transition: width 600ms var(--ease); }
.live-list { display: grid; gap: 0; max-height: 360px; overflow: auto; mask-image: linear-gradient(#000 85%, transparent); -webkit-mask-image: linear-gradient(#000 85%, transparent); }
.live-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 0.75rem; align-items: start; padding: 0.6rem 0; border-bottom: 1px solid var(--divider); font-size: var(--text-sm); animation: rise 500ms var(--ease) both; }
.live-list li:last-child { border-bottom: 0; }
.live-list .t { color: var(--faint); font-variant-numeric: tabular-nums; font-size: var(--text-xs); padding-top: 2px; }
.live-list .note { display: block; color: var(--muted); font-size: var(--text-xs); margin-top: 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.live-actions { margin-top: 1rem; }

.ico { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.ico svg { width: 12px; height: 12px; }
.ico.ok { background: var(--ok-bg); color: var(--ok); }
.ico.flag { background: var(--flag-bg); color: var(--flag); }

/* stat cards */
.stat-label { font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.stat-value { display: flex; align-items: center; gap: 0.6rem; font-size: var(--text-lg); font-weight: 500; }
.ok-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.stat-foot { color: var(--faint); font-size: var(--text-xs); margin-top: 0.6rem; }
.readings-row { display: flex; gap: 2.5rem; }
.stat-num { font-family: var(--font-display); font-size: 2.5rem; line-height: 1; }
.stat-num span { font-size: 1.1rem; color: var(--muted); margin-left: 2px; }
.spark { width: 100%; height: 64px; margin-top: 0.9rem; display: block; }

/* tabs */
.tabs { display: flex; gap: 0.25rem; margin-top: 2.5rem; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 0.9rem 1rem; font-size: var(--text-sm); color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color 180ms; display: inline-flex; align-items: center; gap: 0.45rem; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold); }
.badge { background: var(--flag); color: #1a0f0b; font-size: 0.6875rem; font-weight: 600; border-radius: 999px; min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center; }

.panel { padding: 1.75rem 0 3rem; }

/* timeline */
.timeline { display: grid; gap: 1rem; }
.visit { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.visit-head { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 1rem; padding: 1.25rem 1.5rem; align-items: center; }
.visit-head:hover { background: var(--surface-2); }
.visit-date { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; }
.visit-kind { font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-light); margin-bottom: 0.3rem; }
.visit-meta { font-size: var(--text-sm); color: var(--muted); margin-top: 0.3rem; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.verified { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--ok); }
.verified svg { width: 13px; height: 13px; }
.visit-summary { display: inline-flex; align-items: center; gap: 0.5rem; font-size: var(--text-sm); padding: 0.35rem 0.75rem; border-radius: 999px; white-space: nowrap; }
.visit-summary.ok { background: var(--ok-bg); color: var(--ok); }
.visit-summary.flag { background: var(--flag-bg); color: var(--flag); }
.chev { width: 16px; height: 16px; color: var(--faint); transition: transform 250ms var(--ease); margin-left: 0.25rem; }
.visit[open-state="true"] .chev { transform: rotate(180deg); }
.visit-body { padding: 0 1.5rem 1.5rem; display: grid; gap: 1.25rem; }
.visit-body[hidden], .panel[hidden], [hidden] { display: none !important; }
.visit-note { background: var(--surface-2); border-left: 2px solid var(--gold); padding: 0.9rem 1rem; border-radius: 0 6px 6px 0; font-size: var(--text-sm); color: #d8d5ce; }
.visit-note b { color: var(--text); font-weight: 600; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms var(--ease); }
.photo:hover img { transform: scale(1.04); }
.photo span { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.4rem 0.6rem 0.45rem; font-size: var(--text-xs); line-height: 1.3; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #f1eee8; text-align: left; }
.photo span small { display: block; color: #bdb9b1; font-size: 0.6875rem; }
.checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 2rem; }
.checks li { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.5rem 0; border-bottom: 1px solid var(--divider); font-size: var(--text-sm); }
.checks .note { display: block; color: var(--muted); font-size: var(--text-xs); }
.sub-h { font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.6rem; }

/* items */
.item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.5rem; margin-bottom: 1rem; display: grid; grid-template-columns: 1fr 1.1fr; gap: 1.75rem; }
.item.closed { opacity: 0.85; }
.item-tag { display: inline-flex; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.25rem 0.6rem; border-radius: 999px; margin-bottom: 0.75rem; }
.item-tag.open { background: var(--flag-bg); color: var(--flag); }
.item-tag.done { background: var(--ok-bg); color: var(--ok); }
.item h3 { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: 0.5rem; }
.item-desc { color: var(--muted); font-size: var(--text-sm); }
.item-who { font-size: var(--text-sm); margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--divider); color: #d0cdc6; }
.item-who b { font-weight: 600; color: var(--text); }
.item-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; flex-wrap: wrap; }
.steps { position: relative; display: grid; gap: 0; align-content: start; }
.step { display: grid; grid-template-columns: 22px 1fr; gap: 0.85rem; padding-bottom: 1.1rem; position: relative; }
.step::before { content: ''; position: absolute; left: 10px; top: 22px; bottom: 0; width: 1px; background: var(--border); }
.step:last-child::before { display: none; }
.step-dot { width: 21px; height: 21px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); display: grid; place-items: center; }
.step.done .step-dot { background: var(--ok-bg); border-color: rgba(143,183,154,0.5); color: var(--ok); }
.step.now .step-dot { border-color: var(--gold); }
.step.now .step-dot::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.step-dot svg { width: 11px; height: 11px; }
.step-t { font-size: var(--text-sm); font-weight: 500; }
.step.pending .step-t { color: var(--faint); }
.step-d { font-size: var(--text-xs); color: var(--muted); }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 1rem; }

/* buttons */
.btn-gold { background: var(--gold); color: #17140c; font-weight: 600; font-size: var(--text-sm); padding: 0.75rem 1.25rem; border-radius: 6px; transition: background 180ms; }
.btn-gold:hover { background: var(--gold-light); }
.btn-ghost { border: 1px solid var(--border); font-size: var(--text-sm); padding: 0.7rem 1.1rem; border-radius: 6px; color: var(--text); transition: border-color 180ms; }
.btn-ghost:hover { border-color: var(--gold); }

/* drone */
.flight { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.5rem; margin-bottom: 1rem; }
.flight-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; margin-bottom: 1rem; }
.flight-head h3 { font-family: var(--font-display); font-size: 1.6rem; }
.flight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.flight-grid .photo { aspect-ratio: 4 / 3; border-radius: 8px; }
.flight-notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.25rem; }
.fn { border-top: 1px solid var(--divider); padding-top: 0.75rem; }
.fn p:first-child { font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.fn p:last-child { font-size: var(--text-sm); margin-top: 0.25rem; }
.next-flight { color: var(--muted); font-size: var(--text-sm); padding: 1rem 0; }

/* home profile */
.home-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.home-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.5rem; }
.home-card h3 { font-family: var(--font-display); font-size: 1.45rem; margin-bottom: 0.75rem; }
.kv { display: grid; grid-template-columns: 1fr; }
.kv div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--divider); font-size: var(--text-sm); }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd .warn { display: block; color: var(--flag); font-size: var(--text-xs); margin-top: 2px; }
.secret { letter-spacing: 0.2em; color: var(--faint); }
.access li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--divider); font-size: var(--text-sm); }
.access li:last-child { border-bottom: 0; }
.access .role { display: block; color: var(--muted); font-size: var(--text-xs); }
.switch { position: relative; width: 40px; height: 22px; border-radius: 999px; background: var(--border); transition: background 200ms; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform 200ms var(--ease); }
.switch[aria-checked="true"] { background: var(--gold); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: #17140c; }
.switch[disabled] { opacity: 0.6; cursor: default; }

/* footer */
.foot { border-top: 1px solid var(--divider); padding: 2.5rem 0 2rem; margin-top: 1rem; }
.foot-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.foot-title { font-family: var(--font-display); font-size: 1.6rem; }
.foot-sub { color: var(--muted); font-size: var(--text-sm); }
.foot-note { color: var(--faint); font-size: var(--text-xs); margin-top: 1.75rem; max-width: 70ch; }

/* lightbox, toast */
.lightbox { position: fixed; inset: 0; background: rgba(5,5,4,0.92); z-index: 50; display: grid; place-items: center; padding: 1.5rem; }
.lightbox[hidden] { display: none; }
.lightbox figure { max-width: min(1000px, 100%); }
.lightbox img { max-height: 78vh; width: auto; margin-inline: auto; border-radius: 8px; }
.lightbox figcaption { text-align: center; color: #d8d5ce; font-size: var(--text-sm); margin-top: 0.75rem; }
.lb-close { position: absolute; top: 1rem; right: 1.25rem; font-size: 2rem; line-height: 1; color: var(--text); width: 44px; height: 44px; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--gold); color: var(--text); padding: 0.8rem 1.2rem; border-radius: 8px; font-size: var(--text-sm); z-index: 60; max-width: calc(100% - 2rem); text-align: center; }
.toast[hidden] { display: none; }

/* responsive */
@media (max-width: 880px) {
  .status-grid { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr; }
  .home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .wrap { width: calc(100% - 2rem); }
  .owner-name { display: none; }
  .card, .item, .flight, .home-card { padding: 1.15rem; }
  .visit-head { padding: 1.1rem 1.15rem; grid-template-columns: 1fr; }
  .visit-body { padding: 0 1.15rem 1.15rem; }
  .checks { grid-template-columns: 1fr; }
  .flight-grid { grid-template-columns: 1fr; }
  .flight-notes { grid-template-columns: 1fr; gap: 0; }
  .kv div { grid-template-columns: 7.5rem 1fr; }
  .photos { grid-template-columns: repeat(2, 1fr); }
  .tab { padding: 0.85rem 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.mgr { display: flex; align-items: center; gap: 1rem; }
.mgr-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); border: 1px solid rgba(201,168,76,0.5); display: grid; place-items: center; font-family: var(--font-display); font-size: 1.4rem; color: var(--gold-light); flex-shrink: 0; }
.mgr-name { font-weight: 500; }
.mgr-role { color: var(--muted); font-size: var(--text-xs); }
.mgr-actions { display: flex; gap: 0.6rem; margin-top: 1.1rem; }
.mgr-actions button { flex: 1; }
.upnext { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--divider); display: grid; gap: 0.5rem; font-size: var(--text-sm); }
.upnext li { display: flex; justify-content: space-between; gap: 1rem; }
.upnext li span:last-child { color: var(--muted); white-space: nowrap; }
