/* MarTech Portal — base styles + per-tenant branding hooks
   ================================================
   Default identity: JM Sandberg (teal + charcoal, Neue Haas Display).
   Per-tenant brand overrides --brand-primary and --brand-accent at runtime.
*/

@import url("/fonts.css");

:root {
  /* Brand — JM Sandberg defaults; overridden per tenant from JS */
  --brand-primary: #164657;        /* JMS teal */
  --brand-accent:  #121212;        /* JMS charcoal */

  /* JMS-specific tokens (used by login/admin chrome — never overridden) */
  --jms-teal:    #164657;
  --jms-teal-50: #F0F7F9;
  --jms-teal-100:#D6E8ED;
  --jms-teal-700:#103847;
  --jms-teal-800:#0B2A36;
  --jms-charcoal:#121212;
  --jms-logo:    #060810;

  /* Neutrals — warm-tinted to pair with teal */
  --ink-900: #121212;
  --ink-700: #1F1F1F;
  --ink-500: #3D3D3D;
  --ink-400: #6E6E6E;
  --ink-100: rgba(18, 18, 18, 0.12);
  --ink-50:  rgba(18, 18, 18, 0.05);
  --white: #FFFFFF;
  --bg-soft: #FCFCFB;              /* Canvas */
  --bg-mist: #F4F8FA;              /* Mist */
  --bg-breeze: #EAF1F4;

  /* Status */
  --success: #1F7A5A;
  --warn: #B8841A;
  --danger: #B53A3A;

  /* Geometry */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(18,18,18,0.06), 0 1px 3px rgba(18,18,18,0.04);
  --shadow-md: 0 2px 6px rgba(18,18,18,0.08), 0 8px 24px rgba(18,18,18,0.06);
  --shadow-lg: 0 8px 32px rgba(18,18,18,0.18);

  /* Type — Neue Haas Display is the JMS brand typeface */
  --font-sans: "Neue Haas Display", -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body, #root {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--ink-900);
  background: var(--bg-soft);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 300;
  letter-spacing: -0.025em;
}

/* Cap browser-default bold to Medium — JM Sandberg uses no Bold */
b, strong {
  font-weight: 500;
}

a { color: var(--brand-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ---------- LAYOUT ---------- */

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: var(--white);
  border-right: 1px solid var(--ink-100);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-head {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--ink-100);
  background: linear-gradient(180deg, var(--bg-mist) 0%, var(--white) 100%);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  min-height: 36px;
}

.brand-logo {
  max-height: 36px;
  max-width: 180px;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

.brand-name {
  font-size: 17px;
  font-weight: 400;
  color: var(--ink-900);
  letter-spacing: -0.02em;
}

.powered-by {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-top: 1px solid var(--ink-100);
  background: var(--bg-soft);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-400);
  flex-shrink: 0;
}

.powered-by img {
  height: 11px;
  color: var(--jms-logo);
  margin-left: 4px;
}

.sidebar-title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--ink-900);
}

.sidebar-sub {
  font-size: 12px;
  color: var(--ink-500);
}

.sidebar-search {
  position: relative;
  padding: 14px 16px 8px;
}

.sidebar-search input {
  width: 100%;
  padding: 10px 12px 10px 32px;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-pill);
  background: var(--white);
  outline: none;
  transition: border-color 120ms;
}

.sidebar-search input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 25%, transparent);
}

.sidebar-search-icon {
  position: absolute;
  top: 50%;
  left: 28px;
  transform: translateY(-50%);
  color: var(--ink-400);
  pointer-events: none;
  font-size: 14px;
}

.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--ink-100);
}

.filter-chips-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-400);
  padding: 5px 4px 5px 0;
  margin-right: 2px;
}

.uc-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ---------- MULTISELECT (sidebar filters) ---------- */

.multiselect {
  position: relative;
  flex: 1;
  min-width: 0;
}

.multiselect-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--ink-700);
  text-align: left;
  transition: border-color 120ms;
}

.multiselect-trigger:hover { border-color: var(--ink-400); }

.multiselect-trigger.has-selection {
  border-color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 6%, var(--white));
}

.multiselect-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-400);
  flex-shrink: 0;
}

.multiselect-summary {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-900);
}

.multiselect-chevron {
  color: var(--ink-400);
  font-size: 10px;
  flex-shrink: 0;
}

.multiselect-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 280px;
  display: flex;
  flex-direction: column;
}

.multiselect-actions {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--ink-100);
}

.multiselect-link {
  font-size: 11px;
  color: var(--brand-accent);
  font-weight: 500;
  padding: 0;
  background: transparent;
}

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

.multiselect-options {
  overflow-y: auto;
  padding: 4px 0;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-700);
  transition: background 80ms;
}

.multiselect-option:hover { background: var(--bg-mist); }

.multiselect-option.checked { color: var(--ink-900); }

.multiselect-option input[type="checkbox"] {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--brand-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.multiselect-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.multiselect-option-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multiselect-count {
  font-size: 11px;
  color: var(--ink-400);
  background: var(--ink-50);
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}

.filter-multiselects {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ink-100);
}

.filter-chip {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--ink-50);
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 120ms;
}

.filter-chip:hover { background: var(--ink-100); }

.filter-chip.active {
  background: var(--ink-900);
  color: var(--white);
}

.filter-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.uc-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 32px;
}

.uc-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 22px 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  text-transform: uppercase;
}

.uc-group-head .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.uc-group-head .count {
  background: var(--ink-50);
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  letter-spacing: 0;
}

.uc-group-head .season {
  margin-left: auto;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 10px;
  color: var(--ink-400);
}

.uc-item {
  position: relative;
  padding: 12px 22px;
  cursor: pointer;
  transition: background 100ms;
  border-left: 3px solid transparent;
}

.uc-item:hover { background: var(--bg-mist); }

.uc-item.active {
  background: var(--bg-mist);
  border-left-color: var(--brand-primary);
}

.uc-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-900);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.uc-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-500);
}

.uc-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  border-radius: 4px;
  letter-spacing: 0.04em;
  background: var(--ink-50);
  color: var(--ink-700);
}

.uc-tag.crs { background: #EDE9FE; color: #6D28D9; }
.uc-tag.add { background: #FFE4D4; color: #C2410C; }
.uc-tag.upg { background: #DBEAFE; color: #1E40AF; }
.uc-tag.scl { background: #DCFCE7; color: #15803D; }

.uc-item-deep {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-primary);
}

.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  flex-shrink: 0;
}

.sidebar-foot .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-accent);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-foot .meta {
  flex: 1;
  min-width: 0;
}

.sidebar-foot .meta .name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-foot .meta .role {
  font-size: 11px;
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar-foot button.icon-btn {
  padding: 6px;
  color: var(--ink-500);
  border-radius: 6px;
  transition: all 120ms;
}

.sidebar-foot button.icon-btn:hover {
  background: var(--ink-50);
  color: var(--ink-900);
}

/* ---------- DETAIL ---------- */

.detail {
  overflow-y: auto;
  background: var(--bg-soft);
}

.detail-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 44px 80px;
}

.detail-crumbs {
  font-size: 12px;
  color: var(--ink-500);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}

.detail-crumbs .sep { color: var(--ink-100); }

.detail-title {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 8px;
  color: var(--ink-900);
}

.detail-subtitle {
  font-size: 16px;
  color: var(--ink-500);
  margin: 0 0 24px;
  line-height: 1.5;
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--ink-700);
}

.meta-pill .label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-400);
}

.meta-pill.priority-1 { border-color: #FB923C; }
.meta-pill.priority-1 .label { color: #C2410C; }
.meta-pill.priority-2 { border-color: #34D399; }
.meta-pill.priority-2 .label { color: #047857; }

.trigger-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-left: 3px solid var(--brand-primary);
  border-radius: var(--radius-md);
  margin-bottom: 28px;
  font-size: 13px;
  color: var(--ink-700);
  line-height: 1.5;
}

.trigger-box b {
  display: block;
  font-weight: 500;
  color: var(--ink-900);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

/* ---------- TABS ---------- */

.tabs-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--ink-100);
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  background: var(--bg-soft);
  z-index: 5;
  padding-top: 8px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 120ms;
  letter-spacing: -0.01em;
}

.tab-btn:hover { color: var(--ink-900); }

.tab-btn.active {
  color: var(--ink-900);
  border-bottom-color: var(--brand-primary);
  font-weight: 500;
}

.tab-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 10px;
  font-weight: 500;
  background: var(--ink-50);
  color: var(--ink-500);
  border-radius: 50%;
}

.tab-btn.active .tab-num {
  background: var(--brand-primary);
  color: var(--white);
}

.tab-edit-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
}

.tab-panel {
  animation: fadeIn 200ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- KPI GRID (Översikt) ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.kpi-card.hypothesis {
  grid-column: 1 / -1;
  border-left: 3px solid var(--brand-primary);
}

.kpi-card.business-case {
  grid-column: 1 / -1;
  background: var(--bg-mist);
  border-color: color-mix(in srgb, var(--brand-primary) 20%, var(--ink-100));
}

.kpi-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-400);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  line-height: 1.25;
}

.kpi-card.hypothesis .kpi-value {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink-700);
}

.kpi-sub {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 4px;
}

/* ---------- EDIT INPUTS ---------- */

input.field, textarea.field, select.field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-sm);
  background: var(--white);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
  font-size: 14px;
}

input.field:focus, textarea.field:focus, select.field:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 25%, transparent);
}

textarea.field {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
  font-family: inherit;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  margin-bottom: 6px;
}

.field-row {
  margin-bottom: 14px;
}

/* ---------- BUTTONS ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all 120ms;
  border: 1px solid transparent;
}

.btn:active { transform: scale(0.99); }

.btn-primary {
  background: var(--brand-primary);
  color: var(--ink-900);
}
.btn-primary:hover { filter: brightness(0.93); }

.btn-secondary {
  background: var(--white);
  color: var(--ink-700);
  border-color: var(--ink-100);
}
.btn-secondary:hover { background: var(--ink-50); }

.btn-ghost {
  background: transparent;
  color: var(--ink-500);
}
.btn-ghost:hover { background: var(--ink-50); color: var(--ink-900); }

.btn-danger {
  background: var(--white);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---------- LOGIN ---------- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--jms-charcoal) 0%, #0E2A36 45%, var(--jms-teal) 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 36px 36px 32px;
  box-shadow: var(--shadow-lg);
}

.login-jms-logo {
  height: 22px;
  color: var(--jms-logo);
  margin-bottom: 28px;
  display: block;
}

.login-card h1 {
  font-size: 26px;
  font-weight: 300;
  margin: 0 0 6px;
  letter-spacing: -0.03em;
  color: var(--ink-900);
}

.login-card p.lead {
  font-size: 14px;
  color: var(--ink-500);
  margin: 0 0 24px;
}

.login-card .field-row { margin-bottom: 16px; }

.login-card .err {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.login-card .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 12px 18px;
}

/* ---------- ADMIN ---------- */

.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
}

.admin-nav {
  background: var(--ink-900);
  color: var(--white);
  padding: 24px 0;
}

.admin-nav h2 {
  font-size: 18px;
  font-weight: 500;
  margin: 0 24px 24px;
  letter-spacing: -0.02em;
}

.admin-nav a {
  display: block;
  padding: 10px 24px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 120ms;
}

.admin-nav a:hover {
  color: var(--white);
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}

.admin-nav a.active {
  color: var(--white);
  background: rgba(255,255,255,0.08);
  border-left-color: var(--brand-primary);
}

.admin-main {
  padding: 32px 40px;
  overflow-y: auto;
  background: var(--bg-soft);
}

.admin-main h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.admin-main p.lead {
  color: var(--ink-500);
  margin: 0 0 28px;
  font-size: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  padding: 14px 18px;
  border-bottom: 1px solid var(--ink-100);
  background: var(--bg-soft);
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--ink-100);
  font-size: 13px;
  color: var(--ink-700);
}

.data-table tr:last-child td { border-bottom: 0; }

.data-table tr:hover td { background: var(--bg-mist); }

.swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--ink-100);
  vertical-align: middle;
  margin-right: 6px;
}

.role-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-badge.super_admin { background: #1F2937; color: #FBBF24; }
.role-badge.tenant_admin { background: #DBEAFE; color: #1E40AF; }
.role-badge.member { background: var(--ink-50); color: var(--ink-700); }

/* ---------- MODAL ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 4, 81, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.modal p.lead {
  margin: 0 0 20px;
  color: var(--ink-500);
  font-size: 13px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--ink-100);
}

/* ---------- NOTES ---------- */

.note {
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.note-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--ink-500);
}

.note-author {
  font-weight: 500;
  color: var(--ink-900);
}

.note-body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-700);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.note-actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
}

/* ---------- EMPTY STATES ---------- */

.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  color: var(--ink-400);
  font-size: 14px;
}

.empty .big {
  font-size: 18px;
  font-weight: 500;
  color: var(--ink-700);
  margin-bottom: 8px;
}

/* ---------- SCROLLBARS ---------- */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-100); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* ---------- UTILITY ---------- */

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--brand-primary) 20%, transparent);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  flex-direction: column;
  gap: 16px;
  color: var(--ink-400);
}

.section-title {
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}

.section-sub {
  font-size: 13px;
  color: var(--ink-500);
  margin-bottom: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.toolbar .grow { flex: 1; }
