@layer od-layout {
  [hidden]:not([hidden="until-found" i]) { display: none !important; }
  dialog:not([open]) { display: none !important; }
  :where(.od-stack,.od-row,.od-row-top,.od-cluster,.od-grid,.od-field,.od-stat,.od-cell,.od-tile) > :where(*) { min-width: 0; }
  .od-stack   { display: flex; flex-direction: column; gap: var(--od-gap, 8px); }
  .od-row     { display: flex; align-items: center; gap: var(--od-gap, 8px); }
  .od-row-top { display: flex; align-items: flex-start; gap: var(--od-gap, 8px); }
  .od-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--od-gap, 8px); }
  .od-fill    { flex: 1 1 0; min-width: 0; }
  .od-fixed   { flex: none; }
  .od-grid    { display: grid; gap: var(--od-gap, 12px); grid-template-columns: repeat(var(--od-cols, 3), minmax(0, 1fr)); }
  .od-stat, .od-field, .od-cell { display: grid; gap: var(--od-gap, 2px); }
  :where(.od-stat,.od-field,.od-cell) > :where(*) { display: block; }
  .od-tile { display: grid; grid-template-rows: auto 1fr; }
  :where(.od-tile) > :where(*) { display: block; }
  .od-media { display: block; width: 100%; height: auto; aspect-ratio: var(--od-ratio, auto); }
  .od-media-cover { object-fit: cover; }
  .od-icon { display: inline-block; inline-size: var(--od-icon-size, 1em); block-size: var(--od-icon-size, 1em); flex: none; }
  .od-truncate { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .od-clamp-2, .od-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .od-clamp-2 { -webkit-line-clamp: 2; }
  .od-clamp-3 { -webkit-line-clamp: 3; }
  .od-lines-2 { min-height: calc(2 * 1.4em); }
  .od-nowrap  { white-space: nowrap; }
  .od-keep    { word-break: keep-all; overflow-wrap: anywhere; }
  .od-screen { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
  .od-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
  .od-rail { display: flex; gap: var(--od-gap, 8px); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
             padding-inline: var(--od-rail-pad, 16px); scroll-padding-inline: var(--od-rail-pad, 16px); }
  .od-rail::-webkit-scrollbar { display: none; }
  :where(.od-rail) > :where(*) { flex: none; scroll-snap-align: start; }
  :where(.od-rail) > :where(:last-child) { margin-inline-end: var(--od-rail-pad, 16px); }
  .od-spacer { flex: none; visibility: hidden; pointer-events: none; }
  .od-touch  { min-width: 44px; min-height: 44px; }
}
:root [hidden]:where(:not([hidden="until-found" i])) { display: none; }

:root {
  --bg: #eef2f4;
  --bg-deep: #e5ebee;
  --surface: #ffffff;
  --surface-2: #f7fafb;
  --surface-3: #edf3f5;
  --ink: #0e1a22;
  --ink-2: #425560;
  --ink-3: #5f727d;
  --line: #dde6ea;
  --line-strong: #c8d5db;
  --brand: #0d5c55;
  --brand-700: #0a4a45;
  --brand-600: #0c544e;
  --brand-soft: #e2f0ed;
  --brand-ink: #07332f;
  --info: #1f5f8b;
  --info-soft: #e7f1f8;
  --success: #176b45;
  --success-soft: #e6f3ec;
  --warning: #7a4a00;
  --warning-soft: #fbf0dd;
  --danger: #a82a2a;
  --danger-soft: #fbeaea;
  --sidebar: #0d1a21;
  --sidebar-2: #132730;
  --sidebar-ink: #d8e3e8;
  --sidebar-muted: #93a7b0;
  --sidebar-line: #223640;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(10, 24, 32, .06);
  --shadow-md: 0 8px 24px rgba(10, 24, 32, .09);
  --shadow-lg: 0 28px 70px rgba(8, 20, 28, .22);
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Sora', 'Inter', system-ui, sans-serif;
  --topbar-h: 70px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; margin: 0; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-700); }
img, svg { max-width: 100%; }
::selection { background: #b9ded7; color: var(--brand-ink); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

.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;
}

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.shell { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 14px 14px;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  z-index: 60;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: #12453f;
  border: 1px solid #1d5b54;
  border-radius: 10px;
  color: #8fd6c8;
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; letter-spacing: -.03em; color: #fff; line-height: 1.1; }
.brand-sub { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--sidebar-muted); font-weight: 600; margin-top: 2px; }
.sidebar-close { margin-left: auto; display: none; color: var(--sidebar-ink); }

.sidebar-context {
  display: flex; align-items: center; gap: 9px;
  background: var(--sidebar-2);
  border: 1px solid var(--sidebar-line);
  border-radius: 10px;
  padding: 9px 10px;
  margin-bottom: 4px;
}
.sidebar-context .od-icon { color: #83c9bb; }
.sidebar-context-name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.25; }
.sidebar-context-meta { font-size: 11.5px; color: var(--sidebar-muted); line-height: 1.3; }

.sidebar-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 2px; scrollbar-width: thin; }
.nav-group { margin-top: 12px; }
.nav-group:first-child { margin-top: 2px; }
.nav-label {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: #7d939d; font-weight: 700; padding: 0 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; min-height: 40px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--sidebar-ink);
  font-size: 14.5px; font-weight: 500; text-align: left;
  transition: background .16s ease, color .16s ease;
}
.nav-item .od-icon { color: #8fa9b3; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item:hover .od-icon { color: #cfe4df; }
.nav-item[aria-current="page"] {
  background: rgba(52, 166, 148, .18);
  color: #fff;
  box-shadow: inset 2px 0 0 #56c9b7;
  font-weight: 600;
}
.nav-item[aria-current="page"] .od-icon { color: #7edccc; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: 999px; background: #2f7a71; color: #fff;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.nav-badge.alert { background: #9a4a32; }
.sidebar-foot { border-top: 1px solid var(--sidebar-line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.isolation {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 9px 10px; border-radius: 9px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--sidebar-line);
  color: var(--sidebar-muted);
  font-size: 11.5px; line-height: 1.4;
}
.isolation .od-icon { color: #6fbfb0; margin-top: 1px; }
.isolation strong { color: #cfe0e5; font-weight: 600; }

.sidebar-scrim { position: fixed; inset: 0; background: rgba(6, 14, 19, .55); z-index: 55; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h);
  padding: 0 26px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.context-btn {
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 6px 12px 6px 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; text-align: left;
  transition: border-color .16s ease, background .16s ease;
}
.context-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.context-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand-700);
}
.context-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.context-kicker { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--ink-3); }
.context-name { font-size: 14px; font-weight: 600; color: var(--ink); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-btn .chev { color: var(--ink-3); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.demo-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink-3); font-size: 11.5px; font-weight: 600;
}
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 8px 4px 12px; margin-left: 2px;
  border: 0; background: transparent;
  border-left: 1px solid var(--line);
  border-radius: 0 9px 9px 0;
  min-height: 44px;
}
.user-chip:hover { background: var(--surface-2); }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { font-size: 13px; font-weight: 600; }
.user-meta span { font-size: 11.5px; color: var(--ink-3); }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--ink-2);
  transition: background .16s ease, color .16s ease, border-color .16s ease;
  position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn[aria-expanded="true"] { background: var(--brand-soft); color: var(--brand-700); border-color: #c4e0db; }
.icon-badge {
  position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px;
  display: grid; place-items: center; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; border: 2px solid var(--surface);
}

/* ---------- Popovers ---------- */
.popover {
  position: fixed; z-index: 90;
  width: min(370px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
}
.pop-head { padding: 8px 10px 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); }
.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 46px; padding: 8px 10px;
  border: 0; border-radius: 8px; background: transparent;
  text-align: left; color: var(--ink);
}
.pop-item:hover { background: var(--surface-2); }
.pop-item .od-icon { color: var(--ink-3); }
.pop-item-body { flex: 1; min-width: 0; }
.pop-item-title { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.pop-item-meta { display: block; font-size: 12px; color: var(--ink-3); line-height: 1.35; margin-top: 1px; }
.pop-check { color: var(--brand); }
.pop-divider { height: 1px; background: var(--line); margin: 6px 4px; }
.pop-note { padding: 6px 10px 8px; font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
.pop-empty { padding: 18px 12px; text-align: center; font-size: 13px; color: var(--ink-3); }
.alert-item .alert-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 5px; }
.alert-item .tone-danger { background: var(--danger); }
.alert-item .tone-warning { background: #b7791f; }
.alert-item .tone-info { background: var(--info); }
.alert-item .tone-success { background: var(--success); }

/* ---------- Main ---------- */
#main { flex: 1; padding: 26px 28px 64px; width: 100%; max-width: 1560px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head-copy { flex: 1 1 420px; min-width: 0; }
.eyebrow {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; margin-bottom: 5px;
}
.page-head h1 { font-size: 27px; line-height: 1.15; color: var(--ink); }
.lede { font-size: 15px; color: var(--ink-2); margin-top: 6px; max-width: 72ch; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px;
  border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1;
  text-decoration: none; white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.btn .od-icon { flex: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn-primary:disabled { background: #b7c6c3; border-color: #b7c6c3; color: #36433f; cursor: not-allowed; }
.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover { background: var(--surface-2); border-color: #adbfc7; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-danger { background: var(--surface); border-color: #e3bcbc; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #d4a3a3; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; gap: 5px; }
.btn-block { width: 100%; }
.btn-link { border: 0; background: none; color: var(--brand-700); font-weight: 600; padding: 0; min-height: 0; border-radius: 3px; text-decoration: underline; text-underline-offset: 3px; }
.link { border: 0; background: none; color: var(--brand-700); font-weight: 600; padding: 0; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Chips & badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.4;
  background: var(--surface-3); color: var(--ink-2);
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip-brand { background: var(--brand-soft); color: var(--brand-ink); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-warning { background: var(--warning-soft); color: var(--warning); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-neutral { background: var(--surface-3); color: var(--ink-2); }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  display: inline-flex; padding: 2px 7px; border-radius: 5px;
  background: var(--surface-3); color: var(--ink-2);
  font-size: 11px; font-weight: 600;
}

/* ---------- Avatars ---------- */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-xl { width: 68px; height: 68px; font-size: 22px; }

/* ---------- Cards & grids ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  min-width: 0;
}
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head-copy { flex: 1; min-width: 0; }
.card-title { font-family: var(--font-display); font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.card-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.45; }
.card-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stack-16 { display: flex; flex-direction: column; gap: 16px; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.section-gap { margin-top: 16px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 14px 13px;
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  box-shadow: var(--shadow-sm);
}
.kpi-label { font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.kpi-value { font-family: var(--font-display); font-size: 24px; font-weight: 600; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-value small { font-family: var(--font-body); font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.kpi-meta { font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }
.kpi-meta strong { color: var(--ink-2); font-weight: 600; }
.kpi-trend-up { color: var(--success); }
.kpi-trend-down { color: var(--danger); }

/* ---------- Funnel ---------- */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 134px minmax(0, 1fr) 46px; align-items: center; gap: 10px; }
.funnel-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.funnel-count { font-size: 13px; font-weight: 700; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.funnel-track { height: 11px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 999px; min-width: 4px; transition: width .3s ease; }
.funnel-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }

/* ---------- Lists ---------- */
.day-list { display: flex; flex-direction: column; }
.day-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.day-row:last-child { border-bottom: 0; padding-bottom: 0; }
.day-row:first-child { padding-top: 0; }
.day-time { font-size: 12.5px; font-weight: 700; color: var(--ink-2); width: 44px; flex: none; font-variant-numeric: tabular-nums; }
.day-main { flex: 1; min-width: 0; }
.day-title { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.day-meta { font-size: 12px; color: var(--ink-3); margin-top: 1px; line-height: 1.35; }

.task-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; padding-bottom: 0; }
.task-check {
  width: 21px; height: 21px; flex: none; border-radius: 6px;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  display: grid; place-items: center; margin-top: 1px; color: #fff;
  transition: background .15s ease, border-color .15s ease;
}
.task-check:hover { border-color: var(--brand); }
.task-check.done { background: var(--brand); border-color: var(--brand); }
.task-main { flex: 1; min-width: 0; }
.task-title { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink); line-height: 1.35; }
.task-row.done .task-title { color: var(--ink-3); text-decoration: line-through; }
.task-meta { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.35; }
.task-meta .overdue { color: var(--danger); font-weight: 600; }

.avatar-row { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar-row-text { min-width: 0; }
.avatar-row-title { font-size: 13px; font-weight: 600; color: var(--ink); display: block; }
.avatar-row-meta { font-size: 11.5px; color: var(--ink-3); display: block; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; }
.rtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rtable th {
  text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; padding: 8px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.rtable td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.rtable tbody tr:last-child td { border-bottom: 0; }
.rtable tbody tr:hover { background: var(--surface-2); }
.rtable td strong { color: var(--ink); font-weight: 600; }
.rtable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rtable .actions { text-align: right; white-space: nowrap; }
.rtable .muted { color: var(--ink-3); }
.table-note { font-size: 12px; color: var(--ink-3); margin-top: 10px; line-height: 1.5; }
.table-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.search-box { position: relative; flex: 1 1 240px; max-width: 340px; }
.search-box .od-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-box input { padding-left: 36px; }
.count-note { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

/* ---------- Inputs ---------- */
input, select, textarea {
  width: 100%; min-height: 40px;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
select { padding-right: 30px; }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #8697a0; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 92, 85, .14);
}
input[readonly] { background: var(--surface-2); color: var(--ink-2); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); }
input.invalid:focus, select.invalid:focus, textarea.invalid:focus { box-shadow: 0 0 0 3px rgba(168, 42, 42, .14); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
.field-error { font-size: 12px; color: var(--danger); font-weight: 500; line-height: 1.4; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.span-2 { grid-column: span 2; }
.form-errors {
  background: var(--danger-soft);
  border: 1px solid #ecc6c6;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: #7e2222;
  margin-bottom: 13px;
}
.form-errors strong { display: block; margin-bottom: 4px; }
.form-errors ul { margin: 0; padding-left: 16px; }
.form-errors li { margin: 2px 0; }
.form-errors .link { color: #7e2222; font-size: 12.5px; }
.check-row { display: flex; align-items: flex-start; gap: 9px; }
.check-row input { width: 18px; min-height: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.check-row label { font-size: 13px; line-height: 1.45; color: var(--ink-2); font-weight: 400; }
.check-row .field-error { width: 100%; }

/* ---------- Page furniture ---------- */
.banner {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px; line-height: 1.5;
}
.banner .od-icon { flex: none; margin-top: 1px; }
.banner-body { flex: 1; min-width: 0; }
.banner strong { font-weight: 600; }
.banner-info { background: var(--info-soft); border-color: #c7dfef; color: #174a6b; }
.banner-warning { background: var(--warning-soft); border-color: #ecd5ac; color: #6b4100; }
.banner-danger { background: var(--danger-soft); border-color: #ecc6c6; color: #7e2222; }
.banner-success { background: var(--success-soft); border-color: #bfe0cd; color: #125437; }
.banner-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.access-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 26px;
  background: #133c46; color: #e2f0ee;
  font-size: 13px; line-height: 1.45;
}
.access-banner .od-icon { color: #8fd6c8; }
.access-banner strong { color: #fff; }
.access-banner .btn { margin-left: auto; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.access-banner .btn:hover { background: rgba(255,255,255,.18); }

.empty {
  text-align: center;
  padding: 34px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
}
.empty-icon {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; margin: 0 auto 10px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--brand);
}
.empty strong { display: block; font-size: 14px; color: var(--ink); margin-bottom: 3px; }
.empty p { font-size: 13px; max-width: 44ch; margin: 0 auto; line-height: 1.5; }
.empty .btn { margin-top: 12px; }

.callout {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-2);
}
.callout strong { color: var(--ink); }
.callout ul { margin: 6px 0 0; padding-left: 17px; }
.callout li { margin: 3px 0; }
.callout code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; background: var(--surface-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; color: var(--ink); }

.person-line { display: flex; align-items: center; gap: 9px; min-width: 0; }
.person-name { font-weight: 600; color: var(--ink); font-size: 13.5px; }
.person-meta { color: var(--ink-3); font-size: 12px; }

.summary-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.summary-cell { background: var(--surface); padding: 11px 14px; }
.summary-cell span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; }
.summary-cell strong { display: block; font-family: var(--font-display); font-size: 19px; margin-top: 2px; font-variant-numeric: tabular-nums; }

.progress { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.progress.warn > span { background: #b7791f; }
.progress.danger > span { background: var(--danger); }

.metric-line { display: flex; align-items: baseline; gap: 8px; }
.metric-line strong { font-family: var(--font-display); font-size: 22px; font-variant-numeric: tabular-nums; }
.metric-line span { font-size: 12px; color: var(--ink-3); }

/* ---------- Inbox ---------- */
.inbox {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr) 300px;
  height: calc(100dvh - 216px);
  min-height: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.inbox-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.inbox-list-head { padding: 12px 12px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; }
.filter-row { display: flex; gap: 5px; flex-wrap: wrap; }
.filter-chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 4px 9px; font-size: 11.5px; font-weight: 600; min-height: 28px;
}
.filter-chip:hover { background: var(--surface-2); border-color: var(--line-strong); }
.filter-chip[aria-pressed="true"] { background: var(--brand-soft); border-color: #c4e0db; color: var(--brand-ink); }
.inbox-list-scroll { overflow-y: auto; flex: 1; min-height: 0; }
.conv-item {
  display: block; width: 100%; text-align: left;
  padding: 11px 12px; border: 0; border-bottom: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.conv-item:hover { background: var(--surface-2); }
.conv-item[aria-current="true"] { background: #eaf5f2; box-shadow: inset 2px 0 0 var(--brand); }
.conv-top { display: flex; align-items: center; gap: 8px; }
.conv-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: 11px; color: var(--ink-3); flex: none; }
.conv-preview { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-meta { display: flex; align-items: center; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.unread {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-grid; place-items: center; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 10px; font-weight: 700;
}
.inbox-thread { display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); min-width: 0; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.thread-head-main { flex: 1; min-width: 170px; }
.thread-name { font-size: 15px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.thread-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.thread-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.assign-select { width: auto; min-width: 148px; min-height: 34px; font-size: 12.5px; padding: 6px 28px 6px 9px; }
.thread-scroll { overflow-y: auto; flex: 1; min-height: 0; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 10px; }
.msg-row { display: flex; gap: 8px; }
.msg-row.in { justify-content: flex-start; }
.msg-row.out { justify-content: flex-end; }
.msg-row.note { justify-content: center; }
.bubble {
  max-width: min(78%, 560px);
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: 0 1px 1px rgba(10,24,32,.03);
}
.msg-row.out .bubble { background: var(--brand); border-color: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg-row.in .bubble { border-bottom-left-radius: 4px; }
.msg-meta { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--ink-3); margin-top: 4px; }
.msg-row.out .msg-meta { color: #cfe6e1; justify-content: flex-end; }
.note-bubble {
  width: 100%;
  background: var(--warning-soft);
  border: 1px solid #ecd5ac;
  color: #5a3a06;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12.5px;
  line-height: 1.5;
}
.note-label { display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #7a4a00; margin-bottom: 3px; }
.day-divider { align-self: center; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); background: var(--surface-3); border-radius: 999px; padding: 3px 10px; font-weight: 600; }
.composer { border-top: 1px solid var(--line); background: var(--surface); padding: 10px 14px 12px; }
.composer textarea { min-height: 50px; max-height: 150px; border-color: var(--line); background: var(--surface-2); resize: none; font-size: 13.5px; padding: 10px 11px; }
.composer-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.composer-hint { font-size: 11px; color: var(--ink-3); margin-right: auto; }
.quick-chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 500; min-height: 26px; }
.quick-chip:hover { background: var(--surface-2); border-color: var(--line-strong); }
.note-toggle[aria-pressed="true"] { background: var(--warning-soft); border-color: #ecd5ac; color: #6b4100; }
.send-btn { min-width: 44px; }
.composer-disabled {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  padding: 14px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.inbox-context { border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 13px; background: var(--surface); }
.ctx-block { border-bottom: 1px solid var(--line); padding-bottom: 13px; }
.ctx-block:last-child { border-bottom: 0; padding-bottom: 0; }
.ctx-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; margin-bottom: 6px; }
.ctx-patient { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.ctx-kv { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 3px 0; }
.ctx-kv span { color: var(--ink-3); }
.ctx-kv strong { font-weight: 600; color: var(--ink); text-align: right; }
.thread-back { display: none; }

/* ---------- Kanban ---------- */
.crm-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.crm-tools .search-box { max-width: 280px; }
.select-inline { width: auto; min-width: 150px; min-height: 38px; font-size: 13px; padding: 7px 30px 7px 10px; }
.kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: start; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 9px; min-width: 0; }
.kanban-head { display: flex; align-items: center; gap: 7px; padding: 2px 3px 9px; }
.kanban-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.kanban-title { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.kanban-count { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--ink-3); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; min-width: 21px; height: 19px; display: grid; place-items: center; padding: 0 5px; }
.opp-card {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px; margin-bottom: 7px;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.opp-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.opp-name { font-size: 13px; font-weight: 600; line-height: 1.35; }
.opp-service { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.35; }
.opp-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.opp-next { display: flex; align-items: flex-start; gap: 5px; font-size: 11px; color: var(--ink-2); margin-top: 8px; line-height: 1.35; }
.opp-next .od-icon { color: var(--ink-3); margin-top: 1px; }
.opp-next.late { color: var(--danger); }
.opp-next.late .od-icon { color: var(--danger); }
.opp-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); }
.opp-owner { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--ink-3); min-width: 0; }
.kanban-empty { font-size: 11.5px; color: var(--ink-3); text-align: center; padding: 14px 6px; border: 1px dashed var(--line-strong); border-radius: 8px; }

/* ---------- Agenda ---------- */
.agenda-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.date-nav { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.date-nav input { border: 0; min-height: 32px; width: 152px; font-size: 12.5px; padding: 5px 6px; background: transparent; }
.date-nav .icon-btn { width: 32px; height: 32px; }
.agenda-row td { vertical-align: top; }
.agenda-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.sync-line { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-3); margin-top: 10px; }
.sync-line .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin: 16px 0 18px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--ink-3);
  padding: 9px 11px; font-size: 13px; font-weight: 600;
  white-space: nowrap; margin-bottom: -1px; min-height: 40px;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--brand-700); border-bottom-color: var(--brand); }

/* ---------- Patient ---------- */
.patient-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.patient-head-main { flex: 1; min-width: 240px; }
.patient-head h1 { font-size: 24px; }
.patient-sub { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.patient-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.fact { min-width: 0; }
.fact span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; }
.fact strong { display: block; font-size: 13px; color: var(--ink); margin-top: 2px; font-weight: 600; line-height: 1.4; }
.timeline { position: relative; display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 11px; padding-bottom: 16px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-rail { width: 20px; flex: none; display: flex; flex-direction: column; align-items: center; }
.timeline-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); margin-top: 5px; flex: none; }
.timeline-line { width: 1px; flex: 1; background: var(--line); margin-top: 4px; }
.timeline-item:last-child .timeline-line { display: none; }
.timeline-main { flex: 1; min-width: 0; padding-bottom: 2px; }
.timeline-title { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.timeline-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; line-height: 1.4; }
.doc-row { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: 0; }
.doc-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.doc-main { flex: 1; min-width: 0; }
.doc-name { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 11px; color: var(--ink-3); }

/* ---------- Cadences ---------- */
.cadence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.cadence-card { padding: 15px; }
.cadence-top { display: flex; align-items: flex-start; gap: 10px; }
.cadence-top-main { flex: 1; min-width: 0; }
.cadence-name { font-family: var(--font-display); font-size: 14.5px; font-weight: 600; }
.cadence-trigger { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.switch {
  border: 1px solid var(--line-strong); background: var(--surface-3); color: var(--ink-2);
  min-height: 30px; padding: 0 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px; flex: none;
}
.switch::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.switch[aria-pressed="true"] { background: var(--success-soft); border-color: #bfe0cd; color: var(--success); }
.switch[aria-pressed="true"]::before { background: var(--success); }
.cadence-stats { display: flex; gap: 14px; margin-top: 10px; }
.cadence-stat span { display: block; font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.cadence-stat strong { display: block; font-size: 14px; margin-top: 1px; }
.steps { margin-top: 11px; border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.step { display: flex; gap: 9px; font-size: 12px; line-height: 1.45; }
.step-num {
  width: 19px; height: 19px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--surface-3);
  color: var(--ink-2); font-size: 10px; font-weight: 700;
}
.step strong { color: var(--ink); font-weight: 600; }
.step span { color: var(--ink-3); }
.cadence-foot { display: flex; align-items: center; gap: 8px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.stop-rule { font-size: 11px; color: var(--ink-3); line-height: 1.4; }
.stop-rule strong { color: var(--ink-2); }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; color: var(--ink-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.nps-gauge { display: flex; align-items: baseline; gap: 8px; }
.nps-gauge strong { font-family: var(--font-display); font-size: 40px; line-height: 1; }
.nps-gauge span { font-size: 12px; color: var(--ink-3); }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.form-section { display: flex; flex-direction: column; gap: 13px; }
.form-section + .form-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.section-title { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.section-title span { display: block; font-size: 11.5px; font-weight: 400; color: var(--ink-3); margin-top: 2px; }
.whats-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--surface-2); }
.whats-head { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.whats-icon { width: 38px; height: 38px; border-radius: 9px; background: var(--success-soft); color: var(--success); display: grid; place-items: center; flex: none; }
.whats-icon.off { background: var(--danger-soft); color: var(--danger); }
.whats-icon.warn { background: var(--warning-soft); color: var(--warning); }
.whats-meta { font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.whats-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.sim-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--line); }
.sim-item:first-of-type { border-top: 0; padding-top: 2px; }
.sim-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sim-text { font-size: 13px; color: var(--ink); line-height: 1.45; overflow-wrap: anywhere; }
.sim-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.sim-actions .btn { padding: 2px 7px; font-size: 11.5px; }
.kv-list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.kv-list .ctx-kv { border-bottom: 1px dashed var(--line); padding-bottom: 6px; font-size: 12px; }
.kv-list .ctx-kv:last-child { border-bottom: 0; padding-bottom: 0; }
.permission-row { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.45; }
.permission-row:last-child { border-bottom: 0; }
.permission-row strong { display: block; font-size: 12.5px; color: var(--ink); }
.permission-row span { color: var(--ink-3); }

/* ---------- DKP ---------- */
.dkp-card { padding: 16px; }
.dkp-head { display: flex; align-items: flex-start; gap: 10px; }
.dkp-progress { margin-top: 9px; }
.dkp-progress-row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-bottom: 4px; }
.dkp-list { display: flex; flex-direction: column; gap: 9px; }
.dkp-list-item { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; line-height: 1.45; }
.dkp-list-item .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; margin-top: 6px; }
.dkp-list-item strong { font-weight: 600; }
.dkp-list-item span { color: var(--ink-3); }
.priority-high { color: var(--danger); font-weight: 600; }
.priority-mid { color: var(--warning); font-weight: 600; }
.priority-low { color: var(--info); font-weight: 600; }

/* ---------- Dialogs ---------- */
.dlg {
  border: 0; padding: 0;
  width: min(600px, calc(100vw - 28px));
  max-height: calc(100dvh - 40px);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.dlg-sm { width: min(440px, calc(100vw - 28px)); }
.dlg-wide { width: min(760px, calc(100vw - 28px)); }
.dlg::backdrop { background: rgba(7, 15, 20, .55); backdrop-filter: blur(2px); }
.dlg[open] { animation: dlgIn .18s ease-out; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; }
.dlg-head > div:first-child { flex: 1; min-width: 0; }
.dlg-head h2 { font-size: 19px; }
.dlg-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.45; max-width: 56ch; }
.dlg-body { padding: 4px 20px 20px; overflow-y: auto; max-height: calc(100dvh - 170px); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.confirm-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; padding-top: 2px; }
.dlg .callout { margin-bottom: 13px; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  background: #10242c; color: #eef6f5;
  border: 1px solid #24414b;
  border-radius: 9px; padding: 10px 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12.5px; line-height: 1.45;
  animation: toastIn .2s ease-out;
}
.toast .od-icon { flex: none; margin-top: 1px; color: #8fd6c8; }
.toast-danger { background: #3a1616; border-color: #5c2626; }
.toast-danger .od-icon { color: #f0a3a3; }
.toast-warning { background: #3a2a12; border-color: #5c421f; }
.toast-warning .od-icon { color: #f2c27e; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */
body.logged-out .app,
body.logged-out .skip-link { display: none !important; }
body.logged-out { background: #0d1a21; }

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  background: var(--bg);
}
.login-brand {
  background:
    radial-gradient(1200px 680px at 12% -10%, rgba(86, 201, 183, .16), transparent 52%),
    linear-gradient(165deg, #0d1a21 0%, #132730 58%, #0d3d38 100%);
  color: #e8f3f1;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.login-brand-top { display: flex; align-items: center; gap: 12px; }
.login-logo {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: #12453f;
  border: 1px solid #1d5b54;
  border-radius: 12px;
  color: #8fd6c8;
}
.login-logo-name { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -.03em; color: #fff; }
.login-logo-sub { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #93a7b0; font-weight: 600; margin-top: 2px; }
.login-hero { margin-top: 56px; padding: 0 0 28px; max-width: 540px; }
.login-hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
  color: #fff;
  letter-spacing: -.03em;
}
.login-hero p { margin-top: 16px; font-size: 16px; line-height: 1.6; color: #c5d6d4; max-width: 48ch; }
.login-points { margin-top: 28px; display: grid; gap: 12px; }
.login-point { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; color: #d5e4e1; }
.login-point .od-icon { color: #7edccc; margin-top: 2px; }
.login-brand-foot { font-size: 12px; color: #7d939d; padding-top: 18px; border-top: 1px solid #223640; }

.login-panel {
  background: var(--surface);
  padding: 40px 42px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: auto;
}
.login-panel h2 { font-size: 24px; }
.login-panel .lede { margin: 6px 0 22px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-accounts { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.login-group { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); margin: 12px 0 4px; }
.login-account {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; text-align: left;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.login-account:hover { border-color: var(--line-strong); background: var(--surface-2); box-shadow: var(--shadow-sm); }
.login-account[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(13, 92, 85, .12); }
.login-account-body { flex: 1; min-width: 0; }
.login-account-name { display: block; font-size: 13.5px; font-weight: 600; }
.login-account-meta { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; line-height: 1.35; }
.login-hint { font-size: 12px; color: var(--ink-3); margin-top: 8px; line-height: 1.45; }
.login-mfa { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); margin-top: 10px; }

.home-queue { display: flex; flex-direction: column; }
.home-queue-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 11px 0; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: inherit;
}
.home-queue-item:last-child { border-bottom: 0; }
.home-queue-item:hover { color: var(--ink); }
.tenant-status-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

@media (max-width: 980px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-brand { min-height: auto; padding: 28px 24px 32px; }
  .login-hero { margin-top: 28px; padding: 8px 0 0; }
  .login-hero h1 { font-size: 28px; }
  .login-brand-foot { display: none; }
  .login-panel { min-height: auto; padding: 28px 22px 48px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1440px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1360px) {
  .inbox { grid-template-columns: 288px minmax(0, 1fr); }
  .inbox-context { display: none; }
  .kanban { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2-even { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .patient-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cadence-grid { grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: inline-grid; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 18px; }
  #main { padding: 20px 18px 56px; }
  .context-name { max-width: 180px; }
  .table-wrap { overflow-x: auto; }
}
@media (max-width: 900px) {
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .demo-chip { display: none; }
  .inbox { grid-template-columns: 1fr; height: calc(100dvh - 200px); }
  .inbox-list { border-right: 0; }
  .inbox.mobile-thread .inbox-list { display: none; }
  .inbox:not(.mobile-thread) .inbox-thread { display: none; }
  .thread-back { display: inline-flex; }
  .user-meta { display: none; }
  .user-chip { padding-left: 10px; }
  .rtable.wide thead { display: none; }
  .rtable.wide tr { display: block; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 9px; padding: 6px 12px; background: var(--surface); }
  .rtable.wide td { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; border: 0; padding: 5px 0; text-align: right; }
  .rtable.wide td::before { content: attr(data-label); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; text-align: left; padding-top: 2px; }
  .rtable.wide td:first-child { text-align: left; }
  .rtable.wide td.actions { justify-content: flex-end; padding-top: 8px; }
  .rtable.wide td.actions::before { display: none; }
}
@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 0 14px; }
  .context-icon { display: none; }
  .context-btn { padding: 5px 9px; }
  .context-name { max-width: 132px; font-size: 13px; }
  .context-kicker { font-size: 9.5px; }
  #main { padding: 16px 14px 52px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 23px; }
  .lede { font-size: 14px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 21px; }
  .kanban { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-facts { grid-template-columns: 1fr; }
  .inbox { height: calc(100dvh - 196px); min-height: 460px; border-radius: 12px; }
  .thread-head { padding: 10px 12px; }
  .thread-scroll { padding: 14px 12px 6px; }
  .bubble { max-width: 88%; }
  .access-banner { padding: 10px 14px; font-size: 12px; }
  .access-banner .btn { margin-left: 0; }
  .dlg-head { padding: 16px 16px 10px; }
  .dlg-body { padding: 2px 16px 16px; }
  .dlg-foot .btn { flex: 1 1 auto; }
  .toast-stack { right: 12px; bottom: 12px; }
  .tabs { margin: 12px 0 14px; }
  .agenda-actions { justify-content: flex-start; }
  .date-nav input { width: 128px; }
}
@media (max-width: 520px) {
  .top-actions { gap: 4px; }
  .user-chip { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px 13px; }
  .kpi-value { font-size: 20px; }
  .kpi-value small { font-size: 10.5px; }
  .kpi-meta { font-size: 11px; }
  .summary-strip { grid-template-columns: 1fr; }
  .filter-row { gap: 4px; }
  .thread-tools .assign-select { min-width: 128px; }
  .page-head h1 { font-size: 21px; }
  .funnel-row { grid-template-columns: 104px minmax(0, 1fr) 38px; gap: 8px; }
  .funnel-label { font-size: 11.5px; }
}

@media (max-width: 360px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Agenda: alternância lista / semana / mês ---------- */
.view-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); margin-left: auto; }
.view-toggle-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: transparent; border: 0; cursor: pointer; }
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--line); }
.view-toggle-btn:hover { background: var(--surface-2); }
.view-toggle-btn[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); }
.view-toggle-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.cal-scroll { overflow-x: auto; margin: 0 -2px; padding-bottom: 4px; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 8px; min-width: 860px; }
.cal-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); min-height: 260px; display: flex; flex-direction: column; }
.cal-col.is-today { border-color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.cal-day-head { display: flex; align-items: baseline; gap: 6px; padding: 9px 10px; border: 0; border-bottom: 1px solid var(--line); background: transparent; font: inherit; cursor: pointer; text-align: left; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.cal-day-head:hover { background: var(--surface-3); }
.cal-day-head span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.cal-day-head strong { font-size: 17px; color: var(--ink); }
.cal-day-head em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--ink-3); }
.cal-col-body { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.cal-empty { margin: 6px 2px; font-size: 12px; color: var(--ink-3); }
.cal-item { display: grid; gap: 1px; text-align: left; padding: 7px 8px; border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: 6px; background: var(--surface); font: inherit; cursor: pointer; }
.cal-item:hover { border-color: var(--line-strong); box-shadow: 0 1px 3px rgba(14, 26, 34, .08); }
.cal-time { font-size: 11.5px; font-weight: 700; color: var(--ink); }
.cal-name { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-meta { font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 0 4px 2px; }
.cal-cell { min-height: 108px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell.is-out { background: transparent; opacity: .55; }
.cal-cell.is-today { border-color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.cal-cell-head { display: flex; align-items: center; justify-content: space-between; border: 0; background: transparent; font: inherit; cursor: pointer; padding: 2px 3px; border-radius: 4px; }
.cal-cell-head:hover { background: var(--surface-3); }
.cal-cell-head strong { font-size: 13px; color: var(--ink); }
.cal-cell-head em { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--brand-ink); background: var(--brand-soft); border-radius: 999px; padding: 1px 6px; }
.cal-chip { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--info); background: var(--surface); border-radius: 4px; padding: 2px 5px; font: inherit; font-size: 11px; color: var(--ink); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip:hover { background: var(--surface-3); }
.cal-more { border: 0; background: transparent; font: inherit; font-size: 11px; font-weight: 600; color: var(--brand); text-align: left; padding: 1px 5px; cursor: pointer; }

.cal-agendado { border-left-color: var(--info) !important; }
.cal-confirmado { border-left-color: var(--brand) !important; }
.cal-realizado { border-left-color: var(--success) !important; }
.cal-faltou { border-left-color: var(--danger) !important; }
.cal-cancelado { border-left-color: var(--line-strong) !important; color: var(--ink-3); }
.cal-cancelado .cal-name, .cal-chip.cal-cancelado { text-decoration: line-through; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-swatch { width: 10px; height: 10px; border-radius: 3px; border-left: 3px solid; display: inline-block; background: var(--surface-3); }
.cal-legend-hint { color: var(--ink-3); }
.cal-item:focus-visible, .cal-chip:focus-visible, .cal-day-head:focus-visible, .cal-cell-head:focus-visible, .cal-more:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

@media (max-width: 720px) {
  .view-toggle { margin-left: 0; }
  .cal-month { gap: 3px; }
  .cal-cell { min-height: 64px; padding: 3px; }
  .cal-chip, .cal-more { display: none; }
  .cal-dow { font-size: 10px; padding: 0 1px; letter-spacing: 0; }
}

/* ---------- Funil: arrastar e soltar ---------- */
#crmBoard .opp-card { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#crmBoard .opp-card.is-pressing { transform: scale(.98); box-shadow: var(--shadow-md); transition: transform .2s; }
.kanban-col { transition: background .15s, border-color .15s, box-shadow .15s; }
.kanban.is-dragging .kanban-col { border-style: dashed; }
.kanban-col.is-over { background: var(--brand-soft); border: 1px solid var(--brand); box-shadow: 0 0 0 3px rgba(13, 92, 85, .12); }
.opp-card.is-drag-source { opacity: .3; box-shadow: none; transform: none; }
.opp-ghost {
  position: fixed; left: 0; top: 0; z-index: 2000; margin: 0; pointer-events: none;
  box-shadow: var(--shadow-lg); border-color: var(--brand); cursor: grabbing; opacity: .96;
  transition: none;
}
.drop-marker {
  display: grid; place-items: center; margin: 0 0 8px; border: 2px dashed var(--brand); border-radius: 9px;
  background: repeating-linear-gradient(45deg, rgba(13, 92, 85, .06) 0 8px, rgba(13, 92, 85, .11) 8px 16px);
  animation: drop-pulse 1.1s ease-in-out infinite;
}
.drop-marker span { font-size: 11.5px; font-weight: 700; color: var(--brand-ink); background: var(--surface); border-radius: 999px; padding: 3px 10px; box-shadow: var(--shadow-sm); }
.drop-marker.needs-step { border-color: #b7791f; background: repeating-linear-gradient(45deg, rgba(183, 121, 31, .07) 0 8px, rgba(183, 121, 31, .13) 8px 16px); }
.drop-marker.needs-step span::after { content: ' · abre o agendamento'; font-weight: 500; }
@keyframes drop-pulse { 50% { border-color: rgba(13, 92, 85, .45); } }
.lost-zone {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 1990;
  display: flex; align-items: center; gap: 9px; padding: 13px 22px; border-radius: 12px;
  border: 2px dashed var(--danger); background: var(--danger-soft); color: var(--danger);
  font-size: 13px; box-shadow: var(--shadow-md); transition: transform .15s, background .15s;
}
.lost-zone.is-over { background: var(--danger); color: #fff; transform: translateX(-50%) scale(1.05); }
.opp-card.just-dropped { animation: dropped .7s ease-out; }
@keyframes dropped { 0% { box-shadow: 0 0 0 4px rgba(13, 92, 85, .35); } 100% { box-shadow: 0 0 0 0 rgba(13, 92, 85, 0); } }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }
@media (prefers-reduced-motion: reduce) {
  .drop-marker, .opp-card.just-dropped { animation: none; }
}
.toast-stack { pointer-events: none; }
#crmBoard .opp-card > .opp-name, #crmBoard .opp-card > .opp-service, #crmBoard .opp-card > .opp-next { display: block; }
#crmBoard .opp-card > .opp-next { display: flex; }
#crmBoard .opp-card > .opp-foot { display: flex; }
