/* =========================================================
   Plaud Tracker — "Signal" design system
   Palette : cool sage paper, deep teal brand, sparing amber
   Type    : Fraunces (display) / Inter (UI) / IBM Plex Mono (data)
   Signature: waveform motif tying back to Plaud's audio world
   ========================================================= */

:root {
  /* surfaces */
  --paper:      #EBEEE8;
  --paper-2:    #E3E7DF;
  --card:       #FCFCFA;
  --card-sunk:  #F4F5F1;
  --ink:        #16201C;
  --ink-soft:   #3B4842;
  --muted:      #6B7A72;
  --faint:      #9AA79F;
  --hairline:   #D6DBD2;
  --hairline-2: #C7CDC2;

  /* brand */
  --teal:       #0E6F5C;
  --teal-deep:  #0A5345;
  --teal-tint:  #DCEBE6;
  --teal-tint-2:#E9F2EE;
  --amber:      #C9742B;
  --amber-tint: #F6E6D5;
  --danger:     #B23A48;
  --danger-tint:#F6E0E3;

  /* type */
  --display: "Fraunces", Georgia, serif;
  --ui: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(22,32,28,.05), 0 8px 24px -14px rgba(22,32,28,.22);
  --shadow-lg: 0 24px 60px -22px rgba(22,32,28,.34);
  --ring: 0 0 0 3px rgba(14,111,92,.30);

  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 85% -8%, var(--teal-tint-2), transparent 60%),
    var(--paper);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { left: 12px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

/* ---------- layout shell ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.topbar-inner {
  display: flex; align-items: center; gap: 18px;
  height: 66px;
}
.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; }
.brand .wordmark {
  font-family: var(--display);
  font-weight: 600; font-size: 22px; letter-spacing: -.01em;
  font-optical-sizing: auto;
}
.brand .wordmark b { color: var(--teal); font-weight: 600; }
.brand .tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--faint);
  border-left: 1px solid var(--hairline-2); padding-left: 11px; margin-left: 3px;
}

/* waveform brand glyph */
.wave-glyph { display: flex; align-items: center; gap: 2.5px; height: 26px; }
.wave-glyph span {
  width: 3px; border-radius: 3px; background: var(--teal);
  animation: bar 1.5s ease-in-out infinite;
}
.wave-glyph span:nth-child(1){ height: 9px;  animation-delay: 0s; }
.wave-glyph span:nth-child(2){ height: 19px; animation-delay: .15s; background: var(--amber); }
.wave-glyph span:nth-child(3){ height: 13px; animation-delay: .3s; }
.wave-glyph span:nth-child(4){ height: 24px; animation-delay: .45s; }
.wave-glyph span:nth-child(5){ height: 11px; animation-delay: .6s; }
@keyframes bar { 0%,100%{ transform: scaleY(.55); } 50%{ transform: scaleY(1); } }

.acct { display: flex; align-items: center; gap: 12px; }
.acct .who { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.acct .who .nm { font-weight: 600; font-size: 13px; }
.acct .who .em { font-size: 11px; color: var(--muted); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--teal); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex: none;
}

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--hairline-2); background: var(--card); color: var(--ink);
  padding: 9px 15px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 8px; transition: .15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-soft); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--card-sunk); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: var(--danger-tint); background: var(--danger-tint); }
.btn-danger:hover { border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }

/* ---------- gate (signed-out) ---------- */
.gate { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 40px 0 80px; }
.gate-card {
  max-width: 560px; text-align: center;
}
.gate .eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--teal); margin-bottom: 18px;
}
.gate h1 {
  font-family: var(--display); font-optical-sizing: auto;
  font-weight: 500; font-size: clamp(34px, 6vw, 54px); line-height: 1.04;
  letter-spacing: -.02em; margin: 0 0 18px;
}
.gate h1 em { font-style: italic; color: var(--teal); }
.gate p { color: var(--muted); font-size: 16px; max-width: 440px; margin: 0 auto 30px; }
.gate-wave { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 76px; margin: 0 auto 34px; }
.gate-wave span {
  width: 5px; border-radius: 5px; background: var(--teal);
  animation: gbar 1.8s ease-in-out infinite;
}
@keyframes gbar { 0%,100%{ transform: scaleY(.3); opacity:.55 } 50%{ transform: scaleY(1); opacity:1 } }
.gate-meta {
  margin-top: 36px; display: flex; gap: 26px; justify-content: center; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11.5px; color: var(--faint); letter-spacing: .04em;
}
.gate-meta b { color: var(--ink-soft); font-weight: 600; }

.setup-note {
  margin-top: 22px; font-size: 13px; color: var(--muted);
  background: var(--card-sunk); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 14px 16px; text-align: left;
}
.setup-note code { font-family: var(--mono); font-size: 12px; background: #fff; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--hairline); }

/* ---------- dashboard ---------- */
main { padding: 34px 0 90px; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.dash-head h2 {
  font-family: var(--display); font-optical-sizing: auto;
  font-weight: 500; font-size: 34px; letter-spacing: -.02em; margin: 0;
}
.dash-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.stat {
  background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--faint); }
.stat .v { font-family: var(--display); font-weight: 500; font-size: 30px; line-height: 1.1; margin-top: 7px; letter-spacing: -.01em; }
.stat .v small { font-family: var(--ui); font-size: 13px; color: var(--muted); font-weight: 500; }

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 9px;
  background: var(--card); border: 1px solid var(--hairline-2); border-radius: 11px;
  padding: 0 13px; height: 42px;
}
.search input { border: none; background: none; outline: none; flex: 1; font-size: 14px; color: var(--ink); font-family: inherit; }
.search svg { width: 16px; height: 16px; color: var(--faint); flex: none; }
.select {
  height: 42px; border: 1px solid var(--hairline-2); background: var(--card);
  border-radius: 11px; padding: 0 12px; font-size: 13.5px; color: var(--ink-soft); font-weight: 600; font-family: inherit;
}

/* meeting cards */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mcard {
  background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 13px;
  text-align: left; transition: .18s ease; position: relative; overflow: hidden;
}
.mcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--hairline-2); }
.mcard .date { font-family: var(--mono); font-size: 11px; letter-spacing: .05em; color: var(--teal); text-transform: uppercase; }
.mcard h3 { font-family: var(--display); font-weight: 500; font-size: 20px; line-height: 1.18; margin: 0; letter-spacing: -.01em; }
.mcard .snip { color: var(--muted); font-size: 13.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 18px; }
.card-wave { display: flex; align-items: flex-end; gap: 2px; height: 26px; opacity: .85; }
.card-wave span { flex: 1; background: var(--teal-tint); border-radius: 2px; min-width: 2px; }
.card-wave span.hi { background: var(--teal); }
.mcard .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 4px; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  font-size: 11.5px; font-weight: 600; background: var(--teal-tint-2); color: var(--teal-deep);
  border-radius: 20px; padding: 3px 10px; white-space: nowrap;
}
.chip.more { background: var(--card-sunk); color: var(--muted); }
.attn-count { font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* empty state */
.empty {
  text-align: center; padding: 70px 20px; border: 1.5px dashed var(--hairline-2);
  border-radius: var(--radius-lg); background: var(--card-sunk);
}
.empty .gate-wave { height: 56px; margin-bottom: 22px; }
.empty h3 { font-family: var(--display); font-weight: 500; font-size: 24px; margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0 0 22px; }

/* ---------- modal / drawer ---------- */
.scrim {
  position: fixed; inset: 0; background: rgba(16,24,20,.46); backdrop-filter: blur(3px);
  display: none; z-index: 60; align-items: stretch; justify-content: flex-end;
}
.scrim.open { display: flex; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.drawer {
  width: min(560px, 100%); background: var(--paper); height: 100%; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: slide .26s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
@keyframes slide { from { transform: translateX(28px); opacity: .4 } to { transform: none; opacity: 1 } }
.drawer-head {
  position: sticky; top: 0; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--hairline);
  padding: 18px 24px; display: flex; align-items: center; justify-content: space-between; z-index: 2;
}
.drawer-head h3 { font-family: var(--display); font-weight: 500; font-size: 22px; margin: 0; }
.icon-btn { background: var(--card); border: 1px solid var(--hairline-2); border-radius: 9px; width: 34px; height: 34px; display: grid; place-items: center; color: var(--ink-soft); }
.icon-btn:hover { border-color: var(--ink-soft); }
.icon-btn svg { width: 16px; height: 16px; }
.drawer-body { padding: 22px 24px 30px; }

/* viewer (wide) */
.drawer.wide { width: min(900px, 100%); }

/* form fields */
.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px; }
.field .hint { font-weight: 400; color: var(--faint); font-family: var(--mono); font-size: 10.5px; letter-spacing: .03em; }
.input, .textarea {
  width: 100%; border: 1px solid var(--hairline-2); background: var(--card);
  border-radius: 10px; padding: 11px 13px; font-size: 14px; color: var(--ink);
  font-family: inherit; resize: vertical;
}
.textarea { min-height: 120px; line-height: 1.55; }
.textarea.tall { min-height: 200px; }
.input:focus, .textarea:focus { border-color: var(--teal); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* chip input */
.chip-input {
  border: 1px solid var(--hairline-2); background: var(--card); border-radius: 10px;
  padding: 7px 9px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.chip-input:focus-within { border-color: var(--teal); }
.chip-input .tag {
  background: var(--teal-tint); color: var(--teal-deep); border-radius: 7px;
  padding: 4px 8px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.chip-input .tag button { background: none; border: none; color: var(--teal-deep); padding: 0; line-height: 1; font-size: 14px; }
.chip-input input { border: none; outline: none; background: none; flex: 1; min-width: 90px; font-size: 14px; padding: 4px; font-family: inherit; }

/* file drop */
.drop {
  margin-top: 8px; border: 1.4px dashed var(--hairline-2); border-radius: 10px;
  padding: 11px 13px; font-size: 12.5px; color: var(--muted); background: var(--card-sunk);
  display: flex; align-items: center; gap: 10px; cursor: pointer; transition: .15s;
}
.drop:hover, .drop.over { border-color: var(--teal); background: var(--teal-tint-2); color: var(--teal-deep); }
.drop svg { width: 18px; height: 18px; flex: none; }
.drop b { color: var(--teal); font-weight: 600; }
.drop input { display: none; }
.tcheck { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12.5px; color: var(--muted); }
.tcheck input { accent-color: var(--teal); width: 15px; height: 15px; }

.drawer-foot {
  position: sticky; bottom: 0; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px); border-top: 1px solid var(--hairline);
  padding: 14px 24px; display: flex; gap: 10px; justify-content: flex-end; margin-top: auto;
}

/* ---------- meeting viewer ---------- */
.viewer-meta { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--hairline); }
.viewer-meta .vm { }
.viewer-meta .vm .k { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: 5px; }
.viewer-meta .vm .v { font-size: 14px; font-weight: 600; }
.viewer-links { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--card-sunk); padding: 4px; border-radius: 11px; margin-bottom: 18px; width: fit-content; }
.tab { border: none; background: none; padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.pane { display: none; }
.pane.active { display: block; animation: fade .2s ease; }

.summary-body { font-size: 15px; line-height: 1.7; color: var(--ink-soft); }
.summary-body h1,.summary-body h2,.summary-body h3 { font-family: var(--display); font-weight: 500; color: var(--ink); margin: 22px 0 10px; line-height: 1.25; }
.summary-body h1 { font-size: 24px; } .summary-body h2 { font-size: 20px; } .summary-body h3 { font-size: 17px; }
.summary-body ul,.summary-body ol { padding-left: 22px; }
.summary-body li { margin: 5px 0; }
.summary-body p { margin: 10px 0; }
.summary-body strong { color: var(--ink); }
.summary-body code { font-family: var(--mono); font-size: 13px; background: var(--card-sunk); padding: 1px 5px; border-radius: 4px; }

/* transcript turns */
.transcript { display: flex; flex-direction: column; gap: 4px; }
.turn { padding: 11px 14px; border-radius: 11px; background: var(--card); border: 1px solid var(--hairline); }
.turn + .turn { }
.turn .spk { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.turn .spk .nm { font-weight: 700; font-size: 13px; color: var(--teal-deep); }
.turn .spk .ts { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.turn .txt { font-size: 14.5px; line-height: 1.62; color: var(--ink-soft); }
.transcript.plain .turn { background: none; border: none; padding: 0 0 12px; }
.transcript.plain .turn .txt { color: var(--ink-soft); }
.spk-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; }

.empty-pane { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* ---------- settings ---------- */
.set-block { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.set-block h4 { font-family: var(--display); font-weight: 500; font-size: 17px; margin: 0 0 4px; }
.set-block p { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--hairline); font-size: 13.5px; }
.set-row:first-of-type { border-top: none; }
.set-row .lab { color: var(--muted); }
.set-row .val { font-family: var(--mono); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.dot-ok { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); display: inline-block; }
.dot-off { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.auto-hint { font-size: 13px; line-height: 1.5; color: var(--ink-soft); background: var(--teal-tint-2); border: 1px solid var(--hairline); border-left: 3px solid var(--teal); border-radius: 8px; padding: 11px 14px; margin-bottom: 18px; }
.auto-hint code { font-family: var(--mono); font-size: 12px; color: var(--teal); }
.pill { font-family: var(--ui); font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--teal); background: var(--teal-tint); border: 1px solid var(--hairline); border-radius: 999px; padding: 2px 9px; vertical-align: middle; margin-left: 8px; }
.map-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 7px; }
.map-list li { font-size: 13px; color: var(--ink); padding-left: 14px; position: relative; }
.map-list li::before { content: ""; position: absolute; left: 0; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--amber); }
.map-list code { font-family: var(--mono); font-size: 12px; background: var(--teal-tint); color: var(--teal); padding: 1px 6px; border-radius: 5px; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 9px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 11px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; animation: rise .25s ease;
  max-width: 90vw;
}
@keyframes rise { from { transform: translateY(12px); opacity: 0 } to { transform: none; opacity: 1 } }
.toast.ok .tdot { color: #5fd0a8; }
.toast.err { background: var(--danger); }
.toast .tdot { font-size: 16px; }

/* progress bar in drawer */
.progress { height: 3px; background: var(--teal-tint); border-radius: 3px; overflow: hidden; margin-bottom: 16px; display: none; }
.progress.on { display: block; }
.progress i { display: block; height: 100%; width: 30%; background: var(--teal); border-radius: 3px; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0%{ margin-left: -30% } 100%{ margin-left: 100% } }

/* utilities */
.hidden { display: none !important; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .wrap { padding: 0 16px; }
  .grid { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .brand .tag { display: none; }
  .acct .who { display: none; }
  .dash-head h2 { font-size: 27px; }
}

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