/* Ozy editorial design system — shared by shell and room iframes */

@font-face {
  font-family: "Fraunces";
  src: url("/shell/fonts/Fraunces-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/shell/fonts/Fraunces-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/shell/fonts/Fraunces-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/shell/fonts/InstrumentSans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/shell/fonts/InstrumentSans-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/shell/fonts/InstrumentSans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Paper & ink */
  --paper: #f4efe4;
  --paper-2: #ebe4d6;
  --paper-raised: #faf7f0;
  --panel: #faf7f0;
  --ink: #1a1714;
  --ink-2: #3d3830;
  --ink-wash: rgba(26, 23, 20, 0.06);
  --muted: #5c544a;
  --faint: #7a7268;
  --rule: #cfc4b4;
  --rule-soft: #e0d8ca;
  --accent: #2a4538;
  --accent-soft: #d8e4dc;
  --accent-deep: #1a3028;
  --accent-2: #a84e32;      /* clay — now, alerts, blocks */
  --accent-2-soft: #f0d8ce;
  --accent-3: #2a7090;      /* sky — events, calendar */
  --accent-3-soft: #cce0ea;
  --gold: #a07828;          /* ochre — morning, streaks */
  --gold-soft: #f0e4c8;
  --plum: #5c4080;          /* evening */
  --plum-soft: #e4dae8;
  --agent: #6b4a2d;
  --agent-soft: #f0e6d8;
  --danger: #8a2f2f;
  --danger-soft: #f6e6e6;

  /* Period washes (timeline bands) */
  --wash-morning: rgba(160, 120, 40, 0.07);
  --wash-afternoon: rgba(42, 112, 144, 0.06);
  --wash-evening: rgba(92, 64, 128, 0.07);

  /* Habit pigment inks (contract enum unchanged) */
  --c-sage: #2a4538;   --c-sage-soft: #d4e0d8;   --c-sage-ink: #1a3028;   --c-sage-glow: rgba(42, 69, 56, 0.18);
  --c-moss: #4a6632;   --c-moss-soft: #dde8d0;   --c-moss-ink: #2e4020;   --c-moss-glow: rgba(74, 102, 50, 0.18);
  --c-clay: #a84e32;   --c-clay-soft: #f0d8ce;   --c-clay-ink: #7a3824;   --c-clay-glow: rgba(168, 78, 50, 0.18);
  --c-ochre: #a07828;  --c-ochre-soft: #f0e4c8;  --c-ochre-ink: #705018;  --c-ochre-glow: rgba(160, 120, 40, 0.18);
  --c-rose: #9a4060;   --c-rose-soft: #f0d4de;   --c-rose-ink: #702840;  --c-rose-glow: rgba(154, 64, 96, 0.18);
  --c-plum: #5c4080;   --c-plum-soft: #e4dae8;   --c-plum-ink: #402858;  --c-plum-glow: rgba(92, 64, 128, 0.18);
  --c-slate: #3d5870;  --c-slate-soft: #d4dde4;  --c-slate-ink: #283848;  --c-slate-glow: rgba(61, 88, 112, 0.18);
  --c-sky: #2a7090;    --c-sky-soft: #cce0ea;    --c-sky-ink: #1a5068;   --c-sky-glow: rgba(42, 112, 144, 0.18);

  /* Heatmap ink levels */
  --heat-0: #e8e0d2;
  --heat-1: #c4d8cc;
  --heat-2: #8ab098;
  --heat-3: #4a7860;
  --heat-4: #2a4538;

  /* Type scale */
  --font-display: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --font-ui: "Instrument Sans", system-ui, sans-serif;
  --text-display: clamp(40px, 5vw, 72px);
  --text-title: clamp(28px, 3.5vw, 36px);
  --text-heading: 24px;
  --text-body: 16px;
  --text-ui: 14px;
  --text-caps: 11px;

  /* Layout */
  --page-pad: clamp(16px, 3vw, 32px);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --spring-snappy: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-soft: cubic-bezier(0.22, 1.2, 0.36, 1);
  --spring-bouncy: cubic-bezier(0.44, 1.4, 0.56, 1);
  --dur-fast: 140ms;
  --dur: 280ms;
  --dur-slow: 520ms;
  --dur-slower: 800ms;
  --stagger: 40ms;

  --shadow: 0 1px 0 rgba(26, 23, 20, 0.04), 0 12px 40px -16px rgba(26, 23, 20, 0.12);
  --shadow-1: 0 1px 2px rgba(26, 23, 20, 0.06), 0 4px 12px -4px rgba(26, 23, 20, 0.08);
  --shadow-2: 0 2px 4px rgba(26, 23, 20, 0.06), 0 12px 32px -8px rgba(26, 23, 20, 0.14);
  --shadow-3: 0 4px 8px rgba(26, 23, 20, 0.08), 0 24px 64px -16px rgba(26, 23, 20, 0.22);
}

@supports (animation-timing-function: linear(0, 1)) {
  :root {
    --spring-snappy: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%, 0.937 38.1%, 0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.8%, 1);
    --spring-soft: linear(0, 0.008, 0.031 2.5%, 0.128 5.9%, 0.646 17.5%, 0.832 23.4%, 0.924 29.1%, 0.976 35%, 0.998 41.2%, 1.006 47.4%, 1.009 55.3%, 1.002 78.2%, 1);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1100px 560px at 8% -12%, rgba(216, 228, 220, 0.75), transparent 62%),
    radial-gradient(900px 520px at 104% -6%, rgba(240, 228, 200, 0.7), transparent 58%),
    radial-gradient(800px 480px at 50% 112%, rgba(228, 218, 232, 0.45), transparent 60%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  background-attachment: fixed, fixed, fixed, scroll;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
h1, h2, h3, h4 { font-weight: 400; margin: 0; }

.num { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Typography */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.display-italic { font-style: italic; }
.caps {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.dateline {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--muted);
}

/* Rules & layout */
.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.rule-soft { border-color: var(--rule-soft); }

.page {
  padding: var(--page-pad);
  min-height: 100vh;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}
.masthead-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 36px);
  font-style: italic;
  line-height: 1.1;
}
.masthead-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.editorial-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (min-width: 960px) {
  .editorial-grid.has-aside {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-1);
}

/* Card (raised panel) */
.card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
  transition: transform var(--dur) var(--spring-soft), box-shadow var(--dur);
}
.card:hover { box-shadow: var(--shadow-2); }
.card.lift:hover { transform: translateY(-2px); }

/* Hero date */
.hero-date {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
}
.hero-date.reveal { clip-path: inset(0 100% 0 0); animation: text-reveal 680ms var(--ease-out) forwards; }
@keyframes text-reveal { to { clip-path: inset(0 0 0 0); } }
.hero-date em { font-style: inherit; color: var(--accent); }
.hero-bar {
  height: 4px;
  width: 96px;
  border-radius: 2px;
  margin-top: 10px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--gold) 55%, var(--accent-2) 100%);
  transform-origin: left;
  animation: bar-grow 720ms var(--spring-soft) 200ms both;
}
@keyframes bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Metric chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 8px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  background: var(--c-soft, var(--paper-2));
  color: var(--c-ink, var(--ink));
  border: 1px solid transparent;
  animation: fade-in 420ms var(--ease-out) both;
}
.metric-chip .mc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); box-shadow: 0 0 0 3px var(--c-glow, transparent); }
.metric-chip b { font-family: var(--font-display); font-size: 16px; font-weight: 400; font-style: italic; }

/* Week strip day cells */
.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--spring-snappy), box-shadow var(--dur-fast);
}
.day-cell:hover { background: var(--paper-2); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.day-cell.today { border-color: var(--accent-soft); box-shadow: 0 0 0 3px var(--c-sage-glow); }
.day-cell.today .day-label { color: var(--accent); }
.day-cell.selected {
  border-color: var(--accent);
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: var(--paper);
  box-shadow: var(--shadow-2), 0 10px 28px -12px var(--accent);
}
.day-cell.selected .day-label, .day-cell.selected .day-num { color: var(--paper); }
.day-cell.selected .day-dot { background: rgba(255,255,255,0.35); }
.day-cell.selected .day-dot.on { background: var(--paper); }
.day-cell.past:not(.selected) { opacity: 0.75; }
.day-cell .day-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.day-cell .day-num { font-family: var(--font-display); font-size: 24px; font-style: italic; line-height: 1; }
.day-cell .day-dots { display: flex; gap: 4px; margin-top: 3px; min-height: 6px; }
.day-cell .day-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rule); transition: transform var(--dur-fast) var(--spring-snappy); }
.day-cell .day-dot.on { background: var(--accent); }
.day-cell .day-dot.habits.on { background: var(--accent); }
.day-cell .day-dot.habits.partial { background: var(--gold); }
.day-cell .day-dot.events.on { background: var(--accent-3); }
.day-cell .day-dot.blocks.on { background: var(--accent-2); }
.day-cell:hover .day-dot { transform: scale(1.2); }
.day-cell .day-ring { width: 28px; height: 28px; }

/* Progress ring */
.ring { display: block; }
.ring-track { fill: none; stroke: var(--rule-soft); stroke-width: 3; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset var(--dur-slow) var(--spring-soft); }

/* Large stamp */
.chip-stamp {
  appearance: none;
  width: 48px;
  height: 48px;
  border: 2px solid var(--c-soft, var(--rule));
  border-radius: var(--radius-sm);
  background: var(--panel);
  display: grid;
  place-items: center;
  padding: 0;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--spring-snappy), box-shadow var(--dur-fast);
  flex-shrink: 0;
}
.chip-stamp svg { width: 20px; height: 20px; stroke: var(--paper); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.chip-stamp svg path { stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset 280ms var(--ease-out) 60ms; }
.chip-stamp[aria-pressed="true"] { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); box-shadow: 0 0 0 4px var(--c-glow, var(--accent-soft)); }
.chip-stamp[aria-pressed="true"] svg path { stroke-dashoffset: 0; }
.chip-stamp.pop { animation: stamp-pop 420ms var(--spring-bouncy); }

/* Timeline */
.timeline {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  min-height: 400px;
}
.timeline-hours { display: contents; }
.timeline-hour {
  grid-column: 1;
  font-size: 11px;
  font-weight: 500;
  color: var(--faint);
  text-align: right;
  padding-right: 10px;
  height: 48px;
  line-height: 48px;
  border-top: 1px solid var(--rule-soft);
}
.timeline-grid {
  grid-column: 2;
  position: relative;
  border-left: 1px solid var(--rule);
  min-height: 100%;
}
.timeline-slot {
  position: absolute;
  left: 8px;
  right: 8px;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--dur-fast), transform var(--dur-fast);
  z-index: 1;
}
.timeline-slot:hover { box-shadow: var(--shadow-2); z-index: 2; }
.timeline-slot.event { background: var(--c-soft, var(--accent-soft)); border: 1px solid var(--c, var(--accent)); color: var(--c-ink, var(--accent)); }
.timeline-slot.event.google { background: transparent; border: 1.5px dashed var(--muted); color: var(--ink-2); font-style: italic; }
.timeline-slot.block { background: var(--c, var(--accent)); color: var(--paper); border: none; }
.timeline-slot.block.done { opacity: 0.55; text-decoration: line-through; }
.timeline-slot .slot-time { font-size: 10px; opacity: 0.75; margin-bottom: 2px; }
.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-2), rgba(168, 78, 50, 0.25));
  z-index: 5;
  pointer-events: none;
}
.now-line::before {
  content: "";
  position: absolute;
  left: -6px;
  top: -5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 4px var(--c-clay-glow);
  animation: now-pulse 2.4s ease-in-out infinite;
}
.now-line .now-label {
  position: absolute;
  right: 8px;
  top: -9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--paper);
  background: var(--accent-2);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}
@keyframes now-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--c-clay-glow); }
  50% { box-shadow: 0 0 0 9px rgba(168, 78, 50, 0.06); }
}

.kbd {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper-2);
  color: var(--muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 500;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--panel);
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--spring-snappy), box-shadow var(--dur-fast);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { box-shadow: var(--shadow-1); }
.btn:hover:not(:disabled) { background: var(--paper-2); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset, 0 6px 16px -8px var(--c-sage-glow); }
.btn.primary:hover:not(:disabled) { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--paper-2); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: #e0c0c0; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.icon { padding: 7px 10px; }

.btn:focus-visible, .stamp:focus-visible, .seg button:focus-visible,
.field input:focus-visible, .field textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Stamp (check control) */
.stamp {
  appearance: none;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--c-soft, var(--rule));
  background: var(--panel);
  display: grid;
  place-items: center;
  padding: 0;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--spring-snappy);
  flex-shrink: 0;
}
.stamp svg {
  width: 16px; height: 16px;
  stroke: var(--paper);
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stamp svg path {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  transition: stroke-dashoffset 260ms var(--ease-out) 60ms;
}
.stamp[aria-pressed="true"] {
  background: var(--c, var(--accent));
  border-color: var(--c, var(--accent));
}
.stamp[aria-pressed="true"] svg path { stroke-dashoffset: 0; }
.stamp.pop { animation: stamp-pop 380ms var(--spring-snappy); }
@keyframes stamp-pop {
  0% { transform: scale(0.82); }
  55% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Ledger rows */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule-soft);
  cursor: pointer;
  transition: background 400ms ease;
  will-change: transform;
}
.ledger-row:hover { background: rgba(235, 228, 214, 0.45); }
.ledger-row.done .ledger-name { color: var(--muted); }
.ledger-row.flash { background: var(--agent-soft); transition: background 0s; }
.ledger-row.flash-you { background: var(--accent-soft); transition: background 0s; }
.ledger-row.pending { opacity: 0.7; }
.ledger-row.enter { animation: row-enter 400ms var(--ease-out) both; }
@keyframes row-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 0 6px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2px;
}

/* Figure (stat block) */
.figure {
  padding: 14px 16px;
  border: 1px solid var(--rule);
  background: var(--panel);
}
.figure .label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.figure .value {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.1;
  color: var(--accent);
  margin-top: 2px;
}
.figure .value small {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}
.figure .sub {
  font-size: 12px;
  color: var(--faint);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Segmented control */
.seg {
  display: inline-flex;
  position: relative;
  border: 1px solid var(--rule);
  background: var(--paper);
}
.seg button {
  position: relative;
  z-index: 1;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--dur-fast);
}
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { color: var(--paper); }
.seg-indicator {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: var(--ink);
  transition: transform var(--dur) var(--ease-out), width var(--dur) var(--ease-out);
  pointer-events: none;
}

/* Live wire badge */
.wire {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--rule);
  padding: 4px 10px 4px 8px;
  background: var(--panel);
  transition: color 300ms, border-color 300ms, background 300ms;
}
.wire .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--faint);
  transition: background 300ms, box-shadow 300ms;
}
.wire.on .dot { background: var(--accent); animation: breathe 2.6s ease-in-out infinite; }
.wire.ping { color: var(--agent); border-color: #dcc8b0; background: var(--agent-soft); }
.wire.ping .dot { background: var(--agent); box-shadow: 0 0 0 4px rgba(107, 74, 45, 0.15); animation: none; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Sheet / dialog */
dialog.sheet, .sheet-dialog {
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--ink);
  padding: 0;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  box-shadow: 0 24px 64px -20px rgba(26, 23, 20, 0.35);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 220ms var(--ease-out), transform 260ms var(--ease-out), overlay 260ms allow-discrete, display 260ms allow-discrete;
}
dialog.sheet[open], .sheet-dialog[open], .sheet-backdrop.open .sheet-dialog { opacity: 1; transform: none; }
@starting-style { dialog.sheet[open], .sheet-dialog[open] { opacity: 0; transform: translateY(10px); } }
dialog.sheet::backdrop {
  background: rgba(26, 23, 20, 0.28);
  backdrop-filter: blur(1px);
  transition: opacity 220ms, overlay 220ms allow-discrete, display 220ms allow-discrete;
}
@media (max-width: 640px) {
  dialog.sheet, .sheet-dialog {
    width: 100vw;
    max-width: none;
    max-height: calc(100vh - 20px);
    margin: auto 0 0;
    transform: translateY(32px);
  }
  @starting-style { dialog.sheet[open], .sheet-dialog[open] { transform: translateY(32px); } }
}

.sheet-body { padding: 22px 22px 8px; overflow: auto; max-height: inherit; }
.sheet-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px 18px;
  border-top: 1px solid var(--rule-soft);
  flex-wrap: wrap;
}
.sheet-foot .grow { flex: 1; }

.field { margin-bottom: 16px; }
.field label, .field .lbl {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="date"],
.field input[type="number"],
.field input[type="email"],
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--rule);
  background: #fff;
  font-size: 15px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.field input:focus, .field textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Toast */
.plot-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 16px);
  opacity: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  transition: opacity 200ms, transform 300ms var(--spring-snappy);
  max-width: calc(100vw - 32px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 100;
}
.plot-toast.show { opacity: 1; transform: translate(-50%, 0); }
.plot-toast.agent { background: var(--agent); }
.plot-toast.error { background: var(--danger); }

/* Empty state */
.empty-state {
  padding: 32px 24px;
  text-align: center;
  animation: fade-in 500ms var(--ease-out);
}
.empty-state h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-style: italic;
  margin-bottom: 8px;
}
.empty-state p { color: var(--muted); max-width: 42ch; margin: 0 auto 20px; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Chip / starter */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--rule);
  background: var(--panel);
  padding: 7px 14px 7px 8px;
  font-size: 14px;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--spring-snappy);
}
.chip:hover:not(:disabled) { background: var(--c-soft, var(--paper-2)); border-color: var(--c-soft, var(--rule)); transform: translateY(-1px); }
.chip .ci {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--c-soft, var(--paper-2));
  font-size: 13px;
}
.chip.added { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); color: var(--paper); }
.chip.added .ci { background: rgba(255,255,255,0.2); }

/* Feed */
.feed { list-style: none; margin: 0; padding: 0; max-height: min(56vh, 520px); overflow: auto; }
.feed-day {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  padding: 10px 0 4px;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
.feed-entry {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 13px;
}
.feed-entry.enter { animation: feed-in 360ms var(--ease-out); }
@keyframes feed-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: none; }
}
.feed-who {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--accent-soft);
  color: var(--accent);
}
.feed-entry.agent .feed-who { background: var(--agent-soft); color: var(--agent); }

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