/* public/styles.css — Kindloops OS brand system.
   Kindloops brand (from kindloops.io): signal blue #003F91 + cyan #5DA9E9 + ink
   navy on a warm canvas, white cards. System sans (Segoe UI ~ Rubik). Offline. */

:root {
  /* brand — the variable NAMES are kept so all downstream rules cascade;
     values are the real Kindloops palette (blue/cyan/ink). */
  --sage: #0D2B52;              /* deep brand blue: headings, labels, logo, nav text */
  --sage-mid: #2E6FB8;          /* mid blue: single-hue data fill (>=3:1 on bg) */
  --sage-soft: #5DA9E9;         /* cyan: soft accents */
  --sage-tint: #E6EEF8;         /* light blue tint: active nav bg, chips */
  --sage-tint-2: #D6E4F4;
  --terracotta: #003F91;        /* signal blue: primary actions, active nav, links */
  --terracotta-dark: #06306E;
  --terracotta-tint: #E4EEFB;

  /* surfaces */
  --bg: #F4F3EE;                /* Kindloops canvas */
  --card: #FFFFFF;
  --surface: #EEF1F5;
  --surface-2: #E3E9F0;
  --border: #DCE3EC;
  --border-soft: #E9EDF2;

  /* ink */
  --ink: #0A1222;              /* near-black navy */
  --ink-2: #46566B;           /* stone */
  --ink-3: #8A96A5;           /* stone-soft */

  /* status */
  --good: #15803D;
  --good-bg: rgba(34, 197, 94, .14);
  --warn: #B45309;
  --warn-bg: rgba(251, 191, 36, .16);
  --bad: #B91C1C;
  --bad-bg: rgba(239, 68, 68, .12);
  --info: #003F91;
  --info-bg: rgba(93, 169, 233, .16);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 3px 14px rgba(4, 8, 17, .08);
  --shadow-lg: 0 12px 40px rgba(4, 8, 17, .16);
  --sidebar-w: 228px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }
html { overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  display: flex;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;      /* the page itself never scrolls sideways; wide */
}                          /* content (kanban, tables) scrolls in its own box */
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--terracotta); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--ink-3); }

/* ============================== SIDEBAR ============================== */
#sidebar {
  width: var(--sidebar-w);
  position: fixed; top: 0; left: 0; bottom: 0;
  background: linear-gradient(180deg, var(--sage-tint) 0%, #F1F3EA 100%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
}
.sb-logo {
  padding: 22px 20px 18px;
  display: flex; align-items: center; gap: 10px;
  font-weight: bold; font-size: 17px; color: var(--sage); letter-spacing: -.2px;
  border-bottom: 1px solid var(--sage-tint-2);
}
.sb-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--terracotta); flex: none; }
.sb-nav { flex: 1; padding: 12px 12px 16px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.sb-section {
  font-size: 10px; font-weight: bold; letter-spacing: .12em; text-transform: uppercase;
  color: var(--sage-soft); padding: 12px 12px 6px;
}
.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 9px; cursor: pointer;
  font-size: 14px; color: var(--ink-2); text-align: left;
  background: none; border: none; width: 100%;
  transition: background .15s, color .15s;
}
.sb-item:hover { background: rgba(255, 255, 255, .75); color: var(--ink); }
.sb-item.active { background: var(--terracotta); color: #fff; font-weight: bold; box-shadow: 0 2px 8px rgba(184, 107, 75, .3); }
.sb-item .ico { font-size: 16px; width: 20px; text-align: center; flex: none; }
.sb-footer { padding: 14px 20px; border-top: 1px solid var(--sage-tint-2); font-size: 11px; color: var(--sage-soft); }

/* ============================== MAIN / TOPBAR ============================== */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }
#topbar {
  padding: 16px 28px;
  background: rgba(250, 247, 242, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title { font-size: 20px; font-weight: bold; color: var(--sage); letter-spacing: -.3px; }
.topbar-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
/* hamburger — hidden on desktop, shown when the sidebar becomes a drawer */
.sb-toggle { display: none; background: none; border: none; font-size: 22px; line-height: 1; color: var(--sage); cursor: pointer; padding: 2px 4px; flex: none; }
.sb-backdrop { position: fixed; inset: 0; background: rgba(4, 8, 17, .4); z-index: 99; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sb-backdrop.open { opacity: 1; pointer-events: auto; }
/* two-column layout that stacks on small screens (used by Content, Finance…) */
.split-2 { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.workspace-chip {
  font-size: 12px; font-weight: bold; color: var(--sage);
  background: var(--sage-tint); border: 1px solid var(--sage-tint-2);
  padding: 6px 14px; border-radius: 20px; white-space: nowrap;
}
#view { padding: 24px 28px 40px; flex: 1; min-width: 0; }

/* ============================== BUTTONS ============================== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: bold; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--terracotta); color: #fff; box-shadow: 0 2px 8px rgba(184, 107, 75, .25); }
.btn-primary:hover:not(:disabled) { background: var(--terracotta-dark); }
.btn-ghost { color: var(--ink-2); border-color: var(--border); background: var(--card); }
.btn-ghost:hover:not(:disabled) { background: var(--surface); color: var(--ink); border-color: var(--sage-soft); }
.btn-quiet { color: var(--ink-2); }
.btn-quiet:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
.btn-danger { color: var(--bad); border-color: rgba(158, 75, 75, .35); background: var(--card); }
.btn-danger:hover:not(:disabled) { background: var(--bad-bg); }
.btn-good { background: var(--good); color: #fff; }
.btn-good:hover:not(:disabled) { background: #446F4D; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }

/* ============================== CARDS ============================== */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card-hd {
  padding: 15px 20px; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-hd-title { font-size: 15px; font-weight: bold; color: var(--ink); }
.card-hd-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 18px 20px; }

/* ============================== STAT TILES ============================== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-tile {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); cursor: pointer;
  border-top: 3px solid var(--sage-tint-2);
  transition: border-color .15s, transform .12s;
}
.stat-tile:hover { transform: translateY(-1px); border-color: var(--sage-soft); }
.stat-tile.accent { border-top-color: var(--terracotta); }
.stat-tile.sage { border-top-color: var(--sage-mid); }
.stat-label { font-size: 11px; font-weight: bold; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.stat-val { font-size: 28px; font-weight: bold; color: var(--ink); line-height: 1.05; letter-spacing: -.5px; }
.stat-sub { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

/* ------ bar list (single-hue magnitude; labels + values in ink) ------ */
.barlist { display: flex; flex-direction: column; gap: 10px; }
.barlist-row { display: grid; grid-template-columns: 130px 1fr 34px; gap: 10px; align-items: center; }
.barlist-label { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barlist-track { background: var(--surface); border-radius: 4px; height: 14px; overflow: hidden; }
.barlist-fill { background: var(--sage-mid); height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; transition: width .3s ease; }
.barlist-val { font-size: 12px; font-weight: bold; color: var(--ink); text-align: right; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border-soft);
}
.list-row:last-child { border-bottom: none; }
.list-row-main { min-width: 0; }
.list-row-title { font-size: 13px; font-weight: bold; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.needs-action-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.needs-action-row:last-child { border-bottom: none; }
.needs-action-row:hover .list-row-title { color: var(--terracotta); }
.na-count {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 13px; background: var(--terracotta-tint); color: var(--terracotta-dark);
  flex: none;
}
.na-count.zero { background: var(--surface); color: var(--ink-3); }

/* ============================== INPUTS / FORMS ============================== */
.input, .select, textarea.input {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; color: var(--ink); font-size: 13px; outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--terracotta); box-shadow: 0 0 0 3px rgba(184, 107, 75, .12);
}
.input::placeholder { color: var(--ink-3); }
textarea.input { resize: vertical; min-height: 72px; line-height: 1.5; }
.search-input { width: 230px; background: var(--surface); }
.select { cursor: pointer; }
.fg { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.fg > label { font-size: 11px; font-weight: bold; color: var(--sage); letter-spacing: .05em; text-transform: uppercase; }
.fg .hint { font-size: 12px; color: var(--ink-3); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 42px; height: 24px; border-radius: 13px; background: var(--surface-2);
  border: 1px solid var(--border); transition: background .18s; flex: none;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s;
}
.switch input:checked + .track { background: var(--good); border-color: var(--good); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(184, 107, 75, .2); }

/* segmented control (Note / Email toggle) */
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segmented button {
  padding: 6px 14px; border-radius: 6px; border: none; background: transparent;
  font-size: 12px; font-weight: bold; color: var(--ink-2); cursor: pointer; transition: background .12s, color .12s;
}
.segmented button.active { background: var(--card); color: var(--sage); box-shadow: 0 1px 3px rgba(46, 51, 37, .15); }

/* ============================== TABLE ============================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 20px; text-align: left; font-size: 11px; font-weight: bold;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
  border-bottom: 1px solid var(--border-soft); white-space: nowrap;
  background: var(--surface);
}
tbody tr { border-bottom: 1px solid var(--border-soft); transition: background .12s; }
tbody tr.rowlink { cursor: pointer; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
tbody td { padding: 12px 20px; font-size: 13px; color: var(--ink-2); }
tbody td:first-child { color: var(--ink); font-weight: bold; }

/* ============================== BADGES / CHIPS ============================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: bold; white-space: nowrap;
}
.badge-lead { background: var(--info-bg); color: var(--info); }
.badge-customer { background: var(--good-bg); color: var(--good); }
.badge-src { background: var(--surface-2); color: var(--ink-2); }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--surface-2); color: var(--ink-2); }
.badge-sage { background: var(--sage-tint); color: var(--sage); }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: bold;
  background: var(--sage-tint); color: var(--sage); border: 1px solid var(--sage-tint-2);
}
.tag-chip .x { cursor: pointer; opacity: .55; }
.tag-chip .x:hover { opacity: 1; color: var(--bad); }

/* ============================== KANBAN ============================== */
.kanban-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.kanban { display: flex; gap: 14px; overflow-x: auto; align-items: flex-start; padding-bottom: 14px; }
.kanban-col {
  min-width: 248px; width: 248px; flex: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); display: flex; flex-direction: column;
  max-height: calc(100vh - 235px);
}
.kanban-col.drop-target { border-color: var(--terracotta); background: var(--terracotta-tint); }
.kanban-col-hd { padding: 12px 14px 10px; border-bottom: 1px solid var(--border-soft); }
.kanban-col-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: bold; letter-spacing: .04em; text-transform: uppercase; color: var(--ink); }
.kanban-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.kanban-count {
  margin-left: auto; font-size: 11px; font-weight: bold; color: var(--ink-2);
  background: var(--card); border: 1px solid var(--border); padding: 1px 8px; border-radius: 12px;
}
.kanban-sum { font-size: 11px; color: var(--ink-3); margin-top: 4px; font-weight: bold; }
.kanban-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; flex: 1; }
.kanban-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; cursor: grab; box-shadow: 0 1px 4px rgba(46, 51, 37, .07);
  transition: box-shadow .15s, border-color .15s;
}
.kanban-card:hover { border-color: var(--sage-soft); box-shadow: var(--shadow); }
.kanban-card.dragging { opacity: .45; cursor: grabbing; }
.kc-contact { font-size: 13px; font-weight: bold; color: var(--ink); }
.kc-company { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.kc-title { font-size: 12px; color: var(--ink-2); margin-top: 5px; }
.kc-value { font-size: 12px; font-weight: bold; color: var(--terracotta-dark); margin-top: 6px; }
.kanban-empty { font-size: 12px; color: var(--ink-3); font-style: italic; text-align: center; padding: 14px 6px; }

/* ============================== CONVERSATIONS ============================== */
.convo-layout {
  display: grid; grid-template-columns: 290px 1fr; gap: 16px;
  height: calc(100vh - 148px); min-height: 420px;
}
.convo-list { display: flex; flex-direction: column; overflow: hidden; }
.convo-list-scroll { overflow-y: auto; flex: 1; }
.convo-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft); cursor: pointer;
  transition: background .12s;
}
.convo-item:hover { background: var(--bg); }
.convo-item.active { background: var(--sage-tint); border-left: 3px solid var(--terracotta); padding-left: 13px; }
.convo-item-name { font-size: 13px; font-weight: bold; color: var(--ink); display: flex; justify-content: space-between; gap: 8px; }
.convo-item-name .when { font-weight: normal; font-size: 11px; color: var(--ink-3); flex: none; }
.convo-item-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-pane { display: flex; flex-direction: column; overflow: hidden; }
.convo-thread { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.bubble { max-width: 78%; border-radius: 12px; padding: 10px 14px; font-size: 13px; line-height: 1.5; box-shadow: 0 1px 3px rgba(46, 51, 37, .08); }
.bubble .b-subject { font-weight: bold; margin-bottom: 4px; color: inherit; }
.bubble .b-body { white-space: pre-wrap; word-break: break-word; }
.bubble .b-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 11px; color: var(--ink-3); flex-wrap: wrap; }
.bubble-in { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble-out { align-self: flex-end; background: var(--sage-tint); border: 1px solid var(--sage-tint-2); border-bottom-right-radius: 4px; }
.bubble-note { align-self: stretch; max-width: 100%; background: #FBF3DC; border: 1px solid #EFDFB3; border-radius: 10px; }
.bubble-note .b-meta { color: #8A7433; }
.composer { border-top: 1px solid var(--border-soft); padding: 12px 16px; background: var(--card); }
.composer-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.composer textarea.input { min-height: 62px; }
.composer-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 8px; }

/* ============================== AGENDA (calendar) ============================== */
.agenda-day { margin-bottom: 20px; }
.agenda-day-hd { font-size: 12px; font-weight: bold; letter-spacing: .07em; text-transform: uppercase; color: var(--sage); padding-bottom: 6px; border-bottom: 2px solid var(--sage-tint-2); margin-bottom: 4px; }
.agenda-row { display: flex; align-items: center; gap: 14px; padding: 11px 4px; border-bottom: 1px solid var(--border-soft); }
.agenda-row:last-child { border-bottom: none; }
.agenda-time { font-size: 13px; font-weight: bold; color: var(--terracotta-dark); min-width: 88px; flex: none; }
.agenda-main { flex: 1; min-width: 0; }
.agenda-title { font-size: 13px; font-weight: bold; color: var(--ink); }
.agenda-title.cancelled { text-decoration: line-through; color: var(--ink-3); }
.agenda-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.agenda-actions { display: flex; gap: 6px; flex: none; }

/* ============================== WORKFLOW BUILDER ============================== */
.wf-step {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; margin-bottom: 10px;
}
.wf-step-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.wf-step-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--sage); color: #fff;
  font-size: 11px; font-weight: bold; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.wf-step-hd .select { flex: 1; }
.wf-step-config .fg { margin-bottom: 9px; }
.wf-step-config .fg:last-child { margin-bottom: 0; }
.code-url {
  font-family: Consolas, Monaco, monospace; font-size: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px;
  color: var(--sage); overflow-x: auto; white-space: nowrap; flex: 1; min-width: 0;
}

/* ============================== SLIDE-IN PANEL ============================== */
.overlay { position: fixed; inset: 0; background: rgba(46, 51, 37, .35); z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s; }
.overlay.open { opacity: 1; pointer-events: auto; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 450px; max-width: 94vw;
  background: var(--card); border-left: 1px solid var(--border);
  overflow-y: auto; padding: 26px; z-index: 201;
  transform: translateX(102%); transition: transform .25s cubic-bezier(.25, .46, .45, .94);
  box-shadow: var(--shadow-lg);
}
.panel.open { transform: translateX(0); }
.panel-close {
  position: absolute; top: 16px; right: 16px; width: 34px; height: 34px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 15px; color: var(--ink-2);
}
.panel-close:hover { background: var(--surface-2); color: var(--ink); }
.dp-avatar {
  width: 54px; height: 54px; border-radius: 50%; background: var(--sage);
  color: #fff; font-size: 21px; font-weight: bold;
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.dp-name { font-size: 20px; font-weight: bold; color: var(--sage); }
.dp-sub { font-size: 13px; color: var(--ink-2); margin: 2px 0 16px; }
.dp-field { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 9px; padding: 10px 13px; margin-bottom: 10px; }
.dp-field-label { font-size: 10px; font-weight: bold; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px; }
.dp-field-val { font-size: 13px; color: var(--ink); word-break: break-word; }
.dp-field-val.empty { color: var(--ink-3); font-style: italic; }
.dp-section-title { font-size: 12px; font-weight: bold; color: var(--ink); margin: 18px 0 8px; letter-spacing: .03em; text-transform: uppercase; }
.dp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dp-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.dp-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ============================== MODAL ============================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(46, 51, 37, .42); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px; width: 520px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: popIn .18s ease;
}
.modal.wide { width: 660px; }
@keyframes popIn { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 18px; font-weight: bold; color: var(--sage); margin-bottom: 3px; }
.modal-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }

/* callout (settings warning etc.) */
.callout { border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.55; margin: 8px 0 14px; }
.callout-warn { background: var(--warn-bg); color: #7A5A20; border: 1px solid rgba(169, 118, 43, .3); }
.callout-good { background: var(--good-bg); color: #38623F; border: 1px solid rgba(79, 138, 91, .3); }

/* ============================== TOAST / STATES ============================== */
#toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(90px);
  background: var(--sage); color: #fff; border-radius: 24px; padding: 11px 22px;
  font-size: 13px; font-weight: bold; z-index: 9998; box-shadow: var(--shadow-lg);
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1); max-width: min(88vw, 560px);
}
#toast.show { transform: translateX(-50%) translateY(0); }

.empty-state { padding: 52px 24px; text-align: center; }
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .6; }
.empty-title { font-size: 16px; font-weight: bold; color: var(--ink); margin-bottom: 6px; }
.empty-desc { font-size: 13px; color: var(--ink-3); line-height: 1.6; max-width: 380px; margin: 0 auto; }

.loading { padding: 44px; text-align: center; color: var(--ink-3); font-size: 13px; }
.spinner {
  width: 26px; height: 26px; margin: 0 auto 12px;
  border: 3px solid var(--border); border-top-color: var(--terracotta); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== RESPONSIVE ==============================
   Below 900px the fixed sidebar becomes an off-canvas DRAWER toggled by the
   topbar hamburger (works the same on a tablet or a phone on the same Wi-Fi). */
@media (max-width: 900px) {
  body { display: block; }                 /* sidebar is a fixed drawer now — no flex row */
  .sb-toggle { display: inline-flex; }
  #sidebar {
    width: 244px;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.25, .46, .45, .94);
    box-shadow: var(--shadow-lg);
  }
  #sidebar.open { transform: none; }
  .main { margin-left: 0; width: 100%; overflow-x: hidden; }
  #topbar { padding: 12px 16px; }
  #view { padding: 18px 16px 40px; }
  .convo-layout { grid-template-columns: 1fr; height: auto; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .split-2 { grid-template-columns: 1fr; }
}

/* Phone: tighten spacing, denser stat grid, roomier tap targets. */
@media (max-width: 560px) {
  #view { padding: 14px 12px 40px; }
  .topbar-sub { display: none; }
  .stats-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat-tile { padding: 13px 14px; min-width: 0; }
  .stat-val { font-size: 21px; }
  .card-hd, .card-body { padding-left: 15px; padding-right: 15px; }
  .card-hd { flex-wrap: wrap; }
  .card-hd > * { min-width: 0; }               /* long titles/subs wrap, not overflow */
  .card-hd .list-row-sub { flex-basis: 100%; } /* card subtitle drops to its own line */
  .btn { padding: 10px 15px; }                 /* larger touch targets */
  .btn-sm { padding: 7px 11px; }
  .modal { padding: 20px; border-radius: 14px; }
  .workspace-chip { display: none; }
  .kanban-col { width: 82vw; min-width: 82vw; }
}
