:root {
  --bg: #0b100d;
  --surface: #121a15;
  --surface-2: #18221b;
  --surface-3: #202c23;
  --line: #2b392f;
  --ink: #f2f4ec;
  --muted: #98a49b;
  --quiet: #657168;
  --acid: #d8f17a;
  --acid-dark: #2b3719;
  --red: #f18a73;
  --amber: #e8ba67;
  --cyan: #7fc9bd;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 85% 0, rgba(216,241,122,.06), transparent 28rem), var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { color: inherit; -webkit-tap-highlight-color: transparent; cursor: pointer; }
button:focus, input:focus, select:focus, textarea:focus { outline: 2px solid var(--acid); outline-offset: 2px; }
button:disabled { opacity: .45; }
h1, h2, p { overflow-wrap: break-word; }
h1 { margin: 0; font: 400 46px/1 Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
h2 { margin: 0; font-weight: 600; }

.app-shell { min-height: 100vh; padding-bottom: 96px; }
.topbar { position: -webkit-sticky; position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 72px; padding: env(safe-area-inset-top) 24px 0; border-bottom: 1px solid rgba(255,255,255,.07); background: rgba(11,16,13,.96); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.brand { display: inline-grid; grid-template-columns: 38px 1fr; grid-gap: 12px; align-items: center; width: max-content; }
.brand-button { min-height: 52px; padding: 0; border: 0; background: transparent; text-align: left; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 12px; letter-spacing: .18em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.sigil { display: block; width: 38px; height: 38px; border: 1px solid #6f8139; border-radius: 10px; background: var(--acid); color: #11180d; font: 700 23px/38px Georgia, serif; text-align: center; }
.topbar-status { display: grid; grid-auto-flow: column; grid-gap: 10px; align-items: center; color: var(--muted); font-size: 12px; }
.topbar-status time { padding-left: 12px; border-left: 1px solid var(--line); color: var(--ink); font: 17px ui-monospace, SFMono-Regular, Menlo, monospace; }
.status-dot, .mini-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--quiet); }
.status-dot.online, .mini-dot.good { background: var(--acid); box-shadow: 0 0 12px rgba(216,241,122,.55); }
.status-dot.offline, .mini-dot.offline { background: var(--red); }
.mini-dot.pending { background: var(--amber); }

.access-shell { min-height: 100vh; }
.access-topbar { position: static; }
.connection-pill { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.access-main { display: grid; place-items: center; min-height: calc(100vh - 72px); padding: 24px; }
.access-card { width: 100%; max-width: 520px; padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.access-card h1 { font-size: 38px; }
.access-card form { margin-top: 24px; }

main { max-width: 1180px; margin: 0 auto; padding: 42px 28px 48px; }
.view { animation: enter .2s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.eyebrow { margin: 0 0 8px; color: var(--acid); font: 600 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; text-transform: uppercase; }
.lead { margin: 12px 0 0; color: var(--muted); font-size: 16px; line-height: 1.5; }
.welcome-row { display: grid; grid-template-columns: 1fr auto; grid-gap: 32px; align-items: end; min-height: 142px; }
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); grid-gap: 10px; }
.action-button { display: grid; grid-template-columns: auto 1fr; grid-gap: 8px; align-items: center; min-height: 50px; padding: 0 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.action-button span { color: var(--acid); font-size: 19px; }
.action-button.primary { border-color: #607031; background: var(--acid); color: #141a0f; }
.action-button.primary span { color: inherit; }

.system-strip { display: grid; grid-template-columns: 1fr 1fr 1fr auto; grid-gap: 1px; margin-top: 34px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--line); }
.system-strip article { display: grid; grid-template-columns: auto 1fr; grid-gap: 10px; align-items: center; min-height: 72px; padding: 12px 16px; background: var(--surface); }
.system-strip small, .system-strip strong { display: block; }
.system-strip small { color: var(--quiet); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.system-strip strong { margin-top: 4px; font-size: 13px; }
.system-strip button { min-width: 88px; border: 0; background: var(--surface-2); color: var(--acid); }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 10px; margin-top: 12px; }
.metric-grid article { min-height: 132px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.metric-grid span, .metric-grid strong, .metric-grid small { display: block; }
.metric-grid span { color: var(--muted); font-size: 12px; }
.metric-grid strong { margin: 22px 0 8px; font: 400 42px/1 Georgia, serif; }
.metric-grid small { color: var(--quiet); font-size: 10px; }
.alert-metric strong { color: var(--red); }

.content-card { margin-top: 12px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.card-heading { display: grid; grid-template-columns: 1fr auto; grid-gap: 20px; align-items: end; margin-bottom: 18px; }
.card-heading h2 { font: 400 26px/1.1 Georgia, serif; }
.card-heading > button { min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--acid); font-size: 11px; }
.focus-list { border-top: 1px solid var(--line); }
.focus-item { display: grid; grid-template-columns: 86px 1fr; grid-gap: 14px; align-items: center; min-height: 88px; border-bottom: 1px solid var(--line); }
.focus-item:last-child { border-bottom: 0; }
.focus-item small, .focus-item strong { display: block; }
.focus-item small { color: var(--quiet); font-size: 10px; text-transform: uppercase; }
.focus-item strong { margin-top: 5px; font-size: 15px; }
.focus-item p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.focus-priority { color: var(--amber); font: 10px ui-monospace, monospace; text-transform: uppercase; }
.home-columns, .vault-columns { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 12px; }
.agent-summary, .compact-list { display: grid; grid-gap: 8px; }
.agent-summary-item, .compact-item { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.agent-summary-item { display: grid; grid-template-columns: 40px 1fr; grid-gap: 10px; align-items: center; }
.agent-avatar-small, .agent-mark { position: relative; display: block; padding: 0; border: 1px solid #51612f; background: transparent; color: var(--acid); font-family: Georgia, serif; text-align: center; overflow: hidden; }
.agent-avatar-small { width: 36px; height: 36px; border-radius: 8px; font-size: 18px; line-height: 34px; }
.agent-mark { width: 52px; height: 52px; margin-bottom: 20px; border-radius: 11px; font-size: 24px; line-height: 50px; }
.agent-avatar-small img, .agent-mark img { position: absolute; top: 0; left: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.agent-avatar-small img { border-radius: 7px; }
.agent-mark img { border-radius: 10px; }
.agent-summary-item strong, .agent-summary-item small, .compact-item strong, .compact-item small { display: block; }
.agent-summary-item strong, .compact-item strong { font-size: 12px; }
.agent-summary-item small, .compact-item small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.empty-state { padding: 24px; color: var(--muted); text-align: center; line-height: 1.5; }
.wide-empty { grid-column: 1 / -1; border: 1px dashed var(--line); border-radius: 16px; background: var(--surface); }

.page-heading { display: grid; grid-template-columns: 1fr auto; grid-gap: 20px; align-items: end; min-height: 118px; margin-bottom: 24px; }
.round-action { width: 52px; height: 52px; border: 0; border-radius: 50%; background: var(--acid); color: #11180d; font-size: 26px; }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 420px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.filters button { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.filters button.active { background: var(--ink); color: var(--bg); }
.activity-list, .agent-grid { display: grid; grid-template-columns: repeat(2, 1fr); grid-gap: 12px; margin-top: 18px; }
.activity-card, .agent-card { min-height: 210px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.activity-card.blocked { border-color: #633b32; }
.activity-top { display: grid; grid-template-columns: 1fr auto; grid-gap: 12px; align-items: center; }
.activity-top > span:first-child { color: var(--acid); font: 10px ui-monospace, monospace; }
.state-pill { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.activity-card h2 { margin-top: 24px; font-size: 18px; line-height: 1.25; }
.activity-card p { margin: 10px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.activity-meta { color: var(--quiet); font-size: 10px; }
.agent-card small { color: var(--quiet); font: 9px ui-monospace, monospace; text-transform: uppercase; }
.agent-card h2 { margin: 18px 0 6px; font: 400 28px Georgia, serif; }
.agent-card strong { color: var(--cyan); font-size: 12px; }
.agent-card p { color: var(--muted); font-size: 12px; line-height: 1.5; }

.room-grid { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 10px; }
.room-card { display: grid; grid-template-columns: 42px 1fr; grid-gap: 12px; min-height: 118px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.room-card > span { color: var(--acid); font: 11px ui-monospace, monospace; }
.room-card small { color: var(--quiet); font-size: 10px; }
.room-card h2 { margin: 5px 0; font: 400 19px Georgia, serif; }
.room-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.timeline article { padding: 14px; border-bottom: 1px solid var(--line); }
.timeline article:last-child { border-bottom: 0; }
.timeline small, .timeline strong { display: block; }
.timeline small { color: var(--quiet); font: 9px ui-monospace, monospace; }
.timeline strong { margin-top: 5px; color: var(--acid); font-size: 11px; }
.timeline p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }

.bottom-nav { position: fixed; right: 50%; bottom: 14px; z-index: 30; display: grid; grid-template-columns: repeat(5, 88px); width: 440px; margin-right: -220px; padding: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); border: 1px solid var(--line); border-radius: 22px; background: rgba(18,26,21,.97); box-shadow: 0 18px 50px rgba(0,0,0,.45); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.bottom-nav button { min-height: 58px; padding: 5px; border: 0; border-radius: 16px; background: transparent; color: var(--muted); font-size: 9px; }
.bottom-nav button span { display: block; margin-bottom: 4px; font-size: 19px; line-height: 1; }
.bottom-nav button.active { background: var(--surface-3); color: var(--acid); }
.bottom-nav .capture-nav { margin: 0 4px; border: 1px solid #556635; background: var(--acid-dark); color: var(--acid); }

.display-mode { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; display: grid; grid-template-rows: auto 1fr auto auto; padding: calc(24px + env(safe-area-inset-top)) 30px calc(24px + env(safe-area-inset-bottom)); background: radial-gradient(circle at center, #1b281e, #080c09 68%); }
.display-top, .display-bottom { display: grid; grid-template-columns: 1fr auto; align-items: center; color: var(--muted); font: 11px ui-monospace, monospace; letter-spacing: .12em; }
.display-top button { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.display-center { align-self: center; text-align: center; }
.display-center time { display: block; font: 400 132px/.9 Georgia, serif; letter-spacing: -.06em; }
.display-center p { margin: 18px 0 0; color: var(--muted); font-size: 24px; text-transform: capitalize; }
.display-focus { max-width: 760px; margin: 0 auto 34px; text-align: center; }
.display-focus small, .display-focus strong, .display-focus span { display: block; }
.display-focus small { color: var(--acid); font: 10px ui-monospace, monospace; letter-spacing: .16em; }
.display-focus strong { margin: 12px 0 7px; font: 400 26px/1.25 Georgia, serif; }
.display-focus span { color: var(--muted); font-size: 13px; }
.display-bottom span:last-child { color: var(--amber); }

.sheet-open { overflow: hidden; }
.sheet-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 80; display: grid; place-items: end center; padding: 18px; background: rgba(2,4,3,.72); }
.sheet { width: 100%; max-width: 680px; max-height: 92vh; overflow: auto; padding: 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: 0 20px 80px rgba(0,0,0,.55); }
.sheet-header { display: grid; grid-template-columns: 1fr auto; grid-gap: 18px; align-items: start; margin-bottom: 22px; }
.sheet-header h2 { font: 400 30px Georgia, serif; }
.sheet-header > button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); font-size: 25px; }
form { display: grid; grid-gap: 16px; }
label { display: block; color: var(--muted); font-size: 12px; }
label > small { display: block; margin-top: 5px; color: var(--quiet); text-align: right; }
input, select, textarea { display: block; width: 100%; margin-top: 7px; border: 1px solid var(--line); border-radius: 12px; background: #0d130f; color: var(--ink); font-size: 16px; }
input, select { min-height: 50px; padding: 0 13px; }
textarea { min-height: 150px; padding: 13px; resize: vertical; line-height: 1.5; }
.primary-button { min-height: 52px; padding: 0 16px; border: 0; border-radius: 14px; background: var(--acid); color: #11180d; font-weight: 700; }
.form-note { margin: 0; padding: 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 11px; line-height: 1.45; }
.form-result { min-height: 18px; margin: 0; color: var(--acid); font-size: 12px; }
.receipt-block { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.receipt-list { margin: 0; padding: 0; list-style: none; }
.receipt-list li { padding: 12px 0; border-top: 1px solid var(--line); font-size: 12px; }
.receipt-list li:first-child { border-top: 0; }
.receipt-list small { display: block; margin-top: 4px; color: var(--muted); }
#toast { position: fixed; right: 22px; bottom: 96px; z-index: 120; max-width: 320px; transform: translateY(16px); padding: 13px 16px; border: 1px solid #5b6a34; border-radius: 12px; background: #192316; color: var(--acid); opacity: 0; pointer-events: none; transition: .2s ease; font-size: 12px; }
#toast.show { transform: none; opacity: 1; }

@media (max-width: 820px) {
  main { padding: 34px 20px 44px; }
  .system-strip { grid-template-columns: 1fr 1fr; }
  .system-strip button { min-height: 54px; }
  .metric-grid article { min-height: 116px; padding: 16px; }
  .display-center time { font-size: 112px; }
}

@media (max-width: 680px) {
  .topbar { padding-left: 16px; padding-right: 16px; }
  #connection-label { display: none; }
  main { padding: 26px 16px 42px; }
  h1 { font-size: 40px; }
  .welcome-row { grid-template-columns: 1fr; grid-gap: 22px; align-items: start; }
  .system-strip, .metric-grid, .home-columns, .vault-columns, .activity-list, .agent-grid, .room-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid article { min-height: 108px; }
  .room-card { grid-column: span 2; }
  .bottom-nav { right: 8px; left: 8px; width: auto; margin-right: 0; grid-template-columns: repeat(5, 1fr); }
  .display-center time { font-size: 86px; }
  .display-center p { font-size: 18px; }
}

@media (max-width: 430px) {
  h1 { font-size: 36px; }
  .system-strip, .home-columns, .vault-columns, .activity-list, .agent-grid { grid-template-columns: 1fr; }
  .metric-grid article { padding: 14px; }
  .metric-grid strong { font-size: 32px; }
  .focus-item { grid-template-columns: 1fr; padding: 15px 0; }
  .display-mode { padding-left: 18px; padding-right: 18px; }
  .display-center time { font-size: 68px; }
  .display-bottom { grid-template-columns: 1fr; grid-gap: 8px; }
  .sheet-backdrop { padding: 0; }
  .sheet { border-right: 0; border-bottom: 0; border-left: 0; border-radius: 24px 24px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
