/* ============================================================
   Ewreka Graft Pro — design system
   Single source of truth for the whole UI. No page-local CSS.
   ============================================================ */

/* Inter (SIL OFL), self-hosted: no third-party font request, KVKK-friendly. */
@font-face { font-family:'Inter'; font-style:normal; font-display:swap; font-weight:100 900;
  src:url('../fonts/web/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Inter'; font-style:normal; font-display:swap; font-weight:100 900;
  src:url('../fonts/web/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  --brand: #0e7490;
  --brand-600: #0b6680;
  --brand-50: #e9f5f7;
  --ink: #15222d;
  --ink-2: #384653;
  --muted: #66727e;
  --muted-2: #98a2ac;
  --line: #e1e6e5;
  --line-2: #eef1f0;
  --bg: #f3f5f4;
  --card: #ffffff;
  --danger: #c8372d;
  --danger-bg: #fdf1f0;
  --success: #0f8a5f;
  --success-bg: #ebf7f1;
  --warn: #b26a00;
  --warn-bg: #fdf6e7;
  --info: #2563eb;
  --info-bg: #eef4ff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(21,34,45,.04);
  --shadow-lg: 0 12px 40px rgba(21,34,45,.16);
  --sidebar-w: 236px;
  --topbar-h: 60px;
}
@supports (background: color-mix(in srgb, red 50%, white)) {
  :root {
    --brand-50: color-mix(in srgb, var(--brand) 9%, white);
    --brand-600: color-mix(in srgb, var(--brand) 86%, black);
    --brand-100: color-mix(in srgb, var(--brand) 18%, white);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.55 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-feature-settings: 'cv11', 'ss03';
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
img { max-width: 100%; }
button { font: inherit; }
input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--muted-2); }

/* ---------------- Layout ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: #0b1526; color: #cbd5e1; flex-shrink: 0;
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 50;
  transition: transform .2s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px; min-height: var(--topbar-h);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand img { max-height: 30px; max-width: 140px; border-radius: 4px; }
.sidebar-brand .name { font-weight: 700; font-size: 14.5px; color: #fff; line-height: 1.25; }
.sidebar-brand .sub { font-size: 10.5px; color: #7c8aa0; letter-spacing: .02em; }
.sidebar nav { padding: 10px; flex: 1; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; color: #aab8cc; padding: 9px 12px;
  border-radius: 8px; font-size: 13.5px; font-weight: 500; margin-bottom: 1px;
}
.sidebar nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.sidebar .powered { padding: 12px 18px; font-size: 10.5px; color: #5c6b82; border-top: 1px solid rgba(255,255,255,.07); }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 40;
}
.topbar .burger { display: none; }
.topbar-search { position: relative; flex: 1; max-width: 420px; }
.topbar-search input {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px;
  padding: 8px 12px 8px 34px; font-size: 13.5px;
}
.topbar-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-2); }
.topbar-search .results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; display: none;
}
.topbar-search .results.open { display: block; }
.topbar-search .results a { display: block; padding: 9px 14px; color: var(--ink); border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.topbar-search .results a:hover, .topbar-search .results a.sel { background: var(--bg); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.iconbtn {
  position: relative; background: none; border: 0; cursor: pointer; color: var(--muted);
  width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
}
.iconbtn:hover { background: var(--bg); color: var(--ink); }
.iconbtn svg { width: 19px; height: 19px; }
.iconbtn .dot {
  position: absolute; top: 6px; right: 6px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 99px;
  background: var(--danger); color: #fff; font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.userchip { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 10px; cursor: pointer; border: 0; background: none; }
.userchip:hover { background: var(--bg); }
.avatar {
  width: 30px; height: 30px; border-radius: 99px; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0;
}
.userchip .meta { text-align: left; line-height: 1.2; }
.userchip .meta b { display: block; font-size: 12.5px; }
.userchip .meta span { font-size: 11px; color: var(--muted); }

.content { padding: 22px; max-width: 1440px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 19px; }
.page-head .spacer { flex: 1; }

/* ---------------- Cards ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.card-head h3 { font-size: 14px; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 2px; letter-spacing: -.02em; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--brand); color: #fff; border: 1px solid transparent; border-radius: 10px;
  padding: 8px 15px; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: filter .12s;
}
.btn:hover { filter: brightness(1.08); }
.btn svg { width: 15px; height: 15px; }
.btn-outline { background: var(--card); color: var(--ink-2); border-color: var(--line); }
.btn-outline:hover { background: var(--bg); filter: none; }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-50); filter: none; }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 11px 22px; font-size: 14.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------------- Forms ---------------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  padding: 8.5px 12px; font-size: 13.5px; transition: border-color .12s, box-shadow .12s;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,116,144,.13); }
.input.err { border-color: var(--danger); }
textarea.input { resize: vertical; min-height: 74px; }
.input-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); }
.field-error { color: var(--danger); font-size: 12px; margin-top: 3px; }
.colorinput { width: 42px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; }

/* ---------------- Badges / status ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.badge .swatch { width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--info-bg); color: #2563eb; }
.badge-brand { background: var(--brand-50); color: var(--brand); }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--card);
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.rowlink { cursor: pointer; }

.pagination { display: flex; align-items: center; gap: 6px; padding: 12px 14px; flex-wrap: wrap; }
.pagination .info { color: var(--muted); font-size: 12.5px; margin-right: auto; }
.pagination a, .pagination span.pg {
  min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2); font-size: 12.5px; padding: 0 8px;
}
.pagination a:hover { background: var(--bg); }
.pagination .cur { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------------- Empty / loading states ---------------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--muted-2); margin-bottom: 8px; }
.empty .t { font-weight: 600; color: var(--ink-2); font-size: 14px; }
.empty p { font-size: 13px; margin-top: 3px; }
.skeleton { background: linear-gradient(90deg, var(--line-2) 25%, #e9eef3 50%, var(--line-2) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 99px; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100;
  display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  animation: pop .16s ease;
}
.modal.modal-lg { max-width: 760px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; }
.modal-head h3 { font-size: 15px; }
.modal-head .x { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------- Toast ---------------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: pop .18s ease; max-width: 360px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabpane { display: none; padding-top: 16px; }
.tabpane.active { display: block; }

/* ---------------- Dropdown ---------------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 190px; padding: 5px; display: none; z-index: 60;
}
.dropdown-menu.open { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; width: 100%; text-align: left; background: none; border: 0; padding: 8px 11px;
  border-radius: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; align-items: center; gap: 8px;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); }
.dropdown-menu .danger { color: var(--danger); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }

/* ---------------- Alerts ---------------- */
.alert { padding: 11px 15px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-success { background: var(--success-bg); color: #065f46; border-color: #a7f3d0; }
.alert-error { background: var(--danger-bg); color: #991b1b; border-color: #fecaca; }
.alert-warn { background: var(--warn-bg); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--info-bg); color: #1e40af; border-color: #bfdbfe; }

/* ---------------- Patient profile ---------------- */
.profile-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.profile-avatar {
  width: 76px; height: 76px; border-radius: 16px; background: var(--brand-50); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; flex-shrink: 0;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-meta { flex: 1; min-width: 220px; }
.profile-meta h1 { font-size: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-sub { color: var(--muted); font-size: 13px; margin-top: 3px; display: flex; gap: 14px; flex-wrap: wrap; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

/* ---------------- Photo gallery ---------------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ph {
  position: relative; border-radius: 10px; overflow: hidden; background: var(--line-2); cursor: pointer;
  aspect-ratio: 1; border: 2px solid transparent;
}
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .cap {
  position: absolute; inset: auto 0 0 0; background: linear-gradient(transparent, rgba(0,0,0,.72));
  color: #fff; font-size: 10.5px; padding: 14px 8px 6px; line-height: 1.3;
}
.ph .check { position: absolute; top: 6px; left: 6px; display: none; }
.ph.selectable .check { display: block; }
.ph.sel-before { border-color: #f59e0b; }
.ph.sel-after { border-color: var(--success); }
.ph .selflag {
  position: absolute; top: 6px; right: 6px; font-size: 10px; font-weight: 700; color: #fff;
  padding: 2px 7px; border-radius: 99px; display: none;
}
.ph.sel-before .selflag { display: block; background: #f59e0b; }
.ph.sel-after .selflag { display: block; background: var(--success); }

.dropzone {
  border: 2px dashed var(--line); border-radius: 12px; padding: 26px; text-align: center; color: var(--muted);
  cursor: pointer; transition: border-color .15s, background .15s; font-size: 13.5px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.upload-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 12.5px; }
.upload-item .bar { flex: 1; height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.upload-item .bar i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }

/* ---------------- Lightbox ---------------- */
.lightbox { position: fixed; inset: 0; background: rgba(8,12,22,.94); z-index: 300; display: none; flex-direction: column; }
.lightbox.open { display: flex; }
.lightbox .lb-top { display: flex; align-items: center; gap: 10px; padding: 12px 18px; color: #cbd5e1; font-size: 13px; }
.lightbox .lb-top .spacer { flex: 1; }
.lightbox .lb-top a, .lightbox .lb-top button { color: #fff; background: rgba(255,255,255,.1); border: 0; border-radius: 8px; padding: 7px 13px; cursor: pointer; font-size: 12.5px; }
.lightbox .lb-main { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 56px; position: relative; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox .nav {
  position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.1); color: #fff;
  border: 0; width: 42px; height: 42px; border-radius: 99px; font-size: 20px; cursor: pointer;
}
.lightbox .nav:hover { background: rgba(255,255,255,.22); }
.lightbox .nav.prev { left: 10px; } .lightbox .nav.next { right: 10px; }

/* ---------------- Before/After compare ---------------- */
.ba-slider { position: relative; overflow: hidden; border-radius: 12px; user-select: none; background: #000; }
.ba-slider img { display: block; width: 100%; pointer-events: none; }
.ba-slider .after-wrap { position: absolute; inset: 0; overflow: hidden; }
.ba-slider .after-wrap img { position: absolute; inset: 0; height: 100%; width: 100%; object-fit: cover; }
.ba-slider .base { width: 100%; height: 100%; object-fit: cover; }
.ba-slider .handle {
  position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; cursor: ew-resize; z-index: 5;
  box-shadow: 0 0 8px rgba(0,0,0,.5);
}
.ba-slider .handle::after {
  content: '⇔'; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 36px; height: 36px; background: #fff; border-radius: 99px; display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.ba-tag { position: absolute; top: 10px; z-index: 4; background: rgba(0,0,0,.62); color: #fff; padding: 3px 11px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.ba-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ba-grid-2 img, .ba-stack img { width: 100%; border-radius: 10px; display: block; }
.ba-stack { display: grid; gap: 10px; }

/* ---------------- Kanban ---------------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kcol { background: var(--line-2); border-radius: 12px; min-width: 252px; width: 252px; flex-shrink: 0; }
.kcol-head { padding: 10px 13px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.kcol-head .cnt { margin-left: auto; color: var(--muted); font-size: 11.5px; background: var(--card); border-radius: 99px; padding: 1px 8px; }
.kcol-body { padding: 4px 8px 10px; min-height: 44px; max-height: 68vh; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.kcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; cursor: grab;
  font-size: 12.5px; box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.kcard b { display: block; font-size: 13px; }
.kcard .sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.kcard.dragging { opacity: .5; }
.kcol-body.over { outline: 2px dashed var(--brand); outline-offset: -4px; border-radius: 10px; }

/* ---------------- Calendar ---------------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-head h2 { font-size: 15.5px; min-width: 160px; }
.cal-month { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--line); border-top: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cal-dow { background: var(--line-2); font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-cell { background: var(--card); min-height: 96px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px 6px; font-size: 11.5px; cursor: pointer; }
.cal-cell:hover { background: #fafbfc; }
.cal-cell .d { font-weight: 600; color: var(--muted); font-size: 11px; }
.cal-cell.today .d { color: #fff; background: var(--brand); border-radius: 99px; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.cal-cell.other { background: #fafbfd; color: var(--muted-2); }
.cal-evt { display: block; margin-top: 3px; padding: 2px 6px; border-radius: 6px; background: var(--brand-50); color: var(--brand); font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--brand); }
.cal-evt.st-confirmed { background: var(--info-bg); color: #2563eb; border-left-color: #2563eb; }
.cal-evt.st-arrived, .cal-evt.st-completed { background: var(--success-bg); color: var(--success); border-left-color: var(--success); }
.cal-evt.st-no_show { background: var(--warn-bg); color: var(--warn); border-left-color: var(--warn); }
.cal-evt.st-cancelled { background: var(--danger-bg); color: var(--danger); text-decoration: line-through; border-left-color: var(--danger); }
.cal-list .evt-row { display: flex; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line-2); align-items: center; font-size: 13.5px; }
.cal-list .evt-time { font-weight: 700; min-width: 46px; }

/* ---------------- Timeline ---------------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 16px; font-size: 13px; }
.tl-item::before { content: ''; position: absolute; left: -20px; top: 5px; width: 9px; height: 9px; border-radius: 99px; background: var(--brand); border: 2px solid var(--card); }
.tl-item .when { color: var(--muted); font-size: 11.5px; }

/* ---------------- Notes ---------------- */
.note-item { border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-bottom: 9px; font-size: 13px; background: var(--card); }
.note-item.important { border-color: #fcd34d; background: var(--warn-bg); }
.note-item .meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11.5px; margin-bottom: 4px; flex-wrap: wrap; }
.note-item .content { white-space: pre-wrap; word-break: break-word; }

/* ---------------- Charts ---------------- */
.chart-wrap { position: relative; width: 100%; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 8px; }
.bars .bar { flex: 1; background: var(--brand); border-radius: 5px 5px 0 0; min-height: 2px; position: relative; opacity: .9; }
.bars .bar:hover { opacity: 1; }
.bars .bar .v { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); font-weight: 600; }
.bars-x { display: flex; gap: 6px; margin-top: 5px; }
.bars-x span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12.5px; }
.hbar .lbl { width: 130px; text-align: right; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { flex: 1; background: var(--line-2); height: 18px; border-radius: 6px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--brand); border-radius: 6px; min-width: 2px; }
.hbar .num { width: 44px; font-weight: 600; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.donut-legend .li { display: flex; align-items: center; gap: 8px; }
.donut-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .n { margin-left: auto; font-weight: 600; }
.meter { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.meter i.warn { background: var(--warn); }
.meter i.danger { background: var(--danger); }

/* ---------------- Login ---------------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background:
  linear-gradient(160deg, #f0f9ff 0%, var(--bg) 45%, #f8fafc 100%); }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo .name { font-size: 21px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.auth-logo .name span { color: var(--brand); }
.auth-logo .tag { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.auth-foot { text-align: center; color: var(--muted-2); font-size: 11.5px; margin-top: 18px; }

/* ---------------- Misc ---------------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt0{margin-top:0}.mt1{margin-top:8px}.mt2{margin-top:14px}.mt3{margin-top:22px}
.mb1{margin-bottom:8px}.mb2{margin-bottom:14px}
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.w100 { width: 100%; }
.hide { display: none !important; }
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.filterbar .field { margin-bottom: 0; min-width: 130px; }
.overdue { color: var(--danger); font-weight: 600; }
.clickable { cursor: pointer; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 45; }
  .main { margin-left: 0; }
  .topbar .burger { display: inline-flex; }
  .content { padding: 14px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 120px 1fr; }
  .cal-month { display: none; }
  .stat .value { font-size: 20px; }
  .hbar .lbl { width: 90px; }
  .modal-backdrop { padding: 12px 8px; }
}
@media (max-width: 560px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .topbar-search { max-width: none; }
  .userchip .meta { display: none; }
  .page-head h1 { font-size: 17px; }
}

@media print {
  .sidebar, .topbar, .quick-actions, .btn { display: none !important; }
  .main { margin: 0; }
}

/* ============================================================
   v1.1 — brand & polish
   ============================================================ */

/* Logo lockup */
.brand-mark { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; }
.brand-lockup { display: flex; flex-direction: column; line-height: 1.12; }
.brand-lockup .ew { font-size: 8.5px; font-weight: 600; letter-spacing: .42em; color: #8fa3b8; text-transform: uppercase; }
.brand-lockup .gp { font-size: 17px; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.brand-lockup .gp .pro { color: #38bdf8; font-weight: 800; font-style: normal; }

/* ewreka signature (dark footers): label | divider | logo in original colors */
.sidebar .powered { display: flex; flex-direction: column; gap: 10px; }
.ewreka-sig { display: inline-flex; align-items: center; gap: 10px; opacity: .92; }
.ewreka-sig:hover { opacity: 1; }
.ewreka-sig .lbl {
  text-align: right; font-size: 8.5px; font-weight: 600; letter-spacing: .14em;
  line-height: 1.55; color: #7c8aa0; text-transform: uppercase; white-space: nowrap;
}
.ewreka-sig .sep { width: 1px; height: 26px; background: rgba(255,255,255,.16); flex-shrink: 0; }
.ewreka-sig img { height: 30px; width: auto; display: block; }
.ewreka-sig .ewfb { color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -.02em; }

/* Buttons: subtle depth */
.btn { background: linear-gradient(180deg, var(--brand-600), var(--brand)); box-shadow: 0 1px 2px rgba(15,23,42,.12); }
.btn-outline, .btn-ghost { background: var(--card); box-shadow: none; }
.btn-ghost { background: transparent; }
.btn:focus-visible, .input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Cards & stats polish */
.card { border-radius: 14px; }
.stat { position: relative; overflow: hidden; }
.stat::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: linear-gradient(180deg, var(--brand-600), var(--brand)); opacity: .85; border-radius: 0 4px 4px 0;
}
.topbar { box-shadow: 0 1px 0 rgba(15,23,42,.03); }

/* Integrations */
.intg-ico {
  width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center;
  justify-content: center; flex-shrink: 0;
}

/* ---- Auth split layout ---- */
.auth-split {
  display: grid; grid-template-columns: 1.05fr 1fr; width: 100%; max-width: 880px;
  background: var(--card); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}
.auth-brandpane {
  background: linear-gradient(160deg, #0b1526 0%, #0e3a4a 70%, #0e7490 130%);
  color: #cbd5e1; padding: 44px 40px; display: flex; flex-direction: column;
}
.auth-lockup { display: flex; align-items: center; gap: 14px; }
.auth-lockup img { width: 54px; height: 54px; border-radius: 14px; }
.auth-lockup .ew { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .45em; color: #8fa3b8; text-transform: uppercase; margin-bottom: 4px; }
.auth-lockup .gp { display: block; font-size: 27px; font-weight: 800; color: #fff; letter-spacing: -.02em; line-height: 1.1; }
.auth-lockup .gp .pro, .auth-logo-sm .gp .pro { color: #38bdf8; font-style: normal; }
.auth-brandpane .tag { color: #8fa0b8; font-size: 13.5px; margin-top: 10px; }
.auth-points { list-style: none; padding: 0; margin: 30px 0 0; }
.auth-points li { position: relative; padding: 7px 0 7px 28px; font-size: 13.5px; color: #b6c4d8; }
.auth-points li::before {
  content: '✓'; position: absolute; left: 0; top: 7px; width: 18px; height: 18px; border-radius: 99px;
  background: rgba(34,211,238,.16); color: #22d3ee; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.auth-brand-foot { margin-top: auto; padding-top: 30px; }
.auth-formpane { padding: 44px 40px; }
.auth-logo-sm { display: none; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-logo-sm img { width: 38px; height: 38px; border-radius: 10px; }
.auth-logo-sm .ew { display: block; font-size: 9px; font-weight: 600; letter-spacing: .38em; color: var(--muted); text-transform: uppercase; }
.auth-logo-sm .gp { display: block; font-size: 18px; font-weight: 800; color: var(--ink); }
@media (max-width: 760px) {
  .auth-split { grid-template-columns: 1fr; max-width: 420px; }
  .auth-brandpane { display: none; }
  .auth-logo-sm { display: flex; }
  .auth-formpane { padding: 28px 24px; }
}

/* ===================================================================
   v1.2 — role editor, cron monitor, demo request pipeline, state chips
   =================================================================== */

/* --- permission catalogue -------------------------------------------------- */
.perm-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0; }
.perm-group + .perm-group { margin-top: 14px; }
.perm-group legend { padding: 0 6px; font-size: 13px; display: flex; align-items: center; gap: 6px; width: 100%; }
.perm-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 4px; border-radius: 6px; cursor: pointer; }
.perm-row:hover { background: var(--line-2); }
.perm-row input[type="checkbox"] { margin-top: 3px; flex: 0 0 auto; }
.perm-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.perm-title { font-size: 13.5px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.perm-desc { line-height: 1.4; }
.badge-sm { font-size: 10px; padding: 1px 6px; }
.risk-low { background: var(--line-2); color: var(--muted); }
.risk-med { background: var(--info-bg); color: #2563eb; }
.risk-high { background: var(--warn-bg); color: var(--warn); }
.risk-crit { background: var(--danger-bg); color: var(--danger); }

/* --- generic states -------------------------------------------------------- */
.empty-state { text-align: center; padding: 32px 20px; }
.state-dot { width: 8px; height: 8px; border-radius: 99px; display: inline-block; margin-right: 6px; }
.state-ok { background: var(--success); }
.state-warn { background: var(--warn); }
.state-bad { background: var(--danger); }
.state-idle { background: var(--muted-2); }
.skeleton { background: linear-gradient(90deg, var(--line-2) 25%, var(--line) 37%, var(--line-2) 63%);
            background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 6px; height: 14px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* --- cron monitor ---------------------------------------------------------- */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px; }
.metric .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.metric .v { font-size: 19px; font-weight: 650; color: var(--ink); margin-top: 3px; }
.metric .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.metric.bad { border-color: #fecaca; background: var(--danger-bg); }
.metric.warn { border-color: #fde68a; background: var(--warn-bg); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.secret-mask { letter-spacing: .18em; }

/* --- pipeline (demo requests) ---------------------------------------------- */
.pipe { display: flex; gap: 6px; flex-wrap: wrap; }
.pipe .p { padding: 5px 11px; border-radius: 99px; font-size: 12.5px; border: 1px solid var(--line);
           background: var(--card); color: var(--ink-2); text-decoration: none; }
.pipe .p.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pipe .p .n { opacity: .7; margin-left: 4px; }

/* --- timeline -------------------------------------------------------------- */
.tl { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); margin-left: 6px; }
.tl li { position: relative; padding: 0 0 14px 16px; }
.tl li::before { content: ''; position: absolute; left: -5px; top: 5px; width: 8px; height: 8px;
                 border-radius: 99px; background: var(--brand); }
.tl .when { font-size: 11.5px; color: var(--muted); }
.tl .who { font-weight: 600; font-size: 12.5px; }
.tl .what { font-size: 13px; color: var(--ink-2); margin-top: 1px; }

/* ============================================================
   Before/After composer & template editor (v1.3)
   ============================================================ */
.ba-steps { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px; }
.ba-steps button {
  border:1px solid var(--line); background:var(--card); color:var(--muted);
  border-radius:999px; padding:7px 15px; font-size:13px; font-weight:600; cursor:pointer;
  transition:background .15s, color .15s, border-color .15s;
}
.ba-steps button:hover { border-color:var(--muted-2); color:var(--ink-2); }
.ba-steps button.active { background:var(--brand); border-color:var(--brand); color:#fff; }
.ba-steps button[disabled] { opacity:.45; cursor:not-allowed; }

.ba-workspace { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(300px,.85fr); gap:18px; align-items:start; }
@media (max-width: 1100px) { .ba-workspace { grid-template-columns:1fr; } }

.ba-preview-col { position:sticky; top:calc(var(--topbar-h) + 14px); }
.ba-preview-frame {
  position:relative; background:
    linear-gradient(45deg,#eef1f4 25%,transparent 25%,transparent 75%,#eef1f4 75%),
    linear-gradient(45deg,#eef1f4 25%,#fff 25%,#fff 75%,#eef1f4 75%);
  background-size:18px 18px; background-position:0 0, 9px 9px;
  border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; min-height:180px;
  display:flex; align-items:center; justify-content:center;
}
.ba-preview-frame img { display:block; width:100%; height:auto; }
.ba-preview-frame .ba-preview-busy {
  position:absolute; inset:0; display:none; align-items:center; justify-content:center;
  background:rgba(255,255,255,.62); font-size:12px; color:var(--muted); gap:8px;
}
.ba-preview-frame.busy .ba-preview-busy { display:flex; }

/* --- framing stage: drag to pan, wheel to zoom --- */
.ba-frames { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
@media (max-width: 640px) { .ba-frames { grid-template-columns:1fr; } }
.ba-stage {
  position:relative; overflow:hidden; background:#0f172a; border-radius:var(--radius-sm);
  cursor:grab; touch-action:none; user-select:none; aspect-ratio:4/5;
}
.ba-stage.dragging { cursor:grabbing; }
.ba-stage img { position:absolute; max-width:none; pointer-events:none; }
.ba-stage::after {
  content:''; position:absolute; inset:0; pointer-events:none;
  background:
    linear-gradient(to right, transparent 33.2%, rgba(255,255,255,.20) 33.2%, rgba(255,255,255,.20) 33.5%, transparent 33.5%,
                    transparent 66.4%, rgba(255,255,255,.20) 66.4%, rgba(255,255,255,.20) 66.7%, transparent 66.7%),
    linear-gradient(to bottom, transparent 33.2%, rgba(255,255,255,.20) 33.2%, rgba(255,255,255,.20) 33.5%, transparent 33.5%,
                    transparent 66.4%, rgba(255,255,255,.20) 66.4%, rgba(255,255,255,.20) 66.7%, transparent 66.7%);
  opacity:0; transition:opacity .15s;
}
.ba-stage.dragging::after { opacity:1; }
.ba-stage-head { display:flex; align-items:center; gap:8px; margin-bottom:6px; font-size:12px; font-weight:700; color:var(--muted); }
.ba-zoom-row { display:flex; align-items:center; gap:8px; margin-top:8px; }
.ba-zoom-row input[type=range] { flex:1; }
.ba-zoom-val { font-size:12px; font-variant-numeric:tabular-nums; color:var(--muted); min-width:38px; text-align:right; }

/* --- design controls --- */
.ba-fieldset { border:1px solid var(--line); border-radius:var(--radius-sm); padding:12px 14px; margin-bottom:12px; }
.ba-fieldset > h4 { margin:0 0 10px; font-size:12px; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); }
.ba-ctrl { display:grid; grid-template-columns:1fr auto; gap:8px; align-items:center; padding:6px 0; }
.ba-ctrl + .ba-ctrl { border-top:1px solid var(--line-2); }
.ba-ctrl label { font-size:13px; color:var(--ink-2); }
.ba-ctrl .hint { grid-column:1/-1; font-size:11px; color:var(--muted); margin-top:-2px; }
.ba-ctrl input[type=color] { width:42px; height:28px; padding:0; border:1px solid var(--line); border-radius:6px; background:none; cursor:pointer; }
.ba-ctrl .input-sm { max-width:170px; }
.ba-color-pair { display:flex; align-items:center; gap:6px; }
.ba-color-pair input[type=text] { width:88px; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12px; }

.ba-presets { display:grid; grid-template-columns:repeat(auto-fill,minmax(104px,1fr)); gap:8px; }
.ba-preset {
  border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--card);
  padding:0; cursor:pointer; overflow:hidden; text-align:left;
}
.ba-preset:hover { border-color:var(--brand); }
.ba-preset.active { border-color:var(--brand); box-shadow:0 0 0 2px var(--brand-50); }
.ba-preset .sw { height:34px; display:block; }
.ba-preset .nm { display:block; padding:5px 7px; font-size:11px; font-weight:600; color:var(--ink-2); line-height:1.25; }


/* ---- v1.5 patient card additions ---- */
.ph.selected { outline: 3px solid var(--brand); outline-offset: -3px; }
.btn-active { background: var(--brand) !important; color: #fff !important; border-color: var(--brand) !important; }
.tl-ico { display: inline-block; width: 1.4em; text-align: center; }
.consent-row:first-of-type { border-top: 0 !important; }
.ph { position: relative; }
.ph .dropdown-menu a { display: block; padding: 7px 12px; font-size: 13px; color: var(--text); text-decoration: none; }
.ph .dropdown-menu a:hover { background: var(--line-2); }
.ba-slider .handle::after { content: '⇔'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; color: #111; border-radius: 50%; width: 30px; height: 30px; line-height: 30px; text-align: center; font-size: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.kv dd button.btn-ghost { padding: 0 6px; margin-left: 4px; }
.table td.overdue, .overdue { color: var(--danger); font-weight: 600; }
.bulk-bar { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; z-index: 5; }
.kcard .kcard-status { display: none; }
@media (max-width: 760px) { .kcard .kcard-status { display: block; margin-top: 6px; } .kanban { flex-direction: column; } .kcol { min-width: 0 !important; width: 100% !important; } }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-week .cal-day { border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 140px; background: var(--card); }
.cal-week .cal-day h4 { font-size: 12px; margin: 0 0 6px; color: var(--muted); }
.cal-week .cal-day.today { border-color: var(--brand); }
.cal-day-list .evt-row { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .cal-week { grid-template-columns: 1fr; } }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }
.cal-dayview .evt-row b { flex: 1; }
.cal-week .cal-evt { display: block; white-space: normal; }
@media (max-width: 760px) { .cal-month { display: none; } .cal-week, .cal-dayview { display: block; } }

/* v1.5 — small screens: grid cells must never be wider than the viewport */
.grid > * { min-width: 0; }
.bars .bar { min-width: 0; }
@media (max-width: 560px) {
  .grid-3 { grid-template-columns: 1fr; }
  .flex { flex-wrap: wrap; }
  .card-pad { padding: 14px; }
  .hbar .lbl { width: 70px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .table-wrap { max-width: 100%; }
  .page-head h1 { font-size: 18px; }
  .btn-group .btn { padding-left: 8px; padding-right: 8px; }
}

.modal.modal-xl { max-width:1040px; }
.ba-frames.ba-frames-3 { grid-template-columns:repeat(3,1fr); }
@media (max-width: 900px) { .ba-frames.ba-frames-3 { grid-template-columns:1fr; } }
/* ============================================================
   CRM board (v1.6)
   ============================================================ */
.i { width:16px; height:16px; flex-shrink:0; vertical-align:-3px; }
.crm-head { display:flex; align-items:flex-end; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
.crm-head h1 { font-size:22px; }
.crm-head .btn .i { width:15px; height:15px; margin-right:2px; }
.crm-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.crm-kpi { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:12px 16px; display:flex; flex-direction:column; gap:2px; color:inherit; box-shadow:var(--shadow); }
.crm-kpi span { font-size:11.5px; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
.crm-kpi b { font-size:24px; font-weight:700; letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
.crm-kpi.is-warn b { color:var(--danger); }
.crm-kpi.is-good b { color:var(--success); }
a.crm-kpi:hover { border-color:var(--muted-2); }
.crm-bar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:10px; }
.crm-phases { display:inline-flex; background:var(--card); border:1px solid var(--line); border-radius:11px; padding:3px; gap:2px; }
.crm-phases a { padding:7px 13px; border-radius:8px; font-size:13px; font-weight:600; color:var(--muted); white-space:nowrap; }
.crm-phases a em { font-style:normal; font-size:11px; font-weight:700; color:var(--muted-2); background:var(--line-2); border-radius:99px; padding:1px 7px; margin-left:3px; }
.crm-phases a.active { background:var(--ink); color:#fff; }
.crm-phases a.active em { background:rgba(255,255,255,.16); color:#e2e8f0; }
.crm-phases a:not(.active):hover { color:var(--ink); }
.crm-filters { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.crm-filters select { width:auto; min-width:120px; }
.crm-search { display:flex; align-items:center; gap:6px; background:var(--card); border:1px solid var(--line); border-radius:var(--radius-sm); padding:0 10px; color:var(--muted); }
.crm-search input { border:0; outline:0; background:transparent; padding:7px 0; width:190px; font-size:13px; }
.crm-search:focus-within { border-color:var(--brand); box-shadow:0 0 0 3px rgba(14,116,144,.12); }
.crm-quick { display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-bottom:14px; }
.crm-pill { border:1px solid var(--line); background:var(--card); color:var(--ink-2); border-radius:99px; padding:4px 12px; font-size:12px; font-weight:600; cursor:pointer; }
.crm-pill.on { background:var(--brand-50); border-color:var(--brand); color:var(--brand); }
.crm-clear { display:inline-flex; align-items:center; gap:4px; font-size:12px; font-weight:600; color:var(--muted); padding:4px 8px; }
.crm-clear .i { width:13px; height:13px; }

.crm-board { display:flex; gap:12px; overflow-x:auto; padding:2px 2px 16px; align-items:flex-start; scroll-snap-type:x proximity; min-height:60vh; }
.crm-col { --c:#94a3b8; flex:0 0 288px; background:#eef2f6; border-radius:14px; display:flex; flex-direction:column; max-height:calc(100vh - var(--topbar-h) - 120px); position:relative; scroll-snap-align:start; transition:background .15s, box-shadow .15s; }
.crm-col::before { content:''; position:absolute; top:0; left:14px; right:14px; height:3px; border-radius:0 0 3px 3px; background:var(--c); }
.crm-col.over { background:#e3f2f5; box-shadow:inset 0 0 0 2px var(--brand); }
.crm-col-head { display:flex; align-items:center; gap:8px; padding:14px 12px 10px 14px; }
.crm-dot { width:8px; height:8px; border-radius:99px; background:var(--c); flex-shrink:0; }
.crm-col-head h2 { font-size:13px; font-weight:700; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.crm-count { margin-left:auto; font-size:11.5px; font-weight:700; color:var(--ink-2); background:#fff; border-radius:99px; padding:1px 8px; font-variant-numeric:tabular-nums; }
.crm-col-toggle { border:0; background:none; color:var(--muted-2); cursor:pointer; padding:2px; border-radius:6px; display:flex; }
.crm-col-toggle:hover { background:#fff; color:var(--ink); }
.crm-col-toggle .i { transform:rotate(180deg); width:14px; height:14px; }
.crm-col-body { padding:2px 10px 12px; overflow-y:auto; display:flex; flex-direction:column; gap:8px; min-height:60px; }
.crm-col.is-collapsed { flex-basis:46px; cursor:pointer; }
.crm-col.is-collapsed .crm-col-head { flex-direction:column; padding:14px 0; gap:10px; }
.crm-col.is-collapsed .crm-col-head h2 { writing-mode:vertical-rl; transform:rotate(180deg); }
.crm-col.is-collapsed .crm-count { margin:0; }
.crm-col.is-collapsed .crm-col-toggle .i { transform:none; }
.crm-col.is-collapsed .crm-col-body, .crm-col.is-collapsed .crm-add { display:none; }
.crm-empty { text-align:center; font-size:12px; color:var(--muted-2); padding:18px 6px; border:1.5px dashed #d7dee7; border-radius:10px; }
.crm-more { text-align:center; font-size:12px; font-weight:600; color:var(--muted); padding:8px; border-radius:8px; }
.crm-more:hover { background:#fff; color:var(--brand); }

.crm-card { background:#fff; border:1px solid #e3e8ef; border-radius:11px; padding:11px 12px 10px; box-shadow:0 1px 2px rgba(15,23,42,.05); cursor:pointer; transition:box-shadow .15s, transform .15s, border-color .15s; outline:none; }
.crm-card:hover { box-shadow:0 6px 18px rgba(15,23,42,.10); border-color:#d3dae4; }
.crm-card:focus-visible { box-shadow:0 0 0 3px rgba(14,116,144,.3); }
.crm-card.has-overdue { box-shadow:inset 3px 0 0 var(--danger), 0 1px 2px rgba(15,23,42,.05); }
.crm-card.dragging { opacity:.45; transform:rotate(1.5deg); }
.crm-card.is-saving { opacity:.6; pointer-events:none; }
.crm-card.just-moved { animation:crm-flash .9s ease; }
.crm-card.is-filtered { display:none; }
@keyframes crm-flash { 0% { box-shadow:0 0 0 3px rgba(16,185,129,.55); } 100% { box-shadow:0 1px 2px rgba(15,23,42,.05); } }
.crm-card-top { display:flex; align-items:flex-start; gap:9px; }
.crm-av { --h:200; width:32px; height:32px; border-radius:99px; flex-shrink:0; display:inline-flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; letter-spacing:.02em; background:hsl(var(--h) 60% 92%); color:hsl(var(--h) 45% 30%); }
.crm-card-id { min-width:0; flex:1; }
.crm-name { display:block; font-weight:650; font-size:13.5px; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:1.3; }
.crm-name:hover { color:var(--brand); }
.crm-meta { display:block; font-size:11.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.crm-age { display:inline-flex; align-items:center; gap:3px; font-size:11px; font-weight:600; color:var(--muted-2); white-space:nowrap; padding-top:2px; }
.crm-age .i { width:12px; height:12px; }
.crm-age.is-warn { color:var(--warn); }
.crm-age.is-bad { color:var(--danger); }
.crm-chips { display:flex; flex-wrap:wrap; gap:4px; margin-top:8px; }
.crm-chip { --t:#64748b; font-size:10.5px; font-weight:600; padding:2px 7px; border-radius:6px; color:var(--t); background:color-mix(in srgb, var(--t) 12%, #fff); }
.crm-chip-src { --t:#475569; background:#f1f5f9; }
.crm-next { display:flex; flex-direction:column; gap:3px; margin-top:8px; }
.crm-ev { display:inline-flex; align-items:center; gap:5px; font-size:11.5px; color:var(--ink-2); }
.crm-ev .i { width:13px; height:13px; color:var(--muted); }
.crm-ev.is-bad { color:var(--danger); font-weight:600; } .crm-ev.is-bad .i { color:var(--danger); }
.crm-ev.is-warn { color:var(--warn); font-weight:600; } .crm-ev.is-warn .i { color:var(--warn); }
.crm-card-foot { display:flex; align-items:center; gap:6px; margin-top:9px; padding-top:8px; border-top:1px solid var(--line-2); }
.crm-owner { display:inline-flex; align-items:center; gap:6px; font-size:11.5px; color:var(--muted); min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; }
.crm-owner i { --h:200; font-style:normal; width:18px; height:18px; border-radius:99px; font-size:8.5px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; background:hsl(var(--h) 55% 90%); color:hsl(var(--h) 45% 30%); flex-shrink:0; }
.crm-owner em { font-style:normal; color:var(--warn); font-weight:600; }
.crm-acts { display:flex; gap:2px; opacity:.55; transition:opacity .15s; }
.crm-card:hover .crm-acts { opacity:1; }
.crm-acts a { width:26px; height:26px; border-radius:7px; display:inline-flex; align-items:center; justify-content:center; color:var(--muted); }
.crm-acts a:hover { background:var(--brand-50); color:var(--brand); }
.crm-acts .i { width:15px; height:15px; }
.crm-board.is-compact .crm-chips, .crm-board.is-compact .crm-card-foot, .crm-board.is-compact .crm-meta { display:none; }
.crm-board.is-compact .crm-card { padding:8px 10px; }
.crm-board.is-compact .crm-av { width:24px; height:24px; font-size:10px; }
.crm-board.is-compact .crm-next { margin-top:4px; }

.crm-add { padding:0 10px 8px; }
.crm-add-open { width:100%; display:flex; align-items:center; justify-content:center; gap:6px; border:1.5px dashed #cdd6e1; background:transparent; color:var(--muted); border-radius:10px; padding:8px; font-size:12.5px; font-weight:600; cursor:pointer; }
.crm-add-open:hover { border-color:var(--brand); color:var(--brand); background:#fff; }
.crm-add-form { background:#fff; border:1px solid var(--line); border-radius:10px; padding:10px; display:flex; flex-direction:column; gap:7px; box-shadow:var(--shadow); }
.crm-add-row { display:flex; gap:6px; }
.crm-add-row .input { min-width:0; }
.crm-add-dup { font-size:12px; background:var(--warn-bg); border-radius:8px; padding:8px; }
.crm-add-dup ul { margin:4px 0 8px; padding-left:16px; }

.crm-snack { position:fixed; left:50%; bottom:24px; transform:translateX(-50%); background:#0f172a; color:#fff; border-radius:12px; padding:10px 12px 10px 16px; display:flex; align-items:center; gap:14px; font-size:13px; box-shadow:0 12px 32px rgba(15,23,42,.35); z-index:300; animation:crm-up .2s ease; }
.crm-snack button { background:rgba(255,255,255,.12); color:#fff; border:0; border-radius:8px; padding:6px 12px; font-weight:700; cursor:pointer; }
.crm-snack button:hover { background:rgba(255,255,255,.22); }
.crm-snack.out { opacity:0; transition:opacity .3s; }
@keyframes crm-up { from { transform:translate(-50%, 12px); opacity:0; } }

.crm-drawer { position:fixed; inset:0; z-index:200; pointer-events:none; visibility:hidden; transition:visibility 0s .22s; }
.crm-drawer-scrim { position:absolute; inset:0; background:rgba(15,23,42,.32); opacity:0; transition:opacity .2s; }
.crm-drawer-panel { position:absolute; top:0; right:0; bottom:0; width:min(440px, 100vw); background:var(--card); box-shadow:-12px 0 40px rgba(15,23,42,.18); transform:translateX(100%); transition:transform .22s ease; overflow-y:auto; padding:22px 22px 30px; }
.crm-drawer.open { pointer-events:auto; visibility:visible; transition:none; }
.crm-drawer.open .crm-drawer-scrim { opacity:1; }
.crm-drawer.open .crm-drawer-panel { transform:none; }
.crm-drawer-x { position:absolute; top:14px; right:14px; border:0; background:var(--line-2); width:32px; height:32px; border-radius:99px; cursor:pointer; display:flex; align-items:center; justify-content:center; color:var(--muted); }
.crm-drawer-x:hover { color:var(--ink); }
.crm-drawer-loading { display:flex; justify-content:center; padding:60px 0; }
.pk-head { display:flex; align-items:center; gap:12px; margin-bottom:16px; padding-right:40px; }
.pk-head h2 { font-size:18px; }
.pk-av { width:48px; height:48px; border-radius:99px; object-fit:cover; font-size:16px; }
.pk-stage { margin-bottom:12px; }
.pk-stage label { display:block; margin-bottom:4px; }
.pk-actions { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:16px; }
.pk-facts { display:grid; grid-template-columns:1fr 1fr; gap:10px 14px; margin:0 0 14px; padding:14px; background:var(--bg); border-radius:10px; }
.pk-facts dt { font-size:11px; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:.03em; }
.pk-facts dd { margin:2px 0 0; font-size:13px; word-break:break-word; }
.pk-sec { border-top:1px solid var(--line-2); padding-top:14px; margin-top:14px; }
.pk-sec h3 { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin-bottom:10px; }
.pk-row { display:flex; gap:10px; align-items:flex-start; padding:5px 0; font-size:13px; }
.pk-ico { width:22px; text-align:center; }
.text-danger { color:var(--danger); }
.pk-note { display:flex; flex-direction:column; gap:6px; align-items:flex-end; margin-bottom:10px; }
.pk-note textarea { width:100%; }
.pk-noteitem { background:var(--bg); border-radius:10px; padding:9px 11px; margin-bottom:7px; font-size:13px; }
.pk-noteitem.is-imp { background:var(--warn-bg); }
.pk-noteitem p { margin-bottom:3px; }
.pk-tl { list-style:none; margin:0; padding:0; }
.pk-tl li { display:flex; gap:10px; padding:6px 0; font-size:12.5px; }
.pk-tl-ico { width:22px; height:22px; border-radius:99px; background:var(--line-2); display:inline-flex; align-items:center; justify-content:center; font-size:11px; flex-shrink:0; }

@media (max-width: 980px) { .crm-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) {
  .crm-head h1 { font-size:19px; }
  .crm-bar { flex-direction:column; align-items:stretch; }
  .crm-phases { overflow-x:auto; max-width:100%; }
  .crm-filters { width:100%; }
  .crm-search { flex:1 1 100%; } .crm-search input { width:100%; }
  .crm-filters select { flex:1 1 30%; min-width:0; }
  .crm-board { scroll-snap-type:x mandatory; }
  .crm-col { flex-basis:84vw; max-height:none; }
  .crm-kpi { padding:8px 12px; } .crm-kpi b { font-size:19px; } .crm-kpi span { font-size:10px; }
  .crm-kpis { gap:8px; margin-bottom:12px; }
  .crm-head p { display:none; }
  .crm-board { margin:0 -12px; padding:2px 12px 16px; }
}

/* Patient list (v1.6) */
.crm-views { margin-left:6px; }
.crm-views a { padding:6px 12px; font-size:12.5px; }
.plist-filters { padding:12px 14px; margin-bottom:14px; }
.plist-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.plist-row select { width:auto; max-width:220px; }
.plist-search { flex:1 1 240px; max-width:360px; } .plist-search input { width:100%; }
.plist-more { display:grid; grid-template-columns:repeat(auto-fill, minmax(170px, 1fr)); gap:10px; margin-top:12px; padding-top:12px; border-top:1px solid var(--line-2); }
.plist-more .field { margin:0; }
.plist-active { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-top:10px; }
.plist-chip { display:inline-flex; align-items:center; gap:6px; background:var(--brand-50); color:var(--brand); border:1px solid #bae6f0; border-radius:99px; padding:2px 6px 2px 10px; font-size:12px; font-weight:600; }
.plist-chip span { width:16px; height:16px; border-radius:99px; display:inline-flex; align-items:center; justify-content:center; background:rgba(14,116,144,.12); }
.plist-chip:hover span { background:var(--brand); color:#fff; }
.plist-who { display:flex; align-items:center; gap:10px; }
.plist-name { font-weight:650; color:var(--ink); }
.plist-name:hover { color:var(--brand); }
.plist-phone { display:inline-flex; align-items:center; gap:8px; font-variant-numeric:tabular-nums; }
.plist-wa { font-size:10px; font-weight:800; color:#16a34a; background:#dcfce7; border-radius:6px; padding:1px 5px; }
.ta-r { text-align:right; }
#patientTable td { vertical-align:middle; }
@media (max-width: 760px) { .plist-row select { flex:1 1 45%; max-width:none; } .plist-search { max-width:none; flex-basis:100%; } .crm-views { margin-left:0; } }

/* Patient card header (v1.6) */
.btn .i { width:15px; height:15px; margin-right:1px; }
.btn-icon { padding:6px 8px; }
.btn.is-blocked { opacity:.5; }
.btn-wa:hover { color:#16a34a; border-color:#86efac; }
.profile-side { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.profile-side select { width:auto; max-width:240px; }
.ptrack { margin-top:16px; padding-top:14px; border-top:1px solid var(--line-2); }
.ptrack-bar { display:flex; gap:3px; }
.ptrack-bar span { flex:1; height:6px; border-radius:99px; background:var(--line); }
.ptrack-bar span.done { background:color-mix(in srgb, var(--c) 55%, #fff); }
.ptrack-bar span.cur { background:var(--c); box-shadow:0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.ptrack.is-lost .ptrack-bar span { background:#fde2e2; }
.ptrack-text { display:flex; align-items:center; gap:6px; margin-top:8px; font-size:13px; flex-wrap:wrap; }
.ptrack-age { margin-left:auto; display:inline-flex; align-items:center; gap:4px; font-size:12px; }
.ptrack-age .i { width:13px; height:13px; }

/* ============================================================
   Before/After editor (v1.7) — full-screen, single screen
   ============================================================ */
body.is-editor { overflow: hidden; background: #e8ebf0; }
.bae { position: fixed; inset: 0; display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.bae [hidden] { display: none !important; }
.bae-top { height: 56px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--card); border-bottom: 1px solid var(--line); z-index: 3; }
.bae-iconbtn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; flex: none; }
.bae-iconbtn svg { width: 20px; height: 20px; }
.bae-iconbtn:hover:not(:disabled) { background: var(--line-2); color: var(--ink); }
.bae-iconbtn:disabled { opacity: .35; cursor: default; }
.bae-iconbtn.sm { width: 30px; height: 30px; border-radius: 8px; }
.bae-iconbtn.sm svg { width: 16px; height: 16px; }
.bae-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; margin-right: 6px; }
.bae-title b { font-size: 14px; }
.bae-title span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.bae-formats { display: flex; align-items: center; gap: 4px; padding: 3px; background: var(--line-2); border-radius: 11px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.bae-formats::-webkit-scrollbar { display: none; }
.bae-fmt { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer; white-space: nowrap; font-size: 13px; font-weight: 600; }
.bae-fmt i { display: inline-block; height: 14px; width: calc(14px * var(--r)); max-width: 22px; border: 1.6px solid currentColor; border-radius: 2.5px; opacity: .7; }
.bae-fmt i.dash { border-style: dashed; }
.bae-fmt em { font-style: normal; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.bae-fmt:hover { color: var(--ink); }
.bae-fmt.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.bae-fmt.active i { opacity: 1; color: var(--brand); }
.bae-custom { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; }
.bae-custom input { width: 66px; height: 30px; border: 1px solid var(--line); border-radius: 7px; padding: 0 6px; font-size: 13px; background: var(--card); }
.bae-custom b { color: var(--muted); font-weight: 500; }
.bae-spacer { flex: 1; }
.bae-history { display: flex; gap: 2px; }
.bae-save { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 8px rgba(14,116,144,.28); flex: none; }
.bae-save svg { width: 18px; height: 18px; }
.bae-save:hover:not(:disabled) { filter: brightness(1.08); }
.bae-save:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.bae-body { flex: 1; min-height: 0; display: flex; }
.bae-rail { width: 76px; flex: none; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; z-index: 2; }
.bae-rail button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.bae-rail button svg { width: 22px; height: 22px; }
.bae-rail button:hover { color: var(--ink); background: var(--line-2); }
.bae-rail button.active { color: var(--brand); background: var(--brand-50); }

.bae-panel { width: 0; flex: none; overflow: hidden; background: var(--card); border-right: 1px solid var(--line); transition: width .18s ease; z-index: 1; }
.bae.panel-open .bae-panel { width: 340px; }
.bae-sec { display: none; width: 340px; height: 100%; overflow-y: auto; padding: 16px 18px 28px; overscroll-behavior: contain; }
.bae-sec.active { display: block; }
.bae-sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.bae-sec-head h2 { font-size: 16px; flex: 1; }
.bae-sec h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }
.bae-group { border-top: 1px solid var(--line-2); margin-top: 16px; padding-top: 2px; display: flex; flex-direction: column; gap: 8px; }
.bae-group .btn { align-self: flex-start; }
.bae-link { border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 12.5px; cursor: pointer; padding: 4px 2px; }
.bae-note { font-size: 12.5px; color: var(--ink-2); background: var(--info-bg); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.bae-note.warn { background: var(--warn-bg); color: #92400e; }
.bae-hint { font-size: 12px; color: var(--muted); }
.bae-empty { padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }

.bae-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.bae-chip { height: 28px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.bae-chip:hover { border-color: var(--muted-2); }
.bae-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.bae-tpls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bae-tpls.empty::before { content: attr(data-empty); grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.bae-tpl { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; }
.bae-tpl canvas { width: 100%; height: auto; display: block; border-radius: 8px; background: var(--line-2); box-shadow: 0 0 0 1px var(--line); transition: box-shadow .12s, transform .12s; }
.bae-tpl:not(.ready) canvas { aspect-ratio: 4 / 5; }
.bae-tpl:hover canvas { box-shadow: 0 0 0 2px var(--muted-2), 0 6px 16px rgba(15,23,42,.12); transform: translateY(-1px); }
.bae-tpl.active canvas { box-shadow: 0 0 0 3px var(--brand), 0 6px 16px rgba(14,116,144,.2); }
.bae-tpl .nm { font-size: 12px; font-weight: 600; color: var(--ink-2); line-height: 1.3; }
.bae-tpl.active .nm { color: var(--brand); }
.bae-tpl .own { position: absolute; top: 6px; right: 8px; color: var(--brand); font-size: 12px; text-shadow: 0 0 3px #fff; }

.bae-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bae-slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 6px 8px; border: 1.5px dashed var(--line); border-radius: 10px; background: var(--card); cursor: pointer; font-size: 12px; color: var(--ink-2); }
.bae-slot .img { width: 100%; aspect-ratio: 4 / 5; border-radius: 6px; background: var(--line-2) center / cover no-repeat; }
.bae-slot i { font-style: normal; font-size: 10.5px; color: var(--muted); line-height: 1; }
.bae-slot.filled { border-style: solid; }
.bae-slot.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); color: var(--brand); }
.bae-slots.wants-mid .bae-slot[data-slot=mid] { border-color: var(--warn); }
#baeSlotHint { margin: 8px 0 10px; }
.bae-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bae-photo { position: relative; padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--line-2); aspect-ratio: 1; }
.bae-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bae-photo .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 5px 3px; font-size: 10.5px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); text-align: left; }
.bae-photo .flag { position: absolute; top: 5px; left: 5px; font-size: 10px; font-weight: 700; color: #fff; background: var(--brand); padding: 1px 6px; border-radius: 99px; }
.bae-photo .flag:empty { display: none; }
.bae-photo.picked { box-shadow: inset 0 0 0 3px var(--brand); }
.bae-photo:hover img { opacity: .88; }

.bae-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; border-radius: 9px; }
.bae-field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.bae-field input:not([type=range]) { height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 11px; background: var(--card); font-size: 14px; width: 100%; min-width: 0; }
.bae-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.bae-field small { font-size: 11.5px; color: var(--muted); }
.bae-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bae-prefix { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.bae-prefix span { padding: 0 4px 0 11px; color: var(--muted); }
.bae-prefix input { border: 0 !important; box-shadow: none !important; padding-left: 2px !important; }
.bae-prefix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.bae-ig { margin: 0 0 4px 46px; }
.bae-switch { display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; padding: 4px 0; border-radius: 8px; }
.bae-switch input { position: absolute; opacity: 0; pointer-events: none; }
.bae-switch span { width: 36px; height: 21px; flex: none; border-radius: 99px; background: #cbd5e1; position: relative; transition: background .15s; }
.bae-switch span::after { content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.bae-switch input:checked + span { background: var(--brand); }
.bae-switch input:checked + span::after { transform: translateX(15px); }
.bae-switch input:disabled + span { opacity: .45; }
.bae-switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-50); }
.flash { animation: bae-flash 1.1s ease; }
@keyframes bae-flash { 0%, 40% { background: #fef3c7; box-shadow: 0 0 0 6px #fef3c7; } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }
.bae-seg { display: inline-flex; padding: 2px; background: var(--line-2); border-radius: 8px; }
.bae-seg label { cursor: pointer; }
.bae-seg input { position: absolute; opacity: 0; }
.bae-seg span { display: block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.bae-seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }

.bae-swatches { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.bae-sw { position: relative; aspect-ratio: 1; border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: var(--c); box-shadow: inset 0 0 0 1px rgba(15,23,42,.14); }
.bae-sw.brand { grid-column: span 3; aspect-ratio: auto; height: 100%; min-height: 34px; border-radius: 99px; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.bae-sw.active { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--brand); }
.bae-sw.pick { background: conic-gradient(#f43f5e, #f59e0b, #84cc16, #06b6d4, #6366f1, #d946ef, #f43f5e); overflow: hidden; }
.bae-sw.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.bae-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bae-colors label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 9px; padding: 5px 8px; cursor: pointer; }
.bae-colors input { width: 26px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 6px; }
.bae-fonts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bae-fonts button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); cursor: pointer; font-size: 20px; line-height: 1.1; color: var(--ink); }
.bae-fonts small { font: 600 10.5px/1 Inter, sans-serif; color: var(--muted); }
.bae-fonts button.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-50); }
.bae-fonts button.active small { color: var(--brand); }
.bae-field input[type=range] { width: 100%; accent-color: var(--brand); }

/* stage */
.bae-stage { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: #e8ebf0 radial-gradient(rgba(15,23,42,.07) 1px, transparent 1px) 0 0 / 18px 18px; padding-bottom: 58px; }
.bae-artboard { position: relative; box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 12px 40px rgba(15,23,42,.18); background: #fff; touch-action: none; user-select: none; -webkit-user-select: none; }
.bae-artboard canvas { display: block; touch-action: none; }
.bae-artboard.dragging canvas { cursor: grabbing !important; }
.bae-hover, .bae-sel { position: absolute; pointer-events: none; transform-origin: center; box-sizing: border-box; }
.bae-hover { border: 1.5px dashed rgba(14,165,233,.95); border-radius: 4px; }
.bae-hover.text { border-style: solid; border-color: rgba(14,165,233,.8); background: rgba(14,165,233,.06); }
.bae-shapes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.bae-shapes polygon { fill: none; }
.bae-shapes .hov { stroke: rgba(14,165,233,.95); stroke-width: 1.5; stroke-dasharray: 5 4; }
.bae-shapes .sel { stroke: #0ea5e9; stroke-width: 2; }
.bae-sel.poly, .bae-hover.poly { border: 0 !important; box-shadow: none !important; background: none !important; overflow: visible; }
.bae-sel.poly::before, .bae-hover.poly::before { white-space: nowrap; }
.bae-sel { border: 2px solid #0ea5e9; box-shadow: 0 0 0 1px rgba(255,255,255,.7); }
.bae-sel::before, .bae-hover.photo::before { content: attr(data-label); position: absolute; left: 6px; top: 6px; font: 700 11px/1 Inter, sans-serif; color: #fff; background: #0ea5e9; padding: 4px 7px; border-radius: 5px; }
.bae-hover.photo:empty::before { content: attr(data-label); }
.bae-artboard.is-sample::after { content: 'ÖRNEK FOTOĞRAF'; position: absolute; left: 50%; top: 10px; transform: translateX(-50%); font: 700 10.5px/1 Inter, sans-serif; letter-spacing: .08em; color: #fff; background: rgba(15,23,42,.72); padding: 5px 9px; border-radius: 99px; pointer-events: none; }
.bae-loading { position: absolute; top: 14px; right: 16px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.bae-loading.on { opacity: 1; }
.bae-float { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 14px; background: var(--card); border-radius: 12px; box-shadow: 0 6px 24px rgba(15,23,42,.18); z-index: 2; white-space: nowrap; }
.bae-float b { font-size: 13px; margin-right: 4px; }
.bae-float input[type=range] { width: 150px; accent-color: var(--brand); }
.bae-zv { font-size: 12px; color: var(--muted); width: 36px; font-variant-numeric: tabular-nums; }
.bae-tbtn { height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.bae-tbtn:hover { border-color: var(--muted-2); color: var(--ink); }
.bae-tbtn.on { background: var(--brand-50); border-color: var(--brand); color: var(--brand); }
.bae-float.warn { box-shadow: 0 0 0 2px var(--warn), 0 6px 24px rgba(15,23,42,.18); }
.bae-float:not([hidden]) ~ .bae-tip { visibility: hidden; }
.bae-tip { position: absolute; left: 0; right: 0; bottom: 20px; text-align: center; font-size: 12px; color: var(--muted); pointer-events: none; }
.bae-done { max-width: 520px; }
.bae-done img { display: block; max-height: 52vh; margin: 0 auto 12px; border-radius: 8px; box-shadow: var(--shadow); }
.bae-done-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

@media (max-width: 1180px) {
  .bae-fmt em { display: none; }
  .bae-title span { max-width: 140px; }
}
@media (max-width: 899px) {
  .bae-top { height: 52px; gap: 6px; padding: 0 6px; }
  .bae-title { display: none; }
  .bae-fmt { padding: 0 9px; height: 32px; font-size: 12.5px; }
  .bae-history { display: none; }
  .bae-save { height: 38px; padding: 0 12px; }
  .bae-save span { display: none; }
  .bae-body { flex-direction: column; }
  .bae-stage { order: 1; padding-bottom: 0; }
  .bae-stage.has-float { padding-bottom: 52px; }
  .bae-panel { order: 2; width: 100% !important; height: 0; border: 0; border-top: 1px solid var(--line); transition: height .2s ease; }
  .bae.panel-open .bae-panel { height: 44vh; height: 44dvh; }
  .bae-sec { width: 100%; padding: 12px 14px 20px; }
  .bae-rail { order: 3; width: 100%; flex-direction: row; justify-content: space-around; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .bae-rail button { flex: 1; padding: 6px 2px; font-size: 11px; }
  .bae-tpls { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .bae-photos { grid-template-columns: repeat(4, 1fr); }
  .bae-tip { display: none; }
  .bae-float { bottom: 10px; padding: 4px 6px 4px 10px; gap: 3px; max-width: calc(100% - 16px); }
  .bae-float input[type=range] { width: 80px; }
  .bae-float b, .bae-zv, #baeFloatClose { display: none; }
  .bae-tbtn { padding: 0 8px; font-size: 12px; }
}

/* signature, logo controls (v1.8) */
.bae-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: linear-gradient(180deg, #fbfcfe, #fff); }
.bae-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.bae-card-head b { flex: 1; font-size: 14px; }
.bae-card .bae-hint { margin-bottom: 10px; }
.bae-kit-btn { width: 100%; margin-top: 10px; justify-content: center; }
.bae-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bae-preset { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 4px 4px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; font-size: 11.5px; color: var(--ink-2); }
.bae-preset b { font-weight: 600; text-align: center; }
.bae-preset:hover { border-color: var(--muted-2); }
.bae-preset.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-50); color: var(--brand); }
.pv { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 40px; border-radius: 6px; background: linear-gradient(180deg, #e9eef5, #d9e1ec); padding: 0 6px 5px; overflow: hidden; }
.pv-solid { background: #e3e9f1; }
.pv-radial { background: radial-gradient(circle at 50% 25%, #f8fafc, #d3dbe7 75%); }
.pv-dots { background: #e6ecf3 radial-gradient(rgba(15,23,42,.22) 1px, transparent 1.3px) 0 0 / 6px 6px; }
.pv-lines { background: #e6ecf3 repeating-linear-gradient(45deg, rgba(15,23,42,.13) 0 1px, transparent 1px 6px); }
.pv-grid { background: #e6ecf3 linear-gradient(rgba(15,23,42,.12) 1px, transparent 1px) 0 0 / 7px 7px, linear-gradient(90deg, rgba(15,23,42,.12) 1px, transparent 1px) 0 0 / 7px 7px; }
.pv-frame { box-shadow: inset 0 0 0 2px #e6ecf3, inset 0 0 0 3px var(--brand); }
.pv-stripe::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brand); }
.pv-corners::before { content: ''; position: absolute; inset: 3px; border: 2px solid var(--brand); clip-path: polygon(0 0, 30% 0, 30% 2px, 2px 2px, 2px 30%, 0 30%, 0 70%, 2px 70%, 2px calc(100% - 2px), 30% calc(100% - 2px), 30% 100%, 70% 100%, 70% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 70%, 100% 70%, 100% 30%, calc(100% - 2px) 30%, calc(100% - 2px) 2px, 70% 2px, 70% 0); }
.pv-blobs::before { content: ''; position: absolute; right: -8px; top: -8px; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); opacity: .25; }
.pv .ph { width: 16px; height: 22px; background: #8b6b55; border-radius: 3px; }
.pv .ph-square { border-radius: 0; }
.pv .ph-rounded { border-radius: 6px; }
.pv .ph-arch { border-radius: 8px 8px 2px 2px; }
.pv .lb { position: absolute; left: 6px; top: 7px; width: 14px; height: 5px; background: var(--brand); border-radius: 99px; }
.pv .lb-tab { border-radius: 1px; }
.pv .lb-outline { background: transparent; box-shadow: inset 0 0 0 1.5px var(--brand); }
.pv .lb-underline { background: #475569; border-radius: 0; box-shadow: 0 2px 0 var(--brand); }
.bae-sigrow h3 { margin-top: 14px; }
.bae-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.bae-opt { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.bae-opt:hover { border-color: var(--muted-2); }
.bae-opt.active { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.bae-opt .ic { width: 16px; height: 16px; border-radius: 4px; background: #cbd5e1; flex: none; }
.ic-labels-pill { border-radius: 99px !important; height: 9px !important; background: currentColor !important; }
.ic-labels-tab { border-radius: 2px !important; height: 9px !important; background: currentColor !important; }
.ic-labels-outline { border-radius: 99px !important; height: 9px !important; background: transparent !important; box-shadow: inset 0 0 0 1.5px currentColor; }
.ic-labels-underline { border-radius: 0 !important; height: 8px !important; background: #94a3b8 !important; box-shadow: 0 2px 0 currentColor; }
.ic-ground-gradient { background: linear-gradient(#e2e8f0, #64748b) !important; }
.ic-ground-solid { background: #94a3b8 !important; }
.ic-ground-radial { background: radial-gradient(circle at 50% 30%, #f1f5f9, #64748b) !important; }
.ic-ground-dots { background: #e2e8f0 radial-gradient(#475569 1px, transparent 1.2px) 0 0 / 4px 4px !important; }
.ic-ground-lines { background: #e2e8f0 repeating-linear-gradient(45deg, #64748b 0 1px, transparent 1px 4px) !important; }
.ic-ground-grid { background: #e2e8f0 linear-gradient(#64748b 1px, transparent 1px) 0 0 / 5px 5px, linear-gradient(90deg, #64748b 1px, transparent 1px) 0 0 / 5px 5px !important; }
.ic-ornament-none { background: transparent !important; box-shadow: inset 0 0 0 1.5px #cbd5e1; }
.ic-ornament-corners { background: transparent !important; border: 2px solid currentColor; clip-path: polygon(0 0,40% 0,40% 30%,30% 30%,30% 40%,0 40%,0 60%,30% 60%,30% 70%,40% 70%,40% 100%,60% 100%,60% 70%,70% 70%,70% 60%,100% 60%,100% 40%,70% 40%,70% 30%,60% 30%,60% 0,100% 0,100% 100%,0 100%); }
.ic-ornament-frame { background: transparent !important; box-shadow: inset 0 0 0 1.5px currentColor; }
.ic-ornament-stripe { background: linear-gradient(currentColor 0 25%, #e2e8f0 25% 75%, currentColor 75%) !important; }
.ic-ornament-blobs { background: radial-gradient(circle at 80% 20%, currentColor 0 30%, transparent 32%), #e2e8f0 !important; }
.ic-shape-auto { background: #94a3b8 !important; border-radius: 4px; }
.ic-shape-square { background: #64748b !important; border-radius: 0 !important; }
.ic-shape-rounded { background: #64748b !important; border-radius: 6px !important; }
.ic-shape-arch { background: #64748b !important; border-radius: 8px 8px 1px 1px !important; }
.bae-fonts .ff { font-size: 20px; line-height: 1.1; color: var(--ink); }
.bae-logo-ctl { display: flex; flex-direction: column; gap: 10px; }
.bae-logo-ctl .bae-field { margin: 0; }
.bae-anchors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.bae-anchor { height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 15px; color: var(--ink-2); cursor: pointer; }
.bae-anchor.auto { grid-column: 1 / -1; font-size: 12.5px; font-weight: 600; }
.bae-anchor:hover { border-color: var(--muted-2); }
.bae-anchor.on { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.bae-anchors.mini { display: inline-grid; grid-template-columns: repeat(3, 24px); grid-auto-rows: 15px; gap: 2px; margin-right: 4px; }
.bae-anchors.mini .bae-anchor { height: 15px; width: 24px; font-size: 10px; line-height: 1; padding: 0; border-radius: 4px; }
.bae-anchors.mini .bae-anchor.auto { display: none; }
#baeLogoSize { width: 110px; accent-color: var(--brand); }
.bae-guide { position: absolute; pointer-events: none; background: #f43f5e; z-index: 2; }
.bae-guide.v { top: 0; bottom: 0; width: 1px; }
.bae-guide.h { left: 0; right: 0; height: 1px; }
.bae-hover.brand { border-style: solid; border-color: rgba(244,63,94,.9); }
@media (max-width: 899px) { #baeLogoSize { width: 70px; } .bae-presets { grid-template-columns: repeat(4, 1fr); } }


/* ============================================================
   v1.8 interface — calm, legible, one accent
   Light navigation, sentence-case labels, flat cards with crisp
   edges, tabular figures, a phone tab bar. Overrides earlier rules.
   ============================================================ */
body { background: var(--bg); color: var(--ink); font-size: 14px; }
::selection { background: var(--brand-100, #cfe8ee); }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---- navigation ---- */
.sidebar { background: #fbfcfc; color: var(--ink-2); border-right: 1px solid var(--line); }
.sidebar-brand { border-bottom: 0; padding: 18px 18px 10px; min-height: 0; }
.sidebar-brand .name { color: var(--ink); font-size: 14.5px; }
.sidebar-brand .sub { color: var(--muted); }
.sidebar-brand img { max-height: 34px; }
.brand-lockup .gp { color: var(--ink); }
.brand-lockup .gp .pro { color: var(--brand); }
.sidebar nav { padding: 6px 12px 12px; }
.sidebar nav a { color: var(--ink-2); padding: 8px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 500; gap: 11px; margin-bottom: 2px; }
.sidebar nav a svg { width: 18px; height: 18px; opacity: 1; color: var(--muted); }
.sidebar nav a:hover { background: #eef1f0; color: var(--ink); }
.sidebar nav a.active { background: var(--brand-50); color: var(--brand); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.sidebar nav a.active svg { color: var(--brand); }
.nav-group { font-size: 11.5px; font-weight: 600; color: var(--muted-2); padding: 16px 10px 6px; letter-spacing: .01em; }
.nav-help { display: flex; align-items: center; gap: 10px; margin: 0 12px 8px; padding: 9px 10px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); }
.nav-help svg { width: 17px; height: 17px; color: var(--brand); }
.nav-help:hover { border-color: var(--muted-2); }
.sidebar .powered { color: var(--muted-2); border-top: 1px solid var(--line); }
.ewreka-sig .lbl { color: var(--muted-2); }
.ewreka-sig .sep { background: var(--line); }
.ewreka-sig .ewfb { color: var(--ink); }

.topbar { height: var(--topbar-h); padding: 0 28px; gap: 14px; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px); box-shadow: none; }
.topbar-search { max-width: 460px; }
.topbar-search input { height: 40px; background: var(--bg); border-color: transparent; border-radius: 10px; font-size: 14px; padding-left: 38px; }
.topbar-search input:focus { background: var(--card); border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-50); }
.topbar-search svg { left: 12px; }
.userchip .meta b { font-weight: 600; }

/* ---- page frame ---- */
.content { padding: 28px 32px 48px; max-width: 1400px; }
.page-head { margin-bottom: 22px; gap: 10px 14px; }
.page-head h1 { font-size: 23px; font-weight: 650; letter-spacing: -.022em; line-height: 1.2; }
.page-head .muted, .page-sub { font-size: 13.5px; color: var(--muted); }

/* ---- surfaces ---- */
.card { border-radius: var(--radius); box-shadow: var(--shadow); border-color: var(--line); }
.card-head { padding: 15px 20px; border-bottom-color: var(--line-2); }
.card-head h3 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.card-pad { padding: 20px; }
.grid { gap: 16px; }
.stat { padding: 18px 20px; }
.stat::before { display: none; }
.stat .label { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.stat .value { font-size: 30px; font-weight: 650; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12.5px; }
.metric .k, .crm-kpi span, .pk-facts dt { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.pk-sec h3, .ba-fieldset > h4 { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink-2); }

/* ---- controls ---- */
.btn { background: var(--brand); box-shadow: 0 1px 1px rgba(21,34,45,.12); border-radius: 9px; padding: 0 15px; height: 38px; font-weight: 600; }
.btn:hover { filter: none; background: var(--brand-600); }
.btn-outline { background: var(--card); color: var(--ink-2); border-color: var(--line); box-shadow: 0 1px 1px rgba(21,34,45,.04); }
.btn-outline:hover { background: var(--card); border-color: var(--muted-2); color: var(--ink); }
.btn-ghost { background: transparent; box-shadow: none; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-50); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a92c23; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.input, select.input, textarea.input { border-radius: 9px; padding: 9px 12px; font-size: 14px; border-color: #d9dfdd; }
select.input { padding-right: 30px; }
.input:hover { border-color: #c5cdca; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.input-sm { padding: 6px 10px; font-size: 13px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field { margin-bottom: 15px; }

/* ---- tables ---- */
.table th { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); background: #fafbfb; padding: 10px 16px; }
.table td { padding: 12px 16px; border-bottom-color: var(--line-2); }
.table tbody tr:hover { background: #f8faf9; }
.table td b { font-weight: 600; }
.pagination .cur { background: var(--ink); border-color: var(--ink); }

/* ---- tabs, badges, alerts ---- */
.tabs { gap: 4px; }
.tabs button { font-size: 14px; padding: 11px 12px; color: var(--muted); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--brand); }
.badge { font-weight: 600; padding: 3px 9px; }
.alert { border-radius: 11px; }
.cal-dow { text-transform: none; font-size: 12px; background: #fafbfb; }
.cal-cell.today .d { background: var(--brand); }
.modal { border-radius: 16px; }
.toast { border-radius: 11px; }

/* ---- mobile tab bar ---- */
.tabbar { display: none; }
@media (max-width: 860px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .burger { display: none; }
  .content { padding: 18px 14px calc(92px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 20px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 0; background: none; color: var(--muted); font: 600 11px/1.1 Inter, sans-serif; border-radius: 10px; cursor: pointer; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--brand); }
  .tabbar a.active svg { color: var(--brand); }
  body.nav-open .tabbar { z-index: 40; }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .stat .value { font-size: 24px; }
  .topbar-right .btn .lbl-wide { display: none; }
}

/* ---- dashboard v1.8 ---- */
.dash { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.dash-main, .dash-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash-head .page-sub { margin-top: 4px; }
.day-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 10px; }
.day-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.015em; flex: 1; display: flex; align-items: center; gap: 8px; }
.day-head .count { font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--line-2); border-radius: 99px; padding: 1px 9px; }
.day { padding-bottom: 8px; }
.day-row { display: grid; grid-template-columns: 64px 4px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 11px 20px; color: var(--ink); text-decoration: none; }
.day-row:hover { background: #f8faf9; }
.day-time { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.day-rail { align-self: stretch; border-radius: 4px; background: var(--brand); min-height: 34px; }
.day-body { display: flex; flex-direction: column; min-width: 0; }
.day-body b { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-body span { font-size: 13px; color: var(--muted); }
.day-who { font-size: 13px; color: var(--muted); white-space: nowrap; }
.day-state { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--brand-50); color: var(--brand); white-space: nowrap; }
.day-row.is-op .day-rail { background: var(--success); }
.day-row.is-op .day-time { color: var(--success); font-size: 13.5px; }
.day-row.st-confirmed .day-rail { background: var(--info); } .day-row.st-confirmed .day-state { background: var(--info-bg); color: var(--info); }
.day-row.st-arrived .day-rail, .day-row.st-completed .day-rail { background: var(--success); }
.day-row.st-arrived .day-state, .day-row.st-completed .day-state { background: var(--success-bg); color: var(--success); }
.day-row.st-no_show .day-rail { background: var(--warn); } .day-row.st-no_show .day-state { background: var(--warn-bg); color: var(--warn); }
.day-row.st-cancelled { opacity: .55; } .day-row.st-cancelled b { text-decoration: line-through; }
.day-row.is-past .day-time, .day-row.is-past .day-body b { color: var(--muted); }
.day-now { position: relative; margin: 4px 20px; height: 18px; display: flex; align-items: center; }
.day-now::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px solid var(--danger); }
.day-now span { position: relative; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.day-empty { padding: 18px 20px 22px; color: var(--ink-2); }
.calls { padding-bottom: 6px; }
.call-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 20px; border-top: 1px solid var(--line-2); }
.call-due { font-size: 12px; font-weight: 600; color: var(--warn); }
.call-due.late { color: var(--danger); }
.call-who { display: flex; flex-direction: column; min-width: 0; color: var(--ink); text-decoration: none; }
.call-who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-who span { font-size: 12.5px; color: var(--muted); }
.call-who:hover b { color: var(--brand); }
.call-act { display: flex; gap: 6px; }
.call-act svg { width: 15px; height: 15px; }
.glance { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.glance a { display: flex; flex-direction: column; padding: 16px 18px; color: var(--ink); text-decoration: none; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.glance a:nth-child(2n) { border-right: 0; }
.glance a:nth-child(n+3) { border-bottom: 0; }
.glance a:hover { background: #f8faf9; }
.glance span { font-size: 13px; color: var(--muted); }
.glance b { font-size: 28px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.glance em { font-style: normal; font-size: 12px; color: var(--muted); }
.glance a.is-alert b { color: var(--danger); }
.journey-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--line-2); }
.journey-bar i { display: block; min-width: 6px; }
.journey-legend { list-style: none; padding: 0; margin: 14px 0 0; }
.journey-legend a { display: flex; align-items: center; gap: 10px; padding: 7px 0; color: var(--ink-2); text-decoration: none; font-size: 13.5px; border-top: 1px solid var(--line-2); }
.journey-legend li:first-child a { border-top: 0; }
.journey-legend a:hover { color: var(--ink); }
.journey-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.journey-legend b { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.journey-legend span { width: 40px; text-align: right; font-size: 12px; color: var(--muted); }
.spark { display: flex; align-items: flex-end; gap: 5px; height: 110px; }
.spark-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; }
.spark-col i { display: block; width: 100%; border-radius: 4px 4px 2px 2px; background: var(--brand-100, #cfe8ee); }
.spark-col.cur i { background: var(--brand); }
.spark-col span { font-size: 10.5px; color: var(--muted); }
.next-list { list-style: none; margin: 0; padding: 4px 0 8px; }
.next-list li { display: flex; gap: 12px; align-items: center; padding: 9px 20px; }
.next-list .nd { width: 42px; height: 42px; border-radius: 10px; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); line-height: 1.1; flex: none; }
.next-list .nd b { font-size: 16px; color: var(--ink); }
.next-list li > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.next-list em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.usage-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.usage-row b { color: var(--ink); font-weight: 600; }
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } .dash-side { display: grid; grid-template-columns: 1fr 1fr; } .dash-side .glance { grid-column: 1 / -1; } }
@media (max-width: 640px) {
  .dash-side { display: flex; }
  .day-row { grid-template-columns: 50px 4px minmax(0, 1fr) auto; gap: 10px; padding: 10px 14px; }
  .day-who { display: none; }
  .day-head { padding: 14px 14px 8px; }
  .call-row { grid-template-columns: minmax(0, 1fr) auto; padding: 9px 14px; }
  .call-due { grid-column: 1 / -1; margin-bottom: -6px; }
  .call-act .lbl { display: none; }
  .dash-head .btn { display: none; }
  .glance b { font-size: 24px; }
}

/* ---- patient list v1.8 ---- */
@media (min-width: 761px) { .plist-row select { max-width: 180px; } .plist-search { flex: 1 1 220px; max-width: 320px; } }
.crm-search { height: 38px; border-color: #d9dfdd; }
.crm-search input { font-size: 14px; }
.crm-head h1 { font-size: 23px; font-weight: 650; letter-spacing: -.022em; }
.crm-av { flex: none; }
@media (max-width: 760px) {
  #patientTable thead { display: none; }
  #patientTable, #patientTable tbody { display: block; }
  #patientTable tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); align-items: center; }
  #patientTable td { padding: 0; border: 0; }
  #patientTable td:first-child:has(.selRow) { grid-row: 1 / span 2; }
  #patientTable td:has(.plist-who) { grid-column: 2 / -1; }
  #patientTable .c-stage { grid-column: 2; }
  #patientTable .c-phone { grid-column: 2 / -1; font-size: 13px; color: var(--muted); }
  #patientTable .c-src, #patientTable .c-cons, #patientTable .c-date { display: none; }
  #patientTable tr:not(:has(.selRow)) td:has(.plist-who), #patientTable tr:not(:has(.selRow)) .c-stage { grid-column: 1 / span 2; }
  .plist-filters { padding: 10px; }
  .plist-row select[name=per_page], .plist-row > .btn[type=submit] { display: none; }
  .plist-row .crm-pill { flex: 1 1 45%; height: 38px; border-radius: 9px; }
}

/* ---- patient header v1.8 ---- */
.profile-meta h1 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
@media (max-width: 640px) {
  .profile-head { gap: 12px; }
  .profile-avatar { width: 56px; height: 56px; border-radius: 14px; }
  .profile-meta { min-width: 0; flex: 1 1 calc(100% - 70px); }
  .profile-meta h1 { font-size: 19px; }
  .profile-sub { gap: 4px 12px; font-size: 12.5px; }
  .profile-sub span { white-space: nowrap; }
  .quick-actions { flex-wrap: nowrap; overflow-x: auto; margin-left: -68px; padding: 4px 2px 6px; scrollbar-width: none; }
  .quick-actions::-webkit-scrollbar { display: none; }
  .quick-actions > * { flex: none; }
  .profile-side { width: 100%; display: flex; gap: 8px; }
  .profile-side select { flex: 1; min-width: 0; }
}

/* ---- phone: stacked tables, compact KPI rows ---- */
@media (max-width: 760px) {
  .table.is-stackable thead { display: none; }
  .table.is-stackable, .table.is-stackable tbody { display: block; width: 100%; }
  .table.is-stackable tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  .table.is-stackable tbody tr:last-child { border-bottom: 0; }
  .table.is-stackable td { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 3px 0; border: 0; text-align: right; white-space: normal; min-height: 0; }
  .table.is-stackable td::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 500; }
  .table.is-stackable td[data-label=""]::before { content: none; }
  .table.is-stackable td[data-label=""] { justify-content: flex-end; }
  .table.is-stackable td:empty { display: none; }
  .table-wrap { overflow-x: visible; }
  .kpi3 { grid-template-columns: repeat(3, 1fr) !important; gap: 8px; }
  .kpi3 .stat { padding: 10px 12px; }
  .kpi3 .stat > div:last-child { font-size: 20px !important; }
}
.fnl-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) 56px 130px; gap: 12px; align-items: center; margin-bottom: 10px; font-size: 13.5px; }
.fnl-bar { height: 22px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.fnl-bar i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.fnl-n { text-align: right; font-variant-numeric: tabular-nums; }
.fnl-pct { text-align: right; color: var(--muted); font-size: 12px; }
@media (max-width: 640px) {
  .fnl-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .fnl-bar { grid-column: 1 / -1; grid-row: 2; height: 14px; }
  .fnl-pct { grid-column: 1 / -1; text-align: left; }
  .fnl-n { grid-row: 1; grid-column: 2; }
}

/* ============================================================
   v1.8.1 — sidebar: logos that work on the light sidebar
   ============================================================ */
.sidebar { overflow: hidden; }
.sidebar-brand { min-width: 0; }
.sidebar-brand > div { min-width: 0; }
.sidebar-brand .name { overflow-wrap: anywhere; }
.sidebar-brand img { max-width: 46%; height: auto; object-fit: contain; flex-shrink: 0; }
/* wide wordmarks get their own row */
.sidebar-brand.is-wide { flex-direction: column; align-items: flex-start; gap: 8px; }
.sidebar-brand.is-wide img { max-width: 100%; max-height: 44px; }
.sidebar-brand.is-wide .name { font-size: 13px; font-weight: 600; color: var(--muted); }
/* light (white) logos are placed on an ink plate so they stay visible */
img.logo-on-dark { background: var(--ink); padding: 7px 10px; border-radius: 9px; box-sizing: content-box; }
.sidebar-brand img.logo-on-dark { max-width: calc(100% - 20px); }
.sidebar-brand:not(.is-wide) img.logo-on-dark { max-width: calc(46% - 20px); }

/* footer: one compact dark card, the ewreka logo is white */
.sidebar .powered {
  margin: 0 12px 12px; padding: 10px 12px; gap: 8px; border: 0; border-radius: 12px;
  background: var(--ink); color: rgba(255,255,255,.62); font-size: 10.5px; min-width: 0;
}
.sidebar .powered > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .ewreka-sig { gap: 9px; max-width: 100%; min-width: 0; }
.sidebar .ewreka-sig .lbl { color: rgba(255,255,255,.55); font-size: 8px; letter-spacing: .12em; }
.sidebar .ewreka-sig .sep { background: rgba(255,255,255,.18); height: 22px; }
.sidebar .ewreka-sig img { height: 24px; max-width: 110px; object-fit: contain; object-position: left center; }
.sidebar .ewreka-sig .ewfb { color: #fff; }
@media (max-height: 760px) {
  .sidebar .nav-group { padding-top: 10px; }
  .sidebar nav a { padding-top: 6px; padding-bottom: 6px; }
  .sidebar .powered { padding: 8px 12px; }
}

/* ============================================================
   v2.0 modules
   ============================================================ */
/* operating-day plan (two weeks) */
.opplan { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .opplan { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) { .opplan { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.opday { display: flex; flex-direction: column; gap: 6px; min-height: 132px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; color: var(--ink); }
.opday:hover { border-color: var(--brand); }
.opday.is-weekend { background: #fafbfa; }
.opday.is-today { box-shadow: inset 0 0 0 2px var(--brand); }
.opday.is-full .opday-cap { color: var(--warn); }
.opday.is-over { border-color: var(--danger); }
.opday.is-over .opday-cap { color: var(--danger); }
.opday-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--muted); }
.opday-head b { color: var(--ink); font-size: 14px; }
.opday-cap { font-weight: 700; font-variant-numeric: tabular-nums; }
.opday .meter { height: 4px; }
.opday-item { font-size: 12px; line-height: 1.35; padding: 6px 7px; border-radius: 7px; background: var(--brand-50); display: flex; flex-direction: column; }
.opday-item span { color: var(--muted); }
.opday-item.is-off { opacity: .5; text-decoration: line-through; }
.opday-check { font-size: 11px; }
.opday-sess { font-size: 11.5px; color: var(--muted); margin-top: auto; }
/* dashboard: today in the clinic */
.v2strip h3 { font-size: 13px; margin-bottom: 10px; color: var(--muted); font-weight: 600; }
.v2grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.v2grid a { display: flex; flex-direction: column; padding: 9px 10px; border-radius: var(--radius-sm); background: var(--line-2); color: var(--ink); }
.v2grid a b { font-size: 19px; font-variant-numeric: tabular-nums; }
.v2grid a span { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.v2grid a.is-alert { background: var(--warn-bg); }
.v2warn { display: block; margin-top: 10px; font-size: 12.5px; color: var(--danger); }
#quoteItems .input-sm { min-width: 0; }
#quoteItems td { padding: 4px 6px; }
/* v2.0 — layout fixes */
.table th.right, .table td.right { text-align: right; }
.grid-wide-side { grid-template-columns: 2fr 1fr; }
.modal-foot { flex-wrap: wrap; }
.q-items { overflow-x: auto; }
.q-items .table { min-width: 560px; }
.card > dl.kv:first-child, .card-pad > dl.kv:first-child { margin-top: 0; }
.table.is-stackable td > .cellv { text-align: right; min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 761px) { .tabs { flex-wrap: wrap; } }
@media (max-width: 760px) {
  .grid-wide-side { grid-template-columns: 1fr; }
  .table-wrap:has(> table:not(.is-stackable)) { overflow-x: auto; }
}
.form-group-title { grid-column: 1 / -1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 6px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.form-group-title:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
