/* ==========================================================================
   BLink — installable app shell.
   Phone-first: fixed header, scrolling body, bottom tab bar.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Enterprise palette. The old accent was a saturated #ff3d3d used for every
     button, which reads as alarm rather than brand — and leaves nothing louder
     for genuine warnings. Primary is now a restrained steel blue; red is
     reserved for destructive actions only. */
  --bg:          #0b1017;
  --bg-elev:     #111823;
  --surface:     #151d29;
  --surface-2:   #1c2634;
  --line:        rgba(255,255,255,.08);
  --line-2:      rgba(255,255,255,.15);
  --text:        #e7edf6;
  --muted:       #93a3b8;
  --dim:         #64748b;

  --accent:      #f2a73b;
  --accent-deep: #d68f2a;
  --accent-dark: #b8791a;
  --accent-soft: rgba(242,167,59,.14);
  --on-accent:   #1f1400;

  --ok:          #3fae82;
  --warn:        #d9a441;
  --danger:      #c25550;
  --danger-soft: rgba(194,85,80,.14);

  --radius:      14px;
  --header-h:    56px;
  --tabs-h:      62px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --tint:        rgba(255,255,255,.05);
  --tint-2:      rgba(255,255,255,.08);
  --press:       rgba(255,255,255,.03);
  --shadow:      0 24px 60px rgba(0,0,0,.5);
  --info:        #7dd3fc;
  --ok-text:     #6ee7b7;
  --warn-text:   #fbbf24;
  --danger-text: #fca5a5;
  --chip:        #f2c179;
  /* Header, tab bar and the scanning scrim. Kept as tokens because a fixed
     dark bar over a light page left --dim text on near-black. */
  /* Solid fills that carry white text at small sizes: --danger itself is
     too light for a 10px badge to clear AA. */
  --danger-strong: #a8433e;
  /* The "i" of BLink. Lighter than --accent so it clears AA on the
     header, the cards and the elevated surfaces alike. */
  --brand-i:     #f2a73b;
  --glass:       rgba(8,11,20,.92);
  --glass-2:     rgba(8,11,20,.95);
  --scrim:       rgba(8,11,20,.72);
  --ease: cubic-bezier(.4,0,.2,1);
}

/* Light theme. Set explicitly by the toggle, or followed from the system when
   the user has expressed no preference. */
:root[data-theme="light"] {
  color-scheme: light;

  --bg:          #f4f6fa;
  --bg-elev:     #ffffff;
  --surface:     #ffffff;
  --surface-2:   #eef2f7;
  --line:        rgba(15,23,42,.10);
  --line-2:      rgba(15,23,42,.18);
  --text:        #16202e;
  --muted:       #55647a;
  --dim:         #7d8a9c;

  --accent:      #b8791a;
  --accent-deep: #9c6415;
  --accent-dark: #7a4e10;
  --accent-soft: rgba(184,121,26,.10);
  --on-accent:   #1f1400;

  --ok:          #2f8f68;
  --warn:        #a9761f;
  --danger:      #b5443f;
  --tint:        rgba(15,23,42,.045);
  --tint-2:      rgba(15,23,42,.075);
  --press:       rgba(15,23,42,.06);
  --shadow:      0 18px 44px rgba(15,23,42,.14);
  --info:        #0f6ea8;
  --ok-text:     #1d7a52;
  --warn-text:   #8a5d00;
  --danger-text: #a3322d;
  --chip:        #8a5d16;
  --danger-strong: #993832;
  --brand-i:     #b8791a;
  --glass:       rgba(255,255,255,.90);
  --glass-2:     rgba(255,255,255,.94);
  --scrim:       rgba(15,23,42,.62);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg:          #f4f6fa;
    --bg-elev:     #ffffff;
    --surface:     #ffffff;
    --surface-2:   #eef2f7;
    --line:        rgba(15,23,42,.10);
    --line-2:      rgba(15,23,42,.18);
    --text:        #16202e;
    --muted:       #55647a;
    --dim:         #7d8a9c;
    --accent:      #b8791a;
    --accent-deep: #9c6415;
    --accent-dark: #7a4e10;
    --accent-soft: rgba(184,121,26,.10);
    --ok:          #2f8f68;
    --warn:        #a9761f;
    --danger:      #b5443f;
    --tint:        rgba(15,23,42,.045);
    --tint-2:      rgba(15,23,42,.075);
    --press:       rgba(15,23,42,.06);
    --shadow:      0 18px 44px rgba(15,23,42,.14);
    --info:        #0f6ea8;
    --ok-text:     #1d7a52;
    --warn-text:   #8a5d00;
    --danger-text: #a3322d;
    --chip:        #8a5d16;
    --danger-strong: #993832;
    --brand-i:     #b8791a;
    --glass:       rgba(255,255,255,.90);
    --glass-2:     rgba(255,255,255,.94);
    --scrim:       rgba(15,23,42,.62);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;   /* no rubber-banding behind the shell */
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }

/* The [hidden] attribute is only display:none in the UA stylesheet, so ANY
   author rule that sets display beats it. That silently broke the contact
   action menu — it was built with `hidden` and .fab-menu{display:flex}, so it
   could never close. Enforce it once here rather than per component. */
[hidden] { display: none !important; }
h1 { font-size: 1.35rem; margin: 0 0 .35rem; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ------------------------------------------------------------------ shell */
.app-head {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; gap: .6rem;
  padding-inline: .85rem;
  background: var(--glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.app-head .logo {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 750; font-size: 1rem; letter-spacing: -.02em; color: var(--text);
}
.app-head .logo i { color: var(--accent); }
.app-head .spacer { flex: 1; }
.app-head .icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: transparent; color: var(--text); cursor: pointer; font-size: .95rem;
}

.app-body {
  padding: calc(var(--header-h) + env(safe-area-inset-top) + .85rem) .85rem
           calc(var(--tabs-h) + env(safe-area-inset-bottom) + 1.5rem);
  max-width: 720px;
  margin-inline: auto;
}

.app-tabs {
  position: fixed; inset: auto 0 0 0; z-index: 50;
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--glass-2);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.app-tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--dim); font-size: .68rem; font-weight: 600;
}
.app-tabs a i { font-size: 1.15rem; }
.app-tabs a.is-active { color: var(--accent); }

/* ------------------------------------------------------------------ cards */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-elev));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: .85rem;
}
.card h2 i { color: var(--accent); margin-right: .35rem; }

/* ---------------------------------------------------------------- capture */
.capture {
  display: grid; place-items: center; gap: .75rem;
  padding: 2rem 1rem;
  border: 2px dashed var(--line-2);
  border-radius: 18px;
  background: radial-gradient(ellipse 70% 90% at 50% 0%, var(--accent-soft), transparent 65%);
  text-align: center;
  cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.capture:active { border-color: var(--accent); }
.capture .big {
  width: 70px; height: 70px; display: grid; place-items: center;
  border-radius: 50%; font-size: 1.6rem;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent-dark));
  color: var(--on-accent);
  box-shadow: 0 10px 28px var(--accent-soft);
}
.capture strong { font-size: 1.02rem; }
.capture span { font-size: .84rem; color: var(--muted); }

.preview-wrap { position: relative; border-radius: var(--radius); overflow: hidden; }
.preview-wrap img { width: 100%; display: block; }
.preview-wrap .scanning {
  position: absolute; inset: 0;
  background: var(--scrim);
  display: grid; place-items: center; gap: .6rem;
  color: var(--text); font-size: .9rem; text-align: center; padding: 1rem;
}
/* A light sweep so the wait reads as progress rather than a freeze. */
.scanline {
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: sweep 1.6s ease-in-out infinite;
}
@keyframes sweep { 0% { top: 4%; } 50% { top: 96%; } 100% { top: 4%; } }

/* ------------------------------------------------------------------ forms */
label { display: block; font-size: .78rem; font-weight: 650; color: var(--muted); margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; padding: .65rem .8rem; min-height: 44px;
  font: inherit; font-size: 16px;      /* no iOS zoom */
  color: var(--text); background: var(--bg);
  border: 1px solid var(--line-2); border-radius: 11px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,61,61,.16);
}
textarea { min-height: 84px; resize: vertical; }
.field { margin-bottom: .8rem; }
.f2 { display: grid; gap: .8rem; }
@media (min-width: 520px) { .f2 { grid-template-columns: 1fr 1fr; } }
.hint { font-size: .76rem; color: var(--dim); margin-top: .3rem; }

.btn, .btn-2, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; min-height: 48px; padding: .7rem 1.1rem;
  border: 1px solid transparent; border-radius: 12px;
  font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
}
.btn { background: linear-gradient(135deg, var(--accent-deep), var(--accent-dark)); color: var(--on-accent); }
.btn-2 { background: var(--tint); border-color: var(--line-2); color: var(--text); }
.btn-danger { background: rgba(248,113,113,.14); border-color: rgba(248,113,113,.4); color: var(--danger-text); }
.btn[disabled], .btn-2[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: .6rem; }
.btn-sm { min-height: 38px; font-size: .82rem; padding: .4rem .8rem; width: auto; }

/* ----------------------------------------------------------------- alerts */
.alert {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .8rem .9rem; border-radius: 11px; font-size: .87rem;
  margin-bottom: .9rem; border: 1px solid;
}
.alert-ok   { background: rgba(52,211,153,.1);  border-color: rgba(52,211,153,.35);  color: var(--ok-text); }
.alert-err  { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.35); color: var(--danger-text); }
.alert-info { background: var(--accent-soft);  border-color: var(--accent);    color: var(--danger-text); }

/* --------------------------------------------------------------- contacts */
.filters { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: .3rem; }
.filters::-webkit-scrollbar { height: 0; }
.chip {
  flex: none; padding: .4rem .8rem; border-radius: 999px;
  background: var(--tint); border: 1px solid var(--line-2);
  color: var(--muted); font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------- A–Z listing */
/* Sticks under the fixed app header while its section is on screen. */
.az-head {
  position: sticky;
  top: calc(var(--header-h) + env(safe-area-inset-top));
  z-index: 10;
  display: flex; align-items: center; gap: .5rem;
  margin: 1.1rem 0 .5rem;
  padding: .3rem .1rem;
  font-size: .82rem; font-weight: 800; letter-spacing: .1em;
  color: var(--accent);
  background: var(--bg);          /* opaque, so rows do not show through */
  border-bottom: 1px solid var(--line);
}
.az-head:first-of-type { margin-top: .3rem; }
.az-head span {
  font-size: .68rem; font-weight: 600; letter-spacing: 0;
  color: var(--dim);
}

.az-bar {
  display: flex; flex-wrap: wrap; gap: .2rem;
  margin: 0 0 .6rem;
  padding: .45rem .5rem;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface);
}
.az-bar a {
  flex: 1 0 auto;
  min-width: 26px;
  padding: .2rem 0;
  text-align: center;
  font-size: .74rem; font-weight: 700;
  color: var(--muted);
  border-radius: 6px;
}
.az-bar a:active { background: var(--accent-soft); color: var(--accent); }

/* The row and its quick actions are one visual unit but two separate
   interactive areas, so the actions are not nested inside the row link. */
.contact-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: .55rem;
  overflow: hidden;
  transition: border-color .18s var(--ease);
}
.contact-card:hover { border-color: var(--line-2); }

.contact {
  display: grid; grid-template-columns: 42px 1fr auto; gap: .7rem; align-items: center;
  padding: .75rem;
  color: inherit;
}
.contact:active { background: var(--press); }

.contact-acts {
  display: flex;
  border-top: 1px solid var(--line);
}
.contact-acts a {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 42px;                      /* thumb-sized target */
  font-size: .78rem; font-weight: 650;
  color: var(--muted);
  border-right: 1px solid var(--line);
}
.contact-acts a:last-child { border-right: 0; }
.contact-acts a:active { background: var(--tint); }
.contact-acts a i { font-size: .85rem; }
/* Classed rather than positional: a contact with no phone would otherwise
   colour its email button as if it were the call button. */
.contact-acts .act-call { color: var(--info); }
.contact-acts .act-wa   { color: var(--ok-text); }
.contact-acts .act-mail { color: var(--accent); }
.contact-acts .act-map  { color: var(--warn-text); }

/* Four actions on a narrow phone: drop the labels and keep the icons, so the
   targets stay wide enough to hit reliably. */
@media (max-width: 400px) {
  .contact-acts a span { display: none; }
  .contact-acts a i { font-size: 1rem; }
}
.contact-acts .no-acts {
  flex: 1; text-align: center; padding: .6rem;
  font-size: .74rem; color: var(--dim);
}
.contact .av {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: .95rem;
}
/* .nm and .co are <span>s. overflow and text-overflow have no effect on an
   inline box, so they never truncated — the company name simply ran on and
   passed underneath the tags. Blockifying them is what makes the ellipsis
   work at all. */
.contact .who { min-width: 0; display: flex; flex-direction: column; }
.contact .nm,
.contact .co { display: block; min-width: 0; max-width: 100%;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact .nm { font-weight: 650; font-size: .93rem; }
.contact .co { font-size: .8rem; color: var(--muted); }
/* Cap the tag column so a long industry cannot squeeze the name to nothing. */
.contact .badges {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
  min-width: 0; max-width: 40%;
}
.contact .badges .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.tag {
  font-size: .62rem; font-weight: 700; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
.tag-local   { background: rgba(52,211,153,.15); color: var(--ok); }
.tag-foreign { background: var(--accent-soft); color: var(--chip); }
.tag-unknown { background: rgba(148,163,184,.15); color: var(--muted); }
.tag-ind     { background: var(--tint-2); color: var(--muted); }

.empty { text-align: center; padding: 3rem 1rem; color: var(--dim); }
.empty i { font-size: 2.2rem; display: block; margin-bottom: .7rem; opacity: .4; }

/* ------------------------------------------------------------ plan status */
.plan-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem;
  margin: .2rem 0 .8rem;
}
.plan-stats div {
  text-align: center; padding: .6rem .4rem;
  border: 1px solid var(--line); border-radius: 11px; background: var(--bg-elev);
}
.plan-stats b { display: block; font-size: 1.35rem; font-weight: 750; letter-spacing: -.02em; }
.plan-stats span { font-size: .7rem; color: var(--muted); }

.meter {
  height: 7px; border-radius: 999px; overflow: hidden;
  background: var(--tint-2);
}
.meter span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  transition: width .4s var(--ease);
}

/* --------------------------------------------------------- plan chooser */
.plan-grid { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; }
@media (min-width: 560px) { .plan-grid { grid-template-columns: repeat(4, 1fr); } }

.plan-opt {
  position: relative;
  display: flex; flex-direction: column; gap: 2px;
  padding: .75rem .6rem;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--bg-elev);
  cursor: pointer; text-align: center;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.plan-opt input { position: absolute; opacity: 0; pointer-events: none; }
.plan-opt.is-on { border-color: var(--accent); background: var(--accent-soft); }
.plan-opt .p-dur   { font-size: .78rem; color: var(--muted); font-weight: 650; }
.plan-opt .p-price { font-size: 1.1rem; font-weight: 780; letter-spacing: -.02em; }
.plan-opt .p-sub   { font-size: .66rem; color: var(--dim); line-height: 1.35; }
.plan-opt .p-rate  { font-size: .64rem; color: var(--muted); font-weight: 650; }
.plan-opt .p-save  {
  margin-top: .25rem; font-size: .6rem; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--ok); background: rgba(52,211,153,.12);
  border-radius: 999px; padding: 2px 6px;
}

/* ------------------------------------------------------------------ stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .85rem; }
.stat {
  padding: .7rem .5rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); text-align: center;
}
.stat b { display: block; font-size: 1.3rem; font-weight: 750; letter-spacing: -.02em; }
.stat span { font-size: .7rem; color: var(--muted); }

/* --------------------------------------------------------------- detail */
.kv { display: grid; grid-template-columns: 92px 1fr; gap: .35rem .7rem; font-size: .88rem; }
.kv dt { color: var(--dim); font-size: .78rem; }
.kv dd { margin: 0; word-break: break-word; }

/* -------------------------------------------------------------- auth pages */
.auth-wrap {
  min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, var(--accent-soft), transparent 70%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px; padding: 1.6rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow);
}
.auth-card .mark {
  width: 52px; height: 52px; margin: 0 auto 1rem; border-radius: 15px;
  display: grid; place-items: center; font-size: 1.3rem;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent-dark)); color: var(--on-accent);
}
.auth-card h1 { text-align: center; font-size: 1.2rem; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: .87rem; margin: 0 0 1.3rem; }
.auth-foot { text-align: center; margin-top: 1.1rem; font-size: .85rem; color: var(--muted); }

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

/* ---------------------------------------------------------------- actions --
   One floating control rather than a row of buttons that grows with every
   feature. Centred above the tab bar, where a thumb actually reaches on a
   phone held one-handed. */
.fab-wrap { position: fixed; left: 50%; transform: translateX(-50%);
            bottom: calc(var(--tabs-h) + 14px + env(safe-area-inset-bottom, 0px));
            z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.fab { width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
       background: var(--accent); color: var(--on-accent); font-size: 1.15rem;
       box-shadow: var(--shadow); transition: transform .18s var(--ease), background .18s var(--ease); }
.fab:active { transform: scale(.94); }
.fab-wrap.is-open .fab { background: var(--accent-deep); transform: rotate(45deg); }

.fab-menu { display: flex; flex-direction: column; gap: 8px; align-items: stretch;
            min-width: 210px; animation: fabIn .16s var(--ease); }
@keyframes fabIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fab-item { display: flex; align-items: center; gap: 10px; width: 100%;
            padding: 12px 16px; border-radius: 12px; cursor: pointer;
            background: var(--surface); color: var(--text);
            border: 1px solid var(--line-2); box-shadow: var(--shadow);
            font: inherit; font-size: .9rem; text-align: left; }
.fab-item:active { background: var(--tint-2); }
.fab-item i { width: 18px; color: var(--accent); }

/* Ask panel */
.ask-log { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.ask-log:empty { display: none; }
.ask-msg { padding: 9px 12px; border-radius: 12px; font-size: .88rem; line-height: 1.5; max-width: 92%; }
.ask-q { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.ask-a { align-self: flex-start; background: var(--tint-2); color: var(--text); border-bottom-left-radius: 4px; }
.ask-a ul { margin: .4em 0 .4em 1.1em; padding: 0; }
.ask-row { display: flex; gap: 8px; margin-top: 10px; }
.ask-row input { flex: 1; min-width: 0; }
.ask-row .btn { flex: 0 0 auto; }

/* Give the last card room to clear the floating button. */
.app-body > .card:last-of-type { margin-bottom: 84px; }

/* ------------------------------------------------------- follow-ups */
/* The tab bar is fixed, so the badge is positioned against the anchor
   rather than flowed — a flowed badge shifts the icon off centre. */
.app-tabs a { position: relative; }
.tab-dot {
  position: absolute; top: 6px; left: 50%; margin-left: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: grid; place-items: center;
  border-radius: 9px; background: var(--danger-strong); color: #fff;
  font-size: .6rem; font-weight: 800; line-height: 1;
}

/* Segmented control: open / done. */
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 11px;
}
.seg a {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .8rem; border-radius: 8px;
  color: var(--muted); font-size: .84rem; font-weight: 600;
}
.seg a.is-active { background: var(--accent-dark); color: var(--on-accent); }
.seg-n {
  min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--tint-2); color: inherit;
  font-size: .68rem; font-weight: 800; text-align: center;
}
.seg a.is-active .seg-n { background: rgb(0 0 0 / .22); }

.rem-head {
  display: flex; align-items: center; gap: .45rem;
  margin: 1.1rem 0 .5rem; font-size: .92rem; color: var(--muted);
}
.rem-head i { color: var(--accent); }
.rem-head.overdue, .rem-head.overdue i { color: var(--danger-text); }
.rem-head.today i { color: var(--warn-text); }

.rem-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .4rem .6rem;
  padding: .75rem .85rem;
  margin-bottom: .5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
/* A left rule reads as urgency without tinting the whole row red. */
.rem-row.is-overdue { border-left: 3px solid var(--danger); }

.rem-who { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.rem-who .avatar {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; object-fit: cover;
  background: var(--accent-soft); color: var(--accent);
  font-size: .78rem; font-weight: 800;
}
.rem-name { display: flex; flex-direction: column; min-width: 0; }
.rem-name strong { font-size: .93rem; }
.rem-name .hint { margin: 0; font-size: .76rem; }
.rem-name strong, .rem-name .hint {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.rem-when { text-align: right; display: flex; flex-direction: column; gap: 1px; }
.rem-date { font-size: .78rem; font-weight: 600; color: var(--text); }
.rem-rel  { font-size: .7rem; color: var(--muted); }
.is-overdue .rem-rel { color: var(--danger-text); font-weight: 600; }

.rem-note {
  grid-column: 1 / -1; margin: 0;
  font-size: .84rem; color: var(--muted);
  padding-left: calc(38px + .6rem);
}
.rem-acts {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: .35rem;
  padding-left: calc(38px + .6rem);
}
.rem-acts .inline { display: inline; }

.chip-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .6rem; border-radius: 999px;
  background: var(--tint); border: 1px solid var(--line);
  color: var(--muted); font-size: .74rem; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.chip-btn:hover { background: var(--tint-2); color: var(--text); }
.chip-btn:active { background: var(--press); }
.chip-btn.chip-danger { color: var(--danger-text); }
.chip-btn.chip-danger:hover { background: var(--danger-soft); }

/* Calendar feed URL: monospace, wraps at any character because a 40-hex token
   has no break opportunities and would otherwise force the page to scroll. */
.feed-url {
  margin-top: .6rem; padding: .55rem .7rem;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 9px;
  font-family: var(--mono); font-size: .7rem; color: var(--muted);
  word-break: break-all; user-select: all;
}
.feed-url:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ----------------------------------------------------------------- voice */
.voice-page { display: flex; flex-direction: column; gap: .9rem; padding-bottom: 84px; }

.voice-scope {
  display: flex; align-items: center; gap: .45rem;
  padding: .5rem .75rem; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--line);
  font-size: .82rem; color: var(--muted);
}
.voice-scope i { color: var(--accent); }
.voice-scope-x { margin-left: auto; color: var(--dim); padding: .1rem .3rem; }
.voice-scope-x:hover { color: var(--text); }

.voice-stage {
  display: grid; place-items: center; gap: .8rem;
  padding: 1.6rem 0 .6rem;
}

.voice-orb {
  width: 128px; height: 128px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 2.6rem; color: var(--on-accent);
  background: linear-gradient(145deg, var(--accent-deep), var(--accent-dark));
  border: none; cursor: pointer;
  box-shadow: 0 12px 34px var(--accent-soft);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.voice-orb:active { transform: scale(.95); }
.voice-orb.is-off { background: var(--surface-2); color: var(--dim); }

/* Listening: a ring pulses outward. Rendered with box-shadow rather than a
   pseudo-element so it cannot affect layout or trap taps. */
.voice-orb.is-live { animation: voicePulse 1.5s infinite; }
@keyframes voicePulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-soft), 0 12px 34px var(--accent-soft); }
  70%  { box-shadow: 0 0 0 26px rgb(0 0 0 / 0), 0 12px 34px var(--accent-soft); }
  100% { box-shadow: 0 0 0 0 rgb(0 0 0 / 0), 0 12px 34px var(--accent-soft); }
}
.voice-orb.is-busy { animation: voiceSpin 1.1s linear infinite; }
@keyframes voiceSpin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .voice-orb.is-live, .voice-orb.is-busy { animation: none; }
  .voice-orb.is-live { outline: 3px solid var(--accent); outline-offset: 5px; }
  .voice-orb.is-busy { opacity: .65; }
}

.voice-status { margin: 0; font-size: .95rem; color: var(--muted); text-align: center; }
.voice-heard {
  margin: 0; font-size: .88rem; color: var(--text);
  text-align: center; font-style: italic;
}

.voice-answer {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .95rem;
}
.voice-answer-text { font-size: .96rem; line-height: 1.6; white-space: pre-wrap; }
.voice-answer-acts { display: flex; gap: .35rem; margin-top: .7rem; }

.voice-cards { display: flex; flex-direction: column; gap: .4rem; margin-top: .8rem; }
.voice-card {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .65rem; border-radius: 11px;
  background: var(--tint); border: 1px solid var(--line);
  color: var(--text);
}
.voice-card:hover { background: var(--tint-2); }
.voice-card .avatar {
  flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; object-fit: cover;
  background: var(--accent-soft); color: var(--accent);
  font-size: .8rem; font-weight: 800;
}
.voice-card-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.voice-card-txt strong { font-size: .9rem; }
.voice-card-txt span {
  font-size: .76rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.voice-card i { color: var(--dim); font-size: .8rem; }

.voice-type summary {
  cursor: pointer; font-size: .85rem; color: var(--muted);
  text-align: center; padding: .3rem;
}
.voice-type form { margin-top: .5rem; }

.voice-tips { display: flex; flex-direction: column; gap: .35rem; align-items: center; }
.voice-tips .hint { margin: 0; }
.voice-tip {
  padding: .4rem .8rem; border-radius: 999px;
  background: var(--tint); border: 1px solid var(--line);
  color: var(--muted); font-size: .82rem; font-family: inherit;
  cursor: pointer;
}
.voice-tip:hover { background: var(--tint-2); color: var(--text); }

/* Dictation button riding inside the search field. */
.search-row { position: relative; }
.search-row input { padding-right: 2.6rem; }
.mic-btn {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; border: none; cursor: pointer;
  color: var(--dim); font-size: .95rem;
}
.mic-btn:hover { color: var(--accent); background: var(--tint); }
.mic-btn.is-live { color: var(--on-accent); background: var(--accent); }
.icon-btn.is-on { color: var(--accent); }

/* ------------------------------------------------------------------ team */
.team-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 0; border-top: 1px solid var(--line);
}
.team-row:first-of-type { border-top: none; }
.team-row .avatar {
  flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; object-fit: cover;
  background: var(--accent-soft); color: var(--accent);
  font-size: .76rem; font-weight: 800;
}
.team-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; color: var(--text); }
.team-txt strong { font-size: .9rem; }
.team-txt .hint { margin: 0; font-size: .75rem; }
.team-txt strong, .team-txt .hint {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* The share control on a contact. Green when on, so its state reads at a
   glance rather than needing the label to be parsed. */
.share-toggle {
  display: flex; align-items: center; gap: .6rem;
  width: 100%; padding: .7rem .8rem; border-radius: 12px;
  background: var(--tint); border: 1px solid var(--line);
  color: var(--text); font: inherit; font-size: .88rem; cursor: pointer;
  text-align: left;
}
.share-toggle i:first-child { color: var(--dim); width: 18px; }
.share-toggle.is-on { background: var(--accent-soft); border-color: var(--accent); }
.share-toggle.is-on i:first-child { color: var(--accent); }
.share-toggle .share-state { margin-left: auto; font-size: .76rem; color: var(--muted); }
.share-toggle.is-on .share-state { color: var(--accent); font-weight: 700; }

/* A contact that belongs to a colleague. */
.shared-banner {
  display: flex; align-items: center; gap: .5rem;
  padding: .55rem .75rem; margin-bottom: .8rem;
  border-radius: 10px; background: var(--accent-soft);
  border: 1px solid var(--line); font-size: .83rem; color: var(--muted);
}
.shared-banner i { color: var(--accent); }

/* The "i" of BLink. Set in the accent so the wordmark has a point of
   focus; everything else stays the reading colour. */
.brand-i { color: var(--brand-i); }

/* --------------------------------------------------------- share buttons */
.share-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem;
  margin-top: .2rem;
}
.share-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .3rem; padding: .7rem .3rem; border-radius: 12px;
  background: var(--tint); border: 1px solid var(--line);
  color: var(--text); font: inherit; font-size: .72rem; font-weight: 600;
  cursor: pointer; text-align: center;
}
.share-btn i { font-size: 1.15rem; color: var(--accent); }
.share-btn:hover { background: var(--tint-2); }
.share-btn.wa i { color: #1faf54; }

/* The segmented control doubles as a button group in Settings. */
.seg button {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .8rem; border-radius: 8px;
  background: transparent; border: none;
  color: var(--muted); font: inherit; font-size: .84rem; font-weight: 600;
  cursor: pointer;
}
.seg button.is-active { background: var(--accent-dark); color: var(--on-accent); }

/* .logo is a flex row with a gap, so a bare <span> around the "i" became its
   own flex item and the name rendered as "Card i Snap". Keeping the whole
   wordmark inside one element makes it a single flex item again. */
.app-head .logo .logo-text { white-space: nowrap; }

/* Feedback under the dictation button. Absolutely positioned so appearing and
   disappearing never shifts the contact list below it. */
.mic-note {
  position: absolute; left: 0; right: 0; top: 100%;
  padding: .25rem .2rem 0;
  font-size: .74rem; color: var(--muted);
}
.mic-note:empty { display: none; }
