/* ============================================================
   Recall — personal memory app
   Palette: moss accent, clay for recording, green-biased neutrals
   ============================================================ */

:root {
  --bg:        #EFF1EA;
  --surface:   #FAFBF6;
  --surface-2: #E4E7DC;
  --text:      #1B2016;
  --dim:       #5C6353;
  --faint:     #838B76;
  --line:      #D5D9C9;
  --accent:    #47683C;
  --accent-ink:#FAFBF6;
  --accent-soft:#DFE9D6;
  --rec:       #AB3F2A;
  --rec-soft:  #F3DED8;
  --amber:     #8C6210;
  --amber-soft:#F0E4CA;
  --shadow:    0 1px 2px rgba(27,32,22,.06), 0 8px 24px -12px rgba(27,32,22,.18);
  --sheet-shadow: 0 -8px 40px -12px rgba(27,32,22,.28);

  --f-display: "Fraunces", Georgia, "Times New Roman", serif;
  --f-ui: "Karla", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #12150F;
    --surface:   #1B1F17;
    --surface-2: #262B1F;
    --text:      #E9ECE1;
    --dim:       #9CA490;
    --faint:     #79826B;
    --line:      #333A2A;
    --accent:    #A2CB84;
    --accent-ink:#12150F;
    --accent-soft:#232F1B;
    --rec:       #E28468;
    --rec-soft:  #33201A;
    --amber:     #D9A441;
    --amber-soft:#2E2716;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.7);
    --sheet-shadow: 0 -8px 40px -12px rgba(0,0,0,.75);
  }
}

:root[data-theme="dark"] {
  --bg:        #12150F;
  --surface:   #1B1F17;
  --surface-2: #262B1F;
  --text:      #E9ECE1;
  --dim:       #9CA490;
  --faint:     #79826B;
  --line:      #333A2A;
  --accent:    #A2CB84;
  --accent-ink:#12150F;
  --accent-soft:#232F1B;
  --rec:       #E28468;
  --rec-soft:  #33201A;
  --amber:     #D9A441;
  --amber-soft:#2E2716;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.7);
  --sheet-shadow: 0 -8px 40px -12px rgba(0,0,0,.75);
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- app shell ---------- */

#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100%;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

@media (min-width: 600px) {
  body { background: var(--surface-2); }
  #app {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

.screen {
  flex: 1;
  padding: 0 18px 190px;
  display: none;
  animation: fade .18s ease;
}
.screen.active { display: block; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .screen, .sheet, .sheet-back { animation: none !important; transition: none !important; }
}

/* ---------- headers ---------- */

.head {
  padding: 26px 0 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

h1.title {
  font-family: var(--f-display);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -.015em;
  margin: 0;
  text-wrap: balance;
}

.head .count {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: .06em;
  white-space: nowrap;
}

.eyebrow {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 26px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.eyebrow button {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--accent);
  text-transform: uppercase;
}

/* ---------- cards & lists ---------- */

.stack { display: flex; flex-direction: column; gap: 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 14px;
  text-align: left;
  width: 100%;
  display: block;
  transition: border-color .14s ease, transform .1s ease;
}
button.card:active { transform: scale(.988); }
button.card:hover { border-color: var(--faint); }

.card .meta {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: .05em;
  color: var(--faint);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.card .excerpt {
  margin: 6px 0 0;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
}

.tagrow { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }

.tag {
  font-size: 11.5px;
  padding: 2.5px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .01em;
}
.tag.plain { background: var(--surface-2); color: var(--dim); font-weight: 500; }
.tag.date  { background: var(--amber-soft); color: var(--amber); font-family: var(--f-mono); font-size: 10.5px; }

/* ---------- people ---------- */

.person-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  width: 100%;
  text-align: left;
  transition: border-color .14s ease, transform .1s ease;
}
.person-row:active { transform: scale(.988); }
.person-row:hover { border-color: var(--faint); }

.avatar {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -.01em;
}
.avatar.lg {
  width: 60px; height: 60px; flex-basis: 60px; font-size: 25px;
}

.person-row .nm {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.person-row .sub {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: .04em;
  margin-top: 2px;
}

/* ---------- facts ---------- */

.fact {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.fact .body { flex: 1; min-width: 0; }
.fact .lbl {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
}
.fact .val {
  font-size: 15px;
  line-height: 1.4;
  margin-top: 1px;
  overflow-wrap: anywhere;
}
.fact .val .when {
  font-family: var(--f-mono);
  font-size: 12.5px;
  color: var(--amber);
  display: block;
  margin-top: 2px;
  letter-spacing: .02em;
}
.fact .acts { display: flex; gap: 2px; flex: 0 0 auto; }

.iconbtn {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--faint);
  transition: background .14s ease, color .14s ease;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn svg { width: 15px; height: 15px; }

/* ---------- tasks ---------- */

.task {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.check {
  width: 21px; height: 21px;
  flex: 0 0 21px;
  margin-top: 1px;
  border: 1.8px solid var(--faint);
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: background .14s ease, border-color .14s ease;
}
.check svg { width: 12px; height: 12px; opacity: 0; color: var(--accent-ink); }
.check.on { background: var(--accent); border-color: var(--accent); }
.check.on svg { opacity: 1; }

.task .txt { flex: 1; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.task.done .txt { color: var(--faint); text-decoration: line-through; }
.task .due {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .03em;
  color: var(--amber);
  margin-top: 3px;
  display: inline-block;
  cursor: pointer;
  border-bottom: 1px dotted currentColor;
}
.task .due.overdue { color: var(--rec); }
.task .due.none { color: var(--faint); }

/* ---------- empty states ---------- */

.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--faint);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
}
.empty strong {
  display: block;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--dim);
  margin-bottom: 5px;
}
.empty span { font-size: 13.5px; line-height: 1.5; }

/* ---------- search ---------- */

.searchbar {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  margin-bottom: 4px;
}
.searchbar svg { width: 16px; height: 16px; color: var(--faint); flex: 0 0 16px; }
.searchbar input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 16px;
  min-width: 0;
}
.searchbar input::placeholder { color: var(--faint); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.chip {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .04em;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
  background: var(--surface);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

mark {
  background: var(--amber-soft);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

/* ---------- record button + tab bar ---------- */

.dock {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 40;
  pointer-events: none;
}
.dock-inner {
  max-width: 460px;
  margin: 0 auto;
  position: relative;
}

.recwrap {
  position: absolute;
  bottom: 74px;
  left: 0; right: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.recbtn {
  pointer-events: auto;
  width: 74px; height: 74px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 20px -4px rgba(71,104,60,.55), 0 0 0 6px var(--bg);
  transition: transform .12s ease, background .2s ease;
}
.recbtn:active { transform: scale(.93); }
.recbtn svg { width: 27px; height: 27px; }
.recbtn.live {
  background: var(--rec);
  box-shadow: 0 4px 20px -4px rgba(171,63,42,.6), 0 0 0 6px var(--bg);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 4px 20px -4px rgba(171,63,42,.6), 0 0 0 6px var(--bg), 0 0 0 6px rgba(171,63,42,.35); }
  50%     { box-shadow: 0 4px 20px -4px rgba(171,63,42,.6), 0 0 0 6px var(--bg), 0 0 0 18px rgba(171,63,42,0); }
}
@media (prefers-reduced-motion: reduce) { .recbtn.live { animation: none; } }

.tabs {
  pointer-events: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--faint);
  padding: 4px 0;
  transition: color .14s ease;
}
.tab svg { width: 20px; height: 20px; }
.tab span {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.tab.on { color: var(--accent); }

/* ---------- sheets ---------- */

.sheet-back {
  position: fixed;
  inset: 0;
  background: rgba(18,21,15,.42);
  z-index: 50;
  display: none;
  animation: fade .16s ease;
  backdrop-filter: blur(2px);
}
.sheet-back.open { display: block; }

/* the record button must not glow through an open sheet */
body.sheet-open .dock { display: none; }

.sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 460px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--sheet-shadow);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  animation: rise .24s cubic-bezier(.2,.8,.3,1);
}
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 10px;
  flex: 0 0 auto;
}
.sheet-head h2 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -.01em;
  margin: 0;
  flex: 1;
  line-height: 1.2;
}
.grab {
  width: 34px; height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 8px auto 0;
  flex: 0 0 auto;
}

.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 18px 26px;
  flex: 1;
}

/* ---------- record sheet ---------- */

.rec-stage {
  text-align: center;
  padding: 14px 0 6px;
}
.timer {
  font-family: var(--f-mono);
  font-size: 34px;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.rec-hint {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 5px;
}
.rec-hint.live { color: var(--rec); }

canvas.wave {
  width: 100%;
  height: 54px;
  display: block;
  margin: 14px 0 4px;
}

.live-text {
  min-height: 76px;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--text);
  padding: 4px 2px;
  text-align: left;
}
.live-text .interim { color: var(--faint); }
.live-text .ph { color: var(--faint); font-size: 15px; }

textarea.transcript {
  width: 100%;
  min-height: 130px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 12px 13px;
  font-size: 16px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
}
textarea.transcript:focus { border-color: var(--accent); }

audio { width: 100%; margin-top: 10px; height: 36px; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: .01em;
  transition: opacity .14s ease, transform .1s ease;
}
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost {
  background: none;
  color: var(--dim);
  border: 1px solid var(--line);
  font-weight: 600;
}
.btn.danger { background: none; color: var(--rec); border: 1px solid var(--rec); }
.btn svg { width: 17px; height: 17px; }

.btnrow { display: flex; gap: 8px; margin-top: 14px; }
.btnrow .btn { width: auto; flex: 1; }

.notice {
  background: var(--amber-soft);
  color: var(--amber);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  margin: 10px 0;
}
.notice.bad { background: var(--rec-soft); color: var(--rec); }

/* extraction review */
.found-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
}
.found-item.off { opacity: .42; }
.found-item .body { flex: 1; min-width: 0; }
.found-item input[type=text] {
  width: 100%;
  border: none;
  background: none;
  outline: none;
  font-size: 15px;
  padding: 0;
  border-bottom: 1px dashed transparent;
}
.found-item input[type=text]:focus { border-bottom-color: var(--accent); }

.note-transcript {
  font-size: 16.5px;
  line-height: 1.6;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 13px 14px;
  overflow-wrap: anywhere;
}

.field {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 12px 13px;
  font-size: 16px;
  outline: none;
  margin-bottom: 10px;
}
.field:focus { border-color: var(--accent); }

.toast {
  position: fixed;
  bottom: 168px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 9px 17px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  z-index: 80;
  box-shadow: var(--shadow);
  animation: fade .18s ease;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
