/* Andivo dashboard v1.2: light and calm, a menu bar across the top, red-orange only for small accents. */

:root {
  --bg: #F6F6F4;
  --surface: #FFFFFF;
  --soft: #F1F1EF;
  --line: #E7E7E4;
  --ink: #0F1012;
  --text2: #3A3D44;
  --mute: #6B6F76;
  --red: #FF4D2E;
  --red-ink: #C2331A;
  --red-soft: #FFEDE8;
  --green: #1C7A3C;
  --green-soft: #E7F3EA;
  --amber: #8A5A00;
  --amber-soft: #FBF1DC;
  --danger: #B42318;
  --danger-soft: #FCE9E9;
  --danger-line: #F3C9C9;
  --btn: #0F1012;
  --btn-ink: #FFFFFF;
  --switch-off: #D6D6D2;
  --shadow: 0 1px 3px rgba(15, 16, 18, .06);
  --shadow-lg: -12px 0 40px rgba(15, 16, 18, .18);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0F1012; --surface: #17181B; --soft: #222428; --line: #2C2E33; --ink: #F4F4F5; --text2: #C9CBD0;
    --mute: #9A9DA3; --red-ink: #FF8A70; --red-soft: #3A1E17; --green: #6FD08F; --green-soft: #15301E;
    --amber: #E8B44C; --amber-soft: #33290F; --danger: #FF8A80; --danger-soft: #3A1717; --danger-line: #5A2A2A;
    --btn: #F4F4F5; --btn-ink: #0F1012; --switch-off: #3A3C42; --shadow: none; --shadow-lg: -12px 0 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1012; --surface: #17181B; --soft: #222428; --line: #2C2E33; --ink: #F4F4F5; --text2: #C9CBD0;
  --mute: #9A9DA3; --red-ink: #FF8A70; --red-soft: #3A1E17; --green: #6FD08F; --green-soft: #15301E;
  --amber: #E8B44C; --amber-soft: #33290F; --danger: #FF8A80; --danger-soft: #3A1717; --danger-line: #5A2A2A;
  --btn: #F4F4F5; --btn-ink: #0F1012; --switch-off: #3A3C42; --shadow: none; --shadow-lg: -12px 0 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.icon { flex: none; }
.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; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--btn); color: var(--btn-ink); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 8px; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.normal { font-weight: 400; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.danger { color: var(--danger); }

.h1, .h2, .h3 { margin: 0; font-stretch: 110%; letter-spacing: -0.01em; }
.h1 { font-size: 34px; font-weight: 800; line-height: 1.1; }
.h2 { font-size: 18px; font-weight: 700; line-height: 1.25; }
.h3 { font-size: 15px; font-weight: 700; }
.sub { margin: 6px 0 0; font-size: 16px; color: var(--mute); max-width: 70ch; }
.sub strong { color: var(--ink); }

/* ---------- Top menu bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 58px; padding: 0 18px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.tb-left { min-width: 0; display: flex; }
.biz { display: inline-flex; align-items: center; gap: 10px; min-width: 0; padding: 4px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 700; cursor: pointer; }
.biz:hover { background: var(--soft); }
.biz .logo { flex: none; border-radius: 7px; }
.biz-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: 4px; }
.tabs a {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 9px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500;
}
.tabs a:hover { background: var(--soft); }
.tabs a[aria-current="page"] { background: var(--soft); font-weight: 700; }
.badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; padding: 1px 6px; border-radius: 999px;
  background: var(--red); color: #0F1012; font-size: 10px; font-weight: 800; line-height: 14px; text-align: center;
}
.tb-right { justify-self: end; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--soft); }
.icon-btn-soft { background: var(--soft); width: 34px; height: 34px; }
.bell-dot { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--red); color: #0F1012; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; }

.seg { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 2px; margin: 0 4px; }
.seg button { border: 0; border-radius: 999px; background: transparent; color: var(--mute); height: 26px; padding: 0 10px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(15, 16, 18, .12); }
.seg-wide { display: flex; margin: 6px 4px; }
.seg-wide button { flex: 1; justify-content: center; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.me { cursor: pointer; border-radius: 50%; display: flex; }
.menu-panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; min-width: 250px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 16, 18, .14);
}
.menu-right { left: auto; right: 0; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 14px; text-align: left; text-decoration: none; cursor: pointer; }
.menu-item:hover { background: var(--soft); }
.menu-item[aria-pressed="true"] { font-weight: 700; background: var(--soft); }
.me-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--mute); }
.me-head strong { color: var(--ink); font-size: 14px; }

/* ---------- Building blocks ---------- */
.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--av, var(--soft)); color: #0F1012;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-xl { width: 64px; height: 64px; font-size: 20px; }
.avatar-ink { background: var(--btn); color: var(--btn-ink); width: 32px; height: 32px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--soft); color: var(--mute); }
.chip-xs { font-size: 11px; padding: 1px 6px; }
.chip-ready { background: var(--green-soft); color: var(--green); }
.chip-done, .chip-gray { background: var(--soft); color: var(--mute); }
.chip-emergency { background: var(--danger-soft); color: var(--danger); }
.chip-callback, .chip-open { background: var(--amber-soft); color: var(--amber); }
.chip-accent { background: var(--red-soft); color: var(--red-ink); }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-level-owner, .chip-level-admin { background: var(--btn); color: var(--btn-ink); }
.chip-level-business_admin { background: var(--soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.chip-level-manager { background: var(--green-soft); color: var(--green); }
.chip-level-staff { background: var(--soft); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.mood { display: inline-flex; align-items: center; gap: 6px; }
.mood-dot { width: 8px; height: 8px; border-radius: 50%; background: #9A9DA3; }
.mood-happy .mood-dot { background: var(--green); }
.mood-upset .mood-dot { background: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border: 0; border-radius: 10px;
  background: var(--btn); color: var(--btn-ink); font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn:hover { opacity: .9; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; height: 44px; }
.btn-outline { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid var(--danger-line); }
.push { margin-left: auto; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.card-head .h2 { flex: 1; }
.card-head a { font-size: 13px; font-weight: 600; }
.card-table { padding: 6px 20px; }
.empty-note { list-style: none; padding: 14px 0; color: var(--mute); border-top: 1px solid var(--line); margin: 0; }

.alert { margin: 0 0 16px; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.alert p { margin: 4px 0; }
.alert-success { background: var(--green-soft); color: var(--ink); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.credentials { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 10px 0; }
.credentials dt { color: var(--mute); }
.credentials dd { margin: 0; }
.credentials code { font-size: 14px; background: var(--surface); padding: 2px 6px; border-radius: 6px; user-select: all; }

.switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0;
  width: 36px; height: 21px; border-radius: 999px; background: var(--switch-off); cursor: pointer; transition: background .15s;
}
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #FFFFFF; transition: transform .15s; }
.switch:checked { background: var(--btn); }
.switch:checked::before { transform: translateX(15px); background: var(--btn-ink); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .switch, .switch::before { transition: none; } }

/* Tables (Home latest calls, Team) */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--mute); font-size: 13px; font-weight: 600; padding: 9px 8px; white-space: nowrap; }
.table td { padding: 11px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .need { color: var(--text2); min-width: 200px; }
.click-row { position: relative; }
.click-row:hover td { background: var(--soft); }
.click-row.selected td { background: var(--soft); }
.row-link { color: var(--ink); text-decoration: none; }
.row-link::after { content: ""; position: absolute; inset: 0; }
.row-link:focus-visible { outline: none; }
.row-link:focus-visible::after { outline: 2px solid var(--red); outline-offset: -2px; border-radius: 8px; }
.person-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-text { display: flex; flex-direction: column; min-width: 0; }
.inactive td { opacity: .6; }
.chev { color: var(--mute); width: 24px; }

/* ---------- Pages ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 30px 48px 56px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-head > div { flex: 1; min-width: 260px; }

/* Home */
.home { display: flex; flex-direction: column; gap: 22px; }
.home .page-head { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.stat-n { font-size: 40px; font-weight: 700; font-stretch: 110%; line-height: 1; letter-spacing: -0.02em; }
.stat-label { font-size: 14px; color: var(--mute); }
.stat-ink { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.stat-ink .stat-label { color: inherit; opacity: .78; }
.stat-ink a { color: inherit; font-weight: 600; }
.home-lists { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: var(--ink); text-decoration: none; }
.list-main:hover .strong { text-decoration: underline; }
.list-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.list-text { font-size: 13px; color: var(--text2); }
.list-meta { font-size: 12px; color: var(--mute); }
.list-meta.danger { color: var(--danger); }

/* Conversations: three columns */
.convo-page { background: var(--surface); }
.convo { display: grid; grid-template-columns: 320px minmax(0, 1fr) 320px; height: calc(100vh - 58px); height: calc(100dvh - 58px); }
.convo:not(.has-selected) { grid-template-columns: 320px minmax(0, 1fr); }
.convo-list { border-right: 1px solid var(--line); padding: 12px 10px; overflow-y: auto; }
.convo-thread { background: var(--bg); display: flex; flex-direction: column; min-width: 0; overflow-y: auto; }
.convo-side { border-left: 1px solid var(--line); padding: 26px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.convo-empty { background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--mute); text-align: center; padding: 24px; }
.convo-empty p { margin: 4px 0; }

.search { display: flex; align-items: center; gap: 6px; padding: 0 4px; margin-bottom: 10px; }
.search-box { flex: 1; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 10px; background: var(--soft); color: var(--mute); }
.search-box:focus-within { outline: 2px solid var(--red); outline-offset: 1px; }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); font-size: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 10px; }
.filter { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px; border-radius: 7px; background: var(--soft); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 500; white-space: nowrap; }
.filter[aria-current="true"] { background: var(--red-soft); color: var(--red-ink); font-weight: 600; }
.filter-n { font-size: 12px; opacity: .7; }
.filter-red { color: var(--danger); }
.results-for { margin: 0 4px 8px; font-size: 13px; color: var(--mute); }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.row { display: flex; gap: 11px; padding: 11px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.row:hover, .row[aria-current="true"] { background: var(--soft); }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-top, .row-bottom { display: flex; align-items: center; gap: 6px; }
.row-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-name.unread { font-weight: 700; }
.row-time { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--mute); white-space: nowrap; }
.row-preview { flex: 1; min-width: 0; font-size: 13px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-bottom .chip { font-size: 11px; padding: 1px 6px; }

.back-link { display: none; align-items: center; gap: 6px; margin: 14px 16px 0; font-size: 14px; font-weight: 600; text-decoration: none; }
.thread { flex: 1; padding: 22px 32px 16px; display: flex; flex-direction: column; gap: 14px; }
.day-sep { align-self: center; }
.day-sep span { display: inline-block; font-size: 12px; font-weight: 600; color: var(--mute); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.thread-item { display: flex; gap: 12px; align-items: flex-start; }
.call { flex: 1; min-width: 0; max-width: 700px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.call-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px; }
.call-icon { flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--soft); display: flex; align-items: center; justify-content: center; }
.call-title { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 15px; }
.player { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 0 16px 14px; }
.play { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--btn); color: var(--btn-ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.play .when-playing, .player.is-playing .play .when-paused { display: none; }
.player.is-playing .play .when-playing { display: flex; }
.play .when-paused { display: flex; margin-left: 2px; }
.seek { flex: 1; min-width: 120px; accent-color: var(--ink); }
.time { font-size: 12px; font-weight: 600; color: var(--mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.speed { border: 0; background: var(--soft); color: var(--ink); border-radius: 6px; padding: 3px 7px; font-size: 12px; font-weight: 700; cursor: pointer; }
.player-error { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--danger); }
.call-body { border-top: 1px solid var(--line); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.summary { margin: 0; font-size: 15px; line-height: 1.55; }
.highlights { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--text2); }
.problem { margin: 0; font-size: 14px; color: var(--text2); }
.call-body > .muted { margin: 0; }
.transcript { border-top: 1px solid var(--line); padding-top: 10px; }
.transcript > summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; padding: 2px 0; }
.transcript > summary::-webkit-details-marker { display: none; }
.transcript > summary .icon { margin-left: auto; transition: transform .15s; }
.transcript[open] > summary .icon { transform: rotate(180deg); }
.switch-row { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 13px; color: var(--mute); cursor: pointer; }
.switch-row > span { flex: 1; }
.lines { display: grid; grid-template-columns: 40px 70px minmax(0, 1fr); gap: 8px 10px; margin-top: 10px; font-size: 14px; line-height: 1.5; }
.line { display: contents; }
.line-time { color: var(--mute); font-variant-numeric: tabular-nums; }
.line-who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-en { display: block; margin-top: 2px; color: var(--mute); font-size: 13px; }
.lines.hide-en .line-en { display: none; }

.composer {
  position: sticky; bottom: 0; margin: 0 32px 22px;
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 4px 16px rgba(15, 16, 18, .06);
}
.composer:focus-within { border-color: var(--ink); }
.composer-label { font-size: 12px; font-weight: 700; color: var(--mute); }
.composer textarea { width: 100%; min-height: 64px; border: 0; padding: 0; background: transparent; resize: vertical; font-size: 14px; line-height: 1.5; outline: none; }
.composer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip-btn { border: 0; border-radius: 7px; background: var(--soft); color: var(--mute); padding: 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer; }
.composer-note { margin-left: auto; font-size: 12px; color: var(--mute); max-width: 260px; text-align: right; }
.send { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--btn); color: var(--btn-ink); font-size: 13px; font-weight: 700; text-decoration: none; }

.profile { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.profile .avatar { margin-bottom: 4px; }
.actions { display: flex; gap: 8px; margin-top: 8px; }
.icon-action { width: 42px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.icon-action:hover { background: var(--soft); }
.copied-note { min-height: 16px; font-size: 12px; color: var(--green); }
.facts { margin: 0; border-top: 1px solid var(--line); }
.facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.facts dt { color: var(--mute); flex: none; }
.facts dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.facts-grid { display: grid; grid-template-columns: 140px minmax(0, 1fr); row-gap: 9px; border-top: 0; margin-top: 14px; }
.facts-grid > div { display: contents; }
.facts-grid dt, .facts-grid dd { text-align: left; padding: 0; border: 0; }
.before { display: flex; flex-direction: column; gap: 8px; }
.before-item { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 10px; background: var(--soft); color: var(--ink); text-decoration: none; }
.before-item:hover { outline: 1px solid var(--line); }
.before-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.side-foot { margin-top: auto; }
.done-pill { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--green-soft); color: var(--green); font-weight: 600; }

/* Team: profile sheet that slides in from the right */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(15, 16, 18, .32); }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; z-index: 31; width: min(540px, 100vw); background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: sheet-in .18s ease-out; }
@keyframes sheet-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 28px 20px; display: flex; flex-direction: column; gap: 22px; }
.sheet-head { display: flex; align-items: flex-start; gap: 14px; }
.sheet-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sheet-title .chip { align-self: flex-start; margin-top: 4px; }
.sheet-foot { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 28px; border-top: 1px solid var(--line); background: var(--surface); }
.sheet .alert { margin: 0; }
.access { display: flex; flex-direction: column; gap: 22px; }
.levels { border: 0; margin: 0; padding: 0; min-width: 0; }
.levels legend { padding: 0; margin-bottom: 10px; font-size: 15px; font-weight: 700; }
.level-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.level-card { position: relative; flex: 1 1 130px; display: flex; flex-direction: column; gap: 6px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); }
.level-card:has(input:checked) { border: 2px solid var(--ink); padding: 11px 12px; }
.level-card:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }
.level-card input { position: absolute; top: 12px; right: 12px; margin: 0; accent-color: var(--ink); }
.level-card.is-disabled { opacity: .5; cursor: not-allowed; }
.level-name { font-size: 15px; font-weight: 700; padding-right: 22px; }
.level-desc { font-size: 12px; line-height: 1.4; color: var(--mute); }
.help { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: var(--mute); }
.note { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--soft); color: var(--mute); font-size: 13px; }
.perms { display: flex; flex-direction: column; gap: 12px; }
.perm-group { display: flex; flex-direction: column; }
.perm-group-name { font-size: 12px; font-weight: 700; color: var(--mute); padding: 4px 0 6px; }
.perm { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.perm-text { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.perm-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.perm-note { font-size: 12px; color: var(--mute); }
.recent { display: flex; flex-direction: column; gap: 8px; }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.activity li { display: flex; gap: 10px; }
.activity-when { flex: none; width: 128px; color: var(--mute); white-space: nowrap; }

/* Forms */
.stack-form { display: flex; flex-direction: column; gap: 8px; }
.stack-form label:not(.check):not(.level-card):not(.radio) { font-size: 13px; font-weight: 600; margin-top: 6px; }
.stack-form input[type="text"], .stack-form input[type="email"], .stack-form input[type="password"], .stack-form select {
  height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 15px;
}
.stack-form input:focus-visible, .stack-form select:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.stack-form .btn { margin-top: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 6px; }
.radios { border: 0; padding: 0; margin: 6px 0 0; }
.radios legend { font-size: 13px; font-weight: 600; padding: 0; margin-bottom: 4px; }
.radio { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.radio input { accent-color: var(--ink); }

/* Settings */
.settings { display: flex; flex-direction: column; gap: 16px; }
.narrow { max-width: 640px; width: 100%; }
.money-input { display: flex; align-items: center; gap: 6px; height: 42px; max-width: 220px; margin-top: 12px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.money-input:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }
.money-input input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 15px; }
.hours { margin-top: 12px; }
.hours-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.hours-day { display: flex; align-items: center; gap: 10px; width: 170px; font-weight: 600; cursor: pointer; }
.hours-time input { height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.hours-row:has(.switch:not(:checked)) .hours-time { opacity: .35; }
.pick-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Account */
.account { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.account .card .h2 { margin-bottom: 8px; }

/* Login and error pages */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; color: var(--ink); }
.login-brand .logo { border-radius: 7px; }
.login-card .h1 { font-size: 28px; }
.login-card .sub { margin-bottom: 18px; font-size: 15px; }
.login-card > .btn { margin-top: 10px; }
.lang-links { display: flex; justify-content: center; gap: 16px; margin-top: 18px; font-size: 13px; }
.lang-links a { color: var(--mute); text-decoration: none; }
.lang-links a[aria-current="true"] { color: var(--ink); font-weight: 700; }

/* ---------- Smaller screens ---------- */
@media (max-width: 1180px) {
  .convo, .convo:not(.has-selected) { grid-template-columns: 300px minmax(0, 1fr); height: auto; min-height: calc(100vh - 58px); }
  .convo-list { grid-row: span 2; position: sticky; top: 58px; height: calc(100vh - 58px); }
  .convo-thread { overflow: visible; }
  .convo-side { grid-column: 2; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .side-foot { margin-top: 0; }
}

@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-lists, .account { grid-template-columns: minmax(0, 1fr); }
  .page { padding: 24px 24px 48px; }
  .composer-note { display: none; }
  .send { margin-left: auto; }
}

@media (max-width: 760px) {
  body { padding-bottom: 66px; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; padding: 0 10px 0 12px; gap: 8px; }
  .biz { font-size: 14px; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    justify-content: space-around; gap: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabs a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; }
  .badge { top: 0; right: calc(50% - 26px); }
  .tb-right { gap: 2px; }
  .tb-right .seg { display: none; }
  .page { padding: 20px 16px 40px; }
  .h1 { font-size: 28px; }
  .stat { min-height: 96px; padding: 14px 16px; }
  .stat-n { font-size: 32px; }
  .convo, .convo:not(.has-selected) { display: block; min-height: 0; }
  .convo-list { position: static; height: auto; border-right: 0; }
  .convo.has-selected .convo-list, .convo-empty { display: none; }
  .back-link { display: inline-flex; }
  .thread { padding: 14px 12px; }
  .thread-item > .avatar { display: none; }
  .composer { position: static; margin: 0 12px 14px; }
  .convo-side { padding: 22px 16px; }
  .lines { grid-template-columns: 40px minmax(0, 1fr); }
  .line-text { grid-column: 2; }
  .sheet-body { padding: 18px 16px; }
  .sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .facts-grid { grid-template-columns: 120px minmax(0, 1fr); }
  .activity li { flex-direction: column; gap: 0; }
  .hours-day { width: 100%; }
}
