/* Capture App — mobile PWA. Rebuilt to match Wireframe v0.3's visual language:
   iOS pill-segment controls, solid color pills, left-icon rows. */
:root {
  --accent: #c8531f;
  --personal: #1f9d6b; --hb: #c8531f; --nomadik: #2f6df0; --people: #7a4fd6; --ideas: #d99a1c;
  --ink: #1a1f2b; --ink-soft: #52607a; --muted: #8a96ad;
  --line: #e3e8f0; --bg: #f6f8fb; --card: #ffffff; --chip: #eef2f8; --screen: #fbfcfe;
  --r-card: 16px; --r-row: 11px; --r-in: 9px;
  --shadow: 0 6px 22px rgba(26,31,43,.10);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--screen); color: var(--ink); line-height: 1.5;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
#app {
  max-width: 560px; margin: 0 auto;
  padding-top: calc(50px + env(safe-area-inset-top));
  padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
}

/* System check + offline outbox */
.queue-banner { width: 100%; border: 0; padding: 6px 16px;
                background: #e9f5ef; color: #17734f; font-size: 12px; font-weight: 800; }
.queue-banner.offline { background: #eef2f8; color: var(--ink-soft); }
.queue-banner.warn { background: #fff2dc; color: #8b5700; }
.sheet.system { padding-left: 16px; padding-right: 16px; }
.sys-deploy { color: var(--muted); font-size: 12px; font-weight: 700; margin: -8px 0 12px; }
.sys-list { display: flex; flex-direction: column; gap: 7px; }
.sys-row { display: flex; gap: 11px; align-items: flex-start; padding: 10px 11px;
           border: 1px solid var(--line); border-radius: 11px; background: var(--screen); }
.sys-row > div { min-width: 0; }
.sys-row b { display: block; font-size: 14px; line-height: 1.3; }
.sys-row span:not(.sys-dot) { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.sys-dot { width: 25px; height: 25px; flex: 0 0 auto; border-radius: 50%; display: flex;
           align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 900; }
.sys-dot.healthy { background: var(--personal); }
.sys-dot.configured { background: var(--nomadik); }
.sys-dot.external { background: #9aa6bd; }
.sys-dot.stale { background: #d99a1c; }
.sys-dot.missing, .sys-dot.error { background: #e8503f; }
.sys-loading { text-align: center; color: var(--muted); padding: 22px; font-size: 13px; }

/* Per-item outbox review — retry or discard a capture that won't sync */
.outbox-list { display: flex; flex-direction: column; gap: 7px; }
.outbox-item { display: flex; gap: 10px; align-items: center; padding: 10px 11px;
               border: 1px solid var(--line); border-radius: 11px; background: var(--screen); }
.outbox-item.stuck { border-color: #e8503f; background: rgba(232,80,63,.05); }
.outbox-item .ob-tx { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.3; }
.outbox-item .ob-status { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.outbox-item .ob-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.ob-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink);
          border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 700; }
.ob-btn.danger { color: #e8503f; border-color: rgba(232,80,63,.4); }
.ob-hint { color: var(--ink-soft); font-size: 12.5px; line-height: 1.4; margin: 0 2px 8px; }
#ob-retry-all { width: 100%; margin: 0 0 10px; padding: 9px; }
.cta.secondary { background: var(--chip); color: var(--ink); margin-top: 10px; }
.setup-copy { color: var(--ink-soft); font-size: 14px; line-height: 1.45; }
.setup-steps { margin: 12px 0 16px; padding-left: 22px; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.setup-steps li { margin: 0 0 8px; padding-left: 2px; }
.setup-warning { color: var(--muted); font-size: 11.5px; line-height: 1.4; margin: 12px 2px 0; }

/* Top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  max-width: 560px; margin: 0 auto;
  height: calc(50px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding-left: 12px; padding-right: 12px;
}
.topbar .hamburger, .topbar .topback {
  width: 40px; height: 40px; border: 0; background: none;
  font-size: 22px; color: var(--ink); display: flex; align-items: center; justify-content: center;
}
.topbar .topback { font-size: 30px; line-height: 1; margin-left: -4px; }
/* Centered independently of the left controls so adding a back button doesn't
   knock the title off-center. */
.topbar .tb-title {
  position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none;
  font-size: 17px; font-weight: 800; letter-spacing: -0.01em;
}
.topbar .spacer { flex: 1; }

/* Side drawer */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 25; background: rgba(20,24,33,.4);
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 26;
  width: 280px; max-width: 85vw;
  background: var(--card); box-shadow: 4px 0 20px rgba(0,0,0,.12);
  transform: translateX(-100%); transition: transform .25s ease;
  padding: calc(env(safe-area-inset-top) + 20px) 0 env(safe-area-inset-bottom);
  display: flex; flex-direction: column; overflow-y: auto;
}
.drawer-scrim.open .drawer { transform: translateX(0); }
.drawer-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; font-size: 16px; font-weight: 700; color: var(--ink-soft);
  border: 0; background: none; width: 100%; text-align: left; cursor: pointer;
}
.drawer-item.on { color: var(--accent); background: rgba(200,83,31,.06); }
.drawer-item .di-gly { font-size: 20px; width: 28px; text-align: center; }
.drawer-item .badge {
  margin-left: auto; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 999px; min-width: 22px; text-align: center;
}
.drawer-divider { height: 1px; background: var(--line); margin: 8px 16px; }

/* App bar (non-sticky content header) */
.appbar {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line); display: flex; align-items: baseline; justify-content: space-between;
}
.appbar h1 { margin: 0; font-size: 22px; font-weight: 850; letter-spacing: -0.02em; }
.appbar .v { font-size: 11px; color: var(--ink-soft); background: var(--chip); padding: 3px 9px; border-radius: 7px; font-weight: 700; }
.appbar.hero { padding-bottom: 12px; }
.appbar.hero h1 { font-size: 24px; }
.appbar.hero .sub { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; }

/* Section caption */
.cap { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin: 18px 18px 7px; }
.cap:first-of-type { margin-top: 12px; }

/* Segmented control — gray track, white active pill (v0.3) */
.seg { display: flex; gap: 4px; background: var(--chip); border-radius: 11px; padding: 4px; margin: 12px 16px 2px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 0; border-radius: 8px;
              font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.09); }
.seg + .seg { margin-top: 5px; }
.tag-bar { display: flex; gap: 6px; padding: 6px 16px 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tag-bar button { border: 1px solid var(--chip); background: transparent; color: var(--muted);
                  padding: 5px 12px; border-radius: 16px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag-bar button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Lists + rows (left icon square + title + subline) */
.list { padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.row-wrap { position: relative; overflow: hidden; border-radius: var(--r-row); }
.row-wrap .under { position: absolute; inset: 0; background: #e8503f; color: #fff; display: flex;
                   align-items: center; justify-content: flex-end; padding-right: 20px; font-weight: 800; font-size: 14px; }
.row {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-row);
  padding: 11px 12px; box-shadow: var(--shadow); display: flex; gap: 11px; align-items: flex-start;
  text-decoration: none; color: inherit; touch-action: pan-y;
}
.row .ic { width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto; display: flex;
           align-items: center; justify-content: center; font-size: 15px; background: var(--chip); }
.row .tx { flex: 1; min-width: 0; }
.row .tx b { font-weight: 700; display: block; font-size: 15px; line-height: 1.25;
             overflow: hidden; text-overflow: ellipsis; }
.row .tx .s { color: var(--muted); font-size: 12.5px; margin-top: 3px; display: block; line-height: 1.35;
              overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row .arrow { color: var(--muted); font-size: 18px; align-self: center; }

/* Face avatar (People) */
.face { width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center;
        justify-content: center; font-size: 14px; font-weight: 800; color: #6b4bb0;
        background: linear-gradient(135deg, #e7ddfa, #c9b6f0); object-fit: cover; }

/* Media thumbnail */
.thumb { width: 54px; height: 40px; border-radius: 8px; flex: 0 0 auto;
         background: linear-gradient(135deg, #dfe6f2, #c6d2e6); }

/* Solid pills (white text) */
.pill { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 20px; color: #fff; vertical-align: middle; }
.pill.p-per { background: var(--personal); } .pill.p-hb { background: var(--hb); }
.pill.p-nom { background: var(--nomadik); } .pill.p-ppl { background: var(--people); }
.pill.p-idea { background: var(--ideas); } .pill.p-mut { background: #9aa6bd; }
button.pill-tap { border: 0; cursor: pointer; }

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

/* Rows are in-app (no Notion link) — show they're tappable */
.row[data-detail] { cursor: pointer; }

/* Task checklist */
.row.task { align-items: center; }
.chk { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line);
       background: var(--card); color: #fff; font-size: 15px; font-weight: 900; line-height: 1;
       display: flex; align-items: center; justify-content: center; padding: 0; }
.chk.on { background: var(--personal); border-color: var(--personal); }
.row.task.done b { text-decoration: line-through; color: var(--muted); }

/* Detail sheet (in-app view of a row, replaces opening Notion) */
.sheet.detail { padding-top: 4px; }
.dt-title { font-size: 20px; font-weight: 850; letter-spacing: -.01em; margin: 6px 2px 10px; line-height: 1.25; }
.dt-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.dt-meta:empty { display: none; }
/* Sticky close bar for the long meeting note — stays reachable while scrolling */
.dt-sticky { position: sticky; top: 0; z-index: 3; background: var(--card); margin: -4px -18px 2px; padding: 0 18px; min-height: 30px; }
.dt-sticky .grab { margin: 8px auto 6px; }
.dt-x { position: absolute; top: 4px; right: 12px; width: 32px; height: 32px; border: 0;
        background: var(--chip); color: var(--ink); border-radius: 50%; font-size: 15px; font-weight: 800;
        line-height: 1; display: flex; align-items: center; justify-content: center; }
.chipm { font-size: 12px; font-weight: 700; color: var(--ink-soft); background: var(--chip); padding: 3px 10px; border-radius: 999px; }
.rthumb { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; flex: 0 0 auto; border: 1px solid var(--line); }
.dt-photo { display: block; width: 100%; max-height: 45vh; object-fit: contain; border-radius: 12px;
            border: 1px solid var(--line); background: var(--screen); margin-bottom: 10px; }
.photo-btn { display: block; text-align: center; cursor: pointer; }
.dt-notes { background: var(--screen); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
            font-size: 14.5px; color: var(--ink); white-space: pre-wrap; word-break: break-word;
            max-height: 42vh; overflow-y: auto; margin-bottom: 4px; }
.dt-actions { display: flex; gap: 8px; margin-top: 14px; }
.dt-actions.wrap { flex-wrap: wrap; }
.dt-actions.wrap .act { flex: 1 1 45%; }
.cap-inline { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin: 16px 2px 2px; }
.act { flex: 1; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
       color: var(--ink); font-size: 15px; font-weight: 800; }
.act.primary { background: var(--personal); border-color: var(--personal); color: #fff; }
.act.danger { color: #e8503f; border-color: #f2c2bb; }
.act:disabled { opacity: .6; }
.ext { display: inline-block; margin-top: 8px; color: var(--nomadik); font-weight: 800; font-size: 15px; text-decoration: none; }

/* Photos grid */
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 16px 0; }
.pgrid .cell { aspect-ratio: 1; border-radius: 10px; background: linear-gradient(135deg, #dfe6f2, #c6d2e6); }
.pgrid .cell img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.pgrid .add { background: var(--chip); display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--muted); }
.pactions { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.pactions .a { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line);
               border-radius: 10px; padding: 12px; font-weight: 700; font-size: 14px; }
.pactions .a small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }

/* FAB */
.fab { position: fixed; z-index: 21; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 18px);
       width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
       font-size: 28px; box-shadow: 0 8px 20px rgba(200,83,31,.4); }

/* Quick-nav grid on Today */
.nav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px; }
.nav-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 14px; display: flex; align-items: center; gap: 12px;
  font-size: 15px; font-weight: 700; color: var(--ink);
  box-shadow: 0 2px 8px rgba(26,31,43,.06); cursor: pointer;
}
.nav-card .nc-gly { font-size: 22px; }

/* Capture sheet */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(20,24,33,.45); display: flex; align-items: flex-end; }
.sheet { background: var(--card); width: 100%; max-width: 560px; margin: 0 auto; border-radius: 20px 20px 0 0;
         padding: 8px 18px calc(env(safe-area-inset-bottom) + 20px); max-height: 92vh; overflow-y: auto;
         /* iOS: keep the drag scrolling THIS sheet (momentum on, no chaining to
            the page behind it) so long meeting notes reach the bottom. */
         -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
.grab { width: 40px; height: 4px; background: var(--line); border-radius: 4px; margin: 8px auto 12px; }
.sheet h2 { margin: 4px 0 14px; font-size: 19px; font-weight: 850; }
.lane-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lane-grid .menu-item { margin-bottom: 0; padding: 11px 12px; font-size: 14px; }
.lane-grid .menu-item small { font-size: 11px; }
.menu-item { background: var(--screen); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px;
             font-size: 15px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; }
.menu-item.on { border-color: var(--accent); background: rgba(200,83,31,.06); }
.menu-item .g { font-size: 20px; }
.menu-item small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; margin-top: 1px; }
label.fld { display: block; font-size: 12px; font-weight: 800; color: var(--ink-soft); margin: 14px 0 5px; text-transform: uppercase; letter-spacing: .02em; }
.sheet input[type=text], .sheet input[type=url], .sheet input[type=date], .sheet textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-in); padding: 12px;
  font-size: 16px; font-family: inherit; background: var(--card); color: var(--ink); }
.sheet input[type=date] { margin-top: 8px; }
.sheet textarea { min-height: 96px; resize: vertical; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
                font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.cta { width: 100%; margin-top: 18px; padding: 15px; border: 0; border-radius: 13px; background: var(--accent);
       color: #fff; font-size: 16.5px; font-weight: 850; }
.cta:disabled { background: var(--muted); }
.rec { width: 100%; margin-top: 12px; padding: 13px; border: 1px solid var(--accent);
       background: rgba(200,83,31,.06); color: var(--accent); border-radius: var(--r-row);
       font-size: 15px; font-weight: 800; }
.rec:disabled { opacity: .6; }
.cancel { width: 100%; margin-top: 8px; padding: 12px; border: 0; background: none; color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 80px); z-index: 40;
         background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 700;
         box-shadow: var(--shadow); opacity: 0; transition: opacity .2s; }
.toast.show { opacity: 1; }

/* Stale data banner */
.stale-banner {
  text-align: center; padding: 6px 16px; font-size: 11px; font-weight: 700;
  color: var(--muted); background: var(--chip);
}

/* Meeting recording UI */
.meeting-rec { text-align: center; padding: 16px 0; }
.rec-big { width: 100%; padding: 20px; border: 2px solid var(--accent); background: rgba(200,83,31,.06);
           color: var(--accent); border-radius: var(--r-row); font-size: 18px; font-weight: 850; }
.rec-big.active { background: var(--accent); color: #fff; animation: pulse-rec 1.4s ease-in-out infinite; }
.rec-big:disabled { opacity: .6; }
.rec-timer { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums;
             color: var(--ink); margin: 14px 0 4px; }
.rec-status { font-size: 13px; color: var(--muted); min-height: 18px; }
@keyframes pulse-rec { 0%,100% { opacity: 1; } 50% { opacity: .7; } }

.meeting-body { padding: 8px 0 16px; }
.meeting-body .loader { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 0; }
.mt-heading { font-size: 14px; font-weight: 800; color: var(--ink); margin: 16px 0 6px; }
.mt-heading:first-child { margin-top: 4px; }
.mt-todo { font-size: 13px; color: var(--ink); padding: 3px 0; display: flex; gap: 6px; }
.mt-todo.done { color: var(--muted); text-decoration: line-through; }
.mt-chk { flex-shrink: 0; }
.mt-bullet { font-size: 13px; color: var(--ink); padding: 3px 0; padding-left: 2px; }
.mt-para { font-size: 13.5px; color: var(--ink); padding: 3px 0; line-height: 1.55; }
.mt-quote { font-size: 13px; color: var(--ink-soft); padding: 4px 0 4px 10px; margin: 4px 0;
            border-left: 3px solid var(--line); line-height: 1.5; }
.mt-divider { height: 1px; background: var(--line); margin: 12px 0; }

.gate { text-align: center; padding: 80px 30px; }
.gate h1 { font-size: 24px; }
.gate p { color: var(--ink-soft); line-height: 1.5; }
