/* DIGIMONK GLOBAL CRM — DigiMonk brand system: white space, charcoal text, red as the spotlight. */
:root {
  --charcoal: #333333;
  --red: #EC1A3C;
  --red-deep: #CE002C;
  --gray: #E6E6E6;
  --tint: #F7F7F7;
  --mid: #9A9A9A;
  --red-tint: #FDE8EC;
  --white: #FFFFFF;
  --ok: #1E7B4F;
  --ok-tint: #E7F4EC;
  --warn-tint: #FFF6E0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --sidebar: 236px;
  font-family: 'Poppins', Arial, sans-serif;
  color: var(--charcoal);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--tint); font-size: 14px; line-height: 1.5; }
a { color: var(--red-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; font-weight: 700; margin: 0 0 2px; letter-spacing: -.01em; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 10px; }
h4 { font-size: .9rem; font-weight: 600; margin: 12px 0 6px; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
code { background: var(--tint); border: 1px solid var(--gray); padding: 1px 5px; border-radius: 4px; cursor: default; }
pre.mono { white-space: pre-wrap; background: var(--tint); padding: 10px; border-radius: 8px; border: 1px solid var(--gray); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: #6b6b6b; }
.small, small { font-size: .82rem; }
.text-red { color: var(--red-deep); }
.strong { font-weight: 600; color: var(--charcoal); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.empty { color: var(--mid); padding: 14px 0; }
.hint { color: #777; font-size: .8rem; margin: 4px 0; }
.icon { flex: none; vertical-align: middle; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--charcoal); color: #fff; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 30; }
.sidebar-org { padding: 18px 14px 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-org select { width: 100%; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.15); font-weight: 600; }
.sidebar-org select option { color: var(--charcoal); }
.sidebar-role { font-size: .72rem; color: #bbb; margin-top: 6px; text-transform: uppercase; letter-spacing: .06em; }
.sidebar nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; color: #ddd; padding: 9px 12px; border-radius: 8px; margin-bottom: 2px; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--red); color: #fff; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot .me { display: flex; align-items: center; gap: 8px; color: #fff; font-size: .85rem; }
.sidebar-foot .icon-btn { color: #ccc; }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--white); border-bottom: 1px solid var(--gray); display: flex; align-items: center; gap: 12px; padding: 10px 24px; }
.search-trigger { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 460px; background: var(--tint); border: 1px solid var(--gray); color: #777; padding: 8px 12px; border-radius: 8px; cursor: pointer; font: inherit; text-align: left; }
.search-trigger span { flex: 1; }
kbd { font-size: .7rem; border: 1px solid var(--gray); border-radius: 4px; padding: 1px 5px; background: #fff; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 40px; width: auto; display: block; margin-left: 6px; }
.bell { position: relative; }
.bell .dot { position: absolute; top: -2px; right: -4px; background: var(--red); color: #fff; font-size: .62rem; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 3px; }
.content { padding: 24px; max-width: 1480px; width: 100%; }
.mobile-only { display: none; }

/* ---------- primitives ---------- */
.card { background: var(--white); border: 1px solid var(--gray); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card .pad, .pad { padding: 16px 18px 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h3 { margin: 0; display: flex; align-items: center; gap: 6px; }
.card.attention { border-color: var(--red); background: linear-gradient(0deg, #fff, var(--red-tint)); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { display: flex; align-items: center; gap: 8px; }
.page-head h1::before { content: ''; width: 4px; height: 1.2em; background: var(--red); border-radius: 2px; }
.actions, .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.wrap { flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.grow { flex: 1; min-width: 160px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack > .card { margin-bottom: 0; }
.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2, .grid-3 { margin-bottom: 18px; }
.span-2 { grid-column: span 2; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--gray); background: var(--white); color: var(--charcoal); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--mid); text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, var(--red), var(--red-deep)); border-color: var(--red-deep); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.wa { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--tint); }
.btn.danger-outline { color: var(--red-deep); border-color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: .82rem; }
.btn.lg { padding: 12px 18px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--charcoal); display: inline-flex; }
.icon-btn:hover { background: var(--tint); }
.link { font-size: .82rem; font-weight: 500; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--red-deep); cursor: pointer; text-decoration: underline; }

input, select, textarea { font: inherit; color: var(--charcoal); border: 1px solid var(--gray); background: #fff; border-radius: 8px; padding: 8px 10px; min-width: 0; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red-tint); border-color: var(--red); }
textarea { resize: vertical; width: 100%; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 500; color: #555; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--charcoal); }
label.check input { width: auto; }
.inline-label { flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid.tight { gap: 8px 10px; }
.form-grid h3 { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--gray); }
.form-grid h3:first-child { border-top: 0; padding-top: 0; }
.form-grid input, .form-grid select { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; align-items: center; }
fieldset { border: 1px solid var(--gray); border-radius: 8px; padding: 10px; }
legend { font-size: .8rem; font-weight: 600; padding: 0 4px; }
.narrow { width: 110px; }
.field-error { color: var(--red-deep); font-size: .78rem; font-weight: 500; }
.has-error input { border-color: var(--red); background: var(--red-tint); }
.copy-input { width: 100%; margin-top: 6px; }

.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--gray); background: #fff; }
.alert.success { border-color: #b9dcc8; background: var(--ok-tint); }
.alert.error { border-color: #f3b3bf; background: var(--red-tint); color: #8a0020; }
.alert.warn { border-color: #f0d68f; background: var(--warn-tint); }
.alert ul { margin: 6px 0; }

.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--tint); border: 1px solid var(--gray); color: var(--charcoal); white-space: nowrap; }
.badge.won, .badge.status-connected, .badge.status-success, .badge.status-processed, .badge.msg-manually_confirmed_sent { background: var(--ok-tint); border-color: #b9dcc8; color: var(--ok); }
.badge.lost, .badge.status-error, .badge.status-failed, .badge.high, .badge.msg-opted_out, .badge.msg-failed { background: var(--red-tint); border-color: #f3b3bf; color: var(--red-deep); }
.badge.muted, .badge.low, .badge.msg-cancelled, .badge.msg-skipped, .badge.status-disconnected, .badge.status-skipped { color: #777; }
.badge.msg-opened, .badge.status-partial, .badge.status-configured, .badge.status-pending, .badge.status-unmatched { background: var(--warn-tint); border-color: #f0d68f; color: #7a5a00; }
.badge.msg-prepared, .badge.medium { background: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; padding: 3px 10px; border-radius: 20px; border: 1px solid var(--gray); background: #fff; color: var(--charcoal); cursor: pointer; font-family: inherit; }
.chip.xs { font-size: .68rem; padding: 1px 7px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--mid); padding: 0 0 0 2px; font-size: 1rem; line-height: 1; }
.chip-form { display: inline; }
.score { display: inline-grid; place-items: center; min-width: 30px; height: 22px; border-radius: 6px; font-size: .75rem; font-weight: 700; padding: 0 6px; }
.score.hot { background: var(--red); color: #fff; }
.score.warm { background: var(--red-tint); color: var(--red-deep); }
.score.cold { background: var(--tint); color: #777; border: 1px solid var(--gray); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff; display: inline-grid; place-items: center; font-weight: 600; font-size: .75rem; flex: none; }
.avatar.lg { width: 54px; height: 54px; font-size: 1.1rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--tint); }
.list > li:last-child { border-bottom: 0; }
.list > li.unread { font-weight: 500; }
.list > li.unread::before { content: ''; width: 6px; height: 6px; border-radius: 3px; background: var(--red); flex: none; }
.list.tasks > li { justify-content: flex-start; }
.list > li.overdue strong { color: var(--red-deep); }
.check-btn { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--gray); background: #fff; display: grid; place-items: center; cursor: pointer; color: transparent; padding: 0; }
.check-btn:hover { border-color: var(--red); color: var(--red); }
.check-btn.done { background: var(--ok); border-color: var(--ok); color: #fff; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 8px 0; font-size: .86rem; }
.kv dt { color: #777; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv.cols { grid-template-columns: repeat(4, max-content 1fr); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: #777; font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--gray); background: var(--tint); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--tint); vertical-align: top; }
.table tr:hover td { background: #fcfcfc; }
.table tr.overdue td:first-child { box-shadow: inset 3px 0 var(--red); }
.table tr.total td { font-weight: 700; background: var(--tint); }
.table.small td, .table.small th { padding: 6px 10px; font-size: .8rem; }
.table input, .table select { padding: 5px 8px; }
.w-check { width: 34px; }

.tabs, .tabs-inline { display: flex; gap: 4px; border-bottom: 1px solid var(--gray); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button, .tabs-inline a { background: none; border: 0; padding: 8px 12px; font: inherit; font-weight: 500; color: #777; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.tabs button.active, .tabs-inline a.active { color: var(--charcoal); border-bottom-color: var(--red); }
.tabs-inline a:hover { text-decoration: none; color: var(--charcoal); }
.seg { display: inline-flex; border: 1px solid var(--gray); border-radius: 8px; overflow: hidden; width: fit-content; }
.seg label { flex-direction: row; }
.seg input { display: none; }
.seg span { padding: 6px 14px; cursor: pointer; font-weight: 500; color: #555; }
.seg input:checked + span { background: var(--charcoal); color: #fff; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis.small { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--gray); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi span { font-size: .76rem; color: #777; font-weight: 500; display: block; }
.kpi strong { display: block; font-size: 1.45rem; font-weight: 700; margin: 2px 0; overflow-wrap: anywhere; }
.kpi small { color: #888; font-size: .74rem; }
.kpi.accent { border-top: 3px solid var(--red); }
.kpi.accent strong { color: var(--red-deep); }
.kpi.warn strong { color: var(--red-deep); }
.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel-row { display: grid; grid-template-columns: 180px 1fr 50px 110px; gap: 12px; align-items: center; color: var(--charcoal); font-size: .85rem; }
.funnel-row:hover { text-decoration: none; background: var(--tint); }
.funnel-bar { background: var(--tint); height: 14px; border-radius: 7px; overflow: hidden; }
.funnel-bar span { display: block; height: 100%; background: var(--charcoal); border-radius: 7px; }
.funnel-bar span.won { background: var(--red); }
.funnel-bar span.lost { background: var(--mid); }
.funnel-num { font-weight: 700; text-align: right; }

/* ---------- leads ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; }
.filters input[type=search] { flex: 1; min-width: 220px; }
.save-view { margin: -8px 0 14px; }
.bulkbar { position: sticky; top: 61px; z-index: 10; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--charcoal); color: #fff; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
.bulkbar select, .bulkbar input { padding: 4px 8px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 10px 0 20px; }
.lead-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.lead-id { display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
.lead-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 13px; top: 4px; bottom: 4px; width: 2px; background: var(--gray); }
.timeline li { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.t-icon { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2px solid var(--gray); display: grid; place-items: center; flex: none; z-index: 1; color: #777; }
.t-call .t-icon, .t-meeting .t-icon, .t-whatsapp .t-icon { border-color: var(--red); color: var(--red); }
.t-payment .t-icon { border-color: var(--ok); color: var(--ok); }
.t-meta { font-size: .78rem; color: #777; }
.t-meta strong { color: var(--charcoal); }
.t-body { white-space: normal; overflow-wrap: anywhere; margin-top: 2px; }

/* ---------- pipeline ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; min-height: 60vh; }
.column { flex: 0 0 272px; background: #EFEFEF; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 190px); }
.column header { padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; border-top: 3px solid var(--charcoal); border-radius: var(--radius) var(--radius) 0 0; }
.column.col-won header { border-top-color: var(--red); }
.column.col-lost header { border-top-color: var(--mid); }
.column header small { grid-column: span 2; }
.column .count { background: #fff; border-radius: 10px; padding: 0 8px; font-size: .75rem; font-weight: 600; }
.cards { padding: 4px 8px 10px; overflow-y: auto; flex: 1; min-height: 80px; display: flex; flex-direction: column; gap: 8px; }
.cards.drop-hover { background: var(--red-tint); border-radius: 8px; outline: 2px dashed var(--red); }
.kcard { background: #fff; border: 1px solid var(--gray); border-radius: 8px; padding: 10px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .5; }
.kcard.rotting { border-left: 3px solid var(--red); }
.kmeta { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; font-size: .78rem; font-weight: 500; }
.modal { border: 0; border-radius: var(--radius); padding: 22px; width: min(420px, 92vw); box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal::backdrop { background: rgba(0,0,0,.35); }

.chart-box { position: relative; width: 100%; }

/* ---------- WhatsApp ---------- */
.wa-bubble { background: #F2F2F2; border-radius: 12px 12px 12px 2px; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--gray); max-width: 520px; }
code[data-insert] { cursor: pointer; }
code[data-insert]:hover { border-color: var(--red); }
.step-card { display: flex; gap: 14px; }
.step-num { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 700; }

/* ---------- AI ---------- */
.ai-answer { border-left: 4px solid var(--red); }
.prose { line-height: 1.65; margin-top: 10px; overflow-wrap: anywhere; }
.prose li { margin-left: 18px; }
.prose h4 { margin-top: 10px; }

/* ---------- command palette ---------- */
.palette { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 100; display: flex; justify-content: center; padding-top: 12vh; }
.palette[hidden] { display: none; }
.palette-box { background: #fff; border-radius: 12px; width: min(560px, 92vw); max-height: 60vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.palette-box input { border: 0; border-bottom: 1px solid var(--gray); border-radius: 0; padding: 16px; font-size: 1rem; outline: none; }
#palette-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
#palette-results li a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--charcoal); }
#palette-results li a small { color: #888; display: block; }
#palette-results li a:hover, #palette-results li.sel a { background: var(--red-tint); text-decoration: none; }

/* ---------- guest ---------- */
body.guest { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px 16px; background: var(--tint); }
.guest-card { background: #fff; border: 1px solid var(--gray); border-radius: 14px; padding: 30px; width: min(420px, 100%); box-shadow: var(--shadow); position: relative; }
.guest-card.wide { width: min(760px, 100%); }
.guest-brand { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.guest-brand img { height: 44px; width: auto; max-width: 100%; }
.guest-card h1 { margin-bottom: 14px; }
.guest-foot { color: var(--mid); font-size: .78rem; margin-top: 16px; }
.empty-state { text-align: center; padding: 60px 20px; }
.big-code { font-size: 4rem; font-weight: 700; color: var(--red); }
.narrow-card { max-width: 640px; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 > .span-2 { grid-column: span 2; }
  .hide-md { display: none; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .main { margin-left: 0; }
  .mobile-only { display: inline-flex; }
  .lead-grid, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .kv.cols { grid-template-columns: max-content 1fr; }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .topbar { padding: 8px 16px; gap: 8px; }
  .search-trigger span, .search-trigger kbd, .hide-sm { display: none; }
  .search-trigger { flex: 0 0 auto; }
  .brand-logo { height: 30px; }
  .kpis, .kpis.small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 > .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .funnel-row { grid-template-columns: 110px 1fr 36px; }
  .funnel-val { display: none; }
  .kpi strong { font-size: 1.15rem; }
  .filters > * { flex: 1 1 140px; }
  .narrow { width: 100%; }
  .guest-card { padding: 22px; }
}
@media print {
  .sidebar, .topbar, .bulkbar, form { display: none !important; }
  .main { margin: 0; }
}

/* MFA */
.qr-box { display: flex; justify-content: center; padding: 8px; background: #fff; border: 1px solid var(--gray); border-radius: var(--radius); }
.qr-box svg { max-width: 100%; height: auto; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; list-style: none; padding: 0; margin: 10px 0 0; font-size: 1rem; }

/* Calendar */
.cal-label { margin-left: 6px; }
.cal-add summary { cursor: pointer; display: flex; align-items: center; gap: 6px; font-weight: 500; }
.cal-add form { margin-top: 12px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 8px 10px; font-size: .75rem; font-weight: 600; color: #777; text-transform: uppercase; border-bottom: 1px solid var(--gray); }
.cal-cell { min-height: 112px; padding: 6px; border-right: 1px solid var(--gray); border-bottom: 1px solid var(--gray); display: flex; flex-direction: column; gap: 3px; min-width: 0; position: relative; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: var(--tint); }
.cal-cell.other .cal-day { color: var(--mid); }
.cal-day { font-size: .8rem; font-weight: 600; color: var(--charcoal); align-self: flex-start; padding: 1px 6px; border-radius: 12px; }
.cal-cell.today .cal-day { background: var(--red); color: #fff; }
.cal-event { display: block; font-size: .74rem; line-height: 1.3; padding: 2px 6px; border-radius: 5px; background: var(--tint); border-left: 3px solid var(--charcoal); color: var(--charcoal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.cal-event:hover { text-decoration: none; background: var(--gray); }
.cal-event.type-meeting { border-left-color: var(--red); background: var(--red-tint); }
.cal-event.type-call { border-left-color: var(--ok); background: var(--ok-tint); }
.cal-event.overdue { color: var(--red-deep); font-weight: 600; }
.cal-event.done { opacity: .6; text-decoration: line-through; }
.cal-time { font-weight: 600; }
.cal-more { font-size: .72rem; color: #777; }
.cal-count { display: none; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.cal-col { padding: 10px; margin: 0; min-height: 220px; }
.cal-col h3 { font-size: .9rem; margin: 0 0 8px; }
.cal-col.today { border-color: var(--red); }
.cal-item { display: flex; align-items: flex-start; gap: 2px; margin-bottom: 6px; }
.cal-item .cal-event { flex: 1; white-space: normal; }
.cal-meta { display: block; font-size: .7rem; color: #777; }
.cal-done { margin: 0; }
@media (max-width: 900px) {
  .cal-week { grid-template-columns: 1fr; }
  .cal-col { min-height: 0; }
}
@media (max-width: 640px) {
  .cal-cell { min-height: 58px; padding: 4px; }
  .cal-cell .cal-event, .cal-cell .cal-more { display: none; }
  .cal-count { display: inline-block; align-self: center; margin-top: auto; font-size: .68rem; font-weight: 600; background: var(--charcoal); color: #fff; border-radius: 10px; padding: 0 6px; }
}

/* Automation builder */
.automation-layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.builder { display: flex; flex-direction: column; gap: 14px; }
.builder-section { border: 1px solid var(--gray); border-radius: var(--radius); padding: 12px; margin: 0; min-width: 0; }
.builder-section legend { font-weight: 600; padding: 0 6px; }
.builder-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.builder-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.builder-row > select, .builder-row > input { flex: 1 1 140px; min-width: 0; }
.builder-join { font-size: .78rem; font-weight: 600; color: #777; min-width: 26px; }
.builder-row-controls { display: flex; gap: 2px; margin-left: auto; }
.builder-action { border-left: 3px solid var(--red); background: var(--tint); border-radius: 8px; padding: 8px 10px; }
.builder-params { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-top: 8px; }
.builder-params label { font-size: .8rem; display: flex; flex-direction: column; gap: 3px; }
.builder-checks { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.builder-checks .check { font-size: .82rem; }
.builder-json summary { cursor: pointer; font-size: .85rem; color: #777; }
.builder-json[open] summary { margin-bottom: 8px; }
@media (max-width: 900px) { .automation-layout { grid-template-columns: 1fr; } }
.rules-help { padding-left: 18px; margin: 0; } .rules-help li { margin-bottom: 6px; }
.builder-params .builder-checks label { flex-direction: row; align-items: center; gap: 4px; }
