:root {
  --page: #eef3f8;
  --page-deep: #e6edf5;
  --surface: rgb(255 255 255 / 58%);
  --surface-solid: #ffffff;
  --surface-blue: rgb(237 246 255 / 62%);
  --ink: #172131;
  --ink-soft: #344155;
  --muted: #667286;
  --muted-light: #8b96a8;
  --brand: #087cf0;
  --brand-deep: #0666c7;
  --signal: #34c7d2;
  --signal-soft: rgb(220 249 251 / 72%);
  --border: rgb(255 255 255 / 66%);
  --border-strong: rgb(75 98 127 / 16%);
  --positive: #29a875;
  --positive-soft: rgb(226 248 239 / 72%);
  --warning: #e49a38;
  --warning-soft: rgb(255 243 221 / 76%);
  --danger: #e05461;
  --danger-soft: rgb(255 229 233 / 76%);
  --shadow: 0 28px 80px rgb(54 75 105 / 16%), 0 2px 10px rgb(54 75 105 / 7%);
  --shadow-soft: 0 14px 38px rgb(54 75 105 / 9%), inset 0 1px 0 rgb(255 255 255 / 70%);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 11px;
  /* Accessible UI type scale: 12 / 14 / 16 / 18 / 20 / 24 / 32 / 40 px. */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-display: 2.5rem;
  color: var(--ink);
  font-family: Inter, "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-synthesis: none;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 8%, rgb(104 181 255 / 26%), transparent 30%),
    radial-gradient(circle at 88% 2%, rgb(117 229 220 / 22%), transparent 29%),
    radial-gradient(circle at 76% 94%, rgb(171 146 255 / 13%), transparent 32%),
    linear-gradient(145deg, #f8fbff 0%, var(--page) 48%, #edf2f9 100%);
  background-attachment: fixed;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(0 200 205 / 28%);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-weight: 650;
  letter-spacing: -0.025em;
}

h1 {
  margin-bottom: 2px;
  font-size: clamp(var(--text-2xl), 2vw, var(--text-3xl));
}

h2 {
  margin-bottom: 0;
  font-size: clamp(var(--text-xl), 1.6vw, var(--text-2xl));
}

h3 {
  margin-bottom: 0;
  font-size: var(--text-lg);
}

.muted,
.meta,
.empty-state {
  color: var(--muted);
}

.eyebrow,
.section-kicker,
.nav-label {
  margin-bottom: 5px;
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: 760;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.button,
.filter-button,
.nav-item,
.icon-button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 650;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled,
.filter-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.button-primary {
  padding: 0 18px;
  background: linear-gradient(135deg, var(--brand), #0878dc);
  box-shadow: 0 9px 22px rgb(3 94 207 / 20%);
  color: white;
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--brand-deep), var(--brand));
}

.button-secondary {
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--brand);
}

.button-ghost {
  padding: 0 13px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-soft);
}

.button-ghost:hover:not(:disabled),
.button-secondary:hover:not(:disabled) {
  border-color: var(--brand);
  background: var(--surface-blue);
}

.button-full {
  width: 100%;
}

.icon-button {
  width: 42px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}

.surface,
.glass-card {
  border: 1px solid rgb(255 255 255 / 72%);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.surface {
  border-radius: var(--radius-lg);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-light);
  box-shadow: 0 0 0 4px rgb(140 160 185 / 12%);
}

.status-dot.is-positive {
  background: var(--positive);
  box-shadow: 0 0 0 4px rgb(31 168 121 / 12%);
}

.status-dot.is-warning,
.connection-status.is-reconnecting .status-dot {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgb(225 149 50 / 12%);
}

/* Login */
.login-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 28px;
}

.ambient {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.ambient-one {
  top: -14vw;
  right: -9vw;
  width: 46vw;
  height: 46vw;
  background: radial-gradient(circle, rgb(0 200 205 / 19%), rgb(0 200 205 / 0%) 68%);
}

.ambient-two {
  bottom: -18vw;
  left: -10vw;
  width: 52vw;
  height: 52vw;
  background: radial-gradient(circle, rgb(3 94 207 / 16%), rgb(3 94 207 / 0%) 68%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 450px);
  padding: 36px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--brand);
  font-family: Comfortaa, ui-rounded, "SF Pro Rounded", sans-serif;
  font-size: var(--text-lg);
  font-weight: 750;
  letter-spacing: -0.04em;
}

.brand img {
  width: 32px;
  height: 32px;
}

.brand > span > span {
  color: var(--signal);
}

.brand-login {
  margin-bottom: 42px;
  font-size: var(--text-xl);
}

.brand-login img {
  width: 38px;
  height: 38px;
}

.login-copy h1 {
  margin-bottom: 28px;
  font-size: var(--text-3xl);
}

.login-card form {
  display: grid;
  gap: 11px;
}

label {
  color: var(--ink-soft);
  font-size: var(--text-base);
  font-weight: 650;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgb(255 255 255 / 72%);
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input::placeholder {
  color: var(--muted-light);
}

input:hover,
input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgb(3 94 207 / 7%);
}

.login-card .button-primary {
  margin-top: 5px;
}

.form-error {
  margin: 3px 0 0;
  color: var(--danger);
  font-size: var(--text-sm);
}


/* Application shell */
.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 24px 18px 18px;
  border-right: 1px solid rgb(3 94 207 / 9%);
  background: rgb(247 251 255 / 78%);
  box-shadow: 8px 0 35px rgb(38 78 125 / 4%);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.sidebar-brand {
  padding: 2px 7px 22px;
}

.practice-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 68%);
}

.practice-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--signal));
  color: white;
  font-weight: 760;
}

.practice-avatar {
  width: 36px;
  height: 36px;
  font-size: var(--text-sm);
}

.practice-card div {
  min-width: 0;
}

.practice-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.practice-card strong {
  font-size: var(--text-sm);
}

.main-nav {
  min-height: 0;
  overflow-y: auto;
}

.nav-item {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 44px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  padding: 0 11px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item + .nav-item {
  margin-top: 4px;
}

.nav-item::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -18px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  content: "";
}

.nav-item:hover,
.nav-item.is-active {
  background: rgb(3 94 207 / 7%);
  color: var(--brand);
}

.nav-item.is-active::before {
  background: var(--signal);
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  font-size: var(--text-base);
}

.nav-count,
.count-pill,
.soft-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
}

.nav-count {
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  background: var(--signal-soft);
  color: var(--brand);
  font-size: var(--text-xs);
}

.sidebar-footer {
  display: grid;
  gap: 11px;
  margin-top: auto;
  padding-top: 18px;
}

.handoff-test-button {
  gap: 8px;
  border: 1px solid rgb(0 200 205 / 24%);
  background: var(--signal-soft);
  color: var(--brand);
}

.handoff-test-button:hover {
  border-color: rgb(0 200 205 / 42%);
  background: #ddf8fa;
}

.handoff-test-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 4px rgb(0 200 205 / 12%);
}

.sync-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
}

.sync-note strong,
.sync-note small {
  display: block;
}

.sync-note strong {
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.sync-note small {
  color: var(--muted);
  font-size: var(--text-sm);
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 80px;
  align-items: center;
  gap: 16px;
  padding: 13px clamp(20px, 3vw, 42px);
  border-bottom: 1px solid rgb(3 94 207 / 8%);
  background: rgb(243 248 253 / 78%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.topbar-title {
  min-width: 0;
}

.topbar-title h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.connection-status,
.date-chip {
  display: inline-flex;
  min-height: 35px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgb(255 255 255 / 60%);
  color: var(--muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.menu-button {
  display: none;
}

.workspace-content {
  width: min(100%, 1580px);
  margin: 0 auto;
  padding: 30px clamp(20px, 3vw, 42px) 54px;
}

.view {
  animation: view-in 260ms ease both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.count-pill,
.soft-badge {
  min-height: 30px;
  padding: 0 11px;
  background: var(--signal-soft);
  color: var(--brand);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.section-header {
  min-height: 72px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}

.section-header-compact {
  min-height: 66px;
}

.section-header h2,
.section-header p {
  margin-bottom: 0;
}

/* Overview */
.metric-icon,
.setting-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  background: var(--surface-blue);
  color: var(--brand);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgb(255 255 255 / 78%);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.metric-card::after {
  position: absolute;
  right: -25px;
  bottom: -34px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: rgb(3 94 207 / 5%);
  content: "";
}

.metric-card.is-primary {
  background: linear-gradient(145deg, var(--brand) 0%, #087bd5 75%, var(--signal) 150%);
  color: white;
}

.metric-card.is-primary::after {
  background: rgb(255 255 255 / 10%);
}

.metric-card-label {
  display: flex;
  min-height: 34px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.3;
}

.metric-card.is-primary .metric-card-label,
.metric-card.is-primary small {
  color: rgb(255 255 255 / 72%);
}

.metric-card strong {
  display: block;
  margin: 9px 0 0;
  color: var(--ink);
  font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl));
  font-weight: 680;
  letter-spacing: -0.06em;
  line-height: 1;
}

.metric-card.is-primary strong {
  color: white;
}

.metric-card small {
  color: var(--muted-light);
  font-size: var(--text-sm);
}

.metric-icon {
  width: 28px;
  height: 28px;
  font-size: var(--text-sm);
}

.metric-card.is-primary .metric-icon {
  background: rgb(255 255 255 / 14%);
  color: white;
}

.live-calls-panel {
  margin-bottom: 16px;
  overflow: hidden;
}

.live-calls-header {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}

.live-calls-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-calls-title h2 {
  font-size: var(--text-lg);
}

.live-pulse {
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface-solid);
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 4px var(--positive-soft);
}

.count-pill.is-live {
  background: var(--positive-soft);
  color: var(--positive);
}

.live-calls-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.live-call-item {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
}

.live-call-item + .live-call-item {
  border-left: 1px solid var(--border);
}

.live-call-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.live-call-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--signal));
  color: white;
  font-size: var(--text-sm);
  font-weight: 760;
}

.live-call-identity div,
.live-call-context {
  min-width: 0;
}

.live-call-identity strong,
.live-call-identity span,
.live-call-context strong,
.live-call-context span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-call-identity span,
.live-call-context span {
  color: var(--muted);
  font-size: var(--text-sm);
}

.live-call-context {
  text-align: right;
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(310px, 0.72fr);
  gap: 16px;
  align-items: stretch;
}

.attention-panel {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.attention-list,
.cases-list {
  display: grid;
}

.attention-item,
.case-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}

.attention-item:last-child,
.case-row:last-child {
  border-bottom: 0;
}

.attention-copy,
.case-copy {
  min-width: 0;
}

.attention-meta,
.case-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.priority-label,
.case-status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  font-weight: 680;
}

.priority-label {
  gap: 6px;
  color: var(--muted);
}

.priority-label::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--signal);
  content: "";
}

.priority-label.is-urgent { color: var(--danger); }
.priority-label.is-urgent::before { background: var(--danger); }
.priority-label.is-high { color: #98601b; }
.priority-label.is-high::before { background: var(--warning); }

.case-status {
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-blue);
  color: var(--ink-soft);
}

.case-date {
  color: var(--muted-light);
}

.attention-copy strong,
.case-copy strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--text-base);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-copy p,
.case-copy p {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--text-sm);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.attention-actions,
.case-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.attention-actions .button,
.case-actions .button {
  min-height: 34px;
  padding: 0 10px;
  font-size: var(--text-sm);
}

.overview-aside {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
}

.chart-card {
  overflow: hidden;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
}

.weekly-chart {
  display: grid;
  height: 195px;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 8px;
  padding: 22px 18px 17px;
}

.week-column {
  display: grid;
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.week-bars {
  display: flex;
  height: 100%;
  align-items: end;
  justify-content: center;
  gap: 3px;
}

.week-bar {
  width: min(11px, 45%);
  min-height: 5px;
  border-radius: 7px 7px 3px 3px;
  background: rgb(3 94 207 / 18%);
}

.week-bar.is-automated {
  background: linear-gradient(to top, var(--signal), #5ddfe1);
}

.week-column small {
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: center;
}

.relief-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 21px;
  background:
    radial-gradient(circle at 85% 15%, rgb(52 199 210 / 15%), transparent 42%),
    linear-gradient(145deg, rgb(255 255 255 / 76%), rgb(232 244 255 / 58%));
  color: var(--ink);
}

.relief-card .section-kicker {
  color: var(--brand-deep);
}

.relief-copy { min-width: 0; }

.relief-orb {
  display: grid;
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
  place-content: center;
  border: 1px solid rgb(255 255 255 / 54%);
  border-radius: 50%;
  background: linear-gradient(145deg, #0764c2, #087786);
  box-shadow: 0 12px 28px rgb(8 124 240 / 20%), inset 0 1px 0 rgb(255 255 255 / 34%);
  color: white;
  text-align: center;
}

.relief-orb span {
  font-size: var(--text-2xl);
  font-weight: 720;
  letter-spacing: -0.06em;
  line-height: 1;
}

.relief-orb small {
  color: white;
  font-size: var(--text-sm);
}

.empty-state {
  display: grid;
  min-height: 190px;
  place-items: center;
  padding: 25px;
  text-align: center;
}

/* Cases */
.cases-panel {
  overflow: hidden;
}

.cases-toolbar {
  justify-content: flex-start;
  overflow-x: auto;
}

.filter-switch {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--page);
}

.filter-button {
  min-height: 34px;
  padding: 0 11px;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.filter-button:hover,
.filter-button.is-active {
  background: var(--surface-solid);
  box-shadow: 0 2px 8px rgb(3 94 207 / 8%);
  color: var(--brand);
}

.case-row {
  min-height: 112px;
  grid-template-columns: minmax(320px, 1fr) 230px 430px;
  column-gap: 20px;
}

.case-person {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 2px;
  padding-left: 18px;
  border-left: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.case-person strong,
.case-person span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-person span {
  color: var(--muted);
  font-size: var(--text-sm);
}

.case-row .case-actions {
  min-width: 0;
  align-self: center;
}

.case-status.status-in_progress { background: #eef1ff; color: #5864c6; }
.case-status.status-waiting_patient,
.case-status.status-waiting_practice { background: var(--warning-soft); color: #a66a1f; }
.case-status.status-done { background: var(--positive-soft); color: var(--positive); }

/* Calls */
.calls-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(520px, 1.28fr);
  gap: 16px;
  align-items: start;
}

.calls-list-panel,
.call-detail {
  min-height: 620px;
  overflow: hidden;
}

.calls-list-panel {
  position: sticky;
  top: 96px;
}

.calls-toolbar {
  align-items: stretch;
  flex-direction: column;
  gap: 10px;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field span {
  position: absolute;
  left: 12px;
  z-index: 1;
  color: var(--muted);
}

.search-field input {
  min-height: 40px;
  padding-left: 34px;
  background: var(--surface-solid);
}

.calls-list {
  max-height: calc(100vh - 240px);
  overflow-y: auto;
}

.call-row {
  display: grid;
  width: 100%;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: start;
  gap: 11px;
  padding: 14px 17px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.call-row:last-child {
  border-bottom: 0;
}

.call-row:hover,
.call-row.is-selected {
  background: var(--surface-blue);
}

.call-row.is-selected {
  box-shadow: inset 3px 0 var(--signal);
}

.call-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #ddecfb, #eef8ff);
  color: var(--brand);
  font-size: var(--text-base);
  font-weight: 760;
}

.call-row-copy {
  min-width: 0;
}

.call-row-title,
.call-row-outcome {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-row-title {
  font-size: var(--text-base);
  font-weight: 680;
}

.call-row-outcome {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.call-row-time {
  color: var(--muted-light);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.call-detail {
  padding: 23px;
}

@media (min-width: 1041px) {
  body.is-calls-view {
    height: 100vh;
    overflow: hidden;
  }

  body.is-calls-view .app-shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  body.is-calls-view .workspace {
    display: grid;
    height: 100vh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  body.is-calls-view .topbar {
    position: static;
  }

  body.is-calls-view .workspace-content,
  body.is-calls-view #callsView,
  body.is-calls-view .calls-layout {
    height: 100%;
    min-height: 0;
  }

  body.is-calls-view .workspace-content {
    overflow: hidden;
    padding-top: 24px;
    padding-bottom: 24px;
  }

  body.is-calls-view .calls-layout {
    align-items: stretch;
  }

  body.is-calls-view .calls-list-panel {
    position: static;
    display: grid;
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }

  body.is-calls-view .calls-list,
  body.is-calls-view .call-detail {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  body.is-calls-view .calls-list {
    max-height: none;
  }

  body.is-calls-view .call-detail {
    height: 100%;
  }
}

.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.detail-person {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.detail-person .call-avatar {
  width: 48px;
  height: 48px;
}

.detail-heading h2 {
  margin-bottom: 3px;
}

.detail-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.status-label {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--signal-soft);
  color: var(--brand);
  font-size: var(--text-sm);
  font-weight: 700;
}

.summary-card {
  margin-top: 19px;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-blue);
}

.summary-card p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.fact {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgb(255 255 255 / 56%);
}

.fact dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.fact dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 650;
}

.detail-section {
  margin-top: 24px;
}

.detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.related-list,
.timeline-list,
.message-list {
  display: grid;
  gap: 9px;
}

.related-item,
.timeline-item {
  position: relative;
  padding: 11px 13px 11px 18px;
  border-left: 2px solid var(--signal);
}

.related-item strong,
.timeline-item strong {
  display: block;
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.related-item p,
.timeline-item p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.timeline-time {
  color: var(--muted-light);
  font-size: var(--text-sm);
}

.message-list {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f6f9fd;
}

.message {
  max-width: 84%;
  justify-self: end;
}

.message.is-agent {
  justify-self: start;
}

.message-meta {
  margin: 0 4px 3px;
  color: var(--muted-light);
  font-size: var(--text-sm);
}

.message p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px 12px 4px 12px;
  background: var(--brand);
  color: white;
  font-size: var(--text-base);
  line-height: 1.55;
}

.message.is-agent p {
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px;
  background: var(--surface-solid);
  color: var(--ink-soft);
}

.transcript-empty {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f6f9fd;
}

.phone-link {
  color: var(--brand);
  text-decoration: none;
}

.phone-link:hover {
  text-decoration: underline;
}

/* Analytics and settings */
.analytics-layout,
.settings-grid,
.integration-grid,
.admin-layout {
  display: grid;
  gap: 16px;
}

.analytics-layout {
  grid-template-columns: 1.4fr 0.8fr;
}

.analytics-card,
.usage-card,
.setting-card,
.admin-card {
  overflow: hidden;
}

.analytics-bars {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.analytics-bar-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.analytics-bar-track,
.usage-track {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: rgb(3 94 207 / 8%);
}

.analytics-bar-track span,
.usage-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(to right, var(--brand), var(--signal));
}

.intent-list {
  display: grid;
  padding: 10px 20px 20px;
}

.intent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.intent-row:last-child { border-bottom: 0; }
.intent-row strong { color: var(--brand); }

.usage-card {
  grid-column: 1 / -1;
  padding: 22px;
  background:
    radial-gradient(circle at 92% 10%, rgb(0 200 205 / 18%), transparent 38%),
    var(--surface);
}

.usage-card > div:first-of-type strong {
  color: var(--brand);
  font-size: var(--text-display);
  letter-spacing: -0.06em;
}

.usage-card > div:first-of-type span {
  color: var(--muted);
}

.usage-card p {
  margin: 4px 0 13px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setting-card,
.admin-card {
  padding: 22px;
}

.setting-icon {
  width: 39px;
  height: 39px;
  margin-bottom: 20px;
}

.setting-card h3,
.admin-card h3 {
  margin-bottom: 8px;
  font-size: var(--text-xl);
}

.setting-card > p:not(.section-kicker),
.admin-card > p:not(.section-kicker) {
  color: var(--muted);
  font-size: var(--text-sm);
}

.settings-list {
  display: grid;
  gap: 0;
  margin: 12px 0 0;
}

.settings-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.settings-list dt {
  color: var(--muted);
  font-size: var(--text-sm);
}

.settings-list dd {
  margin: 0;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 670;
  text-align: right;
}

.workflow-card {
  grid-column: 1 / -1;
  background:
    radial-gradient(circle at 90% 20%, rgb(0 200 205 / 16%), transparent 36%),
    linear-gradient(145deg, rgb(3 94 207 / 96%), #0a6ec4);
}

.workflow-card h3,
.workflow-card p,
.workflow-card .section-kicker {
  color: white;
}

.workflow-card > p:last-child {
  color: rgb(255 255 255 / 67%);
}

.workflow-steps {
  display: flex;
  align-items: center;
  margin: 23px 0;
}

.workflow-steps > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 50%;
  color: rgb(255 255 255 / 70%);
  font-size: var(--text-sm);
}

.workflow-steps > span.is-current {
  border-color: var(--signal);
  background: var(--signal);
  color: var(--brand-deep);
}

.workflow-steps > span span {
  position: absolute;
  margin-top: 62px;
  color: rgb(255 255 255 / 62%);
  font-size: var(--text-sm);
}

.workflow-steps i {
  height: 1px;
  flex: 1;
  background: rgb(255 255 255 / 20%);
}

.integration-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.integration-card {
  padding: 20px;
}

.integration-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
}

.integration-logo {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-blue);
  color: var(--brand);
  font-weight: 760;
}

.integration-card h3 {
  margin-bottom: 5px;
}

.integration-card p {
  min-height: 44px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.integration-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--positive);
  font-size: var(--text-base);
  font-weight: 680;
}

.integration-status.is-test { color: var(--warning); }
.integration-status.is-missing { color: var(--danger); }

.integration-note {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-top: 16px;
  padding: 16px 18px;
}

.integration-note-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--signal-soft);
  color: var(--brand);
  font-weight: 760;
}

.integration-note p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.admin-layout {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.privacy-note {
  margin-top: 15px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-blue);
}

.role-list {
  display: grid;
  margin: 11px 0 14px;
}

.role-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-base);
}

.role-list span,
.admin-card small {
  color: var(--muted);
}

.tariff-card {
  background:
    radial-gradient(circle at 88% 12%, rgb(0 200 205 / 18%), transparent 40%),
    linear-gradient(145deg, var(--brand), #0a6ec4);
}

.tariff-card h3,
.tariff-card p,
.tariff-card .section-kicker {
  color: white;
}

.tariff-number {
  margin: 22px 0 14px;
}

.tariff-number strong,
.tariff-number span {
  display: block;
}

.tariff-number strong {
  color: white;
  font-size: var(--text-display);
  letter-spacing: -0.07em;
  line-height: 1;
}

.tariff-number span,
.tariff-card p {
  color: rgb(255 255 255 / 68%);
  font-size: var(--text-sm);
}

.tariff-card .soft-badge {
  background: rgb(255 255 255 / 12%);
  color: white;
}

.coming-soon-card {
  display: grid;
  width: min(100%, 820px);
  justify-items: center;
  margin: 36px auto 0;
  padding: clamp(34px, 6vw, 72px);
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgb(0 200 205 / 17%), transparent 42%),
    var(--surface);
}

.coming-soon-icon {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid rgb(0 200 205 / 34%);
  border-radius: 20px;
  background: linear-gradient(145deg, var(--signal-soft), white);
  box-shadow: 0 14px 32px rgb(0 200 205 / 13%);
  color: var(--brand);
  font-size: var(--text-2xl);
  font-weight: 760;
}

.coming-soon-card h2 {
  margin: 18px 0 8px;
  font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl));
}

.coming-soon-card > p {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: var(--text-base);
}

.notice {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100% - 48px));
  margin: 0;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

body.has-handoff-modal {
  overflow: hidden;
}

.handoff-overlay {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.handoff-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgb(11 38 73 / 36%);
  backdrop-filter: blur(5px);
}

.handoff-dialog {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border: 1px solid rgb(255 255 255 / 75%);
  border-radius: var(--radius-xl);
  background: var(--surface-solid);
  box-shadow: 0 30px 90px rgb(14 51 94 / 25%);
  animation: handoff-dialog-in 180ms ease-out;
}

@keyframes handoff-dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.handoff-dialog-header {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.handoff-dialog-header h2 {
  margin-bottom: 0;
}

.handoff-dialog-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--brand), #0b7ed5);
  box-shadow: 0 10px 25px rgb(3 94 207 / 20%);
  color: white;
  font-size: var(--text-xl);
}

.handoff-close {
  width: 36px;
  height: 36px;
  color: var(--muted);
  font-size: var(--text-xl);
}

.handoff-patient {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 18px 22px 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-blue);
}

.handoff-patient-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--signal));
  color: white;
  font-weight: 760;
}

.handoff-patient > div {
  min-width: 0;
}

.handoff-patient > div strong,
.handoff-patient > div span {
  display: block;
}

.handoff-patient > div span {
  color: var(--muted);
  font-size: var(--text-sm);
}

.handoff-patient > div strong {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--text-lg);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.handoff-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 22px 12px;
}

.handoff-facts div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.handoff-facts dt {
  color: var(--muted);
  font-size: var(--text-xs);
}

.handoff-facts dd {
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.handoff-concern-card {
  margin: 0 22px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  background: var(--signal-soft);
}

.handoff-concern-card > span,
.handoff-concern-card small {
  color: var(--muted);
  font-size: var(--text-xs);
}

.handoff-concern-card p {
  margin: 3px 0 5px;
  color: var(--ink);
  font-weight: 650;
}

.handoff-concern-card small:empty {
  display: none;
}

.handoff-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 18px 22px 22px;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1260px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .integration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tariff-card { grid-column: 1 / -1; }
}

@media (max-width: 1450px) and (min-width: 1041px) {
  .case-row {
    grid-template-columns: minmax(300px, 1fr) 220px;
    row-gap: 12px;
  }

  .case-row .case-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 218px minmax(0, 1fr); }
  .overview-layout { grid-template-columns: 1fr; }
  .overview-aside {
    grid-template-rows: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .attention-panel { height: auto; }
  .calls-layout { grid-template-columns: 1fr; }
  .calls-list-panel { position: static; min-height: 0; }
  .calls-list { max-height: 430px; }
  .case-row { grid-template-columns: minmax(220px, 1fr) auto; }
  .case-person { display: none; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    width: min(288px, calc(100vw - 46px));
    transform: translateX(-105%);
    transition: transform 200ms ease;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: block;
    width: 100%;
    border: 0;
    background: rgb(12 39 74 / 34%);
    backdrop-filter: blur(3px);
  }
  .menu-button { display: inline-grid; place-items: center; }
  .connection-status { display: none; }
  .overview-aside,
  .analytics-layout,
  .settings-grid,
  .admin-layout { grid-template-columns: 1fr; }
  .workflow-card,
  .usage-card,
  .tariff-card { grid-column: auto; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .topbar { min-height: 70px; padding: 10px 14px; }
  .topbar-title .eyebrow,
  .date-chip { display: none; }
  .workspace-content { padding: 22px 13px 42px; }
  .metric-grid,
  .overview-aside,
  .integration-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { padding: 14px; }
  .attention-item,
  .case-row { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .attention-actions,
  .case-actions { grid-column: 1; justify-content: flex-start; }
  .attention-actions .button,
  .case-actions .button { flex: 1; }
  .calls-list-panel,
  .call-detail { min-height: 0; }
  .call-detail { padding: 17px; }
  .detail-heading { align-items: flex-start; flex-direction: column; }
  .facts { grid-template-columns: 1fr; }
  .message { max-width: 94%; }
  .relief-card { align-items: flex-start; flex-direction: column; }
  .live-calls-list { grid-template-columns: 1fr; }
  .live-call-item { grid-template-columns: minmax(0, 1fr) auto; }
  .live-call-context { grid-column: 1; text-align: left; }
  .live-call-item .button { grid-column: 2; grid-row: 1 / span 2; }
  .handoff-overlay { padding: 10px; }
  .handoff-dialog { max-height: calc(100vh - 20px); border-radius: var(--radius-lg); }
  .handoff-dialog-header { grid-template-columns: 40px minmax(0, 1fr) 34px; padding: 17px; }
  .handoff-dialog-icon { width: 40px; height: 40px; }
  .handoff-patient { margin: 15px 17px 10px; }
  .handoff-facts { grid-template-columns: 1fr; margin: 0 17px 10px; }
  .handoff-concern-card { margin: 0 17px; }
  .handoff-dialog-actions { padding: 16px 17px 17px; }
  .handoff-dialog-actions .button { flex: 1; }
  .login-card { padding: 29px 23px; }
  .notice { right: 12px; bottom: 12px; max-width: calc(100% - 24px); }
}

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

/* Calm glass workspace */
.surface,
.glass-card,
.metric-card {
  border: 1px solid rgb(255 255 255 / 70%);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 68%), rgb(255 255 255 / 42%));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(28px) saturate(145%);
  -webkit-backdrop-filter: blur(28px) saturate(145%);
}

.surface {
  border-radius: var(--radius-lg);
}

.surface.relief-card {
  border-color: rgb(255 255 255 / 78%);
  background:
    radial-gradient(circle at 85% 15%, rgb(52 199 210 / 16%), transparent 44%),
    linear-gradient(145deg, rgb(255 255 255 / 78%), rgb(230 243 255 / 60%));
}

.button,
.filter-button,
.nav-item,
.icon-button,
input {
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease, transform 180ms ease;
}

.button-primary {
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 12px;
  background: linear-gradient(180deg, #1590ff, #0877e6);
  box-shadow: 0 8px 22px rgb(8 124 240 / 20%), inset 0 1px 0 rgb(255 255 255 / 28%);
}

.button-secondary,
.button-ghost,
.icon-button {
  border-color: rgb(73 96 125 / 13%);
  background: rgb(255 255 255 / 48%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 70%);
}

.button-ghost:hover:not(:disabled),
.button-secondary:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  border-color: rgb(8 124 240 / 22%);
  background: rgb(255 255 255 / 78%);
}

.app-shell {
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  top: 14px;
  height: calc(100vh - 28px);
  margin: 14px 0 14px 14px;
  padding: 20px 14px 14px;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 28px;
  background: linear-gradient(155deg, rgb(255 255 255 / 66%), rgb(246 251 255 / 42%));
  box-shadow: 0 18px 52px rgb(55 76 106 / 10%), inset 0 1px 0 rgb(255 255 255 / 82%);
  backdrop-filter: blur(32px) saturate(150%);
  -webkit-backdrop-filter: blur(32px) saturate(150%);
}

.sidebar-brand {
  padding: 3px 9px 20px;
}

.practice-card {
  border-color: rgb(255 255 255 / 74%);
  border-radius: 16px;
  background: rgb(255 255 255 / 42%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
}

.practice-avatar,
.live-call-avatar,
.handoff-patient-avatar {
  background: linear-gradient(145deg, #158cff, #42c9d1);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 30%), 0 6px 16px rgb(8 124 240 / 15%);
}

.nav-item {
  border-radius: 13px;
}

.nav-item::before {
  display: none;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgb(255 255 255 / 60%);
  box-shadow: 0 5px 16px rgb(56 75 101 / 6%), inset 0 1px 0 rgb(255 255 255 / 82%);
  color: var(--brand);
}

.workspace {
  min-width: 0;
  padding-left: 10px;
}

.topbar {
  top: 14px;
  min-height: 66px;
  margin: 14px 18px 0;
  padding: 10px clamp(18px, 2.6vw, 32px);
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 22px;
  background: rgb(250 252 255 / 55%);
  box-shadow: 0 12px 34px rgb(55 76 106 / 8%), inset 0 1px 0 rgb(255 255 255 / 82%);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
}

.topbar h1 {
  font-size: var(--text-2xl);
  font-weight: 660;
  letter-spacing: -0.035em;
}

.connection-status,
.date-chip {
  border-color: rgb(255 255 255 / 76%);
  background: rgb(255 255 255 / 46%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
}

.workspace-content {
  padding-top: 24px;
}

.metric-card {
  overflow: hidden;
  border-radius: 20px;
}

.metric-card.is-primary {
  background:
    radial-gradient(circle at 88% 10%, rgb(52 199 210 / 20%), transparent 42%),
    linear-gradient(145deg, rgb(255 255 255 / 76%), rgb(236 246 255 / 56%));
  color: var(--ink);
}

.metric-card.is-primary .metric-card-label,
.metric-card.is-primary small {
  color: var(--muted);
}

.metric-card.is-primary strong {
  color: var(--ink);
}

.metric-card.is-primary .metric-icon {
  background: rgb(8 124 240 / 9%);
  color: var(--brand);
}

.section-header {
  border-bottom-color: rgb(76 99 128 / 9%);
}

.filter-switch {
  border-color: rgb(255 255 255 / 70%);
  border-radius: 13px;
  background: rgb(226 233 241 / 46%);
  box-shadow: inset 0 1px 2px rgb(53 70 94 / 5%);
}

.filter-button {
  border-radius: 9px;
}

.filter-button:hover,
.filter-button.is-active {
  background: rgb(255 255 255 / 78%);
  box-shadow: 0 3px 10px rgb(46 65 91 / 8%), inset 0 1px 0 rgb(255 255 255 / 76%);
  color: var(--ink);
}

.cases-panel,
.calls-list-panel {
  overflow: hidden;
}

.calls-list-panel {
  position: static;
  min-height: 0;
}

.cases-toolbar,
.calls-toolbar {
  min-height: 66px;
  padding: 12px 16px;
}

.calls-toolbar {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.search-field {
  width: min(420px, 52%);
}

.search-field input {
  min-height: 38px;
  border-color: rgb(255 255 255 / 74%);
  border-radius: 12px;
  background: rgb(255 255 255 / 48%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 70%);
}

.compact-list-head {
  display: grid;
  min-height: 34px;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  border-bottom: 1px solid rgb(76 99 128 / 8%);
  background: rgb(242 247 252 / 30%);
  color: var(--muted-light);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.case-list-head,
.case-row.compact-list-row {
  grid-template-columns: 5px minmax(240px, 1.25fr) minmax(170px, 0.72fr) 106px auto 16px;
}

.call-list-head,
.call-row.compact-list-row {
  grid-template-columns: 122px minmax(190px, 0.9fr) minmax(220px, 1.15fr) 92px 16px;
}

.cases-list,
.calls-list {
  display: grid;
  max-height: none;
  overflow: visible;
}

.compact-list-row,
.case-row.compact-list-row,
.call-row.compact-list-row {
  display: grid;
  width: 100%;
  min-height: 52px;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  border: 0;
  border-bottom: 1px solid rgb(76 99 128 / 8%);
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.compact-list-row:last-child {
  border-bottom: 0;
}

.compact-list-row:hover,
.call-row.compact-list-row:hover,
.call-row.compact-list-row.is-selected {
  background: rgb(255 255 255 / 48%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 56%);
}

.compact-list-row:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid rgb(8 124 240 / 24%);
  outline-offset: -3px;
}

.case-row.compact-list-row {
  position: relative;
  min-height: 64px;
  cursor: pointer;
}

.row-disclosure-button:focus-visible,
.quick-action-button:focus-visible {
  position: relative;
  z-index: 3;
  outline: 3px solid rgb(8 124 240 / 24%);
  outline-offset: 2px;
}

.case-row > .priority-marker { grid-column: 1; }
.case-row > .row-concern-stack { grid-column: 2; }
.case-row > .row-patient { grid-column: 3; }
.case-row > .quick-case-actions { grid-column: 4; }
.case-row > .row-date { grid-column: 5; }
.case-row > .row-disclosure-button { grid-column: 6; }

.row-disclosure-button {
  display: grid;
  width: 16px;
  height: 30px;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.row-concern-stack {
  display: grid;
  min-width: 0;
  justify-items: start;
  gap: 2px;
}

.case-state-tag {
  display: inline-flex;
  width: max-content;
  min-height: 16px;
  align-items: center;
  gap: 5px;
  padding: 0 6px;
  border: 1px solid rgb(255 255 255 / 64%);
  border-radius: 999px;
  background: rgb(235 243 251 / 58%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 64%);
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 720;
  line-height: 1;
  white-space: nowrap;
}

.case-state-tag::before {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgb(102 114 134 / 7%);
  content: "";
}

.case-state-tag.status-open {
  background: rgb(226 240 255 / 76%);
  color: #3176bd;
}

.case-state-tag.status-in_progress {
  background: rgb(235 234 255 / 76%);
  color: #655fba;
}

.case-state-tag.status-waiting_patient,
.case-state-tag.status-waiting_practice {
  background: var(--warning-soft);
  color: #9b671f;
}

.case-state-tag.status-done,
.case-state-tag.status-false_positive {
  background: var(--positive-soft);
  color: var(--positive);
}

.quick-case-actions {
  position: relative;
  z-index: 2;
  display: flex;
  grid-column: 4;
  grid-row: 1;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.quick-action-button {
  display: grid;
  width: 30px;
  height: 30px;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 76%);
  border-radius: 9px;
  background: rgb(255 255 255 / 52%);
  box-shadow: 0 4px 12px rgb(53 72 99 / 7%), inset 0 1px 0 rgb(255 255 255 / 80%);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 760;
  line-height: 1;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.quick-action-button:hover:not(:disabled) {
  border-color: rgb(8 124 240 / 20%);
  background: rgb(255 255 255 / 86%);
  box-shadow: 0 6px 16px rgb(53 72 99 / 10%), inset 0 1px 0 white;
  color: var(--brand);
  transform: translateY(-1px);
}

.quick-action-button:disabled {
  cursor: wait;
  opacity: 0.48;
}

.quick-action-button.is-progress { color: #5f69bb; }
.quick-action-button.is-waiting { color: #a36b22; }
.quick-action-button.is-complete { color: var(--positive); }
.quick-action-button.is-reopen { color: var(--brand); }

.quick-action-tooltip {
  position: fixed;
  z-index: 220;
  max-width: min(220px, calc(100vw - 20px));
  padding: 7px 10px;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 9px;
  background: rgb(37 47 62 / 88%);
  box-shadow: 0 10px 26px rgb(34 45 62 / 20%), inset 0 1px 0 rgb(255 255 255 / 14%);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  color: white;
  font-size: 0.69rem;
  font-weight: 630;
  line-height: 1.2;
  pointer-events: none;
  white-space: nowrap;
}

.quick-action-tooltip::after {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 7px;
  height: 7px;
  background: rgb(37 47 62 / 88%);
  content: "";
  transform: translate(-50%, -50%) rotate(45deg);
}

.quick-action-tooltip.is-below::after {
  top: 0;
}

.priority-marker {
  width: 4px;
  height: 22px;
  border-radius: 99px;
  background: var(--signal);
  box-shadow: 0 0 0 3px rgb(52 199 210 / 9%);
}

.priority-marker.is-urgent {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgb(224 84 97 / 9%);
}

.priority-marker.is-high {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgb(228 154 56 / 10%);
}

.row-concern,
.row-patient,
.row-date,
.row-start,
.row-duration {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-concern {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 670;
}

.row-patient {
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.call-row .row-patient {
  color: var(--ink);
  font-weight: 670;
}

.call-row .row-concern {
  color: var(--ink-soft);
  font-weight: 500;
}

.row-start {
  color: var(--muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.row-duration {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-self: end;
  padding: 0 8px;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 9px;
  background: rgb(230 241 252 / 52%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
  color: var(--ink-soft);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.row-date {
  color: var(--muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.row-chevron {
  color: var(--muted-light);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
  text-align: right;
  transition: color 180ms ease, transform 180ms ease;
}

.compact-list-row:hover .row-chevron {
  color: var(--brand);
  transform: translateX(2px);
}

body.has-detail-modal {
  overflow: hidden;
}

.detail-overlay {
  position: fixed;
  z-index: 110;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgb(22 31 45 / 24%);
  backdrop-filter: blur(13px) saturate(120%);
  -webkit-backdrop-filter: blur(13px) saturate(120%);
}

.detail-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(920px, 100%);
  max-height: calc(100vh - 56px);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 78%);
  border-radius: 30px;
  outline: 0;
  background:
    radial-gradient(circle at 90% 4%, rgb(134 220 239 / 18%), transparent 34%),
    linear-gradient(145deg, rgb(255 255 255 / 82%), rgb(244 249 253 / 68%));
  box-shadow: 0 38px 110px rgb(24 37 56 / 25%), inset 0 1px 0 rgb(255 255 255 / 88%);
  backdrop-filter: blur(42px) saturate(170%);
  -webkit-backdrop-filter: blur(42px) saturate(170%);
  animation: glass-detail-in 200ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

@keyframes glass-detail-in {
  from { opacity: 0; transform: translateY(14px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.detail-modal-header {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 22px 14px 28px;
  border-bottom: 1px solid rgb(76 99 128 / 9%);
  background: rgb(255 255 255 / 26%);
}

.detail-modal-header .section-kicker {
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 0.68rem;
}

.detail-modal-header h2 {
  font-size: var(--text-xl);
}

.detail-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--muted);
  font-size: var(--text-xl);
}

.call-detail {
  min-height: 0;
  padding: 26px 28px 32px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail-heading {
  border-bottom-color: rgb(76 99 128 / 9%);
}

.detail-title-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.summary-card,
.fact,
.message-list,
.transcript-empty {
  border-color: rgb(255 255 255 / 72%);
  background: rgb(255 255 255 / 42%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 74%);
}

.case-task-card {
  border-left: 3px solid var(--brand);
}

.case-workflow-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgb(76 99 128 / 9%);
}

.conversation-context p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.message p {
  background: linear-gradient(180deg, #178cff, #0877e6);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 20%);
}

.message.is-agent p {
  border-color: rgb(255 255 255 / 76%);
  background: rgb(255 255 255 / 66%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 78%);
}

.handoff-dialog {
  border-color: rgb(255 255 255 / 78%);
  background: rgb(250 252 255 / 76%);
  backdrop-filter: blur(38px) saturate(160%);
  -webkit-backdrop-filter: blur(38px) saturate(160%);
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 234px minmax(0, 1fr);
  }

  .case-list-head,
  .case-row.compact-list-row {
    grid-template-columns: 5px minmax(180px, 1fr) minmax(135px, 0.68fr) 106px auto 16px;
  }

  .call-list-head,
  .call-row.compact-list-row {
    grid-template-columns: 110px minmax(145px, 0.85fr) minmax(165px, 1fr) 86px 16px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .workspace {
    padding-left: 0;
  }

  .sidebar {
    top: 10px;
    left: 10px;
    width: min(288px, calc(100vw - 20px));
    height: calc(100vh - 20px);
    margin: 0;
  }

  .topbar {
    top: 10px;
    margin: 10px 10px 0;
  }
}

@media (max-width: 620px) {
  .workspace-content {
    padding: 18px 10px 36px;
  }

  .cases-toolbar,
  .calls-toolbar {
    min-height: 60px;
    padding: 10px;
  }

  .calls-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }

  .compact-list-head {
    display: none;
  }

  .compact-list-row,
  .case-row.compact-list-row,
  .call-row.compact-list-row {
    min-height: 50px;
    gap: 8px;
    padding: 0 10px;
  }

  .case-row.compact-list-row {
    min-height: 102px;
    grid-template-columns: 4px minmax(80px, 1fr) minmax(70px, 0.72fr) auto 12px;
    grid-template-rows: auto auto 30px;
    row-gap: 4px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .case-row > .priority-marker { grid-column: 1; grid-row: 1 / 4; }
  .case-row > .row-concern-stack { grid-column: 2 / 5; grid-row: 1; }
  .case-row > .row-patient { grid-column: 2 / 4; grid-row: 2; }
  .case-row > .row-date { grid-column: 4; grid-row: 2; }
  .case-row > .row-disclosure-button { grid-column: 5; grid-row: 2; }

  .quick-case-actions {
    grid-column: 2 / 5;
    grid-row: 3;
    padding-bottom: 1px;
  }

  .quick-action-button {
    width: 27px;
    height: 27px;
    border-radius: 8px;
  }

  .call-row.compact-list-row {
    grid-template-columns: 82px minmax(68px, 0.85fr) minmax(72px, 1fr) 58px 10px;
    gap: 5px;
  }

  .row-concern,
  .row-patient {
    font-size: var(--text-xs);
  }

  .row-date {
    font-size: 0.68rem;
  }

  .row-start,
  .row-duration {
    font-size: 0.65rem;
  }

  .row-duration {
    min-height: 23px;
    padding: 0 5px;
    border-radius: 7px;
  }

  .detail-overlay {
    align-items: end;
    padding: 8px;
  }

  .detail-dialog {
    width: 100%;
    max-height: calc(100vh - 16px);
    border-radius: 25px;
  }

  .detail-modal-header {
    min-height: 68px;
    padding: 11px 14px 11px 19px;
  }

  .call-detail {
    padding: 20px 16px 26px;
  }

  .detail-person .call-avatar {
    width: 42px;
    height: 42px;
  }

  .case-workflow-actions {
    justify-content: stretch;
  }

  .case-workflow-actions .button {
    flex: 1 1 150px;
  }
}

/* Live calls: badge, running duration, last utterance and live transcript */
.live-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--positive-soft);
  color: var(--positive);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}

.live-badge-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--positive);
  animation: live-dot-pulse 1.6s ease-in-out infinite;
}

@keyframes live-dot-pulse {
  0%,
  100% { box-shadow: 0 0 0 0 rgb(41 168 117 / 45%); }
  50% { box-shadow: 0 0 0 5px rgb(41 168 117 / 0%); }
}

.live-elapsed {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.live-elapsed.is-inline {
  color: inherit;
  font-size: inherit;
}

.live-call-context .live-call-since {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  overflow: visible;
}

.live-call-preview {
  grid-column: 1 / -1;
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-call-preview.is-empty {
  color: var(--muted-light);
}

.live-call-speaker {
  margin-right: 6px;
  color: var(--muted);
  font-weight: 700;
}

.live-call-speaker::after {
  content: ":";
}

.message-list.is-live {
  max-height: min(52vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.live-transcript-hint {
  justify-self: center;
  margin: 4px 0 0;
  color: var(--muted-light);
  font-size: var(--text-xs);
  text-align: center;
}

.row-duration.is-live {
  gap: 6px;
  border-color: rgb(41 168 117 / 22%);
  background: var(--positive-soft);
  color: var(--positive);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.row-duration.is-aborted {
  color: var(--danger);
}

@media (max-width: 620px) {
  .live-call-preview {
    white-space: normal;
  }

  .message-list.is-live {
    max-height: 60vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-badge-dot { animation: none; }
}

/* The generic ".live-call-identity span" / ".live-call-context span" rules make
   every span a grey block; the avatar and the live badge need their own layout. */
.live-call-identity .live-call-avatar {
  display: grid;
  overflow: visible;
  color: white;
  font-size: var(--text-sm);
  text-overflow: clip;
}

.live-call-context .live-badge {
  display: inline-flex;
  overflow: visible;
  color: var(--positive);
  font-size: var(--text-xs);
}

.live-call-context .live-badge > span {
  display: inline-block;
  overflow: visible;
  color: inherit;
  font-size: inherit;
}

.live-call-context .live-elapsed {
  display: inline-block;
  color: var(--ink-soft);
}
