:root {
  --navy: #0f4776;
  --blue: #0f77be;
  --bg: #f4f7fa;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #5b6770;
  --rule: #d5dee6;
  --pale: #eaf3fa;
  --ok: #2e7d32;
  --bad: #c62828;
  --warn-bg: #fff4d6;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --navy: #6db3ea;
    --blue: #4a9fdc;
    --bg: #0f1419;
    --card: #1a222b;
    --text: #e6ebf0;
    --muted: #9aa7b2;
    --rule: #2c3844;
    --pale: #172a3a;
    --ok: #66bb6a;
    --bad: #ef7373;
    --warn-bg: #3a3218;
  }
  /* the navy in the logo disappears on a dark background: give it a light plate */
  .bar-logo, .logo-big { background: #fff; border-radius: 8px; padding: 3px; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
#app { min-height: 100vh; min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
.boot { text-align: center; padding: 4rem 1rem; color: var(--muted); }
main { max-width: 760px; margin: 0 auto; padding: 14px 16px 110px; }
h1, h2, h3 { margin: 0; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; background: var(--card);
  border-bottom: 2px solid var(--blue);
}
.bar h1 { flex: 1; font-size: 1.15rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-logo { height: 30px; width: auto; }
.bar-actions { display: flex; gap: 2px; }
button.icon {
  background: none; border: 0; color: var(--navy); font-size: 1.5rem; line-height: 1; min-width: 44px; height: 44px;
  border-radius: 10px; cursor: pointer;
}
button.icon:active { background: var(--pale); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--rule); background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .5; }
.btn:active:not(:disabled) { filter: brightness(.94); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; }

/* inputs */
input[type=text], input[type=password], input[type=search] {
  width: 100%; min-height: 46px; padding: 0 14px; margin: 0 0 12px; font: inherit; /* 16px keeps iOS from zooming */
  color: var(--text); background: var(--card); border: 1px solid var(--rule); border-radius: 12px;
}
label.field { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }

/* cards & lists */
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.card.link { display: block; text-decoration: none; color: inherit; cursor: pointer; }
.card.link:active { background: var(--pale); }
.meeting-title { font-weight: 700; margin-bottom: 4px; overflow-wrap: anywhere; }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--pale); color: var(--navy); }
.chip.done { background: rgba(46,125,50,.15); color: var(--ok); }
.chip.failed { background: rgba(198,40,40,.15); color: var(--bad); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--rule); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }

/* floating record button */
.fab {
  position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 18px); z-index: 6; min-height: 56px; padding: 0 22px;
  border: 0; border-radius: 28px; background: var(--blue); color: #fff; font: inherit; font-weight: 700;
  box-shadow: 0 6px 18px rgba(15,71,118,.35); cursor: pointer; display: flex; align-items: center; gap: 8px;
}

/* meeting detail */
.tabs { display: flex; border-bottom: 1px solid var(--rule); margin: 0 -16px 14px; padding: 0 16px; position: sticky; top: calc(env(safe-area-inset-top) + 57px); background: var(--bg); z-index: 4; }
.tab { flex: 1; padding: 12px 4px; text-align: center; font-weight: 600; color: var(--muted); border: 0; border-bottom: 3px solid transparent; background: none; font-size: 1rem; cursor: pointer; }
.tab[aria-selected=true] { color: var(--navy); border-bottom-color: var(--blue); }
.summary { white-space: pre-wrap; overflow-wrap: anywhere; }
.info { background: var(--pale); border-left: 4px solid var(--blue); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.info b { color: var(--navy); }
.warn { background: var(--warn-bg); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; overflow-wrap: anywhere; }
.seg { margin-bottom: 16px; }
.seg .who { font-weight: 700; background: none; border: 0; padding: 0; font: inherit; font-weight: 700; cursor: pointer; }
.seg .time { font-size: .78rem; color: var(--muted); margin-left: 6px; }
.seg p { margin: 2px 0 0; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.action { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.action input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.action.done .desc { text-decoration: line-through; color: var(--muted); }
.action .meta { margin-top: 2px; }

/* AI-suggested actions */
.section { margin: 22px 0 4px; color: var(--navy); font-size: 1.05rem; }
.suggestion { background: var(--pale); border-left: 4px solid var(--blue); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.suggestion .desc { font-weight: 600; overflow-wrap: anywhere; }
.suggestion .meta { margin: 2px 0 8px; }
.suggestion .row { margin-top: 10px; }
.btn.small { min-height: 38px; padding: 0 12px; font-size: .9rem; }
.suggestion + .btn { margin-top: 12px; }
p + .btn.block { margin-top: 12px; }

/* visual summary */
.visual-card { background: #fff; border: 1px solid var(--rule); border-radius: 14px; padding: 6px; margin: 10px 0; }
.visual { display: block; width: 100%; height: auto; border-radius: 10px; cursor: zoom-in; min-height: 60px; }
.overlay.wide .modal { width: min(920px, 100%); }
.zoom { overflow: auto; max-height: 68vh; border: 1px solid var(--rule); border-radius: 10px; background: #fff; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.zoom img { display: block; width: 220%; max-width: none; height: auto; }

/* recording */
.rec { text-align: center; padding-top: 10px; }
.clock { font-size: 3.4rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--navy); margin: 18px 0 8px; }
.meter { height: 8px; width: min(260px, 80%); margin: 0 auto 10px; background: var(--rule); border-radius: 4px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .1s; }
.round { width: 92px; height: 92px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; font-size: 2.2rem; cursor: pointer; }
.round.stop { background: #d32f2f; }
.round.small { width: 64px; height: 64px; font-size: 1.5rem; background: var(--navy); color: var(--card); }
.controls { display: flex; gap: 28px; justify-content: center; align-items: center; margin-top: 26px; }

/* modal + toast */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--card); border-radius: 16px; padding: 20px; width: min(420px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal h2 { font-size: 1.1rem; margin-bottom: 10px; color: var(--navy); }
.modal .row { margin-top: 6px; }
.progress { height: 8px; background: var(--rule); border-radius: 4px; overflow: hidden; margin: 12px 0 6px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s; }
.menu { padding: 8px; }
.menu .btn { margin-bottom: 8px; }
#toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px); bottom: calc(env(safe-area-inset-bottom) + 90px);
  background: #22303c; color: #fff; padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: 90vw; z-index: 30; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* connect screen */
.connect { text-align: center; padding-top: calc(env(safe-area-inset-top) + 40px); }
.logo-big { height: 110px; margin-bottom: 14px; }
.connect h1 { color: var(--navy); margin-bottom: 8px; }
.connect input { text-align: center; }

/* ---- bottom navigation (Meetings / Actions / Ask) ---- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; display: flex; background: var(--card);
  border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom);
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; }
.nav-item.active { color: var(--navy); }
.nav-glyph { font-size: 1.3rem; line-height: 1; }
main.has-nav { padding-bottom: 150px; }
main.has-nav .fab { bottom: calc(env(safe-area-inset-bottom) + 76px); }

/* ---- selects, small controls ---- */
.select {
  width: 100%; min-height: 46px; padding: 0 12px; margin: 0 0 12px; font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--rule); border-radius: 12px;
}
.chip.type { background: var(--pale); color: var(--navy); font-weight: 600; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.pill { border: 1px solid var(--rule); background: var(--card); color: var(--text); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .9rem; cursor: pointer; }
.pill[aria-pressed=true] { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }

/* ---- sections, talk time ---- */
.sections h4 { margin: 14px 0 4px; color: var(--navy); font-size: 1rem; }
.sections ul { margin: 0 0 6px; padding-left: 20px; }
.sections li { margin-bottom: 3px; overflow-wrap: anywhere; }
.talk-row { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; gap: 10px; align-items: center; margin: 7px 0; font-size: .92rem; }
.talk-row .who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-bar { height: 10px; background: var(--pale); border-radius: 5px; overflow: hidden; }
.talk-bar > i { display: block; height: 100%; border-radius: 5px; }
.talk-row .num { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- language switch ---- */
.lang-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; }
.lang-bar .pill { padding: 4px 12px; }

/* ---- audio player (transcript tab) ---- */
.player {
  position: sticky; top: calc(env(safe-area-inset-top) + 107px); z-index: 3; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 8px 10px; margin: 0 0 14px;
}
.player button { background: none; border: 0; color: var(--navy); font: inherit; font-weight: 700; min-width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.player button:active { background: var(--pale); }
.player .play { background: var(--blue); color: #fff; border-radius: 50%; width: 44px; height: 44px; font-size: 1.1rem; }
.player input[type=range] { flex: 1 1 120px; min-width: 100px; accent-color: var(--blue); }
.player .t { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.seg { border-left: 3px solid transparent; padding-left: 8px; margin-left: -11px; border-radius: 6px; }
.seg.playing { background: var(--pale); border-left-color: var(--blue); }
.seg p { cursor: pointer; }
.seg.target { animation: flash 2.4s ease-out 1; }
@keyframes flash { 0% { background: var(--warn-bg); } 100% { background: transparent; } }

/* ---- action rows with dates ---- */
.action .meta a { color: var(--blue); text-decoration: none; }
.action .tools { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.action input[type=date] { width: auto; height: auto; min-height: 34px; margin: 0; padding: 0 8px; font-size: .85rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--card); color: var(--text); }
.action .cal { background: none; border: 1px solid var(--rule); border-radius: 8px; min-height: 34px; padding: 0 10px; cursor: pointer; font: inherit; font-size: .85rem; color: var(--navy); }
.badge-overdue { color: var(--bad); font-weight: 700; }
.group-title { margin: 20px 0 2px; font-size: .85rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.group-title.overdue { color: var(--bad); }

/* ---- ask / search ---- */
.askbox { display: flex; gap: 8px; margin-bottom: 4px; }
.askbox input { margin: 0; flex: 1; }
.answer { background: var(--pale); border-left: 4px solid var(--blue); border-radius: 12px; padding: 14px; margin: 14px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.source, .hit { display: block; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.source:active, .hit:active { background: var(--pale); }
.source b, .hit b { color: var(--navy); }
.source .sn { display: inline-block; min-width: 22px; text-align: center; background: var(--blue); color: #fff; border-radius: 6px; font-size: .75rem; font-weight: 700; margin-right: 6px; }
.hit .snip, .source .snip { margin-top: 4px; font-size: .92rem; overflow-wrap: anywhere; }
.examples .pill { text-align: left; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
