/* ==========================================================================
   DM OS - one stylesheet, five themes (Light, Olive, OLED, Dark, Glass).
   Themes only change the variables below; components never hardcode colours.
   ========================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-xl: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar-w: 252px;
  --tabbar-h: 58px;
  --blur: none;
  --wallpaper: none;
}

/* ------------------------------------------------------------------ Light */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f7;
  --sidebar: rgba(236, 236, 240, .78);
  --card: #ffffff;
  --card-border: rgba(0, 0, 0, .07);
  --raised: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --hairline: rgba(0, 0, 0, .1);
  --fill: rgba(118, 118, 128, .1);
  --fill-strong: rgba(118, 118, 128, .18);
  --input: #ffffff;
  --accent: #0071e3;
  --accent-fg: #ffffff;
  --primary-bg: var(--accent);
  --primary-fg: var(--accent-fg);
  --pos: #1f8a3b;
  --neg: #d70015;
  --warn: #b25000;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 24px rgba(0, 0, 0, .05);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .06), 0 18px 48px rgba(0, 0, 0, .16);
  --bar: rgba(245, 245, 247, .8);
}

/* ------------------------------------------------------------------ Olive */
html[data-theme="olive"] {
  color-scheme: light;
  --bg: #eceee0;
  --sidebar: rgba(224, 228, 207, .82);
  --card: #f9faf2;
  --card-border: rgba(64, 74, 24, .13);
  --raised: #fcfdf6;
  --text: #242816;
  --text-2: #5a6145;
  --text-3: #80866a;
  --hairline: rgba(64, 74, 24, .16);
  --fill: rgba(96, 108, 56, .11);
  --fill-strong: rgba(96, 108, 56, .2);
  --input: #fcfdf6;
  --accent: #5a6e1c;
  --accent-fg: #ffffff;
  --primary-bg: var(--accent);
  --primary-fg: var(--accent-fg);
  --pos: #3a7326;
  --neg: #b3261e;
  --warn: #8f5600;
  --shadow: 0 1px 2px rgba(50, 58, 20, .05), 0 6px 24px rgba(50, 58, 20, .07);
  --shadow-lg: 0 2px 6px rgba(50, 58, 20, .08), 0 18px 48px rgba(50, 58, 20, .2);
  --bar: rgba(236, 238, 224, .82);
}

/* ------------------------------------------------------------------- Dark */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161618;
  --sidebar: rgba(28, 28, 30, .8);
  --card: #222225;
  --card-border: rgba(255, 255, 255, .08);
  --raised: #2c2c2e;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #7c7c82;
  --hairline: rgba(255, 255, 255, .11);
  --fill: rgba(118, 118, 128, .2);
  --fill-strong: rgba(118, 118, 128, .34);
  --input: #1a1a1c;
  --accent: #0a84ff;
  --accent-fg: #ffffff;
  --primary-bg: #0071e3; /* deeper than the accent so white button text passes contrast */
  --primary-fg: #ffffff;
  --pos: #30d158;
  --neg: #ff5a50;
  --warn: #ff9f0a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .22);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .4), 0 18px 48px rgba(0, 0, 0, .55);
  --bar: rgba(22, 22, 24, .8);
}

/* ------------------------------------------------------------------- OLED */
html[data-theme="oled"] {
  color-scheme: dark;
  --bg: #000000;
  --sidebar: #000000;
  --card: #000000;
  --card-border: rgba(255, 255, 255, .16);
  --raised: #0b0b0c;
  --text: #ffffff;
  --text-2: #a1a1a6;
  --text-3: #7c7c82;
  --hairline: rgba(255, 255, 255, .16);
  --fill: rgba(255, 255, 255, .09);
  --fill-strong: rgba(255, 255, 255, .17);
  --input: #000000;
  --accent: #0a84ff;
  --accent-fg: #ffffff;
  --primary-bg: #0071e3; /* deeper than the accent so white button text passes contrast */
  --primary-fg: #ffffff;
  --pos: #30d158;
  --neg: #ff5a50;
  --warn: #ff9f0a;
  --shadow: none;
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, .16), 0 18px 48px rgba(0, 0, 0, .8);
  --bar: rgba(0, 0, 0, .86);
}

/* ------------------------------------------------------------------ Glass */
html[data-theme="glass"] {
  color-scheme: dark;
  --bg: #2c3446;
  --sidebar: rgba(20, 20, 26, .3);
  --card: rgba(20, 20, 26, .42);
  --card-border: rgba(255, 255, 255, .17);
  --raised: rgba(38, 36, 42, .82);
  --text: #ffffff;
  --text-2: rgba(255, 255, 255, .74);
  --text-3: rgba(255, 255, 255, .56);
  --hairline: rgba(255, 255, 255, .17);
  --fill: rgba(255, 255, 255, .1);
  --fill-strong: rgba(255, 255, 255, .19);
  --input: rgba(0, 0, 0, .24);
  --accent: #ff7d45;
  --accent-fg: #1d1206;
  --primary-bg: #ffffff;
  --primary-fg: #1d1d1f;
  --pos: #6fe3a0;
  --neg: #ff8d85;
  --warn: #ffc56b;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 8px 32px rgba(0, 0, 0, .2);
  --shadow-lg: inset 0 1px 0 rgba(255, 255, 255, .12), 0 20px 60px rgba(0, 0, 0, .5);
  --bar: rgba(26, 24, 30, .74);
  --blur: blur(28px) saturate(165%);
  --wallpaper:
    radial-gradient(110% 70% at 12% -5%, #54678a 0%, transparent 58%),
    radial-gradient(80% 55% at 98% 8%, #7f8fb0 0%, transparent 55%),
    radial-gradient(75% 55% at 88% 78%, #cf7d3c 0%, transparent 62%),
    radial-gradient(85% 60% at 5% 100%, #8e3f24 0%, transparent 62%),
    radial-gradient(60% 40% at 45% 58%, #a9623a 0%, transparent 70%),
    linear-gradient(180deg, #2c3446 0%, #57403a 52%, #6f3b25 100%);
}

/* Without backdrop blur, glass panels fall back to a more solid tint so text stays readable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-theme="glass"] {
    --card: rgba(30, 28, 34, .86);
    --sidebar: rgba(30, 28, 34, .88);
    --bar: rgba(30, 28, 34, .94);
  }
}

/* ------------------------------------------------------------------- Base */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font: 15px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

/* Glass wallpaper sits on a fixed layer so it doesn't scroll (and behaves on iOS). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--wallpaper);
  pointer-events: none;
}

/* The wallpaper layer sits behind <body>, so the body itself must be see-through in Glass. */
html[data-theme="glass"] body { background: transparent; }

h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
code { font: .9em var(--font-mono); background: var(--fill); padding: 1px 5px; border-radius: 5px; }
.icon { flex: none; display: block; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}

html.theme-switching *, html.theme-switching *::before {
  transition: background-color .28s var(--ease), border-color .28s var(--ease), color .28s var(--ease) !important;
}

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; padding: 8px 12px; border-radius: 8px; background: var(--primary-bg); color: var(--primary-fg); }
.skip-link:focus { left: 8px; }

.muted { color: var(--text-2); }
.center { text-align: center; }
.label, .nav-label {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ----------------------------------------------------------------- Layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--hairline);
  -webkit-backdrop-filter: blur(30px) saturate(170%);
  backdrop-filter: blur(30px) saturate(170%);
  overflow-y: auto;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 14px; }
.brand-tile {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font: 600 17px/1 var(--font-serif);
}
html[data-theme="glass"] .brand-tile { background: rgba(0, 0, 0, .55); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.brand-name { font: 500 23px/1 var(--font-serif); letter-spacing: -.01em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 18px 10px 7px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 8px 10px;
  border: 0; border-radius: 9px;
  background: none;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s var(--ease);
}
.nav-item .icon { color: var(--text-2); }
.nav-item:hover { background: var(--fill); }
.nav-item.is-active { background: var(--fill-strong); }
.nav-item.is-active .icon { color: var(--text); }
.nav-meta { margin-left: auto; font-size: 12.5px; color: var(--text-3); font-weight: 400; }

.sidebar-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 2px; }

.user-row { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.user-chip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px 8px; border-radius: 10px; }
.user-chip:hover, .user-chip.is-active { background: var(--fill); }
.user-text { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; color: var(--text-3); }

.avatar {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--text);
  font-size: 11.5px; font-weight: 650; letter-spacing: .02em;
}

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 9px;
  background: none; color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--fill); color: var(--text); }

.main-wrap { display: flex; flex-direction: column; min-width: 0; }
.main { width: 100%; max-width: 1000px; margin: 0 auto; padding: 26px 28px 8px; display: flex; flex-direction: column; gap: 14px; flex: 1; }

.mobile-bar, .tabbar { display: none; }

.footer { padding: 22px 16px 20px; text-align: center; font-size: 12px; color: var(--text-3); }

/* ------------------------------------------------------------- Page parts */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-title { font: 700 30px/1.12 var(--font-display); letter-spacing: -.022em; }
.page-sub { margin-top: 4px; color: var(--text-2); font-size: 14px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-spacer { flex: 1; }

.notice {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  font-size: 13.5px;
}
.notice .icon { margin-top: 2px; color: var(--accent); }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--r-md);
  background: var(--card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  font-weight: 600; font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .12s var(--ease), background-color .15s var(--ease), filter .15s var(--ease);
}
.btn:hover { background: color-mix(in srgb, var(--card) 86%, var(--text) 14%); }
.btn:active { transform: scale(.975); }
.btn .icon { color: var(--text-2); }
.btn.is-on { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.is-on .icon { color: var(--accent); }

.btn-primary {
  background: var(--primary-bg);
  color: var(--primary-fg);
  border-color: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.btn-primary .icon { color: inherit; }
.btn-primary:hover { background: var(--primary-bg); filter: brightness(1.08); }
html[data-theme="glass"] .btn-primary:hover { filter: brightness(.94); }
.btn-lg { min-height: 46px; padding: 0 22px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------------ Cards */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.card-pad { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; align-items: baseline; gap: 12px; padding: 18px 20px 4px; }
.card-title { font: 650 17px/1.25 var(--font-display); letter-spacing: -.01em; }
.section-title { font: 650 15px/1.3 var(--font-display); margin-top: 8px; }
.optional { font: 500 10.5px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); margin-left: 6px; }

.count {
  min-width: 22px; height: 22px; padding: 0 7px;
  display: inline-grid; place-items: center;
  border-radius: 11px;
  background: var(--fill-strong);
  font: 600 12px/1 var(--font-mono);
}

/* ------------------------------------------------------------------ Tiles */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile {
  padding: 16px 18px 15px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  min-width: 0;
}
.tile-top { display: flex; align-items: center; justify-content: space-between; color: var(--text-3); }
.tile-value {
  margin-top: 8px;
  font: 700 32px/1.1 var(--font-display);
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
}
.tile-value small { font-size: 17px; font-weight: 600; color: var(--text-3); letter-spacing: -.01em; }
.tile-sub { margin-top: 5px; font-size: 13.5px; color: var(--text-2); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.progress { height: 5px; margin-top: 10px; border-radius: 3px; background: var(--fill-strong); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .6s var(--ease); }

/* ------------------------------------------------------------------ Chart */
.chart-wrap { position: relative; height: 230px; padding: 8px 14px 12px; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 20px 38px; text-align: center; }
.empty .icon { color: var(--text-3); margin-bottom: 4px; }
.empty-title { font-weight: 650; }
.empty .muted { max-width: 380px; font-size: 14px; }
.empty-small { padding: 22px 20px 28px; }

/* ----------------------------------------------------------- Action items */
.action-list { padding: 6px 8px 10px; }
.action-list a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; }
.action-list a:hover { background: var(--fill); }
.ring { width: 17px; height: 17px; flex: none; border: 1.75px solid var(--text-3); border-radius: 50%; }
.action-label { font-weight: 500; flex: 1; min-width: 0; }
.action-meta { font: 500 12px/1.2 var(--font-mono); color: var(--text-3); letter-spacing: .02em; white-space: nowrap; }

/* ---------------------------------------------------------- Quick actions */
.quick {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.quick-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 10px;
  border-radius: 11px;
  background: var(--fill);
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background-color .15s var(--ease);
}
.quick-btn:hover { background: var(--fill-strong); }
.quick-btn .icon { color: var(--text-2); }

/* ------------------------------------------------------------------ Folds */
.fold {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.fold summary { display: flex; align-items: center; gap: 12px; padding: 15px 18px; cursor: pointer; list-style: none; border-radius: var(--r-lg); }
.fold summary::-webkit-details-marker { display: none; }
.fold summary .icon { color: var(--text-3); transition: transform .2s var(--ease); }
.fold[open] summary .icon { transform: rotate(90deg); }
.fold-title { font-weight: 650; }
.fold-meta { color: var(--text-2); font-size: 14px; }
.fold-body { padding: 2px 18px 18px 46px; }

.bar-list { display: flex; flex-direction: column; gap: 9px; }
.bar-list li { display: grid; grid-template-columns: 120px minmax(0, 1fr) 36px; align-items: center; gap: 12px; font-size: 14px; }
.bar-track { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.bar-fill { display: block; height: 100%; min-width: 2px; border-radius: 4px; background: var(--accent); }
.bar-value { text-align: right; font: 500 12.5px var(--font-mono); color: var(--text-2); }

.people { display: flex; flex-direction: column; gap: 10px; }
.people li { display: flex; align-items: center; gap: 10px; }
.people-name { font-weight: 550; }
.people-tz { margin-left: auto; font-size: 13px; color: var(--text-2); text-align: right; }

.badge {
  display: inline-flex; align-items: center;
  height: 21px; padding: 0 8px;
  border-radius: 6px;
  background: var(--fill-strong);
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}
.badge-accent { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.badge-muted { color: var(--text-2); background: var(--fill); }

/* ---------------------------------------------------------------- Popover */
.popover-anchor { position: relative; }
.popover {
  position: absolute; z-index: 30;
  top: calc(100% + 8px); left: 0;
  padding: 12px;
  background: var(--raised);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(40px) saturate(170%);
  backdrop-filter: blur(40px) saturate(170%);
  animation: pop .16s var(--ease);
}
.popover[hidden] { display: none; }
.popover-up { top: auto; bottom: calc(100% + 8px); }
.popover-title { font: 500 10.5px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding: 2px 4px 10px; }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }

/* ----------------------------------------------------------- Theme picker */
.theme-picker { display: flex; gap: 4px; }
.theme-opt {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 6px 5px 4px;
  border: 0; border-radius: 12px;
  background: none;
  color: var(--text-2);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
}
.theme-opt:hover { background: var(--fill); }
.theme-opt[aria-checked="true"] { color: var(--text); font-weight: 650; }
.theme-swatch {
  position: relative;
  width: 54px; height: 38px;
  border-radius: 9px;
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.theme-swatch::before { content: ""; position: absolute; left: 7px; right: 7px; top: 8px; height: 13px; border-radius: 4px; }
.theme-swatch::after { content: ""; position: absolute; left: 7px; bottom: 6px; width: 18px; height: 5px; border-radius: 3px; }
.theme-opt[aria-checked="true"] .theme-swatch { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); border-color: transparent; }
html[data-theme="glass"] .theme-opt[aria-checked="true"] .theme-swatch { box-shadow: 0 0 0 2px rgba(0, 0, 0, .35), 0 0 0 4px #fff; }

.sw-light { background: #f5f5f7; } .sw-light::before { background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); } .sw-light::after { background: #0071e3; }
.sw-olive { background: #dfe3cb; } .sw-olive::before { background: #f9faf2; box-shadow: 0 0 0 1px rgba(64, 74, 24, .14); } .sw-olive::after { background: #5a6e1c; }
.sw-oled { background: #000; } .sw-oled::before { background: #000; box-shadow: 0 0 0 1px rgba(255, 255, 255, .3); } .sw-oled::after { background: #0a84ff; }
.sw-dark { background: #161618; } .sw-dark::before { background: #2c2c2e; } .sw-dark::after { background: #0a84ff; }
.sw-glass { background: linear-gradient(160deg, #54678a 0%, #a8563a 60%, #e58a3a 100%); } .sw-glass::before { background: rgba(255, 255, 255, .26); box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); } .sw-glass::after { background: #fff; }

/* ------------------------------------------------------------------ Forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label, .field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--text-3); line-height: 1.4; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"], input[type="time"],
input[type="datetime-local"], input[type="number"], input[type="url"], input[type="tel"], input:not([type]), select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--input);
  font-size: 16px; /* 16px stops iOS from zooming on focus */
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
textarea { resize: vertical; line-height: 1.4; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select option, select optgroup { background: #fff; color: #1d1d1f; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 28%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; font-weight: 500; cursor: pointer; }
.switch {
  appearance: none; -webkit-appearance: none;
  position: relative; flex: none;
  width: 46px; height: 28px;
  margin: 0;
  border-radius: 14px;
  background: var(--fill-strong);
  cursor: pointer;
  transition: background-color .2s var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .2s var(--ease);
}
.switch:checked { background: var(--pos); }
.switch:checked::after { transform: translateX(18px); }

.radio-stack { display: flex; flex-direction: column; gap: 4px; }
.radio-row { display: flex; align-items: center; gap: 10px; min-height: 38px; font-weight: 500; cursor: pointer; }
.radio-row input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.color-input { width: 44px; height: 30px; padding: 0; border: 1px solid var(--hairline); border-radius: 8px; background: none; cursor: pointer; margin-left: auto; }

.form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.form-actions.start { justify-content: flex-start; }

/* --------------------------------------------------------------- Segmented */
.segmented {
  display: inline-flex; align-self: flex-start; gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--fill-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.segmented a { padding: 6px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.segmented a.is-active { background: var(--raised); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }

/* -------------------------------------------------------------- Row lists */
.row-list li + li { border-top: 1px solid var(--hairline); }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.row:hover { background: var(--fill); }
.row-list li:first-child .row { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.row-list li:last-child .row { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.row-list li:only-child .row { border-radius: var(--r-lg); }
.row > .icon { color: var(--text-3); }
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-title { font-weight: 600; }
.row-sub { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.row-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.back-link { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; color: var(--accent); font-weight: 550; font-size: 14px; }
.back-link .icon { transform: rotate(180deg); }
html[data-theme="glass"] .back-link { color: var(--text); }

.kv { margin: 0; padding: 6px 20px 14px; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; }
.kv > div + div { border-top: 1px solid var(--hairline); }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }

.status-line { display: flex; align-items: flex-start; gap: 12px; }
.status-line.ok > .icon { color: var(--pos); }
.status-line.warn > .icon { color: var(--warn); }
.file-list { display: flex; flex-direction: column; gap: 6px; }

/* ---------------------------------------------------------------- Flashes */
.flashes { display: flex; flex-direction: column; gap: 8px; }
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--card-border);
  background: var(--card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  font-size: 14px; font-weight: 500;
}
.flash .icon { margin-top: 1px; }
.flash-success { border-color: color-mix(in srgb, var(--pos) 45%, transparent); }
.flash-success .icon { color: var(--pos); }
.flash-error { border-color: color-mix(in srgb, var(--neg) 50%, transparent); }
.flash-error .icon { color: var(--neg); }

/* --------------------------------------------------------- Soon / Help pages */
.soon { align-items: flex-start; }
.soon-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 15px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
html[data-theme="glass"] .soon-icon { color: #fff; background: var(--fill-strong); }
.soon-list { display: flex; flex-direction: column; gap: 9px; }
.soon-list li { display: flex; align-items: flex-start; gap: 10px; }
.soon-list .icon { margin-top: 3px; color: var(--pos); }

.phase-list { padding: 6px 8px 10px; }
.phase-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.phase-dot { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--fill-strong); font: 600 12px var(--font-mono); color: var(--text-2); }
.phase-list .is-done .phase-dot { background: var(--pos); color: #fff; }
html[data-theme="glass"] .phase-list .is-done .phase-dot { color: #10301d; }
.phase-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.phase-name { font-weight: 600; }

/* ------------------------------------------------------- Auth / installer */
.auth-body { display: flex; flex-direction: column; }
.auth-wrap { flex: 1; width: 100%; max-width: 420px; margin: 0 auto; padding: 8vh 18px 12px; display: flex; flex-direction: column; gap: 18px; }
.auth-wrap:has(.auth-card-wide) { max-width: 640px; padding-top: 5vh; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth-card { padding: 26px 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-card.center { align-items: center; }
.auth-title { font: 700 25px/1.15 var(--font-display); letter-spacing: -.02em; }
.auth-themes { display: flex; justify-content: center; }
.error-code { font: 700 46px/1 var(--font-display); letter-spacing: -.03em; color: var(--text-3); }
.error-code.ok { color: var(--pos); }
.error-code .icon { margin: 0 auto; }

.check-list { display: flex; flex-direction: column; gap: 2px; }
.check-list li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; }
.check-list li + li { border-top: 1px solid var(--hairline); }
.check-list .is-ok .icon { color: var(--pos); }
.check-list .is-bad .icon { color: var(--neg); }
.check-note { color: var(--text-3); font-size: 12.5px; text-align: right; }
.check-list .is-bad .check-note { color: var(--neg); }
.code { margin: 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--fill); font: 12.5px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ----------------------------------------------------------------- Mobile */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }

  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 20;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--bar);
    border-bottom: 1px solid var(--hairline);
    -webkit-backdrop-filter: blur(24px) saturate(170%);
    backdrop-filter: blur(24px) saturate(170%);
  }
  .mobile-bar .brand { padding: 0; }
  .mobile-bar .brand-name { font-size: 20px; }
  .mobile-bar .brand-tile { width: 27px; height: 27px; font-size: 15px; }

  .main { padding: 16px 14px 4px; gap: 12px; }
  .main-wrap { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .page-title { font-size: 28px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 6px 6px env(safe-area-inset-bottom);
    background: var(--bar);
    border-top: 1px solid var(--hairline);
    -webkit-backdrop-filter: blur(24px) saturate(170%);
    backdrop-filter: blur(24px) saturate(170%);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: none;
    color: var(--text-3);
    font-size: 10.5px; font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
  }
  .tab .icon { width: 23px; height: 23px; }
  .tab.is-active { color: var(--accent); }
  html[data-theme="glass"] .tab.is-active { color: #fff; }

  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile-main { grid-column: 1 / -1; }
  .tile { padding: 14px 15px 13px; }
  .tile-value { font-size: 28px; }

  .toolbar .btn-lg { min-height: 46px; padding: 0 16px; }
  .toolbar-actions .toolbar-spacer { display: none; }
  .toolbar-actions > .btn.btn-primary { order: -1; flex: 1 1 100%; }
  .toolbar-actions > .btn, .toolbar-actions > .popover-anchor { flex: 1 1 0; }
  .toolbar-actions .popover-anchor .btn { width: 100%; }
  .chart-wrap { height: 190px; padding: 6px 8px 10px; }
  .card-head { padding: 16px 16px 4px; }
  .card-pad { padding: 16px; }

  .quick { grid-auto-columns: max-content; overflow-x: auto; scrollbar-width: none; }
  .quick::-webkit-scrollbar { display: none; }
  .quick-btn { padding: 0 14px; }

  .fold summary { padding: 14px 14px; flex-wrap: wrap; row-gap: 2px; }
  .fold-body { padding: 2px 14px 16px 14px; }
  .bar-list li { grid-template-columns: 96px minmax(0, 1fr) 32px; gap: 10px; font-size: 13.5px; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .row-hide-sm { display: none; }
  .popover { left: auto; right: 0; }
  .toolbar .popover { left: 0; right: auto; }
  .people-tz { font-size: 12px; }
  .footer { padding: 16px 16px 14px; }
}

@media (max-width: 380px) {
  .theme-swatch { width: 46px; height: 34px; }
  .theme-opt { padding: 6px 3px 4px; font-size: 11.5px; }
}

/* ------------------------------------------------------------ Bottom sheet */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end;
  background: rgba(0, 0, 0, .38);
  animation: fade .2s var(--ease);
}
.sheet-backdrop[hidden] { display: none; }
.sheet {
  width: 100%;
  max-height: 86dvh; overflow-y: auto;
  padding: 8px 12px calc(14px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: var(--raised);
  border-top: 1px solid var(--card-border);
  -webkit-backdrop-filter: blur(40px) saturate(170%);
  backdrop-filter: blur(40px) saturate(170%);
  box-shadow: var(--shadow-lg);
  animation: rise .28s var(--ease);
}
.sheet-grab { width: 38px; height: 5px; margin: 4px auto 10px; border-radius: 3px; background: var(--fill-strong); }
.sheet-section { padding: 6px 0; }
.sheet-section + .sheet-section { border-top: 1px solid var(--hairline); }
.sheet-section .nav-label { padding: 10px 10px 8px; }
.sheet-section .theme-picker { justify-content: space-between; padding: 0 4px 6px; }
.sheet-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 48px; padding: 0 10px;
  border: 0; border-radius: 11px; background: none;
  font-size: 16px; font-weight: 500; text-align: left;
  cursor: pointer;
}
.sheet-item .icon { color: var(--text-2); }
.sheet-item.is-active { background: var(--fill); }
.sheet-danger, .sheet-danger .icon { color: var(--neg); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }

@media (min-width: 861px) {
  .sheet-backdrop { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   v1.0 components (leads, follow-ups, compose, board, dashboard widgets)
   ========================================================================== */

.link { color: var(--accent); font-weight: 550; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 2px; }
html[data-theme="glass"] .link { color: #fff; text-decoration-color: rgba(255, 255, 255, .5); }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--hairline); margin: 4px 0; }
[hidden] { display: none !important; }

.btn-small { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; box-shadow: none; }
.btn-danger { color: var(--neg); }
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; }
.badge-danger { background: color-mix(in srgb, var(--neg) 18%, transparent); color: var(--neg); }

/* ---- Stage pill and local-time badge */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px 0 8px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--pill) 16%, transparent);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pill); }
.wbadge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
  border-radius: 6px; font-size: 11px; font-weight: 650; white-space: nowrap;
  background: var(--fill-strong); color: var(--text-2);
}
.wbadge-open { background: color-mix(in srgb, var(--pos) 20%, transparent); color: var(--pos); }
.wbadge-early_late { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.wbadge-holiday, .wbadge-weekend { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text-2); }

/* ---- Clock bar */
.clockbar {
  padding: 12px 14px;
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  display: flex; flex-direction: column; gap: 10px;
}
.clock-zones { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.clock-zone { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 9px 11px; border-radius: 11px; background: var(--fill); min-width: 0; }
.clock-zone.is-team { background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent); }
.clock-time { font: 650 19px/1 var(--font-display); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.clock-schedule { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13px; color: var(--text-2); }
.clock-schedule strong { color: var(--text); font-weight: 600; }

/* ---- Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 10px 14px; font: 500 10.5px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; border-bottom: 1px solid var(--hairline); }
.table th a { color: inherit; }
.table td { padding: 11px 14px; border-top: 1px solid var(--hairline); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table-rows tbody tr:hover { background: var(--fill); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .check { width: 36px; padding-right: 0; }
.table .bar-col { width: 22%; min-width: 80px; }
.cell-link { display: block; }
.cell-link .row-sub { display: block; margin-top: 1px; }
.cell-link .badge { margin-left: 4px; height: 18px; font-size: 10.5px; vertical-align: 1px; }
.cell-link strong { font-weight: 600; }
.sample-cell { max-width: 320px; overflow-wrap: anywhere; }
input[type="checkbox"]:not(.switch) { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); flex: none; }

/* ---- Search, filters, chips */
.search { display: flex; align-items: center; gap: 8px; flex: 1 1 240px; max-width: 420px; min-height: 38px; padding: 0 12px; border: 1px solid var(--card-border); border-radius: var(--r-md); background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.search .icon { color: var(--text-3); }
.search input { flex: 1; min-height: 36px; padding: 0; border: 0; background: none; font-size: 15px; box-shadow: none !important; }
.filters { gap: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px 14px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 15px; background: var(--fill); font-size: 13px; font-weight: 550; color: var(--text-2); }
.chip:hover { background: var(--fill-strong); }
.chip.is-active { background: var(--primary-bg); color: var(--primary-fg); }
.chip-split { padding-right: 4px; color: var(--text); }
.chip-split form { display: flex; }
.chip-split button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--text-3); cursor: pointer; }
.chip-split button:hover { background: var(--fill-strong); color: var(--text); }
.chip-form { display: flex; gap: 6px; align-items: center; }
.chip-form input { min-height: 32px; width: 150px; padding: 4px 10px; font-size: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input:not([type="checkbox"]), .inline-form select { flex: 1 1 140px; width: auto; min-height: 38px; }
.inline-form .input-small, .input-small { flex: 0 1 90px !important; width: 90px; }
.main:has(.board) { max-width: none; }
.main:has(.table-rows) { max-width: 1240px; }
.inline-form .btn { flex: none; }

.bulkbar {
  position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 12px; padding: 10px 12px;
  border-radius: var(--r-lg); background: var(--raised); border: 1px solid var(--card-border);
  box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px);
  font-weight: 600; font-size: 14px;
}
.bulkbar select { width: auto; min-height: 34px; flex: 0 1 190px; font-size: 14px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; }

/* ---- Lead page */
.lead-head { align-items: flex-start; flex-wrap: wrap; }
.lead-head .page-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.lead-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kv-flush { padding: 0; }
.kv-flush > div { padding: 8px 0; }
.kv-compact > div { padding: 6px 0; font-size: 14px; }
.kv dt { flex: none; max-width: 48%; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 14px; }
.check-row { display: flex; align-items: center; gap: 9px; min-height: 34px; font-weight: 500; cursor: pointer; }
.notice-check { align-items: center; cursor: pointer; }
.bullets { padding-left: 18px; list-style: disc; display: flex; flex-direction: column; gap: 5px; }
.hooks { display: flex; flex-direction: column; gap: 6px; }
.hooks li { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 9px 11px; border-radius: 10px; background: var(--fill); font-size: 14px; }
.files { display: flex; flex-direction: column; gap: 4px; }
.files li { display: flex; align-items: center; gap: 10px; }
.files form { margin-left: auto; }
.upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
input[type="file"] { max-width: 100%; font-size: 14px; }
.score { font: 700 28px/1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font: 13px var(--font-mono); }

.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; padding: 10px 0; position: relative; }
.tl + .tl { border-top: 1px solid var(--hairline); }
.tl-dot { width: 9px; height: 9px; margin: 6px 0 0 4px; border-radius: 50%; background: var(--text-3); }
.tl-out .tl-dot { background: var(--accent); }
.tl-in .tl-dot { background: var(--pos); }
.tl-view .tl-dot { background: var(--warn); }
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; font-size: 14px; }
.tl-time { margin-left: auto; font: 500 11.5px var(--font-mono); color: var(--text-3); white-space: nowrap; }
.tl-text { margin-top: 5px; font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; }

/* ---- Follow-ups */
.limits { display: flex; flex-wrap: wrap; gap: 6px; }
.limit { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 8px; background: var(--fill); font-size: 12.5px; color: var(--text-2); }
.limit strong { color: var(--text); font-variant-numeric: tabular-nums; }
.limit.is-over { background: color-mix(in srgb, var(--neg) 18%, transparent); }
.limit.is-over strong { color: var(--neg); }
.segmented-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; align-self: stretch; }
.segmented-scroll::-webkit-scrollbar { display: none; }
.segmented a { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.segmented .count { min-width: 19px; height: 19px; font-size: 11px; background: var(--fill-strong); }
.tz-head { flex-wrap: wrap; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--hairline); }
.tz-head .count { margin-left: auto; }
.row-wrap { flex-wrap: wrap; }
.row-wrap .row-main { flex: 1 1 250px; }
.row-quote { margin-top: 4px; font-size: 13.5px; color: var(--text-2); font-style: italic; overflow-wrap: anywhere; }
.row-side form { display: flex; }
.row-list-plain li + li { border-top: 1px solid var(--hairline); }
.row-list-plain .row { padding: 10px 0; border-radius: 0 !important; }
.row-list-plain .row:hover { background: none; }
.row-stats { gap: 16px; font-size: 13px; color: var(--text-2); }
.row-stats strong { color: var(--text); }
.review-item { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }

/* ---- Compose */
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.counter-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.counter { font: 600 13px var(--font-mono); color: var(--text-2); }
.counter.is-over { color: var(--neg); }
.warn-list { display: flex; flex-direction: column; gap: 6px; }
.warn-list li { display: flex; gap: 9px; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 34%, transparent); }
.variants { display: flex; flex-direction: column; gap: 8px; }
.variant { padding: 12px 14px; border-radius: 12px; background: var(--fill); display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.variant p { white-space: pre-wrap; overflow-wrap: anywhere; }
.variant .label { margin-bottom: 2px; }
textarea[data-body] { min-height: 190px; }

/* ---- Pipeline board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: 244px; gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: start; scroll-snap-type: x proximity; }
.board-col { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--card-border); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); scroll-snap-align: start; min-height: 120px; }
.board-head { display: flex; align-items: center; gap: 7px; padding: 2px 4px 4px; }
.board-head h2 { font: 650 14px var(--font-display); }
.board-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pill); }
.board-value { margin-left: auto; font: 500 11.5px var(--font-mono); color: var(--text-3); }
.board-cards { display: flex; flex-direction: column; gap: 7px; min-height: 46px; }
.lead-card { padding: 10px 11px; border-radius: 11px; background: var(--fill); border: 1px solid transparent; display: flex; flex-direction: column; gap: 6px; cursor: grab; }
.lead-card:hover { border-color: var(--hairline); }
.lead-card-title { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.lead-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.lead-card-meta .badge { height: 19px; padding: 0 6px; font-size: 10.5px; gap: 4px; }
.lead-card-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); }
.lead-card-foot strong { color: var(--text); }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: var(--shadow-lg); cursor: grabbing; }
.board-more { font-size: 12.5px; padding: 2px 4px; }
.dialog { width: min(92vw, 380px); padding: 20px; border: 1px solid var(--card-border); border-radius: var(--r-xl); background: var(--raised); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(0, 0, 0, .4); }

/* ---- Dashboard widgets */
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
a.tile { display: block; }
a.tile:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--fill); }
.stat strong { font: 700 21px/1.15 var(--font-display); letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.stat .muted { font-size: 12.5px; }
.fold-body { display: flex; flex-direction: column; gap: 12px; }
.bar-list-wide li { grid-template-columns: 150px minmax(0, 1fr) 40px 54px; }
.bar-extra { text-align: right; font: 500 12px var(--font-mono); color: var(--text-3); }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.three-col .label { margin-bottom: 8px; }
.heat { display: flex; flex-direction: column; gap: 3px; overflow-x: auto; }
.heat-row { display: grid; grid-template-columns: 38px repeat(16, minmax(26px, 1fr)); gap: 3px; align-items: center; min-width: 520px; }
.heat-head span { font: 500 9.5px var(--font-mono); color: var(--text-3); text-transform: uppercase; white-space: nowrap; }
.heat-day { font: 500 11px var(--font-mono); color: var(--text-3); }
.heat-cell { height: 26px; border-radius: 6px; display: grid; place-items: center; font: 600 11px var(--font-mono); color: var(--accent-fg);
  background: color-mix(in srgb, var(--accent) calc(var(--a) * 100%), var(--fill)); }
.heat-cell[style*="--a:0;"], .heat-cell[style$="--a:0"] { color: transparent; }

/* ---- Rows editor */
.rows { display: flex; flex-direction: column; gap: 6px; }
.rows-head { display: flex; gap: 8px; padding: 0 2px; font: 500 10.5px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.rows-head-spacer { flex: 0 0 34px; }
.rows-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.rows-cell { min-width: 0; }
.rows-cell input, .rows-cell select { min-height: 38px; font-size: 15px; }
.rows .btn { align-self: flex-start; }
.color-wide { width: 100%; height: 38px; margin: 0; }

/* ---- Busy state on slow forms */
form.is-busy { opacity: .6; pointer-events: none; }
.busy-note { font-size: 13px; color: var(--text-2); }
.audit-list .row { padding: 10px 0; }
.audit-list .row:hover { background: none; }

@media (max-width: 1020px) {
  .lead-grid { grid-template-columns: minmax(0, 1fr); }
  .hide-md { display: none; }
}
@media (max-width: 860px) {
  .hide-sm { display: none; }
  .form-grid-3, .form-grid-4 { grid-template-columns: minmax(0, 1fr); }
  .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles-4 .tile { grid-column: auto; }
  .three-col { grid-template-columns: minmax(0, 1fr); }
  .clock-zones { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .clock-zone { padding: 8px 9px; }
  .clock-time { font-size: 16px; }
  .table th, .table td { padding: 10px 10px; }
  .board { grid-auto-columns: 82vw; }
  .bar-list-wide li { grid-template-columns: 96px minmax(0, 1fr) 30px 46px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .search { max-width: none; flex-basis: 100%; }
  .limits { width: 100%; }
  .kv > div { flex-direction: column; gap: 2px; }
  .kv dd { text-align: left; }
  .kv dt { max-width: none; font-size: 12.5px; }
  .bulkbar { bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); }
  .rows-head { display: none; }
  .rows-row { flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--hairline); }
  .rows-cell { flex: 1 1 40% !important; }
}

.brand-logo { width: 30px; height: 30px; flex: none; border-radius: 8px; object-fit: cover; }
.mobile-bar .brand-logo { width: 27px; height: 27px; }
