/* JobCRM — black & amber, ported from VisionOps CRM */
:root {
  --bg: #07070a;
  --bg-2: #0a0a0e;
  --panel: #0e0e12;
  --panel-2: #15151b;
  --panel-3: #1c1c24;
  --border: #1d1d22;
  --border-2: #2a2a33;
  --text: #ececef;
  --muted: #8a8a96;
  --muted-2: #5a5a66;
  --accent: #fbbf24;       /* amber 400 */
  --accent-2: #fcd34d;     /* amber 300 */
  --accent-dim: rgba(251,191,36,.18);
  --cyan: #fbbf24;         /* alias to amber (we use only black + amber + neutrals) */
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --violet: #a78bfa;
  --glow: 0 0 24px rgba(251,191,36,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(1200px 800px at 80% -10%, rgba(251,191,36,.05), transparent 60%),
              radial-gradient(800px 600px at -10% 100%, rgba(251,191,36,.03), transparent 60%),
              var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  overflow: hidden;
}

code, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a3a44; }

/* ---------- Lock screen ---------- */
.lock-screen {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: radial-gradient(800px 600px at 50% 30%, rgba(251,191,36,.05), transparent 60%), var(--bg);
}
.lock-card {
  width: min(360px, 92vw);
  background: linear-gradient(160deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.7);
}
.lock-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.lock-card h1 span { color: var(--accent); }
.lock-card p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.lock-card input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 11px 13px; font-size: 14px;
  font-family: inherit;
}
.lock-card input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(251,191,36,.15); }
.lock-card .lock-error { color: var(--red); font-size: 12px; margin-top: 8px; min-height: 16px; }
.lock-card button {
  width: 100%; margin-top: 8px; border: 0; cursor: pointer;
  background: var(--accent); color: #1a1300; font-weight: 700; font-size: 14px;
  padding: 11px; border-radius: 10px; font-family: inherit;
}
.lock-card button:hover { background: var(--accent-2); }

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(180deg, rgba(14,14,18,.96), rgba(10,10,14,.96));
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px; }
.brand-mark { width: 36px; height: 36px; filter: drop-shadow(0 0 10px rgba(251,191,36,.5)); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name { font-weight: 800; letter-spacing: .2px; font-size: 16px; }
.brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.nav-item {
  background: transparent; border: 0; color: var(--muted);
  text-align: left; padding: 10px 12px; border-radius: 8px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; transition: all .15s;
  font-family: inherit;
}
.nav-item span { color: var(--muted-2); width: 16px; display: inline-block; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(251,191,36,.14), rgba(251,191,36,.04));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(251,191,36,.3);
}
.nav-item.active span { color: var(--accent); }

.sidebar-actions { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(14,14,18,.6);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
}

/* Board tabs */
.board-tabs { display: inline-flex; padding: 3px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; }
.board-tab { background: transparent; border: 0; color: var(--muted); padding: 6px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; letter-spacing: .2px; }
.board-tab.active { background: var(--accent); color: #1a1300; box-shadow: 0 0 14px rgba(251,191,36,.35); }

.search-wrap {
  position: relative; flex: 1; min-width: 220px;
  display: flex; align-items: center;
}
.search-ic { position: absolute; left: 12px; color: var(--muted); font-size: 16px; }
.search {
  width: 100%; padding: 10px 38px 10px 36px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.search:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(251,191,36,.15); }
.search-wrap kbd {
  position: absolute; right: 10px; font-size: 11px;
  padding: 2px 6px; border-radius: 4px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
}

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters select {
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 7px 10px;
  font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.filters select:focus { outline: 0; border-color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  border: 0; cursor: pointer; padding: 9px 14px; border-radius: 9px;
  font-weight: 600; font-size: 13px; font-family: inherit;
  transition: all .15s; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary {
  background: var(--accent);
  color: #1a1300;
  box-shadow: var(--glow);
}
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); box-shadow: 0 0 32px rgba(251,191,36,.5); }
.btn-ghost {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--panel-3); border-color: var(--border-2); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-danger { background: rgba(248,113,113,.12); color: var(--red); border: 1px solid rgba(248,113,113,.3); }
.btn-danger:hover { background: rgba(248,113,113,.2); }

/* ---------- Views ---------- */
.view { flex: 1; overflow: auto; padding: 24px 28px; }
.view.hidden { display: none; }
.hidden { display: none !important; }

.view-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.2px; }
.view-sub { color: var(--muted); margin: 0 0 22px; font-size: 13px; }

/* ---------- Dashboard ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.metric-card {
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  animation: rise .5s ease both;
  animation-delay: var(--d, 0s);
}
.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-2);
  box-shadow: 0 8px 30px rgba(0,0,0,.4), var(--glow);
}
.metric-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(400px 200px at 100% 0%, rgba(251,191,36,.08), transparent 50%);
  pointer-events: none;
}
.metric-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.metric-value { font-size: 30px; font-weight: 800; margin-top: 8px; letter-spacing: -.5px; }
.metric-value.accent { color: var(--accent); }
.metric-sub { font-size: 11.5px; color: var(--muted-2); margin-top: 4px; }

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

/* ---------- Kanban ---------- */
.kanban {
  display: flex; gap: 14px;
  padding-bottom: 12px;
  overflow-x: auto;
  height: 100%;
}
.kcol {
  flex: 0 0 280px;
  display: flex; flex-direction: column;
  background: rgba(14,14,18,.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 100%;
}
.kcol-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--panel); border-radius: 12px 12px 0 0;
}
.kcol-name { font-weight: 600; font-size: 12.5px; letter-spacing: .2px; }
.kcol-count {
  background: var(--panel-3); color: var(--muted);
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.kcol-body { padding: 10px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kcol-body.drag-over { background: rgba(251,191,36,.05); box-shadow: inset 0 0 0 1px rgba(251,191,36,.3); border-radius: 0 0 12px 12px; }

.kcard {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: grab;
  transition: all .15s;
  position: relative;
}
.kcard:hover { border-color: rgba(251,191,36,.4); box-shadow: 0 4px 16px rgba(0,0,0,.4), var(--glow); transform: translateY(-1px); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .4; transform: scale(.98); }

.kcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.kcard-name { font-weight: 600; font-size: 13px; }
.kcard-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kcard-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.kcard-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.score { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--accent); font-weight: 600; }
.prio-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.prio-dot.muito-alta { background: var(--red); box-shadow: 0 0 8px var(--red); }
.prio-dot.alta { background: var(--amber); }
.prio-dot.média { background: var(--accent-2); }
.prio-dot.baixa { background: var(--muted); }

/* ---------- Badges & Tags ---------- */
.tier-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
}
.tier-1 { background: rgba(251,191,36,.18); color: var(--accent); border: 1px solid rgba(251,191,36,.4); box-shadow: 0 0 12px rgba(251,191,36,.2); }
.tier-2 { background: rgba(251,191,36,.10); color: var(--accent-2); border: 1px solid rgba(251,191,36,.25); }
.tier-3 { background: var(--panel-3); color: var(--text); border: 1px solid var(--border-2); }
.tier-4 { background: var(--panel-3); color: var(--muted); border: 1px solid var(--border-2); }

.tag {
  display: inline-block; padding: 2px 7px; border-radius: 6px;
  font-size: 10.5px; font-weight: 500;
  background: rgba(251,191,36,.08); color: var(--accent-2);
  border: 1px solid rgba(251,191,36,.15);
}

/* ---------- List table ---------- */
.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
table.records { width: 100%; border-collapse: collapse; font-size: 13px; }
table.records th {
  text-align: left; padding: 12px 14px; font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  background: var(--panel-2); border-bottom: 1px solid var(--border);
  user-select: none;
}
table.records td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
table.records tbody tr { cursor: pointer; transition: background .15s; }
table.records tbody tr:hover { background: var(--panel-2); }
table.records tbody tr:last-child td { border-bottom: 0; }

/* ---------- Follow-ups ---------- */
.followups-list { display: flex; flex-direction: column; gap: 10px; }
.followup-item {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
}
.followup-item.late { border-left: 3px solid var(--red); }
.followup-item.today { border-left: 3px solid var(--amber); }
.followup-item.future { border-left: 3px solid var(--accent); }
.followup-item.done { opacity: .5; }
.followup-date { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); min-width: 110px; }
.followup-text { flex: 1; }
.followup-company { font-size: 11.5px; color: var(--accent); }

/* ---------- Templates panel ---------- */
.tmpl-list { display: grid; grid-template-columns: 1fr; gap: 14px; max-width: 900px; }
.tmpl-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.tmpl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 10px; }
.tmpl-name { font-weight: 600; font-size: 14px; }
.tmpl-body { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; white-space: pre-wrap; font-size: 13px; color: var(--text); }

/* ---------- Checklist ---------- */
.weeks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; max-width: 1000px; }
.week-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.week-name { font-size: 11.5px; color: var(--accent); font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.week-task { margin-top: 8px; font-size: 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-2);
  display: inline-grid; place-items: center; flex-shrink: 0; transition: all .15s;
}
.checkbox.checked { background: var(--accent); border-color: var(--accent); box-shadow: var(--glow); }
.checkbox.checked::after { content: "✓"; color: #1a1300; font-size: 12px; font-weight: 700; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(6px); animation: fade .2s; }
.modal-card {
  position: relative; z-index: 1;
  width: min(900px, 94vw); max-height: 92vh; overflow: hidden;
  background: linear-gradient(160deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border-2);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.7), 0 0 60px rgba(251,191,36,.10);
  display: flex; flex-direction: column;
  animation: pop .25s cubic-bezier(.2,.9,.3,1.2);
}
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--muted); width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 14px;
}
.modal-close:hover { color: var(--text); border-color: var(--border-2); }
#modal-body { overflow-y: auto; padding: 0; }

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.m-head { padding: 22px 26px 16px; border-bottom: 1px solid var(--border); }
.m-title { font-size: 20px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 10px; }
.m-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.m-tabs { display: flex; gap: 2px; padding: 0 22px; border-bottom: 1px solid var(--border); background: var(--panel); }
.m-tab {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  padding: 12px 14px; font-size: 13px; font-weight: 500; font-family: inherit;
  border-bottom: 2px solid transparent; transition: all .15s;
}
.m-tab:hover { color: var(--text); }
.m-tab.active { color: var(--text); border-bottom-color: var(--accent); }

.m-body { padding: 22px 26px; }

/* Form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.field input, .field select, .field textarea {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 11px; font-size: 13px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(251,191,36,.12);
}
.field textarea { min-height: 100px; resize: vertical; }

.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pick {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; transition: all .15s;
}
.tag-pick.on { background: rgba(251,191,36,.15); color: var(--accent); border-color: rgba(251,191,36,.4); }

.m-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Outbound */
.ob-channel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.ob-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ob-name { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.ob-actions { display: flex; gap: 6px; }

/* Contacts */
.contacts-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.contact-item {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px;
}
.contact-name { font-weight: 600; }
.contact-role { color: var(--accent); font-size: 12px; }
.contact-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* History */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { display: flex; gap: 12px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.history-date { color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 11.5px; min-width: 100px; }

.decisor-check { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-bottom: 14px; }
.decisor-check label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 6px; border-radius: 6px; }
.decisor-check label:hover { background: var(--panel-2); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border-2);
  padding: 12px 18px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5), var(--glow);
  z-index: 200; animation: toast-in .25s;
}
.toast.hidden { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
  border: 1px dashed var(--border-2); border-radius: 14px;
}
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* ---------- Mobile menu button + backdrop ---------- */
.mobile-menu-btn {
  display: none;
  position: fixed; top: 14px; left: 14px; z-index: 90;
  width: 44px; height: 44px; border-radius: 11px;
  background: var(--panel-2); border: 1px solid var(--border-2);
  cursor: pointer; padding: 0;
  flex-direction: column; gap: 5px; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.mobile-menu-btn span {
  display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform .25s, opacity .2s;
}
body.nav-open .mobile-menu-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .mobile-menu-btn span:nth-child(2) { opacity: 0; }
body.nav-open .mobile-menu-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-backdrop {
  display: none; position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
body.nav-open .mobile-backdrop { opacity: 1; pointer-events: auto; }

/* ---------- Bottom nav ---------- */
.bottom-nav { display: none; }
@media (max-width: 640px) {
  .bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
    display: flex; justify-content: space-around;
    background: rgba(14,14,18,.95); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav button {
    background: transparent; border: 0; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 8px; font-size: 10px; font-weight: 600;
    cursor: pointer; flex: 1; border-radius: 8px;
    font-family: inherit;
  }
  .bottom-nav button span { font-size: 16px; line-height: 1; }
  .bottom-nav button.active { color: var(--accent); }
  .bottom-nav button.active span { filter: drop-shadow(0 0 6px var(--accent)); }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  body { grid-template-columns: 1fr; }
  .main { height: 100vh; }
  .mobile-menu-btn { display: flex; }
  .mobile-backdrop { display: block; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; z-index: 85;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,.0,.2,1);
    box-shadow: 12px 0 40px rgba(0,0,0,.5);
    padding-top: 68px;
  }
  body.nav-open .sidebar { transform: translateX(0); }

  .topbar { padding: 12px 14px 12px 70px; gap: 8px; }
  .search-wrap { order: 3; flex: 1 1 100%; min-width: 0; }
  .search-wrap kbd { display: none; }
  .filters { order: 4; flex: 1 1 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .filters select, .filters button { flex-shrink: 0; }

  .view { padding: 18px 14px; }
  .view-title { font-size: 19px; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .metric-card { padding: 14px; }
  .metric-value { font-size: 24px; }
  .kanban { gap: 10px; }
  .kcol { flex: 0 0 250px; }
}

@media (max-width: 640px) {
  .topbar { padding: 12px 12px 10px 66px; }
  .view { padding: 16px 12px 90px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .table-wrap { background: transparent; border: 0; border-radius: 0; }
  table.records thead { display: none; }
  table.records, table.records tbody, table.records tr, table.records td { display: block; width: 100%; }
  table.records tr {
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
    margin-bottom: 10px; padding: 14px; cursor: pointer;
  }
  table.records td { padding: 4px 0; border: 0; font-size: 13px; }
  table.records td:first-child { font-size: 15px; margin-bottom: 6px; }
  table.records td:not(:first-child)::before {
    content: attr(data-label) ": ";
    color: var(--muted); font-size: 11px; text-transform: uppercase;
    letter-spacing: .5px; font-weight: 600; margin-right: 6px;
  }
  .modal-card { width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; border: 0; }
  .m-head { padding: 18px 18px 14px; padding-right: 56px; }
  .m-title { font-size: 17px; }
  .m-tabs { padding: 0 10px; overflow-x: auto; flex-wrap: nowrap; }
  .m-tab { flex-shrink: 0; padding: 12px 10px; font-size: 12.5px; }
  .m-body { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; gap: 10px; }
  .weeks { grid-template-columns: 1fr; }
  .btn { padding: 11px 14px; font-size: 13.5px; }
  .btn-sm { padding: 8px 12px; }
  .nav-item { padding: 12px 14px; font-size: 14px; }
  .field input, .field select, .field textarea { padding: 11px 12px; font-size: 14px; }
  .search { padding: 12px 14px 12px 38px; font-size: 14px; }
  .kcol { flex: 0 0 84vw; max-width: 320px; }
  .kanban { padding-bottom: 20px; }
  .toast { bottom: 76px; left: 12px; right: 12px; transform: none; text-align: center; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  .followup-item { flex-wrap: wrap; gap: 8px; }
  .followup-date { min-width: auto; font-size: 11.5px; }
  .followup-item .btn { margin-left: auto; }
}
