:root {
  --bg: #0d1117;
  --bg-2: #111821;
  --panel: #151d28;
  --panel-2: #1a2431;
  --line: #263243;
  --line-soft: #1e2937;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --muted-2: #64748b;
  --accent: #5ee39b;
  --accent-dim: #1c3f31;
  --blue: #6aa9ff;
  --amber: #f4b860;
  --red: #ff7a7a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: var(--bg-2);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(145deg, #1e5c43, #123a2b);
  display: grid; place-items: center; font-size: 19px;
  border: 1px solid #2c6b51;
}
.brand-name { font-weight: 650; letter-spacing: -.2px; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 10px 12px;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 10px;
  text-align: left; transition: .15s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active {
  background: var(--panel-2); color: var(--text);
  border-color: var(--line);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-ico { width: 18px; text-align: center; font-size: 15px; opacity: .85; }
.nav-badge {
  margin-left: auto; background: var(--accent-dim); color: var(--accent);
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
}
.sidebar-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line-soft); }
.agent-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(94,227,155,.12); }
.version { color: var(--muted-2); font-size: 10px; margin-top: 8px; letter-spacing: .3px; }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px; border-bottom: 1px solid var(--line-soft);
  background: rgba(13,17,23,.85); backdrop-filter: blur(8px);
}
.eyebrow { font-size: 10px; letter-spacing: 1.6px; color: var(--accent); font-weight: 700; }
h1 { margin: 2px 0 0; font-size: 22px; letter-spacing: -.5px; font-weight: 650; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.user-chip { font-size: 11px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; }
.mode-badge {
  font-size: 10px; letter-spacing: 1px; font-weight: 700;
  color: var(--amber); background: rgba(244,184,96,.1);
  border: 1px solid rgba(244,184,96,.25); padding: 5px 10px; border-radius: 999px;
}
.mode-badge.live { color: var(--accent); background: rgba(94,227,155,.1); border-color: rgba(94,227,155,.3); }

.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 8px 14px; border-radius: 9px; font-size: 12px; font-weight: 550;
  transition: .15s;
}
.btn:hover { border-color: #3b4c62; background: #1f2b3a; }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--accent); color: #062419; border-color: var(--accent); font-weight: 700; }
.btn.primary:hover { background: #7aedb2; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 11px; }

.content { flex: 1; overflow-y: auto; padding: 26px 32px 60px; }
.loading { color: var(--muted); padding: 40px; text-align: center; }

/* Cards & grid */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.two-col { grid-template-columns: 1.35fr 1fr; margin-top: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 18px 20px;
}
.card h2 { margin: 0 0 14px; font-size: 13px; letter-spacing: .2px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title h2 { margin: 0; }
.hint { color: var(--muted-2); font-size: 11px; }

.kpi { position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; }
.kpi .value { font-size: 30px; font-weight: 680; letter-spacing: -1.2px; margin: 8px 0 2px; }
.kpi .foot { font-size: 11px; color: var(--muted-2); }
.kpi .foot.pos { color: var(--accent); }
.kpi .foot.neg { color: var(--red); }
.kpi .glow { position: absolute; right: -20px; top: -20px; width: 90px; height: 90px; border-radius: 50%; filter: blur(28px); opacity: .18; }
.kpi.urgent .glow { background: var(--red); }
.kpi.reply .glow { background: var(--blue); }
.kpi.views .glow { background: var(--accent); }
.kpi.engage .glow { background: var(--amber); }

/* Advisor actions */
.action {
  display: flex; gap: 13px; padding: 13px 12px;
  border: 1px solid var(--line-soft); border-radius: 11px;
  margin-bottom: 9px; background: var(--bg-2);
}
.action:last-child { margin-bottom: 0; }
.prio {
  flex: 0 0 34px; height: 24px; border-radius: 6px;
  display: grid; place-items: center; font-size: 10px; font-weight: 800;
}
.prio.P0 { background: rgba(255,122,122,.14); color: var(--red); }
.prio.P1 { background: rgba(244,184,96,.14); color: var(--amber); }
.prio.P2 { background: rgba(106,169,255,.14); color: var(--blue); }
.action-body { min-width: 0; flex: 1; }
.action-title { font-weight: 600; font-size: 13px; }
.action-reason { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.action-impact { color: var(--accent); font-size: 11px; margin-top: 5px; }
.action-go { align-self: center; }

/* Brief */
.headline { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.theme-box {
  background: linear-gradient(135deg, rgba(94,227,155,.08), rgba(106,169,255,.04));
  border: 1px solid rgba(94,227,155,.18); border-radius: 11px; padding: 14px;
}
.theme-label { font-size: 10px; letter-spacing: 1.2px; color: var(--accent); font-weight: 700; }
.theme-title { font-size: 16px; font-weight: 650; margin: 6px 0 8px; }
.theme-summary { color: var(--muted); font-size: 12px; }
.signal { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); padding: 7px 0; border-bottom: 1px dashed var(--line-soft); }
.signal:last-child { border-bottom: 0; }
.signal-src { color: var(--blue); flex: 0 0 105px; }

/* Inbox */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.chips { display: flex; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  padding: 7px 12px; border-radius: 999px; font-size: 12px;
}
.chip.active { background: var(--accent-dim); color: var(--accent); border-color: #2f6b52; }
.filters select, .filters input {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 7px 11px; border-radius: 9px; font-size: 12px; outline: none;
}
.filters input { min-width: 190px; }
.filters select:focus, .filters input:focus { border-color: var(--accent); }

.comment-list { display: grid; gap: 10px; }
.comment {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 14px 16px; cursor: pointer; transition: .15s;
  border-left: 3px solid transparent;
}
.comment:hover { border-color: #33455c; transform: translateY(-1px); }
.comment.urgent-high { border-left-color: var(--red); }
.comment.urgent-medium { border-left-color: var(--amber); }
.comment.status-approved { border-left-color: var(--blue); }
.comment.status-sent { border-left-color: var(--accent); opacity: .75; }
.comment-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; flex-wrap: wrap; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.author { font-weight: 600; font-size: 13px; }
.tag { font-size: 10px; padding: 2px 7px; border-radius: 5px; font-weight: 650; letter-spacing: .2px; }
.tag.yt { background: rgba(255,122,122,.12); color: #ff9a9a; }
.tag.meta { background: rgba(106,169,255,.12); color: #8fc0ff; }
.tag.sent-neg { background: rgba(255,122,122,.12); color: var(--red); }
.tag.sent-pos { background: rgba(94,227,155,.12); color: var(--accent); }
.tag.sent-neu { background: rgba(139,155,176,.12); color: var(--muted); }
.tag.high { background: rgba(255,122,122,.16); color: var(--red); }
.tag.medium { background: rgba(244,184,96,.14); color: var(--amber); }
.tag.approved { background: rgba(106,169,255,.14); color: var(--blue); }
.tag.sent { background: rgba(94,227,155,.14); color: var(--accent); }
.time { margin-left: auto; color: var(--muted-2); font-size: 11px; }
.comment-text { font-size: 13px; color: #c9d4e0; margin-bottom: 8px; }
.reply-preview { font-size: 11.5px; color: var(--muted); background: var(--bg-2); border-radius: 8px; padding: 8px 10px; border: 1px dashed var(--line); }
.reply-preview b { color: var(--accent); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 50px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(620px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal h3 { margin: 0; font-size: 17px; }
.modal .orig { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px; margin: 14px 0; font-size: 13px; color: #c9d4e0; }
.field-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 6px; }
textarea.reply {
  width: 100%; min-height: 110px; resize: vertical;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 12px; outline: none; font-size: 13px;
}
textarea.reply:focus { border-color: var(--accent); }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.audit-line { font-size: 11px; color: var(--muted-2); border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 16px; }

/* Analytics */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding: 12px 0 0; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, var(--accent), #2e7d5c); border-radius: 6px 6px 2px 2px; min-height: 4px; }
.bar-label { font-size: 10px; color: var(--muted-2); }
.bar-val { font-size: 10px; color: var(--muted); }

/* Pipeline / system */
.placeholder { text-align: center; padding: 60px 20px; color: var(--muted); }
.placeholder .big { font-size: 34px; margin-bottom: 12px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.step { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px; font-size: 12px; color: var(--muted); }
.step b { color: var(--text); display: block; margin-bottom: 4px; }
.step.fase1 { border-color: rgba(94,227,155,.4); }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); color: #c9d4e0; }
.ok { color: var(--accent); }
.err { color: var(--red); }
.warn { color: var(--amber); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 10px; font-size: 13px;
  box-shadow: var(--shadow); transform: translateY(80px); opacity: 0;
  transition: .25s; pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-left-color: var(--red); }

/* Agente */
.version-pill { font-size: 10px; color: var(--accent); background: rgba(94,227,155,.1); border: 1px solid rgba(94,227,155,.25); padding: 4px 9px; border-radius: 999px; }
.instructions { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 14px; font-size: 11px; line-height: 1.55; color: #b9c6d5; max-height: 520px; overflow-y: auto; white-space: pre-wrap; font-family: inherit; margin: 0; }
.timeline { max-height: 560px; overflow-y: auto; padding-left: 6px; }
.timeline-item { position: relative; padding: 0 0 14px 18px; border-left: 1px solid var(--line); }
.timeline-item:last-child { border-left-color: transparent; }
.timeline-dot { position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--panel); }
.timeline-head { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.timeline-head b { color: var(--blue); font-size: 11px; }
.timeline-action { color: var(--text); }
.timeline-in, .timeline-out { font-size: 11px; color: var(--muted); margin-top: 3px; }
.timeline-out { color: #a9d9bf; }
.draft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.draft-card { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 11px; padding: 13px; }
.draft-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.draft-head .hint { margin-left: auto; }
.conf-track { height: 3px; background: var(--line); border-radius: 2px; margin: 10px 0; overflow: hidden; }
.conf-fill { height: 100%; background: var(--accent); }
.draft-reply { font-size: 12.5px; color: #d5dfeb; }
.draft-why { font-size: 11px; color: var(--muted); margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.draft-status { font-size: 10px; color: var(--muted-2); margin-top: 7px; }
.signal-card { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 11px; margin-bottom: 9px; }
.signal-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.signal-top .hint { margin-left: auto; }
.signal-text { font-size: 11.5px; color: #c9d4e0; margin-top: 7px; }
.signal-url { font-size: 10px; color: var(--blue); text-decoration: none; }
.agent-draft-box { background: rgba(106,169,255,.06); border: 1px solid rgba(106,169,255,.2); border-radius: 10px; padding: 11px; margin-bottom: 14px; }
.agent-draft-head { display: flex; align-items: center; gap: 8px; }
.agent-draft-head .hint { margin-left: auto; }
.agent-draft-why { font-size: 11px; color: var(--muted); margin-top: 7px; }
.name-override { background: rgba(244,184,96,.06); border: 1px solid rgba(244,184,96,.2); border-radius: 10px; padding: 10px; margin-bottom: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.name-override input { background: var(--bg-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 7px 10px; font-size: 12px; flex: 1; min-width: 160px; outline: none; }
.name-override input:focus { border-color: var(--amber); }

/* Analytics */
.chart-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.chart-tab { border: 1px solid var(--line); background: var(--panel); color: var(--muted); padding: 9px 18px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.chart-tab.active { background: var(--accent-dim); color: var(--accent); border-color: #2f6b52; }
.chart-card { padding-bottom: 18px; }
.metric-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.metric-chip { border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); padding: 5px 11px; border-radius: 999px; font-size: 11px; text-transform: capitalize; }
.metric-chip.active { background: #243447; color: var(--text); border-color: #3c5473; }
.chart-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.chart-metrics > div { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 9px; padding: 9px 11px; }
.chart-metrics span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; }
.chart-metrics b { font-size: 18px; letter-spacing: -.5px; }
.line-chart { width: 100%; height: auto; display: block; overflow: visible; }
.grid-line { stroke: var(--line-soft); stroke-width: 1; }
.axis-label { fill: var(--muted-2); font-size: 10px; }
.chart-dot { fill: var(--panel); stroke-width: 2; stroke: #5ee39b; }
.chart-note { font-size: 11px; color: var(--muted); background: var(--bg-2); border-left: 2px solid var(--line); padding: 9px 11px; margin-top: 10px; border-radius: 0 8px 8px 0; }

.blog-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; vertical-align: middle; margin-right: 8px; border: 1px solid var(--line); }
.account-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.account-chip { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: 12px; }
.account-chip.ok { border-color: rgba(94,227,155,.3); }
.account-chip.err { border-color: rgba(255,122,122,.3); }
.account-chip .btn { margin-left: 4px; }

.article-hero { width: 100%; height: 200px; object-fit: cover; border-radius: 10px; margin-top: 12px; border: 1px solid var(--line); }
.article-pane { max-height: 48vh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 16px; }
.article-body { font-size: 13.5px; line-height: 1.7; color: #d3dde9; }
.article-body h1 { font-size: 22px; margin: 0 0 12px; }
.article-body h2 { font-size: 17px; margin: 22px 0 9px; color: var(--accent); }
.article-body h3 { font-size: 14px; margin: 16px 0 6px; color: var(--blue); }
.article-body p { margin: 0 0 12px; }
.article-body li { margin: 4px 0 4px 18px; list-style: disc; }
.article-body blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--muted); margin: 10px 0; }
.article-body a { color: var(--blue); }
.article-body pre { background: var(--panel); padding: 10px; border-radius: 8px; overflow-x: auto; }
.article-edit { min-height: 360px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.blog-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.blog-card { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
.blog-cover { width: 100%; height: 104px; object-fit: cover; display: block; background: var(--panel-2); border-bottom: 1px solid var(--line-soft); }
.blog-noimg { display: grid; place-items: center; color: var(--muted-2); }
.blog-card-body { padding: 9px 10px; }
.blog-card-title { font-size: 11.5px; font-weight: 600; line-height: 1.35; margin-bottom: 7px; min-height: 32px; }
.blog-card-body .hint { font-size: 10px; margin-top: 5px; overflow-wrap: anywhere; }

/* Pipeline kanban */
.pipe-board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.pipe-col { flex: 0 0 218px; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 11px; overflow: hidden; }
.pipe-col-head { display: flex; justify-content: space-between; align-items: center; padding: 9px 11px; background: var(--panel); border-bottom: 1px solid var(--line-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.pipe-col-head span { color: var(--accent); font-weight: 700; }
.pipe-col-body { padding: 8px; min-height: 120px; display: flex; flex-direction: column; gap: 8px; }
.pipe-empty { color: var(--muted-2); font-size: 11px; text-align: center; padding: 18px 0; }
.pipe-card { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px; cursor: default; }
.pipe-card-top { display: flex; gap: 5px; margin-bottom: 7px; }
.pipe-title { font-size: 12px; font-weight: 600; line-height: 1.35; cursor: pointer; }
.pipe-title:hover { color: var(--accent); }
.pipe-actions { display: flex; gap: 5px; margin-top: 9px; }
.pipe-actions .btn { flex: 1; font-size: 10px; padding: 4px 6px; }

@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
/* ---------- MOBILE ---------- */
@media (max-width: 700px) {
  body { font-size: 15px; -webkit-text-size-adjust: 100%; }
  .app { flex-direction: column; }

  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    width: 100%; height: 64px; flex: none; z-index: 60;
    flex-direction: row; padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--line);
    background: rgba(17,24,33,.97); backdrop-filter: blur(12px);
  }
  .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; width: 100%; gap: 2px; align-items: stretch; }
  .nav-item {
    flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px;
    justify-content: center; padding: 6px 2px; font-size: 10px;
    border-radius: 9px; position: relative; text-align: center;
  }
  .nav-item span:not(.nav-ico) { display: inline; font-size: 10px; line-height: 1.1; }
  .nav-ico { font-size: 17px; line-height: 1; }
  .nav-badge {
    position: absolute; top: 1px; right: 3px; margin: 0;
    font-size: 9px; padding: 0 4px; line-height: 14px;
  }
  .nav-item.active { box-shadow: inset 0 2px 0 var(--accent); }

  .main { width: 100%; padding-bottom: 74px; }
  .topbar { padding: 12px 14px; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
  h1 { font-size: 20px; }
  .eyebrow { font-size: 9px; }
  .top-actions { width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
  .mode-badge { font-size: 9px; padding: 4px 8px; }
  .top-actions .btn { min-height: 38px; }
  .user-chip { font-size: 10px; padding: 4px 8px; }
  .content { padding: 14px 12px 100px; }

  .grid, .kpis, .two-col, .steps, .draft-grid, .blog-gallery { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .card { padding: 14px; border-radius: 12px; }
  .kpi .value { font-size: 24px; }
  .kpi .label { font-size: 10px; }
  .chart-metrics { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  input, select, textarea, .filters input, .filters select, .name-override input {
    font-size: 16px !important; width: 100%; min-height: 42px;
  }
  .filters { flex-direction: column; align-items: stretch; gap: 8px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .chip { white-space: nowrap; flex: none; min-height: 36px; }
  .btn { min-height: 42px; }
  .btn.sm { min-height: 36px; font-size: 12px; }

  .table { display: block; overflow-x: auto; white-space: nowrap; width: 100%; }
  .table th, .table td { font-size: 11px; padding: 7px 8px; }
  .card > .table { margin: 0 -4px; width: calc(100% + 8px); }

  .comment { padding: 11px 12px; }
  .comment-head { gap: 6px; }
  .comment-head .time, .comment-head .author { width: auto; }
  .comment-text { font-size: 12.5px; }
  .reply-preview { font-size: 11px; }

  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%; max-width: 100%; max-height: 92vh;
    border-radius: 18px 18px 0 0; padding: 18px 14px calc(20px + env(safe-area-inset-bottom));
    animation: sheet-in .22s ease-out;
  }
  @keyframes sheet-in { from { transform: translateY(30px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
  .article-hero { height: 150px; }
  .article-edit { min-height: 280px; font-size: 15px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 45%; }

  .chart-tabs, .pipe-board { overflow-x: auto; scroll-snap-type: x mandatory; }
  .chart-tab { white-space: nowrap; flex: none; min-height: 38px; }
  .pipe-col { flex: 0 0 82vw; scroll-snap-align: start; }
  .account-chip { width: 100%; flex-wrap: wrap; }
  .account-chip .btn { margin-left: auto; }
  .blog-cover { height: 120px; }
  .signal { flex-direction: column; gap: 3px; }
  .signal-src { flex: none; }
  .timeline-head { flex-wrap: wrap; }
  .action { flex-wrap: wrap; }
  .action-go { margin-left: auto; }
  .toast { left: 12px; right: 12px; bottom: 78px; text-align: center; }
}

@media (max-width: 380px) {
  .kpis { grid-template-columns: 1fr; }
  .nav-item { font-size: 9px; }
  .top-actions .btn { flex: 1; }
}
