:root {
  --accent: #F9B52E;
  --accent-soft: rgba(249, 181, 46, 0.18);
  --accent-ink: #1a1305;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --gap-cols: 18px;
  --pad-app: 22px;
  --pad-card: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
}

html[data-theme="dark"] {
  --bg-grad-a: #0b0d12;
  --bg-grad-b: #14171f;
  --bg-glow:   rgba(249, 181, 46, 0.08);
  --surface:   rgba(22, 25, 33, 0.55);
  --surface-2: rgba(30, 34, 44, 0.70);
  --surface-hover: rgba(40, 45, 58, 0.78);
  --border:    rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text:      #f1f3f7;
  --text-muted:#9aa1b1;
  --text-dim:  #6e7689;
  --shadow:    0 18px 40px -20px rgba(0, 0, 0, 0.7);
  --status-todo:        #9aa1b1;
  --status-in-progress: #F9B52E;
  --status-waiting:     #7cb1d1;
  --status-done:        #86c490;
  --status-todo-bg:        rgba(154, 161, 177, 0.16);
  --status-in-progress-bg: rgba(249, 181, 46, 0.18);
  --status-waiting-bg:     rgba(124, 177, 209, 0.18);
  --status-done-bg:        rgba(134, 196, 144, 0.18);
}

html[data-theme="light"] {
  --bg-grad-a: #faf6ee;
  --bg-grad-b: #ffffff;
  --bg-glow:   rgba(249, 181, 46, 0.10);
  --surface:   rgba(255, 255, 255, 0.78);
  --surface-2: rgba(255, 255, 255, 0.92);
  --surface-hover: #ffffff;
  --border:    rgba(40, 35, 25, 0.10);
  --border-strong: rgba(40, 35, 25, 0.18);
  --text:      #1c1a14;
  --text-muted:#5a5648;
  --text-dim:  #8a8674;
  --shadow:    0 14px 30px -18px rgba(40, 35, 25, 0.35);
  --status-todo:        #6a6558;
  --status-in-progress: #b07d10;
  --status-waiting:     #2f6f93;
  --status-done:        #3f8a4c;
  --status-todo-bg:        rgba(106, 101, 88, 0.10);
  --status-in-progress-bg: rgba(249, 181, 46, 0.22);
  --status-waiting-bg:     rgba(47, 111, 147, 0.12);
  --status-done-bg:        rgba(63, 138, 76, 0.12);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 85% -10%, var(--bg-glow), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, var(--bg-glow), transparent 60%),
    linear-gradient(160deg, var(--bg-grad-a) 0%, var(--bg-grad-b) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: var(--pad-app);
  gap: 16px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.header-left {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex-shrink: 1;
}

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

.brand-logo {
  display: inline-flex;
  align-items: baseline;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.2px;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-logo-dark   { color: var(--text); }
.brand-logo-accent { color: var(--accent); }

.brand-divider {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.6px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 1;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.range-track-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

/* Category filter chips (header) */
.cat-chips {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.cat-chip {
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.cat-chip:hover {
  color: var(--text-muted);
  background: var(--surface-hover);
}
.cat-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cat-chip.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}
.cat-chip.is-active:hover {
  color: var(--accent);
  background: rgba(249, 181, 46, 0.28);
}

.range-track-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1;
}
.range-track-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.range-track-current {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1px;
}

.range-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  width: 260px;
  height: 18px;
}
.range-track::before {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 1px;
  background: linear-gradient(
    to right,
    var(--border-strong),
    var(--border-strong) 60%,
    var(--border)
  );
  transform: translateY(-0.5px);
  z-index: 0;
  pointer-events: none;
}

.range-step {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
/* Larger invisible hit target for touch / mis-tap forgiveness. */
.range-step::before {
  content: '';
  position: absolute;
  inset: -10px -2px;
}
.range-step::after {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-grad-b);
  border: 1.5px solid var(--text-dim);
  transition: width 160ms ease, height 160ms ease,
              background-color 160ms ease, border-color 160ms ease,
              box-shadow 200ms ease;
}
.range-step:hover::after {
  border-color: var(--text-muted);
  background: var(--surface-hover);
}
.range-step:focus-visible {
  outline: none;
}
.range-step:focus-visible::after {
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-color: var(--accent);
}
.range-step.is-active::after {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}
.range-step.is-active:hover::after {
  background: var(--accent);
  border-color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .range-step::after { transition: none; }
}

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 120ms ease, transform 120ms ease;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn:disabled { opacity: 0.6; cursor: progress; }

.icon-btn .icon {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.icon-btn .icon-moon { fill: currentColor; stroke: none; }

@keyframes fcc-spin {
  to { transform: rotate(360deg); }
}
.refresh-btn .icon-refresh {
  transition: transform 200ms ease;
}
.refresh-btn:hover .icon-refresh {
  transform: rotate(-45deg);
}
.refresh-btn.is-loading {
  pointer-events: none;
  color: var(--accent);
}
.refresh-btn.is-loading .icon-refresh {
  animation: fcc-spin 0.8s linear infinite;
  transform: none;
}

html[data-theme="dark"]  .theme-toggle .icon-sun  { display: inline-block; }
html[data-theme="dark"]  .theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: inline-block; }

/* Board (single status Kanban filling the viewport beneath the header) */
.board {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* Status accent dots on column headers */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-dim);
  box-shadow: 0 0 0 3px var(--surface);
}
.status-dot--todo        { background: var(--status-todo); }
.status-dot--in-progress { background: var(--status-in-progress); }
.status-dot--waiting     { background: var(--status-waiting); }
.status-dot--done        { background: var(--status-done); }

.column--status .column-head {
  gap: 8px;
}
.column--status .column-head h2 {
  color: var(--text);
}

/* Columns */
.columns {
  flex: 1 1 auto;
  display: flex;
  gap: var(--gap-cols);
  min-height: 0;
}

.column {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.column-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), transparent);
}

.column-head h2 {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-weight: 600;
  color: var(--accent);
}

.count {
  flex-shrink: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border);
}

.column-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.column-body::-webkit-scrollbar { width: 10px; }
.column-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.column-body::-webkit-scrollbar-track { background: transparent; }

@supports (scrollbar-width: thin) {
  .column-body {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
  }
}

/* Cards */
.card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--pad-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
  outline: none;
}
.card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.card:active { transform: translateY(1px); }

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.card-head .card-subject {
  flex: 1 1 auto;
  min-width: 0;
}

.card-subject {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: calc(14.5px * 1.35 * 2);
}

.card-category {
  flex-shrink: 0;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--accent);
  background: var(--accent-soft);
}

.card-snippet {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: calc(13px * 1.45 * 3);
}

.card-tags {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow: hidden;
}

.tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1;
  white-space: nowrap;
  color: #1c1306;
  background: #d8d4ca;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.tag--vip              { background: #F9B52E; color: #1c1306; }
.tag--need-to-onboard  { background: #f7a06b; color: #2a1308; }
.tag--cross-trade      { background: #f6cba0; color: #2a1308; }
.tag--won              { background: #8fd6e2; color: #0d2a30; }
.tag--lost             { background: #d99a9a; color: #2a0d0d; }
.tag--new-lead         { background: #b8e0a8; color: #102a0d; }
.tag--quote-sent       { background: #c5b8e6; color: #1a1030; }

html[data-theme="dark"] .tag {
  border-color: rgba(0, 0, 0, 0.25);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.card-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
}

.card-meta .sender {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.avatar {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
}

.sender-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
  font-weight: 500;
}

.sender-domain {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dim);
}

.card-meta .time {
  flex-shrink: 0;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.status-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
  background: var(--status-todo-bg);
  color: var(--status-todo);
}
.status-pill::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill--todo        { color: var(--status-todo);        background: var(--status-todo-bg); }
.status-pill--in-progress { color: var(--status-in-progress); background: var(--status-in-progress-bg); }
.status-pill--waiting     { color: var(--status-waiting);     background: var(--status-waiting-bg); }
.status-pill--done        { color: var(--status-done);        background: var(--status-done-bg); }

.empty {
  margin: auto;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 20px;
}

@media (max-width: 900px) {
  .columns { flex-direction: column; }
  .column { min-height: 220px; }
}

/* Modal -------------------------------------------------------------------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-root[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 14, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: modal-fade-in 140ms ease-out;
}
html[data-theme="light"] .modal-backdrop {
  background: rgba(40, 35, 25, 0.30);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 600px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 30px 70px -20px rgba(0, 0, 0, 0.65),
    0 12px 30px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: modal-panel-in 160ms ease-out;
  transform-origin: center;
}
html[data-theme="light"] .modal-panel {
  box-shadow:
    0 30px 70px -20px rgba(40, 35, 25, 0.30),
    0 10px 24px -10px rgba(40, 35, 25, 0.22);
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-panel-in {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .modal-panel { animation: none; }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px; height: 32px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 120ms ease, color 120ms ease;
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }
.modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.modal-close svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round;
}

.modal-header {
  flex-shrink: 0;
  padding: 22px 56px 16px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), transparent);
}
.modal-title {
  margin: 0 0 10px 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}
.modal-sender {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.modal-sender .avatar { width: 28px; height: 28px; font-size: 12px; }
.modal-sender .sender-name { font-weight: 500; color: var(--text); }
.modal-sender .sender-domain { color: var(--text-dim); }
.modal-sender .modal-time { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.modal-header .card-tags { gap: 6px; }

.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 24px 6px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}
.modal-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.modal-message {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}
.modal-controls {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.modal-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 200px;
  min-width: 0;
}
.modal-status-select {
  -webkit-appearance: none;
  appearance: none;
  height: 36px;
  padding: 0 36px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 12px) center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.modal-status-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.modal-notes {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}
.modal-notes:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.modal-notes::placeholder {
  color: var(--text-dim);
}

/* Activity log inside the modal */
.modal-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.history-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 12px 0;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.history-item .avatar {
  width: 22px;
  height: 22px;
  font-size: 10px;
  flex-shrink: 0;
}
.history-body {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-muted);
  word-break: break-word;
}
.history-body strong {
  color: var(--text);
  font-weight: 600;
}
.history-body em {
  color: var(--text);
  font-style: normal;
  font-weight: 500;
}
.history-time {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.history-notes {
  margin-top: 6px;
  padding: 8px 12px;
  border-left: 2px solid var(--accent);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.history-notes--empty {
  color: var(--text-dim);
  font-style: italic;
  border-left-color: var(--border-strong);
}

.modal-footer {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 24px 18px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover {
  background: #fac24f;
  border-color: #fac24f;
}
.btn--primary svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* Save — visually between secondary (.btn) and primary (.btn--primary):
   subtle amber wash + amber text so it reads as a commit action without
   stealing the spotlight from "View in Front". */
.btn--save {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}
.btn--save:hover { background: rgba(249, 181, 46, 0.28); }
.btn--save svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none;
  stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}

/* Footer left/right grouping: Save sits at the left of the footer; Close +
   View in Front cluster on the right. */
.modal-footer .btn--save { margin-right: auto; }

/* Toast --------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow:
    0 18px 30px -14px rgba(0, 0, 0, 0.45),
    0 6px 14px -8px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  animation: toast-in 200ms ease-out;
}
html[data-theme="light"] .toast {
  box-shadow:
    0 18px 30px -14px rgba(40, 35, 25, 0.25),
    0 6px 14px -8px rgba(40, 35, 25, 0.18);
}

.toast-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.toast--success .toast-icon { color: var(--status-done); }

.toast--exit {
  animation: toast-out 220ms ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast--exit { animation: none; opacity: 0; }
}

/* Login page ---------------------------------------------------------------- */
.auth-page {
  margin: 0;
}
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.auth-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 50;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 32px 24px 32px;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 30px 70px -20px rgba(0, 0, 0, 0.6),
    0 12px 30px -12px rgba(0, 0, 0, 0.45);
}
html[data-theme="light"] .auth-card {
  box-shadow:
    0 30px 70px -20px rgba(40, 35, 25, 0.28),
    0 10px 24px -10px rgba(40, 35, 25, 0.20);
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 22px;
}
.auth-title {
  margin: 0 0 6px 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}
.auth-sub {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 24px auto;
  padding: 5px 14px;
  border-radius: 999px;
  background: #D0D0D3;
  color: #1c1a14;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
  text-align: center;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.auth-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.auth-field input {
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.auth-field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.auth-hint {
  margin: -6px 0 14px 2px;
  font-size: 11.5px;
  color: var(--text-dim);
}
.auth-submit {
  width: 100%;
  height: 42px;
  margin-top: 6px;
  font-size: 13px;
}
.auth-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(217, 154, 154, 0.18);
  color: #e58a8a;
  font-size: 12.5px;
  line-height: 1.45;
}
html[data-theme="light"] .auth-error {
  background: rgba(170, 60, 60, 0.10);
  color: #a83232;
}

.auth-bootstrap {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--accent-soft-border, var(--border-strong));
  background: var(--accent-soft);
  color: var(--text);
}
.auth-bootstrap-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
.auth-bootstrap-body {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.auth-bootstrap-creds {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-bootstrap-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.auth-bootstrap-label {
  flex-shrink: 0;
  width: 70px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.8px;
  font-weight: 600;
}
.auth-bootstrap-row code {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-user-select: all;
  user-select: all;
}
.auth-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}
.auth-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  margin-left: 4px;
}
.auth-link:hover { text-decoration: underline; }

/* User menu (dashboard header) --------------------------------------------- */
.user-menu {
  position: relative;
  flex-shrink: 0;
}
.user-avatar-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.3px;
  transition: background-color 120ms ease, transform 120ms ease;
}
.user-avatar-btn:hover { background: var(--surface-hover); }
.user-avatar-btn:active { transform: scale(0.96); }
.user-avatar-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.user-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
  min-width: 240px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow:
    0 20px 50px -20px rgba(0, 0, 0, 0.55),
    0 8px 20px -10px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform-origin: top right;
  animation: range-menu-in 140ms ease-out;
}
.user-popover[hidden] { display: none; }
.user-popover-info {
  padding: 6px 10px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.user-popover-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  word-break: break-word;
}
.user-popover-email {
  font-size: 11.5px;
  color: var(--text-dim);
  word-break: break-all;
}
.user-popover-action {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 100ms ease;
}
.user-popover-action:hover { background: var(--surface-hover); }
.user-popover-action svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* Admin button (header) --------------------------------------------------- */
.admin-btn[hidden] { display: none; }
.admin-btn svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* Admin users modal ------------------------------------------------------- */
.user-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.user-row .avatar {
  width: 32px; height: 32px;
  font-size: 12px;
}
.user-row-text {
  flex: 1 1 auto;
  min-width: 0;
}
.user-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-row-email {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-row-badge {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.user-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.user-row-action {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 100ms ease, color 100ms ease;
}
.user-row-action:hover { background: var(--surface-hover); color: var(--text); }
.user-row-action svg {
  width: 15px; height: 15px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.user-row-action--danger:hover { color: #e58a8a; }
.user-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-dim);
  font-size: 13px;
}

.password-reveal {
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.password-reveal-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--accent);
}
.password-reveal-value {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}
.password-reveal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.password-reveal-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-left: auto;
  text-align: right;
  flex-shrink: 1;
  min-width: 0;
}
