/* Loki — knuffig, hell, monochrom. One accent (Loki violet) on cream/white/gray.
   One type scale, 4/8px grid, OKLCH. Green/red only as sparse status semantics. */

:root {
  /* paper & ink (cream / white / gray, violet-tinted neutrals) */
  --paper: oklch(97.8% 0.009 85);
  --card: oklch(100% 0 0);
  --ink: oklch(25% 0.03 282);
  --muted: oklch(50% 0.025 282);
  --faint: oklch(64% 0.02 282);
  --line: oklch(92.5% 0.01 282);
  --line-strong: oklch(88% 0.015 282);

  /* the one accent: Loki violet, as a ramp */
  --brand: oklch(56% 0.19 282);
  --brand-ink: oklch(45% 0.19 282);
  --brand-soft: oklch(93.5% 0.045 282);
  --brand-softer: oklch(96.5% 0.022 282);

  /* status semantics only — sparse */
  --ok: oklch(93% 0.055 160);
  --ok-ink: oklch(40% 0.1 160);
  --attn: oklch(93.5% 0.045 25);
  --attn-ink: oklch(50% 0.15 25);

  /* type scale: 13 / 14 / 16 / 20 / 28 (+ 40 for big friendly numbers) */
  --fs-xs: 13px;
  --fs-sm: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 28px;
  --fs-num: 40px;

  /* chunky-round */
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --shadow-sm: 0 1px 2px oklch(30% 0.03 282 / 0.04), 0 2px 10px oklch(30% 0.03 282 / 0.05);
  --shadow-md: 0 2px 4px oklch(30% 0.03 282 / 0.06), 0 10px 28px oklch(30% 0.03 282 / 0.09);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select { font: inherit; color: inherit; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- shell ---------- */
.shell { max-width: 1080px; margin: 0 auto; padding: 0 24px 96px; }
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 0; margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: var(--fs-lg); letter-spacing: -0.02em; color: var(--ink); }
.wordmark:hover { text-decoration: none; }
.wordmark svg { display: block; }
/* firm switcher */
.firmswitch { position: relative; display: inline-flex; }
.firmswitch .firmname {
  display: inline-flex; align-items: center; gap: 5px; font-family: inherit;
  background: none; border: 0; cursor: pointer; border-radius: 999px; padding: 4px 8px;
  color: var(--faint); font-weight: 500; font-size: var(--fs-sm);
}
.firmswitch .firmname:hover { background: var(--brand-soft); color: var(--brand-ink); }
.firmswitch .chev { font-size: 10px; opacity: 0.7; }
.firmmenu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; min-width: 244px; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-md);
}
.firmmenu[hidden] { display: none; }
.firmrow {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font-family: inherit;
  background: none; border: 0; cursor: pointer; padding: 9px 10px; border-radius: var(--r-sm); color: var(--ink);
}
.firmrow:hover { background: var(--brand-softer); }
.firmrow.active { background: var(--brand-soft); }
.firmrow-main { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.firmrow-name { font-weight: 600; font-size: var(--fs-sm); }
.firmrow-role { color: var(--faint); font-size: var(--fs-xs); }
.firmrow-check { display: flex; color: var(--brand); }
.firmmenu-foot { margin-top: 4px; padding: 8px 10px 4px; border-top: 1px solid var(--line); color: var(--faint); font-size: var(--fs-xs); }
.topnav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.navlink {
  padding: 8px 14px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 550;
  color: var(--muted); transition: background 150ms var(--ease-out), color 150ms var(--ease-out);
}
.navlink:hover { background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; }
.navlink.active { background: var(--brand-soft); color: var(--brand-ink); }
.navlink .badge {
  display: inline-block; min-width: 18px; text-align: center; margin-left: 6px;
  background: var(--attn); color: var(--attn-ink); border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 700; padding: 0 5px;
}
.userchip {
  display: flex; align-items: center; gap: 8px; margin-left: 12px;
  font-size: var(--fs-sm); color: var(--muted);
}
.avatar {
  width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: var(--fs-xs);
}

/* ---------- generic ---------- */
.h1 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.h2 { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: var(--fs-sm); }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head .sub { margin-left: auto; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 999px; font-weight: 600; font-size: var(--fs-sm);
  background: var(--brand); color: white;
  transition: transform 140ms var(--ease-out), filter 140ms var(--ease-out);
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(0.97); }
.btn.secondary { background: var(--brand-soft); color: var(--brand-ink); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }
.btn.ghost:hover { background: var(--card); color: var(--ink); }
.btn.small { padding: 6px 14px; font-size: var(--fs-xs); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:focus-visible, .navlink:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
input[type="text"], select {
  padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--card); font-size: var(--fs-sm); min-width: 0;
}
input[type="text"]:focus-visible, select:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }

/* ---------- grids & tiles ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile {
  display: block; padding: 20px; border-radius: var(--r-lg);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
  color: var(--ink); cursor: pointer;
}
.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tile:active { transform: translateY(0) scale(0.99); }
.tile .tile-emoji {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  margin-bottom: 12px; background: var(--brand-softer); color: var(--brand-ink);
}
.tile .tile-name { font-weight: 650; }
.tile .tile-meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }

/* ---------- desk activity (Home) ---------- */
.desk-tile .activity {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
}
.activity .num {
  font-size: var(--fs-num); font-weight: 750; letter-spacing: -0.03em; line-height: 1;
  color: var(--brand-ink); font-variant-numeric: tabular-nums;
}
.activity.quiet .num { color: var(--faint); }
.activity .num-label { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 36px; padding-bottom: 4px; }
.spark i {
  width: 7px; border-radius: 999px; background: var(--brand);
  min-height: 4px; display: block;
}
.spark i.zero { background: var(--line-strong); }
.activity-last { font-size: var(--fs-xs); color: var(--muted); margin-top: 10px; }
.activity-last b { font-weight: 650; color: var(--ink); }

/* ---------- lists / rows ---------- */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  border-top: 1px solid var(--line); color: var(--ink);
  transition: background 130ms var(--ease-out);
}
.row:first-child { border-top: none; }
.row:hover { background: var(--brand-softer); text-decoration: none; }
.row .fileicon {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--brand-softer); color: var(--brand-ink); letter-spacing: 0.02em;
}
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-size: var(--fs-xs); color: var(--muted); }
.row .when { font-size: var(--fs-xs); color: var(--faint); flex: none; }

/* ---------- brief ---------- */
.brief { padding: 4px 0; }
.brief-entry { display: flex; gap: 14px; padding: 12px 18px; align-items: flex-start; border-top: 1px solid var(--line); }
.brief-entry:first-child { border-top: none; }
.brief-dot { width: 34px; height: 34px; flex: none; border-radius: 999px; display: grid; place-items: center; }
.brief-dot.save { background: var(--brand-soft); color: var(--brand-ink); }
.brief-dot.deal { background: var(--attn); color: var(--attn-ink); }
.brief-dot.closed { background: var(--ok); color: var(--ok-ink); }
.brief-text { font-size: var(--fs-sm); }
.brief-text b { font-weight: 650; }
.brief-text .where { color: var(--muted); }
.brief-when { margin-left: auto; flex: none; font-size: var(--fs-xs); color: var(--faint); padding-top: 2px; }

/* ---------- file view: content left (~2/3, full-height embed), history right ---------- */
.filelayout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.preview { overflow: hidden; }
.preview iframe {
  display: block; width: 100%; border: none; background: white;
  height: calc(100vh - 260px); min-height: 480px;
}
.preview .mdbody, .preview pre.raw { padding: 28px 32px; }
.preview img.imgpreview { display: block; max-width: 100%; }
pre.raw { font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.versions .row { padding: 12px 16px; }
.version-tag {
  font-size: var(--fs-xs); font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--ok); color: var(--ok-ink);
}
.keepnote { padding: 12px 16px; font-size: var(--fs-xs); color: var(--faint); }

/* markdown */
.mdbody { max-width: 72ch; }
.mdbody h1 { font-size: var(--fs-xl); letter-spacing: -0.02em; margin: 0 0 12px; line-height: 1.25; }
.mdbody h2 { font-size: var(--fs-lg); margin: 28px 0 8px; }
.mdbody h3 { font-size: var(--fs-md); margin: 20px 0 6px; }
.mdbody p { margin: 10px 0; }
.mdbody ul, .mdbody ol { margin: 10px 0 10px 24px; }
.mdbody li { margin: 4px 0; }
.mdbody code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--brand-softer); border-radius: 5px; padding: 1px 5px; }
.mdbody pre { background: oklch(96% 0.008 282); border-radius: var(--r-sm); padding: 14px 16px; overflow-x: auto; margin: 12px 0; }
.mdbody pre code { background: none; padding: 0; }
.mdbody table { border-collapse: collapse; margin: 14px 0; width: 100%; font-size: var(--fs-sm); }
.mdbody th, .mdbody td { text-align: left; border: 1px solid var(--line-strong); padding: 8px 12px; }
.mdbody th { background: var(--brand-softer); }
.mdbody blockquote { border-left: 3px solid var(--brand); padding-left: 14px; color: var(--muted); margin: 12px 0; }

/* ---------- dropzone ---------- */
.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--r-lg);
  padding: 32px; text-align: center; color: var(--muted); font-size: var(--fs-sm);
  transition: border-color 150ms var(--ease-out), background 150ms var(--ease-out);
}
.dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.dropzone .btn { margin-top: 12px; }

/* ---------- deals ---------- */
.deal { padding: 20px; }
.deal + .deal { margin-top: 16px; }
.deal-file { font-weight: 650; }
.deal-where { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 16px; }
.deal-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.deal-side { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; }
.deal-side .who { font-weight: 650; font-size: var(--fs-sm); }
.deal-side .what { font-size: var(--fs-xs); color: var(--muted); margin: 2px 0 12px; }
.deal-side .peek { font-size: var(--fs-xs); }
.deal-closed-note { font-size: var(--fs-sm); color: var(--ok-ink); background: var(--ok); border-radius: var(--r-sm); padding: 10px 14px; margin-top: 12px; }
.deal-open-note { font-size: var(--fs-sm); color: var(--attn-ink); background: var(--attn); border-radius: var(--r-sm); padding: 10px 14px; margin-top: 12px; }

/* ---------- members ---------- */
.formrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.invitebox {
  background: var(--brand-softer); border: 1px solid var(--brand-soft); border-radius: var(--r-md); padding: 14px 16px;
  font-size: var(--fs-sm); display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-top: 12px; word-break: break-all;
}
.rolechip { font-size: var(--fs-xs); font-weight: 650; padding: 2px 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.rolechip.mp { background: var(--brand); border-color: var(--brand); color: white; }
.rolechip.partner { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand-ink); }

/* connect claude */
.connect { padding: 20px; }
.connect pre {
  background: oklch(24% 0.03 282); color: oklch(93% 0.03 282);
  font: 12.5px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
  border-radius: var(--r-sm); padding: 14px 16px; overflow-x: auto; margin: 12px 0 8px;
  white-space: pre-wrap; word-break: break-all;
}

/* ---------- join & empty ---------- */
.hero { max-width: 480px; margin: 10vh auto 0; text-align: center; padding: 40px 32px; }
.hero .logo { margin: 0 auto 20px; width: 64px; }
.hero .h1 { margin-bottom: 8px; }
.hero .sub { margin-bottom: 24px; }
.empty { padding: 40px; text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.empty .big { font-size: 32px; margin-bottom: 8px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(420px, calc(100vw - 32px)); }
.toast {
  background: oklch(24% 0.03 282); color: white; border-radius: var(--r-md);
  padding: 12px 18px; font-size: var(--fs-sm); box-shadow: var(--shadow-md);
  opacity: 1; transform: translateY(0);
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out);
}
.toast a { color: oklch(85% 0.08 282); }
@starting-style { .toast { opacity: 0; transform: translateY(12px); } }
.toast.bye { opacity: 0; transform: translateY(8px); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .filelayout { grid-template-columns: 1fr; }
  .deal-sides { grid-template-columns: 1fr; }
  .preview iframe { height: 70vh; min-height: 0; }
}
@media (max-width: 640px) {
  .shell { padding: 0 14px 80px; }
  .topbar { flex-wrap: wrap; row-gap: 8px; padding-bottom: 12px; }
  .topnav { margin-left: 0; width: 100%; overflow-x: auto; }
  .userchip .username { display: none; }
  .firmname { display: none; }
  .h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
