﻿/* DentSide design tokens & app styles */

:root {
  --accent: #2B47E8;
  --accent-2: #5B82FF;
  --mint: #1F9F73;
  --coral: #E27A52;
  --violet: #7B5BE0;

  /* surfaces — warm whites */
  --bg: oklch(0.985 0.003 240);
  --surface: #FFFFFF;
  --surface-2: oklch(0.97 0.004 240);
  --surface-3: oklch(0.95 0.005 240);

  /* sidebar dark */
  --sb-bg: oklch(0.18 0.02 250);
  --sb-bg-2: oklch(0.22 0.02 250);
  --sb-line: oklch(0.28 0.02 250);
  --sb-text: oklch(0.95 0.01 240);
  --sb-mute: oklch(0.62 0.02 240);
  --sb-hover: oklch(0.26 0.02 250);

  /* sidebar light overrides set via [data-sidebar="light"] */

  --ink: oklch(0.22 0.025 250);
  --text: oklch(0.28 0.022 250);
  --text-mute: oklch(0.55 0.018 250);
  --line: oklch(0.93 0.005 250);
  --line-strong: oklch(0.88 0.008 250);

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 22, 42, 0.04);
  --shadow: 0 1px 2px rgba(15, 22, 42, 0.04), 0 4px 12px rgba(15, 22, 42, 0.04);
  --shadow-lg: 0 2px 4px rgba(15, 22, 42, 0.04), 0 12px 32px rgba(15, 22, 42, 0.06);

  --sb-w: 256px;
  --pd-w: 460px;
  --tb-h: 64px;
  --u-pad: 22px;
}

[data-density="compact"] {
  --u-pad: 14px;
  --radius: 8px;
  --radius-lg: 10px;
}

[data-sidebar="light"] {
  --sb-bg: #FFFFFF;
  --sb-bg-2: oklch(0.985 0.003 240);
  --sb-line: var(--line);
  --sb-text: var(--ink);
  --sb-mute: var(--text-mute);
  --sb-hover: oklch(0.96 0.005 250);
}

* { box-sizing: border-box; }

html, body, #root {
  margin: 0; padding: 0; height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
.num { font-family: "JetBrains Mono", ui-monospace, monospace; font-feature-settings: "tnum"; letter-spacing: -0.01em; }
.muted { color: var(--text-mute); }
.xs { font-size: 11px; }

/* ════════════ APP LAYOUT ════════════ */
.app {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  height: 100vh;
  min-height: 720px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.content {
  flex: 1;
  overflow: auto;
  padding: 28px 32px 60px;
  background: var(--bg);
}

/* ════════════ SIDEBAR ════════════ */
.sidebar {
  background: var(--sb-bg);
  color: var(--sb-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sb-line);
  overflow-y: auto;
}
.sidebar--light { background: var(--sb-bg); }

.sidebar__brand {
  padding: 20px 20px 18px;
  display: flex; gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--sb-line);
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 16px; font-weight: 700; color: var(--sb-text); letter-spacing: -0.02em; }
.brand-tag { font-size: 11px; color: var(--sb-mute); letter-spacing: 0; }

.sidebar__user {
  margin: 14px 14px;
  padding: 10px 12px;
  background: var(--sb-bg-2);
  border: 1px solid var(--sb-line);
  border-radius: 10px;
  display: flex; align-items: center; gap: 10px;
}
.user-meta { flex: 1; line-height: 1.2; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 600; color: var(--sb-text); }
.user-role { font-size: 10.5px; color: var(--sb-mute); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-switch {
  background: transparent; border: none; color: var(--sb-mute);
  width: 24px; height: 24px; border-radius: 6px;
  display: grid; place-items: center;
}
.user-switch:hover { background: var(--sb-hover); color: var(--sb-text); }

.sidebar__nav { padding: 4px 14px; flex: 1; }

.nav-group { margin-bottom: 18px; }
.nav-group__title {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--sb-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 12px 8px;
}

.nav-item {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--sb-mute);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex; align-items: center; gap: 11px;
  text-align: left;
  margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--sb-hover); color: var(--sb-text); }
.nav-item.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent), white 25%);
}
.nav-item.is-active svg { stroke: #fff; }
.nav-item > span { flex: 1; }
.nav-badge {
  font-size: 10.5px;
  font-weight: 600;
  background: var(--sb-bg-2);
  color: var(--sb-text);
  padding: 2px 6px;
  border-radius: 5px;
}
.nav-item.is-active .nav-badge { background: rgba(255,255,255,0.22); color: #fff; }
.nav-badge--alert { background: var(--coral); color: #fff; }

.sidebar__upgrade { padding: 14px; }
.upgrade-card {
  background: var(--sb-bg-2);
  border: 1px solid var(--sb-line);
  border-radius: 12px;
  padding: 14px;
  position: relative;
  overflow: hidden;
}
.upgrade-card::before {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 90px; height: 90px;
  background: radial-gradient(circle, color-mix(in oklch, var(--accent), transparent 60%) 0%, transparent 70%);
  border-radius: 50%;
}
.upgrade-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.upgrade-pill { font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; padding: 3px 7px; border-radius: 5px; background: var(--accent); color: #fff; }
.upgrade-title { font-size: 13px; font-weight: 600; color: var(--sb-text); }
.upgrade-body { font-size: 11.5px; color: var(--sb-mute); margin: 4px 0 6px; line-height: 1.4; }
.upgrade-features { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 4px; }
.upgrade-features li { font-size: 11px; color: var(--sb-mute); display: flex; align-items: center; gap: 5px; }
.upgrade-features li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); flex-shrink: 0; }
.tl-status-btn { background: none; border: none; padding: 0; cursor: pointer; display: inline-flex; }
.tl-status-btn:hover { opacity: 0.8; }
.upgrade-soon-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,0.08);
  border: 1px dashed rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.45);
  border-radius: 8px; padding: 8px;
  cursor: default;
  width: 100%;
}

/* ════════════ TOPBAR ════════════ */
.topbar {
  height: var(--tb-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px;
  padding: 0 28px;
  flex-shrink: 0;
}
.topbar__crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.crumb { color: var(--text-mute); }
.crumb--active { color: var(--ink); font-weight: 600; }
.crumb-sep { color: var(--text-mute); opacity: .5; }

.topbar__search {
  flex: 1;
  max-width: 480px;
  margin-left: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 38px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 12px;
  color: var(--text-mute);
}
.topbar__search:focus-within { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent), transparent 90%); }
.topbar__search input {
  background: transparent; border: none; outline: none; flex: 1;
  font-size: 13.5px; color: var(--ink);
}
.topbar__search kbd {
  font-family: inherit; font-size: 10.5px;
  background: var(--surface); border: 1px solid var(--line);
  padding: 2px 6px; border-radius: 5px; color: var(--text-mute);
}

.topbar__actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--line);
  width: 38px; height: 38px; border-radius: 9px;
  display: grid; place-items: center;
  color: var(--ink);
  position: relative;
  transition: background .12s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn--ghost { background: transparent; border-color: transparent; }
.icon-btn--ghost:hover { background: var(--surface-2); }
.icon-btn--notif .badge-dot {
  position: absolute; top: 4px; right: 4px;
  background: var(--coral); color: #fff;
  font-size: 9px; font-weight: 700;
  width: 14px; height: 14px; border-radius: 100%;
  display: grid; place-items: center;
}

.topbar__divider { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.topbar__profile {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 8px 4px 4px;
  border-radius: 30px;
  cursor: pointer;
}
.topbar__profile:hover { background: var(--surface-2); }
.profile-name { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.1; }
.profile-meta { font-size: 10.5px; color: var(--text-mute); }

/* ════════════ AVATARS ════════════ */
.avatar {
  border-radius: 100%;
  color: #fff;
  font-weight: 600;
  display: grid; place-items: center;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.avatar--xs { width: 22px; height: 22px; font-size: 10px; }
.avatar--sm { width: 32px; height: 32px; font-size: 11.5px; }
.avatar--md { width: 36px; height: 36px; font-size: 13px; }

/* ════════════ BUTTONS ════════════ */
.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--ink);
  transition: background .12s, transform .04s;
}
.btn:active { transform: translateY(.5px); }
.btn--accent {
  background: var(--accent); color: #fff;
  border-color: color-mix(in oklch, var(--accent), black 10%);
  box-shadow: 0 1px 0 color-mix(in oklch, var(--accent), white 25%) inset, var(--shadow-sm);
}
.btn--accent:hover { background: color-mix(in oklch, var(--accent), black 6%); }
.btn--ghost { background: var(--surface); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { height: 32px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn--block { width: 100%; justify-content: center; }
.btn.icon-only { padding: 0; width: 32px; justify-content: center; }

/* ════════════ TAGS ════════════ */
.tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent;
  letter-spacing: -0.005em;
  line-height: 1.6;
}
.tag-dot { width: 6px; height: 6px; border-radius: 100%; background: currentColor; }
.tag--neutral { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.tag--blue { background: color-mix(in oklch, var(--accent), white 88%); color: var(--accent); }
.tag--green { background: color-mix(in oklch, var(--mint), white 86%); color: var(--mint); }
.tag--amber { background: color-mix(in oklch, var(--coral), white 86%); color: var(--coral); }

/* ════════════ CARDS ════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.card-title {
  font-size: 15px; font-weight: 700; margin: 0 0 2px;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.card-sub {
  font-size: 12.5px; color: var(--text-mute); margin: 0;
}

/* ════════════ PAGE HEAD ════════════ */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 24px; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink); margin: 0 0 4px;
}
.page-sub { font-size: 13.5px; color: var(--text-mute); margin: 0; }
.page-actions { display: flex; gap: 8px; align-items: center; }

.seg {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  display: inline-flex;
}
.seg__opt {
  background: transparent; border: none;
  height: 30px; padding: 0 12px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-mute);
  border-radius: 6px;
}
.seg__opt.is-on {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ════════════ KPI ════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 14px;
}
.kpi__head { display: flex; align-items: center; gap: 10px; }
.kpi__icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff;
}
.kpi__icon--mint { background: linear-gradient(135deg, var(--mint), color-mix(in oklch, var(--mint), white 20%)); }
.kpi__icon--coral { background: linear-gradient(135deg, var(--coral), color-mix(in oklch, var(--coral), white 18%)); }
.kpi__icon--blue { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.kpi__icon--violet { background: linear-gradient(135deg, var(--violet), color-mix(in oklch, var(--violet), white 15%)); }
.kpi__label { font-size: 12.5px; color: var(--text-mute); font-weight: 500; flex: 1; }
.kpi__more { width: 26px; height: 26px; }
.kpi-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 200;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 160px;
}
.kpi-menu__item {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px; background: none; border: none; cursor: pointer;
  font-size: 12.5px; color: var(--ink); border-radius: 7px;
  font-family: "Inter", sans-serif;
}
.kpi-menu__item:hover { background: var(--surface-2); }
.kpi__value-row { display: flex; justify-content: space-between; align-items: flex-end; }
.kpi__value {
  font-size: 26px; font-weight: 700;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1;
}
.kpi__unit { font-size: 13px; font-weight: 500; color: var(--text-mute); margin-left: 6px; font-family: "Inter", sans-serif; }
.kpi__delta {
  font-size: 11.5px;
  margin-top: 8px;
  display: flex; align-items: center; gap: 4px;
  font-weight: 500;
}
.kpi__delta.is-up { color: var(--mint); }
.kpi__delta.is-down { color: var(--coral); }
.kpi__spark { opacity: .9; }

/* ════════════ DASHBOARD GRID ════════════ */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-12 { grid-column: span 12; }

.big-num { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.big-num__value { font-family: "JetBrains Mono", monospace; font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-mute); }
.legend__dot { width: 8px; height: 8px; border-radius: 2px; }

.chart-wrap { height: 220px; }
.chart-svg { width: 100%; height: 100%; }

/* Donut */
.donut-wrap { display: flex; gap: 22px; align-items: center; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.donut-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.donut-name { color: var(--ink); }
.donut-count { color: var(--text-mute); font-family: "JetBrains Mono", monospace; font-size: 11.5px; }
.donut-pct { font-weight: 600; color: var(--ink); font-family: "JetBrains Mono", monospace; font-size: 11.5px; }

/* Appointment list */
.schedule-list { display: flex; flex-direction: column; gap: 6px; }
.appt {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: 70px 4px 1fr 22px;
  gap: 12px;
  align-items: center;
  text-align: left;
  transition: background .12s;
}
.appt:hover { background: var(--surface-3); }
.appt__time { display: flex; flex-direction: column; align-items: flex-start; }
.appt__hour { font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: 15px; color: var(--ink); }
.appt__dur { font-size: 10.5px; color: var(--text-mute); }
.appt__rail { width: 3px; height: 38px; border-radius: 2px; }
.appt__main { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-width: 0; }
.appt__row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.appt__patient { font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt__procedure { font-size: 12px; color: var(--text-mute); }
.appt__meta { font-size: 11.5px; color: var(--text-mute); display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.appt__meta .muted { display: inline-flex; align-items: center; gap: 4px; }
.appt__action { color: var(--text-mute); }

/* Controls list */
.ctrl-list { display: flex; flex-direction: column; gap: 4px; }
.ctrl {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
.ctrl:last-child { border-bottom: none; }
.ctrl__date {
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 0 5px;
  width: 48px;
}
.ctrl__d { font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: 16px; color: var(--ink); line-height: 1; }
.ctrl__m { font-size: 10px; color: var(--text-mute); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.ctrl__name { font-size: 13px; font-weight: 600; color: var(--ink); }
.ctrl__reason { font-size: 11.5px; color: var(--text-mute); }

/* Receivables table */
.rcv-table { display: flex; flex-direction: column; }
.rcv-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1.2fr;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.rcv-row:first-child { border-top: none; }
.rcv-row--head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  font-weight: 600;
  padding: 0 0 10px;
  border-top: none;
}
.rcv-clinic { display: flex; align-items: center; gap: 10px; }
.clinic-bullet { width: 8px; height: 8px; border-radius: 100%; flex-shrink: 0; }
.rcv-clinic__name { font-weight: 600; color: var(--ink); }
.rcv-clinic__loc { font-size: 11.5px; color: var(--text-mute); }
.num--mute { color: var(--text-mute); }
.rcv-bar { display: flex; align-items: center; gap: 8px; }
.rcv-bar__track { flex: 1; height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.rcv-bar__fill { display: block; height: 100%; border-radius: 4px; }
.rcv-bar__lbl { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--text-mute); min-width: 32px; text-align: right; }

/* ════════════ SPLIT VIEW (PATIENTS) ════════════ */
.view--split { display: grid; grid-template-columns: 1fr var(--pd-w); gap: 18px; align-items: flex-start; min-height: calc(100vh - 92px); }
.split__list { min-width: 0; }

.filters-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px;
  font-size: 12px; font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
}
.chip:hover { background: var(--surface-2); }
.chip.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip-count {
  font-size: 10.5px;
  background: var(--surface-2);
  color: var(--text-mute);
  padding: 1px 6px; border-radius: 5px;
  font-family: "JetBrains Mono", monospace;
}
.chip.is-on .chip-count { background: rgba(255,255,255,0.18); color: rgba(255,255,255,0.9); }

/* Patient table */
.pt-table {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.pt-row {
  display: grid;
  grid-template-columns: 1.6fr 1.2fr 1.5fr 1fr 1.4fr 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  text-align: left;
  background: transparent;
  border-left: none; border-right: none; border-bottom: none;
  width: 100%;
  transition: background .12s;
}
.pt-row:first-child { border-top: none; }
.pt-row:not(.pt-row--head):hover { background: var(--surface-2); cursor: pointer; }
.pt-row.is-sel { background: color-mix(in oklch, var(--accent), white 92%); border-left: 3px solid var(--accent); padding-left: 15px; }
.pt-row--head {
  background: var(--surface-2);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-mute); font-weight: 600;
  padding: 10px 18px;
}
.pt-patient { display: flex; align-items: center; gap: 11px; }
.pt-name { font-weight: 600; color: var(--ink); font-size: 13px; }
.pt-meta { font-size: 11px; color: var(--text-mute); }
.pt-clinic { display: flex; align-items: center; gap: 8px; }
.pt-treat { color: var(--text); font-size: 12.5px; }
.pt-pay__row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.pt-pay__bar { height: 4px; background: var(--surface-3); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.pt-pay__fill { display: block; height: 100%; background: var(--accent); }
.pt-last { font-size: 12px; }

/* Patient detail */
.patient-detail {
  position: sticky;
  top: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 92px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pd__head {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
}
.pd__head-row { display: flex; align-items: flex-start; gap: 12px; }
.pd__head-main { flex: 1; min-width: 0; }
.pd__name { font-size: 18px; font-weight: 700; color: var(--ink); margin: 0 0 4px; letter-spacing: -0.015em; }
.pd__meta { font-size: 12.5px; color: var(--text-mute); margin-bottom: 8px; }
.pd__meta a { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.pd__head-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.pd__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.pd-stat {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px;
  display: flex; flex-direction: column; gap: 3px;
}
.pd-stat__l { font-size: 10.5px; color: var(--text-mute); }
.pd-stat__v { font-size: 14px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }

.pd__progress { margin-top: 14px; }
.pd__progress-track { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.pd__progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.pd__progress-lbl { font-size: 11px; color: var(--text-mute); margin-top: 5px; display: block; }

.pd__tabs {
  display: flex;
  gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.pd-tab {
  background: transparent; border: none;
  padding: 12px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-mute);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.pd-tab:hover { color: var(--ink); }
.pd-tab.is-on { color: var(--ink); border-color: var(--accent); font-weight: 600; }

.pd__body { padding: 18px 22px; flex: 1; overflow-y: auto; min-height: 0; }

/* Plan timeline */
.plan__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.plan__title { font-size: 14px; font-weight: 700; color: var(--ink); margin: 0; }
.plan__sub { font-size: 11.5px; color: var(--text-mute); margin: 2px 0 0; }
.timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.tl-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  position: relative;
  padding-bottom: 4px;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 28px;
  bottom: -4px;
  width: 1.5px;
  background: var(--line);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  width: 28px; height: 28px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 100%;
  display: grid; place-items: center;
  color: var(--text-mute);
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  font-weight: 700;
  z-index: 1;
}
.tl-item--done .tl-dot {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.tl-body {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
}
.tl-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.tl-procedure { font-size: 13px; font-weight: 600; color: var(--ink); }
.tl-meta { display: flex; gap: 12px; font-size: 11.5px; color: var(--text-mute); flex-wrap: wrap; }
.tl-meta span { display: inline-flex; align-items: center; gap: 4px; }
.tl-meta b { color: var(--ink); font-weight: 600; }

/* Sessions / Payments tables */
.ses-table { display: flex; flex-direction: column; }
.ses-row {
  display: grid; gap: 10px; padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 12.5px; align-items: center;
}
.ses-row:first-child { border-top: none; }
.ses-row--head {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute); font-weight: 600;
}
/* col counts inferred per use; just set grid-template-columns per table */
.ses-row { grid-template-columns: 60px 90px 1fr 80px 80px; }
.pd__body .ses-row { grid-template-columns: 80px 1fr 80px 90px; }

.payments-summary {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 16px;
}
.pay-block {
  background: var(--surface-2);
  border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.pay-l { font-size: 11px; color: var(--text-mute); }
.pay-v { font-size: 14px; font-weight: 700; color: var(--ink); }

/* Notes */
.notes { display: flex; flex-direction: column; gap: 12px; }
.ai-note {
  background: linear-gradient(135deg, color-mix(in oklch, var(--accent), white 92%), color-mix(in oklch, var(--violet), white 92%));
  border: 1px solid color-mix(in oklch, var(--accent), white 80%);
  border-radius: 10px;
  padding: 12px 14px;
}
.ai-note__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 11px; }
.ai-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--ink); color: #fff;
  padding: 3px 8px; border-radius: 5px;
  font-weight: 600; font-size: 10.5px;
}
.ai-note__body { font-size: 12.5px; color: var(--text); margin: 0; line-height: 1.55; }

.note { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.note__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.note__author { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 600; color: var(--ink); }
.note p { font-size: 12.5px; color: var(--text); margin: 0; line-height: 1.55; }

.note-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  resize: vertical;
  min-height: 70px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
}
.note-input:focus { border-color: var(--accent); }
.note-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Files */
.files { display: flex; flex-direction: column; gap: 6px; }
.file {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
}
.file__icon { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; }
.file__main { flex: 1; min-width: 0; }
.file__name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.file__meta { font-size: 11px; }
.file-upload {
  background: transparent;
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  padding: 16px;
  color: var(--text-mute);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 12.5px;
  margin-top: 6px;
}
.file-upload:hover { border-color: var(--accent); color: var(--accent); }
.file-upload.is-dragging { border-color: var(--accent); background: color-mix(in oklch, var(--accent), white 93%); color: var(--accent); }

/* File preview */
.file-preview-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.file-preview-box {
  background: var(--surface);
  border-radius: 14px;
  display: flex; flex-direction: column;
  max-width: 900px; width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.file-preview-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.file-preview-name {
  font-size: 13px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-preview-body {
  flex: 1; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  min-height: 200px;
}
.file-preview-img {
  max-width: 100%; max-height: 70vh;
  object-fit: contain; display: block;
}
.file-preview-pdf {
  width: 100%; height: 70vh; border: none;
}
.file-preview-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 12px;
  border-top: 1px solid var(--line);
}

/* ════════════ MODAL ════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 15, 30, 0.45);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.18s ease;
}
@keyframes slideUp { from { transform: translateY(12px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0;
}
.modal__title { font-size: 16px; font-weight: 700; color: var(--ink); }
.modal__body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal__foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 0 24px 20px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 11.5px; font-weight: 600; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.04em; }
.form-field input,
.form-field select,
.form-field textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  width: 100%;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent), transparent 88%); }

.radio-group { display: flex; gap: 8px; }
.radio-opt {
  flex: 1; padding: 8px; border-radius: var(--radius);
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  font-size: 13px; font-weight: 500;
  color: var(--text-mute); cursor: pointer;
  text-align: center;
}
.radio-opt.is-on { border-color: var(--accent); background: color-mix(in oklch, var(--accent), white 92%); color: var(--accent); font-weight: 600; }

/* ════════════ BİLDİRİM PANELİ ════════════ */
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  animation: slideUp 0.15s ease;
}
.notif-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.notif-panel__title { font-size: 13px; font-weight: 700; color: var(--ink); }
.notif-panel__count { font-size: 11px; background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.notif-panel__list { display: flex; flex-direction: column; }
.notif-item {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item__icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 15px; flex-shrink: 0;
}
.notif-item__body { flex: 1; min-width: 0; }
.notif-item__title { font-size: 12.5px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.notif-item__text { font-size: 11.5px; color: var(--text-mute); line-height: 1.45; margin-bottom: 4px; }
.notif-item__time { font-size: 10.5px; color: var(--text-mute); }
.notif-panel__foot { padding: 10px 12px; }

/* ════════════ PROFİL MENÜSÜ ════════════ */
.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  padding: 6px;
  animation: slideUp 0.15s ease;
}
.profile-menu__head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 12px;
}
.profile-menu__name { font-size: 13px; font-weight: 700; color: var(--ink); }
.profile-menu__role { font-size: 11px; color: var(--text-mute); margin-top: 1px; }
.profile-menu__divider { height: 1px; background: var(--line); margin: 4px 0; }
.profile-menu__item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 10px;
  border-radius: 8px; border: none;
  background: transparent;
  font-size: 13px; color: var(--text);
  text-align: left; cursor: pointer;
}
.profile-menu__item:hover { background: var(--surface-2); color: var(--ink); }
.profile-menu__item--danger { color: var(--coral); }
.profile-menu__item--danger:hover { background: color-mix(in oklch, var(--coral), white 92%); }
.profile-info-row { display: flex; align-items: center; gap: 12px; padding: 4px 0 8px; }

/* Profil Ayarları sekmeler */
.ps-tabs { display: flex; gap: 2px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.ps-tab { padding: 10px 14px; font-size: 13px; font-weight: 500; color: var(--text-mute); border: none; background: transparent; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ps-tab:hover { color: var(--ink); }
.ps-tab.is-on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.ps-success { margin: 0 24px 12px; font-size: 12px; color: var(--mint); background: color-mix(in oklch,var(--mint),white 92%); padding: 8px 12px; border-radius: 8px; }
.ps-error { font-size: 12px; color: var(--coral); background: color-mix(in oklch,var(--coral),white 92%); padding: 8px 12px; border-radius: 8px; }

/* Bildirim toggle */
.notif-pref-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.notif-pref-row:last-child { border-bottom: none; }
.notif-pref-label { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.notif-pref-desc { font-size: 11.5px; color: var(--text-mute); }
.toggle { width: 40px; height: 22px; border-radius: 99px; background: var(--line-strong); border: none; padding: 2px; cursor: pointer; transition: background 0.2s; flex-shrink: 0; position: relative; }
.toggle.is-on { background: var(--accent); }
.toggle__knob { display: block; width: 18px; height: 18px; border-radius: 99px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform 0.2s; }
.toggle.is-on .toggle__knob { transform: translateX(18px); }

/* Rapor seçim modalı */
.export-section-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; border-radius: 8px; cursor: pointer;
}
.export-section-row:hover { background: var(--surface-2); }
.export-checkbox {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  border: 2px solid var(--line-strong);
  display: grid; place-items: center;
  transition: all 0.15s;
}
.export-checkbox.is-on { background: var(--accent); border-color: var(--accent); }
.export-section-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.export-section-desc { font-size: 11.5px; color: var(--text-mute); margin-top: 1px; }

.plan-preview {
  display: flex; justify-content: space-between; align-items: center;
  background: color-mix(in oklch, var(--accent), white 90%);
  border: 1px solid color-mix(in oklch, var(--accent), white 70%);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px; font-weight: 500; color: var(--accent);
  margin-bottom: 4px;
}
.plan-preview .muted { color: var(--text-mute); font-weight: 400; }

/* Satır içi form (seans/ödeme ekleme) */
.inline-form {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 16px;
}

/* İşlem listesi yönetimi */
.proc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 8px; border-radius: 7px;
}
.proc-row:hover { background: var(--surface-2); }
.proc-label { font-size: 13px; color: var(--text); flex: 1; }
.proc-edit-input {
  flex: 1; background: var(--surface); border: 1.5px solid var(--accent);
  border-radius: 6px; padding: 5px 8px; font-size: 13px; color: var(--ink); outline: none;
}

/* Tedavi çoklu seçim çipleri */
.treat-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.treat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 99px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  font-size: 12.5px; color: var(--text-mute); cursor: pointer;
  transition: all 0.15s;
}
.treat-chip:hover { border-color: var(--accent); color: var(--accent); }
.treat-chip.is-on { border-color: var(--accent); background: color-mix(in oklch, var(--accent), white 90%); color: var(--accent); font-weight: 600; }

/* ════════════ MOBİL/TABLET ELEMANLAR (default gizli) ════════════ */
.topbar__hamburger { display: none; }
.sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 850; background: rgba(0,0,0,0.45); pointer-events: none; }
.sidebar-overlay.is-open { display: block; pointer-events: auto; }
.sidebar__close { display: none; margin-left: auto; background: transparent; border: none; color: var(--sb-mute); cursor: pointer; padding: 4px; border-radius: 6px; }
.sidebar__close:hover { color: var(--sb-text); background: var(--sb-hover); }
.pd__back-btn { display: none; }

/* ════════════ MOBİL (< 768px) ════════════ */
@media (max-width: 767px) {
  :root { --u-pad: 14px; }

  /* App: single column, no sidebar in grid */
  .app { grid-template-columns: 1fr; }

  /* Sidebar: slide-in overlay */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 260px; z-index: 900;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 6px 0 32px rgba(0,0,0,0.22);
  }
  .sidebar__close { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; }
  .brand-text { display: flex; }
  .user-meta { display: flex; }
  .nav-item > span { display: inline; }
  .nav-group__title { display: block; }
  .sidebar__upgrade { display: block; }

  /* Topbar */
  .topbar { padding: 0 14px; gap: 8px; height: 56px; }
  .topbar__hamburger {
    display: grid; place-items: center;
    width: 38px; height: 38px; flex-shrink: 0;
    background: transparent; border: none; color: var(--ink); cursor: pointer;
  }
  .topbar__crumb { display: none; }
  .topbar__search { flex: 1; max-width: none; }
  .topbar__search kbd { display: none; }
  .profile-name, .profile-meta, .topbar__divider { display: none; }
  .topbar__profile { padding: 4px; }

  /* Content */
  .content { padding: 14px 14px 20px; }

  /* KPI */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .kpi { padding: 13px 13px 11px; gap: 8px; }
  .kpi__value { font-size: 18px; }
  .kpi__label { font-size: 11px; }
  .kpi__spark { display: none; }

  /* Dashboard grid */
  .dash-grid { gap: 10px; }
  .span-5, .span-7, .span-12 { grid-column: span 12; }
  .donut-wrap { flex-direction: column; }
  .chart-wrap { height: 160px; }

  /* Page head */
  .page-head { flex-direction: column; gap: 10px; margin-bottom: 14px; }
  .page-title { font-size: 20px; }
  .page-actions { flex-wrap: wrap; gap: 6px; }
  .page-actions .btn--ghost:not(:last-child) { display: none; }

  /* Modal: slide up from bottom */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUpModal 0.22s ease;
  }
  @keyframes slideUpModal { from { transform: translateY(100%); } to { transform: translateY(0); } }

  /* Patient split: stacked */
  .view--split { grid-template-columns: 1fr; min-height: unset; }
  .patient-detail {
    position: fixed; inset: 0;
    max-height: 100vh; max-height: 100dvh;
    border-radius: 0; z-index: 800;
    box-shadow: none;
  }
  .pd__back-btn {
    display: flex; align-items: center; gap: 6px;
    background: transparent; border: none;
    color: var(--accent); font-size: 13.5px; font-weight: 600;
    cursor: pointer; padding: 0; margin-bottom: 10px;
  }

  /* Patient table: simplify columns */
  .pt-row { grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; padding: 12px 14px; }
  .pt-row > :nth-child(2),
  .pt-row > :nth-child(6) { display: none; }
  .pt-row--head > :nth-child(2),
  .pt-row--head > :nth-child(6) { display: none; }

  /* Receivables table */
  .rcv-row { grid-template-columns: 1.5fr 1fr 1fr; gap: 8px; font-size: 12px; }
  .rcv-row > :nth-child(2),
  .rcv-row > :nth-child(4),
  .rcv-row > :nth-child(6) { display: none; }

  /* Appointment block */
  .appt { grid-template-columns: 60px 4px 1fr 22px; gap: 8px; padding: 10px; }
  .appt__meta { display: none; }

  /* Forms: single column */
  .form-row { grid-template-columns: 1fr; gap: 10px; }

  /* Filters bar */
  .filters-bar { flex-direction: column; align-items: flex-start; }
}
