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

:root {
  --bg:        #F5F4F0;
  --surface:   #FFFFFF;
  --surface2:  #F0EFE9;
  --border:    #E2E0D8;
  --border2:   #CCCAB8;

  --ink:       #1A1A18;
  --ink2:      #3D3D38;
  --ink3:      #6B6B63;
  --ink4:      #9B9B90;

  --red:       #C0392B;
  --red-bg:    #FDF1F0;
  --red-border:#F5C6C2;

  --green:     #1A7A4A;
  --green-bg:  #F0FAF4;
  --green-border:#A8DBBE;

  --amber:     #B45309;
  --amber-bg:  #FFFBEB;
  --amber-border:#FCD34D;

  --blue:      #1D4ED8;
  --blue-bg:   #EFF6FF;
  --blue-border:#BFDBFE;

  --sidebar-w: 228px;
  --font:      'IBM Plex Sans', sans-serif;
  --mono:      'IBM Plex Mono', monospace;
  --radius:    6px;
  --radius-lg: 10px;
}

html, body { height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); overflow: hidden; font-size: 14px; }

/* ── SHELL ── */
.shell { display: flex; height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.brand-mark {
  width: 30px; height: 30px;
  background: var(--ink);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff;
  letter-spacing: -0.02em; flex-shrink: 0;
}
.brand-name { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.brand-sub  { font-size: 10px; color: var(--ink4); margin-top: 1px; letter-spacing: 0.04em; text-transform: uppercase; }

/* constituency */
.tenant-block {
  margin: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex; align-items: center; justify-content: space-between;
}
.tenant-block:hover { border-color: var(--border2); }
.tenant-label { font-size: 10px; color: var(--ink4); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.tenant-name  { font-size: 12px; font-weight: 600; color: var(--ink); }
.tenant-caret { font-size: 10px; color: var(--ink4); }

/* nav */
nav { flex: 1; padding: 6px 0; overflow-y: auto; }
nav::-webkit-scrollbar { width: 0; }

.nav-group { margin-bottom: 2px; }
.nav-group-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink4); padding: 10px 18px 3px; font-weight: 500;
}

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px 7px 18px;
  cursor: pointer; color: var(--ink3); font-size: 13px;
  transition: background 0.1s, color 0.1s;
  position: relative; border-radius: 0;
  user-select: none;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active { background: var(--bg); color: var(--ink); font-weight: 500; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 5px; bottom: 5px;
  width: 2px; background: var(--ink); border-radius: 0 1px 1px 0;
}
.nav-icon { width: 15px; height: 15px; opacity: 0.5; flex-shrink: 0; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-label { flex: 1; }
.nav-count {
  font-family: var(--mono); font-size: 10px; color: var(--ink4);
  background: var(--border); padding: 1px 6px; border-radius: 10px;
}
.nav-count.alert { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }

/* election badge */
.election-strip {
  margin: 0 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  background: var(--bg);
}
.es-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.es-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink4); }
.es-name  { font-size: 13px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.es-days  { font-family: var(--mono); font-size: 18px; font-weight: 500; color: var(--ink); line-height: 1; }
.es-days-label { font-size: 10px; color: var(--ink4); text-align: right; margin-top: 2px; }
.es-bar   { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.es-fill  { height: 100%; background: var(--ink); border-radius: 2px; width: 38%; transition: width 1s; }

/* ── MAIN ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

/* topbar */
.topbar {
  height: 52px; min-height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 12px;
}
.topbar-crumb { display: flex; align-items: center; gap: 6px; flex: 1; }
.crumb-section { font-size: 12px; color: var(--ink4); }
.crumb-sep     { font-size: 12px; color: var(--border2); }
.crumb-page    { font-size: 13px; font-weight: 600; color: var(--ink); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: var(--radius);
  font-family: var(--font); font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all 0.12s; letter-spacing: 0.01em; line-height: 1;
}
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: var(--ink2); }
.btn-outline { background: transparent; color: var(--ink2); border-color: var(--border2); }
.btn-outline:hover { border-color: var(--ink3); color: var(--ink); }
.btn-ghost   { background: transparent; color: var(--ink3); border-color: transparent; }
.btn-ghost:hover { background: var(--surface2); color: var(--ink); }

.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}

/* content */
.content { flex: 1; overflow-y: auto; padding: 24px; }
.content::-webkit-scrollbar { width: 4px; }
.content::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── PAGE HEADER ── */
.page-header { margin-bottom: 22px; }
.page-title  { font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; }
.page-sub    { font-size: 13px; color: var(--ink3); margin-top: 3px; }

/* ── STAT ROW ── */
.stat-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 20px; }

.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 18px 16px;
  position: relative; overflow: hidden;
}
.stat-card.accent { border-top: 2px solid var(--ink); }
.stat-card.green  { border-top: 2px solid var(--green); }
.stat-card.amber  { border-top: 2px solid var(--amber); }
.stat-card.red    { border-top: 2px solid var(--red); }

.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink4); margin-bottom: 10px; font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 600; color: var(--ink); line-height: 1; letter-spacing: -0.03em; font-family: var(--mono); }
.stat-value.green { color: var(--green); }
.stat-value.amber { color: var(--amber); }
.stat-value.red   { color: var(--red); }
.stat-sub   { font-size: 11px; color: var(--ink4); margin-top: 7px; }
.stat-sub strong { color: var(--ink2); }

/* progress */
.prog { margin-top: 12px; }
.prog-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink4); margin-bottom: 4px; }
.prog-track { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.prog-fill  { height: 100%; border-radius: 2px; transition: width 1.2s cubic-bezier(.4,0,.2,1); }
.prog-fill.ink   { background: var(--ink); }
.prog-fill.green { background: var(--green); }
.prog-fill.amber { background: var(--amber); }
.prog-fill.red   { background: var(--red); }

/* ── PANELS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.full   { margin-bottom: 20px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.panel-head {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-title { font-size: 12px; font-weight: 600; color: var(--ink); text-transform: uppercase; letter-spacing: 0.06em; }
.panel-link  { font-size: 12px; color: var(--ink4); cursor: pointer; }
.panel-link:hover { color: var(--ink); }

/* intent grid */
.intent-row { display: grid; grid-template-columns: repeat(4,1fr); }
.intent-cell {
  padding: 16px 18px; border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.intent-cell:nth-child(4n) { border-right: none; }
.intent-cell:nth-child(n+5) { border-bottom: none; }
.intent-num   { font-family: var(--mono); font-size: 22px; font-weight: 500; line-height: 1; color: var(--ink); }
.intent-num.green { color: var(--green); }
.intent-num.amber { color: var(--amber); }
.intent-num.red   { color: var(--red); }
.intent-num.muted { color: var(--ink4); }
.intent-lbl   { font-size: 11px; color: var(--ink3); margin-top: 5px; }
.intent-pct   { font-family: var(--mono); font-size: 11px; color: var(--ink4); margin-top: 3px; }
.intent-bar   { height: 2px; margin-top: 10px; border-radius: 1px; }

/* ops row */
.ops-row { display: grid; grid-template-columns: repeat(4,1fr); }
.ops-cell { padding: 16px 18px; border-right: 1px solid var(--border); }
.ops-cell:last-child { border-right: none; }
.ops-num   { font-family: var(--mono); font-size: 22px; font-weight: 500; color: var(--ink); }
.ops-lbl   { font-size: 11px; color: var(--ink3); margin-top: 4px; }
.ops-delta { font-size: 11px; margin-top: 6px; display: flex; align-items: center; gap: 3px; }
.ops-delta.up   { color: var(--green); }
.ops-delta.warn { color: var(--amber); }
.ops-delta.down { color: var(--red); }

/* table */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink4); font-weight: 500;
  padding: 9px 18px; text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; white-space: nowrap;
}
.tbl td {
  padding: 11px 18px; font-size: 13px;
  border-bottom: 1px solid var(--border); vertical-align: middle;
  color: var(--ink2);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--bg); cursor: pointer; }

/* mini intent bar in table */
.bar-row { display: flex; height: 4px; border-radius: 2px; overflow: hidden; width: 100px; }
.bar-seg  { height: 100%; }
.cell-sub { font-size: 11px; color: var(--ink4); margin-top: 2px; }

/* tags / badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 20px;
  line-height: 1.6;
}
.badge.green  { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge.amber  { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.badge.red    { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-border); }
.badge.grey   { background: var(--bg); color: var(--ink3); border: 1px solid var(--border); }
.badge.ink    { background: var(--ink); color: #fff; border: 1px solid var(--ink); }

.tag {
  display: inline-block; font-size: 11px; color: var(--ink3);
  background: var(--bg); border: 1px solid var(--border);
  padding: 1px 7px; border-radius: 3px; margin: 1px 2px 1px 0;
}

/* member row avatar */
.m-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: #fff;
  margin-right: 8px; flex-shrink: 0; vertical-align: middle;
}

/* feed */
.feed { }
.feed-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
}
.feed-item:last-child { border-bottom: none; }
.feed-dot  { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.feed-body { flex: 1; }
.feed-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.feed-desc { font-size: 12px; color: var(--ink3); margin-top: 2px; line-height: 1.5; }
.feed-meta { font-size: 11px; color: var(--ink4); margin-top: 4px; display: flex; gap: 10px; }
.feed-badge { align-self: flex-start; margin-top: 2px; }

/* ── SEARCH ── */
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.search-wrap { position: relative; flex: 1; max-width: 280px; }
.search-wrap input {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border); color: var(--ink);
  font-family: var(--font); font-size: 13px;
  padding: 8px 11px 8px 30px;
  border-radius: var(--radius); outline: none;
  transition: border-color 0.15s;
}
.search-wrap input:focus { border-color: var(--ink3); }
.search-wrap input::placeholder { color: var(--ink4); }
.search-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--ink4); font-size: 13px; pointer-events: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font);
  border: none;
  color: var(--ink3);
  background: transparent;
  transition: all 0.12s;
  font-weight: 500;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.chip:hover {
  color: var(--ink2);
  background: rgba(255,255,255,0.6);
}
.chip.on {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  font-weight: 600;
}

/* ── VOTER PROFILE ── */
.vp-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
.vp-info { display: flex; flex-direction: column; gap: 16px; }

.vp-identity {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.vp-name { font-size: 17px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; }
.vp-nid  { font-family: var(--mono); font-size: 12px; color: var(--ink4); margin-top: 4px; }
.vp-divider { height: 1px; background: var(--border); margin: 14px 0; }
.vp-row  { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 11px; }
.vp-row:last-child { margin-bottom: 0; }
.vp-key  { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink4); font-weight: 500; padding-top: 2px; }
.vp-val  { font-size: 12px; color: var(--ink2); text-align: right; max-width: 160px; }

.conf-track { display: flex; gap: 3px; }
.conf-pip { width: 18px; height: 4px; border-radius: 1px; background: var(--border); }
.conf-pip.on { background: var(--ink); }

/* log */
.log-entry {
  display: flex; gap: 14px; padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.log-entry:last-child { border-bottom: none; }
.log-line { width: 1px; background: var(--border); align-self: stretch; flex-shrink: 0; margin-top: 6px; }
.log-line.g { background: var(--green); }
.log-line.a { background: var(--amber); }
.log-line.b { background: var(--blue-border); }
.log-head { font-size: 12px; font-weight: 500; color: var(--ink); display: flex; gap: 8px; align-items: center; }
.log-note { font-size: 12px; color: var(--ink3); margin-top: 4px; line-height: 1.5; }
.log-shift { font-size: 11px; color: var(--ink4); margin-top: 6px; display: flex; align-items: center; gap: 5px; }
.log-meta  { font-size: 11px; color: var(--ink4); margin-top: 4px; }
.shift-to.g { color: var(--green); font-weight: 500; }
.shift-to.a { color: var(--amber); font-weight: 500; }

/* canvassing */
.round-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 20px; }
.round-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
}
.rc-island { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink4); margin-bottom: 6px; }
.rc-label  { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 14px; }
.rc-nums   { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink4); margin-bottom: 5px; }
.rc-pct    { font-family: var(--mono); font-size: 11px; color: var(--ink2); font-weight: 500; }

/* election night */
.night-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 20px; }
.night-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
}
.nc-station { font-size: 11px; color: var(--ink4); margin-bottom: 4px; }
.nc-status  { font-size: 12px; font-weight: 500; color: var(--ink3); margin-bottom: 12px; }
.nc-row     { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.nc-cand    { font-size: 12px; color: var(--ink2); }
.nc-votes   { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--ink); }
.nc-votes.lead { color: var(--green); }

/* empty */
.empty { text-align: center; padding: 60px 20px; font-size: 13px; color: var(--ink4); }

/* divider line */
hr { border: none; border-top: 1px solid var(--border); margin: 0; }

/* login */
.login-shell {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; background: var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%; max-width: 360px;
}
.login-card .brand {
  justify-content: center;
  border-bottom: none;
  padding: 0 0 24px;
}
.login-card .brand-name { font-size: 15px; }
.login-card input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--font); font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--radius);
  outline: none;
  margin-bottom: 12px;
}
.login-card input:focus { border-color: var(--ink3); }
.login-card input::placeholder { color: var(--ink4); }
.login-card label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink4);
  margin-bottom: 5px;
  font-weight: 500;
}
.login-card .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 10px;
  margin-top: 8px;
}
.login-error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 16px;
}

/* forms */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink4);
  margin-bottom: 5px;
  font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--font); font-size: 13px;
  padding: 8px 11px;
  border-radius: var(--radius);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--ink3); }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--ink4); }
.form-group .help {
  font-size: 11px; color: var(--ink4); margin-top: 4px;
}
.form-group .error {
  font-size: 11px; color: var(--red); margin-top: 4px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }


/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE & PWA
   ═══════════════════════════════════════════════════════════════ */

/* ── Mobile nav button ── */
.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: transparent; border: none;
  cursor: pointer; color: var(--ink);
  border-radius: var(--radius);
}
.mobile-menu-btn:hover { background: var(--bg); }
.mobile-menu-btn svg { width: 20px; height: 20px; }

/* ── Sidebar overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.2s;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ── Mobile bottom nav ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 80;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
}
.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  color: var(--ink4);
  text-decoration: none;
  font-size: 10px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.mobile-nav a:hover,
.mobile-nav a.active {
  color: var(--ink);
  background: var(--bg);
}
.mobile-nav a svg {
  width: 20px; height: 20px;
  opacity: 0.6;
}
.mobile-nav a.active svg,
.mobile-nav a:hover svg {
  opacity: 1;
}

/* ── Table scroll wrapper ── */
.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tbl-wrap .tbl { min-width: 640px; }

/* ── Touch-friendly tap targets ── */
.nav-item,
.mobile-nav a,
.chip,
.btn,
.panel-link {
  min-height: 44px;
}

/* ── Responsive breakpoints ── */

/* Tablet: 768px – 1023px */
@media (max-width: 1023px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2  { grid-template-columns: 1fr; }
  .grid-3  { grid-template-columns: repeat(2, 1fr); }
  .round-grid   { grid-template-columns: repeat(2, 1fr); }
  .night-grid   { grid-template-columns: repeat(2, 1fr); }
  .vp-layout    { grid-template-columns: 1fr; }
  .intent-row   { grid-template-columns: repeat(2, 1fr); }
  .intent-cell:nth-child(4n) { border-right: 1px solid var(--border); }
  .intent-cell:nth-child(2n) { border-right: none; }
  .intent-cell:nth-child(n+5) { border-bottom: 1px solid var(--border); }
  .intent-cell:nth-child(n+7) { border-bottom: none; }
  .ops-row      { grid-template-columns: repeat(2, 1fr); }
  .ops-cell:nth-child(2n) { border-right: none; }
  .ops-cell:nth-child(odd) { border-right: 1px solid var(--border); }
}

/* Phone: < 768px */
@media (max-width: 767px) {
  :root { --sidebar-w: 0px; }

  html, body { font-size: 15px; }

  html, body { overflow-y: auto; -webkit-overflow-scrolling: touch; }

  .shell { display: block; height: auto; min-height: 100vh; }

  /* Sidebar hidden by default, slides in when open */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 260px; min-width: 260px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main {
    height: auto;
    min-height: 100vh;
    padding-bottom: 56px; /* space for bottom nav */
  }

  .topbar {
    height: 48px; min-height: 48px;
    padding: 0 12px;
    gap: 8px;
  }
  .topbar-actions {
    gap: 6px;
  }
  .topbar-actions .btn-outline {
    display: none;
  }
  .topbar-actions .btn-primary {
    padding: 5px 10px;
    font-size: 11px;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .content {
    padding: 14px;
    overflow-y: visible;
  }

  .page-header { margin-bottom: 14px; }
  .page-title { font-size: 18px; }
  .page-sub  { font-size: 12px; }

  .stat-row { grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }
  .stat-card { padding: 14px 14px 12px; }
  .stat-value { font-size: 24px; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 12px; margin-bottom: 14px; }
  .full { margin-bottom: 14px; }

  .intent-row { grid-template-columns: 1fr 1fr; }
  .intent-cell { padding: 12px 14px; }
  .intent-num { font-size: 18px; }

  .ops-row { grid-template-columns: 1fr 1fr; }
  .ops-cell { padding: 12px 14px; }
  .ops-num { font-size: 18px; }

  .panel-head { padding: 12px 14px 10px; }
  .panel-title { font-size: 11px; }

  .round-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }
  .night-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }

  .vp-layout { grid-template-columns: 1fr; gap: 12px; }

  .feed-item { padding: 10px 14px; gap: 10px; }
  .feed-name { font-size: 14px; }
  .feed-desc { font-size: 13px; }

  .m-avatar { width: 32px; height: 32px; font-size: 11px; }

  .search-wrap { max-width: none; }
  .toolbar { flex-wrap: wrap; }

  .form-row { grid-template-columns: 1fr; }

  .login-card { padding: 28px 20px; margin: 16px; }

  .tbl th, .tbl td { padding: 9px 14px; }

  /* Show mobile bottom nav */
  .mobile-nav {
    display: flex;
  }
}

/* Small phone: < 380px */
@media (max-width: 379px) {
  .topbar-crumb .crumb-section {
    display: none;
  }
  .topbar-crumb .crumb-sep {
    display: none;
  }
  .intent-row { grid-template-columns: 1fr; }
  .ops-row { grid-template-columns: 1fr 1fr; }
  .content { padding: 10px; }
}

/* ── Safe-area insets for notched phones ── */
@supports (padding: max(0px)) {
  @media (max-width: 767px) {
    .topbar {
      padding-left: max(12px, env(safe-area-inset-left));
      padding-right: max(12px, env(safe-area-inset-right));
      padding-top: env(safe-area-inset-top);
    }
    .mobile-nav {
      padding-bottom: env(safe-area-inset-bottom);
      height: calc(56px + env(safe-area-inset-bottom));
    }
    .sidebar {
      padding-top: env(safe-area-inset-top);
    }
  }
}


/* ═══════════════════════════════════════════════════════════════
   FORM INPUTS
   ═══════════════════════════════════════════════════════════════ */

.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 11px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--ink3); }
.input::placeholder { color: var(--ink4); }

select.input {
  appearance: auto;
  padding-right: 12px;
}
select.input option {
  color: var(--ink);
  background: var(--surface);
}
select.input option:first-child {
  color: var(--ink3);
}

.checkbox {
  width: 18px; height: 18px;
  accent-color: var(--ink);
  cursor: pointer;
}

/* row click target */
.row-link {
  cursor: pointer;
}
.row-link:hover td {
  background: var(--bg);
}


/* ═══════════════════════════════════════════════════════════════
   TOM SELECT — searchable dropdowns
   ═══════════════════════════════════════════════════════════════ */

.ts-control {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: var(--ink) !important;
  font-family: var(--font) !important;
  font-size: 13px !important;
  padding: 7px 30px 7px 11px !important;
  min-height: 36px !important;
}
.ts-control:focus,
.ts-control.focus {
  border-color: var(--ink3) !important;
  box-shadow: none !important;
}
.ts-dropdown {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
  color: var(--ink) !important;
  font-family: var(--font) !important;
  font-size: 13px !important;
  z-index: 200 !important;
}
.ts-dropdown .option {
  padding: 7px 11px !important;
}
.ts-dropdown .option.active {
  background: var(--bg) !important;
  color: var(--ink) !important;
}
.ts-dropdown .option:hover {
  background: var(--bg) !important;
}
.ts-dropdown .create {
  color: var(--ink3) !important;
}
.ts-dropdown input {
  background: var(--surface) !important;
  color: var(--ink) !important;
  font-family: var(--font) !important;
  font-size: 13px !important;
}
.ts-wrapper.single .ts-control::after {
  border-color: var(--ink4) transparent transparent transparent !important;
}
.ts-wrapper.single.dropdown-active .ts-control::after {
  border-color: transparent transparent var(--ink4) transparent !important;
}
.ts-wrapper .ts-control > input {
  color: var(--ink) !important;
}


/* ═══════════════════════════════════════════════════════════════
   FORM HELPERS
   ═══════════════════════════════════════════════════════════════ */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.form-grid .form-group:has(textarea),
.form-grid .form-group.full-width {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 24px;
}
.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 0 !important;
  font-size: 13px;
  color: var(--ink2);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

/* Custom checkbox */
.checkbox-row input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border2);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s;
}
.checkbox-row input[type="checkbox"]:checked {
  background: var(--ink);
  border-color: var(--ink);
}
.checkbox-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.form-panel {
  max-width: 720px;
}
.panel-divider {
  border-top: 1px solid var(--border);
}
.panel-foot {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 16px;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* Empty state in stat cards */
.stat-empty {
  color: var(--ink3);
  font-size: 18px;
  font-weight: 500;
}
.stat-empty-sub {
  color: var(--ink3);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ═══════════════════════════════════════════════════════════════
   MEMBER PROFILE CARD (view + edit)
   ═══════════════════════════════════════════════════════════════ */

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.profile-header-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.profile-photo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
}

.profile-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border), 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink4);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.profile-photo.has-image {
  border: 3px solid var(--surface);
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.profile-photo .photo-icon {
  width: 36px;
  height: 36px;
  opacity: 0.35;
}

.profile-body {
  padding: 28px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.profile-name {
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.profile-name-input {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  border: none;
  border-bottom: 2px solid var(--border);
  background: transparent;
  padding: 4px 0;
  width: 100%;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}
.profile-name-input:focus {
  border-color: var(--ink);
}

.profile-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}
.profile-status-badge.green {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.profile-status-badge.red {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.profile-status-badge.grey {
  background: var(--bg);
  color: var(--ink3);
  border: 1px solid var(--border);
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 14px;
  color: var(--ink3);
}
.profile-meta-item {
  display: flex;
  gap: 6px;
}
.profile-meta-label {
  color: var(--ink4);
}
.profile-meta-value {
  color: var(--ink2);
  font-weight: 500;
}

.profile-age {
  font-size: 15px;
  color: var(--ink3);
}

.profile-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.profile-info-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.profile-info-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ink3);
}

.profile-info-icon svg {
  width: 20px;
  height: 20px;
}

.profile-info-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink4);
  font-weight: 500;
  margin-bottom: 3px;
}

.profile-info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.profile-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.profile-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.profile-contact-icon {
  width: 20px;
  height: 20px;
  color: var(--ink4);
  flex-shrink: 0;
  margin-top: 2px;
}

.profile-contact-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink4);
  font-weight: 500;
  margin-bottom: 3px;
}

.profile-contact-value {
  font-size: 14px;
  color: var(--ink2);
  word-break: break-word;
}

.profile-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.profile-address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.profile-address-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-address-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink4);
  font-weight: 500;
}

.profile-address-value {
  font-size: 14px;
  color: var(--ink2);
  line-height: 1.5;
}

/* Edit form overrides inside profile */
.profile-body .form-group {
  margin-bottom: 0;
}
.profile-body .form-group input,
.profile-body .form-group select,
.profile-body .form-group textarea {
  background: var(--surface);
}

.profile-info-cell .form-group label {
  margin-bottom: 2px;
  font-size: 10px;
}
.profile-info-cell .form-group input,
.profile-info-cell .form-group select {
  padding: 5px 8px;
  font-size: 13px;
}

.profile-photo-edit {
  position: relative;
  width: 160px;
  height: 160px;
}
.profile-photo-edit input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.profile-photo-edit .profile-photo {
  position: absolute;
  inset: 0;
}

@media (max-width: 1023px) {
  .profile-header-row {
    gap: 20px;
  }
  .profile-photo {
    width: 100px;
    height: 100px;
  }
  .profile-body {
    padding: 20px 24px 24px;
  }
  .profile-name {
    font-size: 22px;
  }
  .profile-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  .profile-header-row {
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }
  .profile-header-content {
    width: 100%;
  }
  .profile-photo {
    width: 100px;
    height: 100px;
  }
  .profile-body {
    padding: 16px;
    gap: 16px;
  }
  .profile-name {
    font-size: 20px;
  }
  .profile-meta {
    font-size: 13px;
    gap: 6px 16px;
  }
  .profile-info-grid {
    grid-template-columns: 1fr;
  }
  .profile-contact-grid,
  .profile-address-grid {
    grid-template-columns: 1fr;
  }
  .profile-header {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 767px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .checkbox-row {
    padding-top: 0;
    flex-wrap: wrap;
  }
}

/* ── Utility classes used in templates ── */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 4px;
  background: var(--surface2);
  border-radius: 10px;
  width: fit-content;
}
.cell-name {
  display: flex;
  align-items: center;
  gap: 10px;
}
.p-4 {
  padding: 16px;
}
.space-y-4 > * + * {
  margin-top: 16px;
}
.space-y-2 > * + * {
  margin-top: 8px;
}
.flex {
  display: flex;
}
.gap-2 {
  gap: 8px;
}
.label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink3);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.fixed {
  position: fixed;
}
.top-4 {
  top: 16px;
}
.right-4 {
  right: 16px;
}
.z-50 {
  z-index: 50;
}
.vp-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--ink2);
  flex-shrink: 0;
}
.vp-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}
.vp-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px 16px;
}


/* ── Tabs ── */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--surface2);
  border-radius: 10px;
  margin: 0 16px;
}
.tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink3);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.12s;
  cursor: pointer;
  background: transparent;
  border: none;
  white-space: nowrap;
  line-height: 1;
}
.tab-item:hover {
  color: var(--ink2);
  background: rgba(255,255,255,0.6);
}
.tab-item.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  font-weight: 600;
}
.tab-item svg {
  flex-shrink: 0;
}
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 600;
  background: var(--surface2);
  color: var(--ink3);
  margin-left: 2px;
}
.tab-item.active .tab-count {
  background: var(--ink);
  color: #fff;
}

/* ── Relationship cards ── */
.relation-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.relation-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.relation-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.relation-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.relation-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.relation-badge {
  display: inline-block;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e0e7ff;
  color: #4338ca;
}
.relation-meta {
  font-size: 12px;
  color: var(--ink3);
}
.relation-actions {
  display: flex;
  gap: 6px;
}


/* ── Button group (radio as selectable buttons) ── */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.btn-group-item {
  position: relative;
  cursor: pointer;
}
.btn-group-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.btn-group-item span {
  display: inline-block;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink3);
  transition: all 0.12s;
  user-select: none;
}
.btn-group-item:hover span {
  border-color: var(--border2);
  color: var(--ink2);
}
.btn-group-item input[type="radio"]:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}
.btn-group-item.active span {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}


/* ── Timeline ── */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}
.timeline-item {
  position: relative;
  padding-bottom: 20px;
}
.timeline-item:last-child {
  padding-bottom: 0;
}
.timeline-dot {
  position: absolute;
  left: -24px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--border);
  background: var(--surface);
  z-index: 1;
}
.timeline-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.timeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.timeline-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}
.timeline-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.timeline-desc {
  font-size: 12px;
  color: var(--ink2);
  line-height: 1.5;
  margin-bottom: 6px;
}
.timeline-meta {
  font-size: 11px;
  color: var(--ink4);
}
.timeline-date {
  font-size: 11px;
  color: var(--ink4);
  white-space: nowrap;
  flex-shrink: 0;
}


/* ── User dropdown ── */
.user-dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  z-index: 100;
  overflow: hidden;
}
.dropdown-header {
  padding: 14px 16px;
}
.dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.dropdown-role {
  font-size: 11px;
  color: var(--ink3);
  text-transform: capitalize;
  margin-top: 2px;
}
.dropdown-divider {
  height: 1px;
  background: var(--border);
}
.dropdown-body {
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dropdown-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.dropdown-info-label {
  color: var(--ink3);
}
.dropdown-info-value {
  color: var(--ink);
  font-weight: 500;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink2);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.dropdown-item:hover {
  background: var(--bg);
}

/* ── Tom Select Custom Styling ── */
.ts-control {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 4px 8px !important;
  min-height: 36px;
  font-size: 13px;
  color: var(--ink);
}
.ts-control:focus,
.ts-control.focus {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.15) !important;
}
.ts-dropdown {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
  z-index: 1000;
}
.ts-dropdown .option {
  padding: 8px 12px !important;
  font-size: 13px;
  color: var(--ink2);
}
.ts-dropdown .option:hover,
.ts-dropdown .active {
  background: var(--bg) !important;
  color: var(--ink) !important;
}
.ts-dropdown .selected {
  background: var(--blue-bg) !important;
  color: var(--blue) !important;
}
.ts-item {
  background: var(--blue) !important;
  color: #fff !important;
  border-radius: 4px !important;
  padding: 2px 8px !important;
  font-size: 12px !important;
  margin: 2px 4px 2px 0 !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ts-item .remove {
  color: rgba(255,255,255,0.7) !important;
  font-size: 14px !important;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  margin-left: 2px;
}
.ts-item .remove:hover {
  color: #fff !important;
}
.ts-control input {
  color: var(--ink) !important;
  font-size: 13px !important;
}
.ts-control .items {
  display: flex;
  flex-wrap: wrap;
}
/* Ensure selected items appear first in dropdown */
.ts-dropdown .selected {
  order: -1;
}


/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.active {
  display: flex;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  max-width: 420px;
  width: 100%;
  animation: modalIn 0.18s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 18px 20px 0;
}
.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.modal-body {
  padding: 14px 20px 18px;
}
.modal-footer {
  padding: 0 20px 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.modal-member .m-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-member img.m-avatar {
  object-fit: cover;
}
.modal-member-info {
  min-width: 0;
}
.modal-member-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.modal-member-meta {
  font-size: 12px;
  color: var(--ink3);
  margin-top: 2px;
}
.modal-member-detail {
  font-size: 12px;
  color: var(--ink3);
  margin-top: 3px;
}
.modal-member-detail:first-of-type {
  margin-top: 4px;
}
