/* Outreachable Portal: light, clean CRM style.
   To re-brand, change --accent (buttons, active toggles, focus rings). */
:root {
  --accent: #111827;
  --accent-ink: #ffffff;

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #f0f1f5;
  --border: #e8e9ef;
  --border-strong: #d8dae3;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #8b90a0;

  --green: #15803d;
  --green-bg: #ecfdf3;
  --green-line: #bbf7d0;
  --green-tint: #f3fbf6;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --amber-line: #fde68a;
  --red: #dc2626;
  --red-bg: #fef2f2;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-panel: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 30px rgba(16, 24, 40, 0.06);
  --shadow-pop: 0 12px 40px rgba(16, 24, 40, 0.14);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --sidebar-w: 220px;

  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: linear-gradient(135deg, #eef1fd 0%, #f5f6fa 38%, #f3f1fc 100%);
  background-attachment: fixed;
  color: var(--text);
  font: 13.5px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ico { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------------------------------------------------------ layout --- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  display: flex; flex-direction: column; gap: 22px;
  padding: 18px 12px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; }
.monogram {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 12.5px; letter-spacing: -0.3px;
}
.wordmark { font-weight: 600; font-size: 15px; letter-spacing: -0.2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); font-weight: 600; }

.sidebar-foot { margin-top: auto; padding: 0 8px; }
.demo-tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--amber); background: var(--amber-bg); border: 1px solid var(--amber-line);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 24px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.content { padding: 24px; outline: none; min-width: 0; }

/* ---------------------------------------------------- workspace menu --- */
.ws-switcher { position: relative; }
.ws-button {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 11px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; max-width: 320px; box-shadow: var(--shadow-card);
}
.ws-button:hover { border-color: var(--border-strong); }
.ws-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caret { color: var(--muted); font-size: 11px; }
.mode-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent;
}
.mode-demo { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.mode-live { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }

.ws-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  min-width: 270px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-pop);
}
.ws-row { display: flex; align-items: center; border-radius: 8px; }
.ws-row:hover { background: var(--surface-2); }
.ws-pick {
  flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 8px; background: none; border: 0; cursor: pointer; text-align: left;
}
.ws-pick-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.check { width: 14px; color: var(--text); font-weight: 700; }
.ws-edit { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px 9px; border-radius: 6px; }
.ws-edit:hover { color: var(--text); background: var(--surface-3); }
.ws-sep { height: 1px; background: var(--border); margin: 6px 2px; }
.ws-add {
  width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font-weight: 600; cursor: pointer;
}
.ws-add:hover { background: var(--surface-3); }

.search {
  flex: 1; max-width: 400px; display: flex; align-items: center; gap: 8px;
  padding: 6px 11px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.search svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); }
.search input::placeholder { color: var(--muted); }

.icon-btn {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.topbar .icon-btn { margin-left: auto; }
.topbar .icon-btn:not([hidden]) + .avatar { margin-left: 0; }
.avatar {
  margin-left: auto; flex: none;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
  font-weight: 600; font-size: 11.5px;
}

.avatar-sm {
  flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3); color: #a0a5b4;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em;
}
.avatar-generic { background: var(--surface-2); border: 1px dashed var(--border-strong); }

/* ------------------------------------------------------------ panels --- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-panel); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.panel-head h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.2px; }
.panel-count { margin-left: 6px; font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.hint { color: var(--muted); font-size: 12px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.page-head .sub { margin: 2px 0 0; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border-strong);
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-card);
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, white); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--surface); border-color: #fecaca; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid transparent; }
.pill-green { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
.pill-amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.pill-neutral { color: var(--text-2); background: var(--surface-3); }

.fin { font-weight: 500; font-size: 12.5px; color: var(--text-2); }
.fin::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.fin-yes { color: var(--green); } .fin-yes::before { background: #22c55e; }
.fin-no::before { background: #f87171; }
.fin-unknown { color: var(--muted); } .fin-unknown::before { background: #cbd0db; }

.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 500; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
}
.tag-more { color: var(--muted); }

.stage-chip {
  display: inline-block; padding: 1px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 500;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border);
}
.stage-replied { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }

.banner {
  margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber);
}

/* ------------------------------------------------------------ tables --- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.table td { padding: 10px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.who { display: flex; align-items: center; gap: 10px; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #fafbfc; }
.row-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ------------------------------------------------------------- board --- */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr);
  overflow-x: auto; align-items: stretch;
}
.col {
  display: flex; flex-direction: column; min-height: 420px;
  border-right: 1px solid var(--border);
  transition: background 0.15s;
}
.col:last-child { border-right: 0; }
.col-handoff { background: var(--green-tint); }
.col.drop { background: #f4f6ff; box-shadow: inset 0 0 0 2px #c7d2fe; }
.col-head { padding: 12px 12px 6px; }
.col-title { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12.5px; font-weight: 600; }
.count {
  display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--surface-3);
}
.handoff-tag {
  margin-left: 4px; padding: 0 6px; border-radius: 4px; vertical-align: 1px;
  font-size: 9.5px; font-weight: 600; color: var(--green); background: #dcfce7;
}
.col-fires { margin: 3px 0 0; font-size: 11px; line-height: 1.4; color: var(--muted); }
.col-body { display: flex; flex-direction: column; gap: 8px; padding: 6px 10px 12px; flex: 1; }
.col-empty { padding: 16px 8px; text-align: center; font-size: 12px; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 12px; }

.card {
  padding: 10px 11px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card);
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.card:hover { border-color: var(--border-strong); box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08); transform: translateY(-1px); }
.card.dragging { opacity: 0.5; }
.card-top { display: flex; align-items: center; gap: 9px; }
.card-top .avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.card-text { flex: 1; min-width: 0; }
.card-company { font-size: 13px; font-weight: 500; line-height: 1.3; }
.card-meta { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.card-meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-meta span:first-of-type { flex: none; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border); }
.dot { color: #c3c7d2; }
.handoff-pill {
  flex: none; align-self: center; padding: 1px 8px; border-radius: 999px; cursor: pointer; font: inherit;
  font-size: 10px; font-weight: 600; color: var(--green); background: var(--green-bg); border: 1px solid var(--green-line);
}
.handoff-pill:hover { background: #dcfce7; border-color: #86efac; }

/* Leads | Accounts toggle (matches the reference: black active segment) */
.panel-tools { display: flex; align-items: center; gap: 12px; }
.seg-toggle { display: inline-flex; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-card); }
.seg-toggle button {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer;
}
.seg-toggle button:hover { color: var(--text); }
.seg-toggle button.on { background: var(--accent); color: var(--accent-ink); }

/* Lead cards: person-first, like the Outreach Tracker */
.card-title { font-size: 13px; font-weight: 500; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-lead .card-top .avatar-sm { width: 32px; height: 32px; font-size: 11px; }
.card-handed .card-title, .card-handed .card-meta, .card-handed .avatar-sm { opacity: 0.72; }
.card-lead .card-meta span { flex: 1 1 auto; }
.card-lead .handoff-pill { margin-top: 6px; }

/* Account cards: company-first, like the Deal Pipeline */
.acc-title { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; }
.acc-title .ico { width: 15px; height: 15px; color: var(--text-2); }
.acc-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-meta { margin-top: 4px; }
.acc-meta .ico { width: 14px; height: 14px; }
.card-account .card-foot { margin-top: 10px; }
.col-won .col-title { color: var(--green); }
.deal-live { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
.card.flash { animation: flash 1.5s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px #86efac; border-color: #22c55e; } 100% { box-shadow: var(--shadow-card); } }

/* Account modal */
.avatar-building { width: 42px; height: 42px; color: var(--text-2); }
.avatar-building .ico { width: 20px; height: 20px; }
.h2-sub { font-weight: 400; color: var(--muted); font-size: 15px; }
.small { font-size: 11.5px; }
.link-btn { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.progress { display: flex; margin: 0; padding: 12px 20px; list-style: none; gap: 6px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.progress li { flex: 1; min-width: 96px; }
.progress li span {
  display: block; padding: 5px 8px; border-radius: 7px; text-align: center; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border);
}
.progress li.done span { color: var(--text-2); background: var(--surface-3); }
.progress li.now span { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.contact-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.contact-row {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font: inherit;
}
.contact-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.contact-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.contact-main .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); font-size: 18px; line-height: 1; }
.table .num { text-align: right; }

/* Triggers: handoff into the partner pipeline */
.handoff-box { max-width: 760px; margin-top: 8px; padding: 16px 18px; background: var(--green-tint); border: 1px solid var(--green-line); border-radius: 12px; }
.handoff-box h3 { margin: 0; font-size: 14px; font-weight: 600; }
.handoff-box p { margin: 4px 0 12px; }
.deal-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.deal-steps li { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; min-width: 150px; flex: 1; }
.deal-steps li span { font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------- timeline --- */
.timeline { list-style: none; margin: 0; padding: 0; max-width: 760px; }
.tl-item { position: relative; display: flex; gap: 16px; padding-bottom: 18px; }
.tl-item::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 1px; background: var(--border-strong); }
.tl-item:last-child::before { display: none; }
.tl-marker {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); font-weight: 600; font-size: 12.5px;
  box-shadow: var(--shadow-card);
}
.tl-item:last-child .tl-marker { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.tl-body { flex: 1; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-card); }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.tl-body p { margin: 5px 0 0; color: var(--text-2); }
.actor { font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); }
.actor-system { color: var(--text-2); background: var(--surface-2); }
.actor-human { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
.actor-mixed { color: #4f46e5; background: #eef2ff; border-color: #c7d2fe; }
.wait { font-size: 11.5px; color: var(--muted); }
.wait::before { content: "⏱ "; }

/* ------------------------------------------------------------ states --- */
.state-card {
  max-width: 540px; margin: 40px auto; padding: 30px 26px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-panel);
}
.state-card h2 { margin: 12px 0 6px; font-size: 17px; font-weight: 600; }
.state-card p { margin: 6px 0; }
.state-icon {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-2); font-weight: 700; font-size: 18px;
}
.state-error .state-icon { background: var(--red-bg); color: var(--red); }
.err-lines { list-style: none; margin: 8px 0; padding: 0; color: var(--text-2); }
.err-lines li { margin: 3px 0; }
.checklist { margin: 14px auto 0; max-width: 460px; text-align: left; color: var(--text-2); font-size: 13px; }
.checklist summary { cursor: pointer; color: var(--text); font-weight: 600; text-align: center; }
.checklist ul { padding-left: 18px; }
.checklist li { margin: 5px 0; }
.state-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.spinner {
  width: 26px; height: 26px; margin: 0 auto; border-radius: 50%;
  border: 3px solid var(--surface-3); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- modal --- */
.modal-root { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.backdrop { position: absolute; inset: 0; background: rgba(17, 24, 39, 0.32); backdrop-filter: blur(3px); }
.modal {
  position: relative; width: 100%; max-width: 500px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-pop);
}
.modal-wide { max-width: 1000px; }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -0.2px; }
.modal-title { display: flex; align-items: center; gap: 12px; }
.modal-title .avatar-sm { width: 42px; height: 42px; font-size: 13px; }
.eyebrow { margin: 0 0 2px; font-size: 11px; font-weight: 600; color: var(--muted); }

.modal-grid { display: grid; grid-template-columns: 250px 1fr; }
.fields { margin: 0; padding: 18px 20px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; background: var(--surface-2); }
.field dt { font-size: 11px; font-weight: 600; color: var(--muted); }
.field dd { margin: 3px 0 0; word-break: break-word; }

.draft { padding: 18px 20px; min-width: 0; }
.draft-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.draft-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.source { font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); }
.source-n8n { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
.source-template { color: var(--text-2); background: var(--surface-2); }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab { padding: 5px 11px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font-weight: 600; font-size: 12px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab.active { background: var(--accent); color: var(--accent-ink); }
.mail { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.mail-meta { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; display: grid; gap: 3px; background: var(--surface-2); border-radius: 12px 12px 0 0; }
.mail-meta .muted { display: inline-block; width: 58px; }
.mail-body {
  margin: 0; padding: 14px; white-space: pre-wrap; word-wrap: break-word;
  font: 13.5px/1.65 var(--font); color: var(--text);
  max-height: 46vh; overflow: auto;
}
.draft-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

/* -------------------------------------------------------------- form --- */
.form { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.fld { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.fld > span, .fld legend { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 0; }
.fld small { font-size: 11.5px; }
.fld input:not([type=radio]) {
  width: 100%; padding: 8px 11px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
}
.fld input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08); }
.with-btn { display: flex; gap: 6px; }
.with-btn input { flex: 1; min-width: 0; }
.live-fields { display: flex; flex-direction: column; gap: 14px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; width: fit-content; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 5px 16px; border-radius: 6px; font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-error { margin: 0; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--red-bg); color: var(--red); font-size: 12.5px; }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.form-foot-right { display: flex; gap: 8px; margin-left: auto; }

/* ------------------------------------------------------------- toast --- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60;
  max-width: calc(100vw - 32px); padding: 9px 15px; border-radius: 10px;
  background: #111827; color: #fff; box-shadow: var(--shadow-pop); font-weight: 500; font-size: 13px;
}

/* -------------------------------------------------------- responsive --- */
@media (max-width: 900px) {
  .modal-grid { grid-template-columns: 1fr; }
  .fields { border-right: 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar {
    position: sticky; top: 0; z-index: 25; height: auto; width: 100%; flex: none;
    flex-direction: row; align-items: center; gap: 10px; padding: 8px 16px;
    border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto;
  }
  .wordmark { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-item { padding: 7px 9px; }
  .nav-item span { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; }
  .topbar { top: 47px; padding: 9px 16px; gap: 10px; }
  .search { display: none; }
  .content { padding: 16px; }
  .ws-menu { min-width: min(270px, calc(100vw - 32px)); }
  .board { grid-auto-columns: minmax(78vw, 1fr); }
  .panel-head .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* "Show N more" at the bottom of a long column */
.col-more {
  width: 100%; padding: 7px 10px; border-radius: 10px; cursor: pointer; font: inherit;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  background: var(--surface); border: 1px dashed var(--border-strong);
}
.col-more:hover { color: var(--text); border-style: solid; background: var(--surface-2); }
