/* Kitepost — own visual identity: deep teal ink, kite-teal accent, warm orange tail. */
:root {
  --brand: #0f9d8a; --brand-600: #0b7f70; --brand-50: #e6f6f3; --brand-100: #c9ece6;
  --ink: #12222b; --ink-2: #3a4b56; --muted: #66767f; --line: #e3e8ec; --line-2: #eef2f5;
  --bg: #f4f6f8; --card: #ffffff; --side: #0f2a33; --side-2: #16353f; --side-ink: #cfe3e6;
  --accent: #ff8a3d; --violet: #7c5cff; --red: #e5484d; --amber: #f5a524; --green: #16a34a;
  --radius: 14px; --radius-sm: 9px; --shadow: 0 1px 2px rgba(16,34,43,.06), 0 4px 16px rgba(16,34,43,.06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-600); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.icon { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { background: #fff; color: var(--red); border-color: #f4c7c8; }
.btn.danger:hover { background: #fdeeee; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgba(127,140,150,.16); }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 400; color: var(--ink); }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
label.check { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); }
.form-error { color: var(--red); font-size: 14px; white-space: pre-line; }
.form-error:empty { display: none; }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- auth ---------- */
.boot, .auth { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 18px; padding: 24px; color: var(--muted); }
.auth { background: radial-gradient(1200px 600px at 10% -10%, #d7f3ee 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #ffe6d5 0, transparent 55%), var(--bg); }
.auth-card { width: min(420px, 100%); background: #fff; border-radius: 20px; padding: 30px; box-shadow: var(--shadow); display: grid; gap: 10px; color: var(--ink); }
.auth-card h1 { margin-top: 8px; }
.auth-card form { margin-top: 10px; }
.auth-foot { font-size: 13px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; color: inherit; }
.brand.center { justify-content: center; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); color: var(--side-ink); padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; }
.sidebar .brand { color: #fff; padding: 2px 6px; }
.ws-name { font-size: 12.5px; color: #8fb1b6; padding: 0 8px 10px 48px; margin-top: -6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .create { margin: 4px 0 12px; min-height: 42px; }
.nav { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--side-ink); font-weight: 550; position: relative; }
.nav-item:hover { background: var(--side-2); color: #fff; }
.nav-item.active { background: rgba(20,184,166,.18); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: #2dd4bf; }
.nav-badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 2px; border-top: 1px solid var(--side-2); }
.me-text { display: grid; flex: 1; min-width: 0; font-size: 13px; }
.me-text b { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text .muted { color: #8fb1b6; text-transform: capitalize; }
.main { min-width: 0; }
main { padding: 28px 32px 48px; max-width: 1320px; margin: 0 auto; outline: none; }
.mobile-top, .tabbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards & common ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid rgba(227,232,236,.7); }
.card > h2, .card-head { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cards { display: grid; gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: grid; gap: 4px; border: 1px solid rgba(227,232,236,.7); }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi b { font-size: 26px; letter-spacing: -.02em; }
.kpi .kpi-foot { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.kpi.accent { background: linear-gradient(135deg, #0f9d8a, #0e7490); color: #fff; border: 0; }
.kpi.accent span, .kpi.accent .kpi-foot { color: #d5f5ef; }
.delta { font-weight: 700; font-size: 12.5px; }
.delta.up { color: var(--green); } .delta.down { color: var(--red); }
.kpi.accent .delta, .kpi.accent a { color: #fff; }
.post-row > .muted { white-space: nowrap; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.grey { background: #eef1f4; color: #56656f; } .pill.violet { background: #efeaff; color: #5b3fe0; }
.pill.amber { background: #fff3dc; color: #9a6100; } .pill.teal { background: var(--brand-50); color: var(--brand-600); }
.pill.green { background: #e4f7ea; color: #137a38; } .pill.red { background: #fde8e8; color: #c0262c; }
.net-badge { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 800; flex: none; letter-spacing: -.02em; }
.net-badge.sm { width: 20px; height: 20px; font-size: 9px; }
.net-badge.big { width: 54px; height: 54px; font-size: 19px; }
.badges { display: inline-flex; }
.badges .net-badge + .net-badge { margin-left: -6px; box-shadow: 0 0 0 2px #fff; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.acc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 20px; background: var(--line-2); font-size: 13px; font-weight: 600; }
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 36px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); }
.loading { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 30px; justify-content: center; }
.spin { width: 18px; height: 18px; border: 2.5px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabs { display: flex; gap: 4px; background: #e9edf0; padding: 4px; border-radius: 12px; width: max-content; max-width: 100%; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.list { display: grid; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line-2); }
.list-item:first-child { border-top: 0; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.when { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.note { padding: 10px 12px; border-radius: 10px; background: #fff7e8; color: #7a4d00; font-size: 13.5px; }
.note.info { background: var(--brand-50); color: #0b5f55; }
.error-box { border-left: 4px solid var(--red); display: grid; gap: 10px; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table-wrap { overflow-x: auto; }

/* ---------- toasts & modal ---------- */
.toasts { position: fixed; z-index: 60; right: 18px; bottom: 18px; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 11px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: 380px; white-space: pre-line; animation: pop .2s ease; transition: opacity .4s, transform .4s; }
.toast.err { background: #b4232a; } .toast.warn { background: #8a5a00; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15,30,38,.45); display: grid; place-items: center; padding: 18px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 18px; width: min(520px, 100%); max-height: calc(100vh - 36px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.modal-body { padding: 8px 18px 18px; overflow-y: auto; display: grid; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.more-list { display: grid; gap: 2px; margin-bottom: 10px; }
.more-list .nav-item { color: var(--ink); }
.more-list .nav-item:hover, .more-list .nav-item.active { background: var(--line-2); color: var(--ink); }
.more-list .nav-item.active::before { display: none; }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.hello { font-size: 26px; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.quick a { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: var(--line-2); color: var(--ink); font-weight: 600; }
.quick a:hover { background: var(--brand-50); color: var(--brand-600); }
.post-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line-2); cursor: pointer; }
.post-row:first-child { border-top: 0; }
.post-row .time { display: grid; text-align: center; width: 76px; padding: 6px; border-radius: 10px; background: var(--line-2); font-size: 12px; font-weight: 700; color: var(--ink-2); }
.post-row .time b { font-size: 14px; color: var(--ink); white-space: nowrap; }
.post-row > div { min-width: 0; }
.cards, .cards > *, .dash > *, .two-col > *, .an-grid > *, .composer > * { min-width: 0; }
.activity { display: grid; gap: 12px; }
.activity > div { display: flex; gap: 10px; font-size: 14px; align-items: flex-start; }

/* ---------- composer ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.acc-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.acc-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 5px; border-radius: 22px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.acc-toggle.on { border-color: var(--brand); background: var(--brand-50); }
.acc-toggle:not(.on) .net-badge { filter: grayscale(.85); opacity: .6; }
.editor { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.editor:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.editor textarea { border: 0; box-shadow: none !important; min-height: 160px; border-radius: 12px 12px 0 0; }
.editor-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--line-2); }
.counters { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.counter { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.counter.over { color: var(--red); }
.media-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.media-tile { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; background: var(--line-2); }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .icon-btn { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; background: rgba(0,0,0,.55); color: #fff; }
.media-tile .kind { position: absolute; left: 5px; bottom: 5px; background: rgba(0,0,0,.55); color: #fff; border-radius: 6px; padding: 1px 5px; font-size: 11px; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.variant { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.variant-head { display: flex; align-items: center; gap: 8px; }
.problems { color: var(--red); font-size: 13px; display: grid; gap: 2px; }
.problems:empty { display: none; }
.when-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.when-opt { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; display: grid; gap: 2px; font-weight: 650; font-size: 14px; background: #fff; text-align: left; }
.when-opt span { font-size: 12px; color: var(--muted); font-weight: 500; }
.when-opt.on { border-color: var(--brand); background: var(--brand-50); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.chip:hover, .chip.on { border-color: var(--brand); color: var(--brand-600); background: var(--brand-50); }
.compose-foot { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 4px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.preview-col { position: sticky; top: 20px; display: grid; gap: 14px; }
.preview { background: #fff; border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line-2); }
.preview-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.preview-head b { display: block; font-size: 14px; }
.preview-text { padding: 0 14px 12px; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.preview-media { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 2px; background: var(--line-2); }
.preview-media img, .preview-media video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.preview-foot { display: flex; gap: 18px; padding: 10px 14px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.preview-bar { height: 4px; }

/* ---------- calendar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-title { font-size: 18px; font-weight: 750; min-width: 170px; }
.cal-layout { display: grid; grid-template-columns: 1fr 250px; gap: 16px; align-items: start; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.dow { background: #f8fafb; padding: 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day { background: #fff; min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; cursor: pointer; transition: background .1s; }
.day:hover { background: #fbfdfd; }
.day.other { background: #fafbfc; }
.day.other .day-num { color: #aab4bb; }
.day.today .day-num { background: var(--brand); color: #fff; }
.day.past { background: #fcfcfd; }
.day-num { font-size: 12.5px; font-weight: 700; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.drop-hover { background: var(--brand-50) !important; box-shadow: inset 0 0 0 2px var(--brand); }
.chip-post { display: flex; align-items: center; gap: 5px; padding: 4px 6px; border-radius: 7px; background: #f3f6f8; border-left: 3px solid #b8c3ca; font-size: 12px; min-width: 0; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.chip-post:hover { background: #eaf0f3; }
.chip-post .t { font-weight: 700; color: var(--ink-2); flex: none; }
.chip-post .txt { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.chip-post.s-scheduled { border-left-color: var(--brand); } .chip-post.s-published { border-left-color: var(--green); background: #f1faf4; }
.chip-post.s-pending { border-left-color: var(--violet); background: #f5f2ff; } .chip-post.s-draft { border-left-color: #9aa6ae; border-left-style: dashed; }
.chip-post.s-failed, .chip-post.s-partial { border-left-color: var(--red); background: #fdf1f1; } .chip-post.s-rejected { border-left-color: var(--amber); }
.chip-post.locked { cursor: pointer; }
.more-link { font-size: 12px; font-weight: 700; color: var(--brand-600); background: none; border: 0; text-align: left; padding: 2px 4px; cursor: pointer; }
.drag-ghost { position: fixed; z-index: 70; pointer-events: none; transform: rotate(-2deg); box-shadow: 0 10px 30px rgba(0,0,0,.2); width: 180px; }
.week-wrap { overflow: auto; max-height: calc(100vh - 210px); border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.week { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); min-width: 820px; }
.week .wh { position: sticky; top: 0; z-index: 2; background: #f8fafb; padding: 8px; font-size: 12px; font-weight: 700; border-bottom: 1px solid var(--line); text-align: center; color: var(--muted); }
.week .wh.today { color: var(--brand-600); }
.week .hr { font-size: 11px; color: var(--muted); text-align: right; padding: 4px 6px; border-top: 1px solid var(--line-2); }
.week .slot { min-height: 52px; border-top: 1px solid var(--line-2); border-left: 1px solid var(--line-2); padding: 3px; display: grid; gap: 3px; align-content: start; cursor: pointer; }
.week .slot:hover { background: #fbfdfd; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.side-drafts .chip-post { margin-bottom: 6px; }
.day-group { margin-bottom: 18px; }
.day-group > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.post-card { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 8px; margin-bottom: 10px; border: 1px solid rgba(227,232,236,.7); }
.post-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post-card-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.post-card .thumbs { display: flex; gap: 6px; }
.post-card .thumbs img, .post-card .thumbs video { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.post-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.target-list { display: grid; gap: 6px; }
.target { display: flex; align-items: center; gap: 8px; font-size: 13.5px; flex-wrap: wrap; }
.target .err { color: var(--red); font-size: 12.5px; width: 100%; padding-left: 28px; }
.metric-row { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.metric-row b { color: var(--ink); font-size: 15px; display: block; }

/* ---------- queue ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.best { display: grid; gap: 10px; }
.best-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; font-size: 14px; font-weight: 600; }
.bar { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #2dd4bf, var(--brand)); }
.slots { display: grid; gap: 8px; }
.slot-day { display: grid; grid-template-columns: 46px 1fr; gap: 8px; align-items: center; }
.slot-day b { font-size: 13px; color: var(--muted); }
.time-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border-radius: 14px; background: var(--brand-50); color: var(--brand-600); font-size: 13px; font-weight: 700; }
.time-chip button { border: 0; background: none; cursor: pointer; color: inherit; display: grid; place-items: center; padding: 2px; border-radius: 50%; }
.add-time { display: inline-flex; gap: 4px; align-items: center; }
.add-time input { width: 110px !important; min-height: 30px !important; padding: 2px 6px !important; font-size: 13px; }

/* ---------- bulk ---------- */
.drop-zone { border: 2px dashed var(--brand-100); border-radius: 16px; padding: 34px 20px; display: grid; justify-items: center; gap: 8px; text-align: center; background: #fbfefd; cursor: pointer; color: var(--muted); }
.drop-zone.over { border-color: var(--brand); background: var(--brand-50); }
.drop-zone b { color: var(--ink); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 800; flex: none; }
.row-ok { color: var(--green); font-weight: 700; } .row-bad { color: var(--red); font-size: 13px; }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 380px 1fr; gap: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; min-height: calc(100vh - 170px); border: 1px solid rgba(227,232,236,.7); }
.inbox-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.inbox-filters { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.inbox-items { overflow-y: auto; flex: 1; max-height: calc(100vh - 290px); }
.msg { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; position: relative; }
.msg:hover { background: #fafcfc; }
.msg.active { background: var(--brand-50); }
.msg.unread::after { content: ""; position: absolute; right: 14px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.msg-av { position: relative; align-self: start; height: 34px; }
.msg-av .net-badge { position: absolute; right: -4px; bottom: -4px; box-shadow: 0 0 0 2px #fff; }
.msg-top { display: flex; gap: 6px; align-items: baseline; font-size: 14px; padding-right: 14px; }
.msg-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-top .when { margin-left: auto; flex: none; font-weight: 500; }
.msg-body { font-size: 13.5px; color: var(--ink-2); }
.convo { display: flex; flex-direction: column; min-width: 0; }
.convo-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.convo-body { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; background: #fafbfc; }
.context { border-left: 3px solid var(--line); padding: 4px 10px; font-size: 13px; color: var(--muted); }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.06); white-space: pre-wrap; word-break: break-word; }
.bubble.mine { align-self: flex-end; background: var(--brand); color: #fff; }
.bubble small { display: block; font-size: 11.5px; opacity: .75; margin-top: 4px; }
.reply-box { padding: 12px 18px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.reply-box textarea { min-height: 70px; }
.back-btn { display: none; }

/* ---------- analytics ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart .grid-line { stroke: var(--line-2); }
.chart-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.chart-legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.hbar { display: grid; grid-template-columns: 120px 1fr 70px; gap: 10px; align-items: center; font-size: 13.5px; margin-bottom: 10px; }
.hbar .bar { height: 12px; border-radius: 6px; }
.heat { display: grid; grid-template-columns: 38px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 10.5px; color: var(--muted); }
.heat .c { aspect-ratio: 1; border-radius: 3px; background: #eef2f4; min-width: 0; }
.heat .lbl { display: flex; align-items: center; font-weight: 700; }
.heat .hl { text-align: center; }
.heat-scale { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.heat-scale i { width: 16px; height: 10px; border-radius: 2px; display: inline-block; }
.an-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }

/* ---------- library ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.lib-tile { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; border: 1px solid rgba(227,232,236,.7); }
.lib-tile .thumb { aspect-ratio: 4/3; background: var(--line-2); position: relative; }
.lib-tile .thumb img, .lib-tile .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-tile .meta { padding: 10px; display: grid; gap: 3px; font-size: 13px; }
.lib-tile .meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-tile .tile-actions { display: flex; gap: 4px; padding: 0 6px 8px; margin-top: auto; }
.lib-tile.pick { cursor: pointer; }
.lib-tile.pick.on { outline: 3px solid var(--brand); }
.snippet { display: grid; gap: 6px; }

/* ---------- links ---------- */
.link-row { display: grid; grid-template-columns: 1fr 120px 90px auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line-2); }
.link-row:first-child { border-top: 0; }
.short { font-weight: 700; color: var(--brand-600); word-break: break-all; }
.spark { width: 120px; height: 34px; }
.clicks { font-size: 22px; font-weight: 800; }

/* ---------- accounts & team ---------- */
.net-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.net-card { display: grid; gap: 12px; align-content: start; }
.net-card-head { display: flex; gap: 12px; align-items: center; }
.acc-line { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--line-2); flex-wrap: wrap; }
.acc-line select { width: auto; min-height: 30px; padding: 2px 8px; font-size: 13px; }
.role-table td:first-child { font-weight: 700; text-transform: capitalize; }
.team-card { border-left: 4px solid var(--brand); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

/* ---------- consent & report pages ---------- */
.consent { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.consent-card { width: min(440px, 100%); background: #fff; border-radius: 18px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px; justify-items: start; }
.report { max-width: 900px; margin: 0 auto; padding: 32px 24px; background: #fff; min-height: 100vh; }
.report h2 { margin: 26px 0 10px; }
.report table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report th, .report td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.report-head > div { display: flex; gap: 12px; align-items: center; }
.report-chart { width: 100%; height: auto; background: #fafcfc; border-radius: 10px; }
@media print { .no-print { display: none; } .report { padding: 0; } .kpi { box-shadow: none; border: 1px solid var(--line); } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .cal-layout { grid-template-columns: 1fr; }
  .side-drafts { order: 2; }
}
@media (max-width: 1080px) {
  .shell { grid-template-columns: 76px 1fr; }
  .sidebar { padding: 16px 10px; align-items: center; }
  .sidebar .brand span, .ws-name, .nav-label, .me-text { display: none; }
  .sidebar .create { width: 46px; padding: 0; }
  .nav-item { justify-content: center; padding: 11px; }
  .nav-badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 17px; font-size: 10.5px; padding: 0 4px; }
  .nav-item.active::before { left: -10px; }
  .me { flex-direction: column; padding-top: 10px; }
  .composer, .dash, .two-col, .an-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-col { position: static; }
  main { padding: 24px 22px 48px; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .shell { display: block; }
  .sidebar { display: none; }
  .mobile-top { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--side); color: #fff; }
  .mobile-top .brand { font-size: 17px; color: #fff; }
  main { padding: 18px 14px calc(92px + env(safe-area-inset-bottom)); }
  h1 { font-size: 21px; } .hello { font-size: 21px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line);
    padding: 6px 6px max(6px, env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(0,0,0,.05); }
  .tabbar .nav-item, .tab-item { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); font-size: 11px; font-weight: 600; background: none; border: 0; border-radius: 10px; position: relative; }
  .tabbar .nav-item .nav-label { display: block; }
  .tabbar .nav-item.active { color: var(--brand-600); background: none; }
  .tabbar .nav-item.active::before { display: none; }
  .tabbar .nav-badge { position: absolute; top: 0; left: 55%; min-width: 17px; height: 16px; font-size: 10px; }
  .tab-create { align-self: center; justify-self: center; width: 50px; height: 50px; border-radius: 16px; background: var(--brand); color: #fff; place-items: center; margin-top: -18px; box-shadow: 0 6px 16px rgba(15,157,138,.4); }
  .page-head { margin-bottom: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 14px; } .kpi b { font-size: 21px; }
  .card { padding: 14px; }
  .when-options { grid-template-columns: 1fr 1fr; }
  .grid2, .steps { grid-template-columns: 1fr; }
  .month { font-size: 11px; }
  .day { min-height: 74px; padding: 3px; }
  .day .chip-post .txt, .day .chip-post .badges { display: none; }
  .day .chip-post { padding: 2px 3px; }
  .day .chip-post .t { font-size: 9.5px; letter-spacing: -.02em; }
  .dow { padding: 6px 2px; text-align: center; font-size: 10.5px; }
  .inbox { grid-template-columns: 1fr; min-height: 0; }
  .inbox.show-convo .inbox-list { display: none; }
  .inbox:not(.show-convo) .convo { display: none; }
  .inbox-items { max-height: none; }
  .back-btn { display: inline-grid; }
  .link-row { grid-template-columns: 1fr auto; }
  .link-row .spark { display: none; }
  .hbar { grid-template-columns: 90px 1fr 56px; }
  .heat { grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 1px; }
  .heat .hl:nth-child(odd) { visibility: hidden; }
  .toasts { left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .modal { border-radius: 18px 18px 0 0; align-self: end; max-height: 88vh; }
  .overlay { padding: 0; }
  .compose-foot { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .best-row { grid-template-columns: 80px 1fr auto; }
}

/* ---------- second pass: nav groups, Vigil, agents, leads, voice, reports, simple mode ---------- */
.nav-group { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #6f9399; padding: 12px 10px 4px; }
.nav-group:first-child { padding-top: 2px; }
.more-list .nav-group { color: var(--muted); }
.nav-item { padding-top: 7px; padding-bottom: 7px; }
.pill .icon { margin-right: 4px; }
.chip-post.s-blocked { border-left-color: var(--red); background: #fdf1f1; }
.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.finding { border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 10px; padding: 8px 10px; display: grid; gap: 4px; background: #fff; font-size: 13.5px; }
.finding.block { border-left-color: var(--red); } .finding.approval { border-left-color: var(--violet); }
.vigil-card .card-head h2 { display: flex; align-items: center; gap: 8px; }
.blocked-card { border: 1px solid #f4c7c8; border-left: 4px solid var(--red); display: grid; gap: 10px; }
.override summary { cursor: pointer; font-weight: 700; color: var(--red); }
.override[open] summary { margin-bottom: 8px; }
.attention { display: flex; flex-wrap: wrap; gap: 10px; margin: -4px 0 18px; }
.att { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; background: #fff; box-shadow: var(--shadow); border: 1px solid var(--line); color: var(--ink); }
.att.red { border-left: 4px solid var(--red); } .att.amber { border-left: 4px solid var(--amber); } .att.green { border-left: 4px solid var(--green); } .att.violet { border-left: 4px solid var(--violet); }
.att:hover { background: var(--line-2); }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.rule { display: grid; gap: 8px; align-content: start; }
.rule.off { opacity: .6; }
.rule .net-badge { margin-left: 3px; vertical-align: middle; }
.verify { display: grid; gap: 6px; border-left: 4px solid var(--green); }
.verify.bad { border-left-color: var(--red); background: #fff6f6; }
.verify.ok .icon { color: var(--green); } .verify.bad .icon { color: var(--red); }
.log-table td { font-size: 13.5px; vertical-align: top; }
.log-table .detail { max-width: 420px; color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.hash { font-size: 12px; color: var(--muted); background: var(--line-2); padding: 2px 5px; border-radius: 5px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.inset { background: #fafcfc; box-shadow: none; }
.rule-row { align-items: center; }
.msg-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.msg-tags .pill { height: 19px; font-size: 11px; padding: 0 7px; }
.lead-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.lead { display: grid; gap: 10px; align-content: start; }
.lead-head { display: flex; gap: 10px; align-items: center; }
.lead-head .small { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.lead-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lead textarea { min-height: 60px; }
.score { min-width: 30px; height: 26px; border-radius: 8px; background: var(--line-2); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.quote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--brand-100); background: #fafcfc; border-radius: 0 8px 8px 0; font-size: 14px; white-space: pre-wrap; }
.agent-hero { display: flex; gap: 18px; align-items: flex-start; background: linear-gradient(135deg, #f1fbf9, #f5f2ff); }
.agent-hero-icon, .agent-icon { display: grid; place-items: center; border-radius: 16px; background: var(--brand); color: #fff; flex: none; }
.agent-hero-icon { width: 62px; height: 62px; }
.agent-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--violet); }
.safety { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
.safety li { display: flex; gap: 8px; align-items: flex-start; }
.safety .icon { color: var(--green); margin-top: 2px; }
.agent-row { align-items: center; flex-wrap: wrap; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tool-grid.compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin: 10px 0; gap: 6px; }
.tool { align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.key-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.key { font-size: 14px; background: #12222b; color: #a7f3d0; padding: 8px 12px; border-radius: 9px; word-break: break-all; flex: 1; min-width: 0; }
.code-wrap { position: relative; }
.code { margin: 0; background: #12222b; color: #d7ecef; padding: 14px; border-radius: 10px; font-size: 12.5px; overflow-x: auto; white-space: pre; }
.code-copy { position: absolute; top: 8px; right: 8px; }
.suggestion { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.suggestion.preferred { border-color: var(--brand); background: #fbfefd; }
.suggestion-text { white-space: pre-wrap; font-size: 14.5px; }
.helper-controls { display: grid; grid-template-columns: 1.4fr 1fr 90px auto; gap: 12px; align-items: end; }
.voice-summary { font-size: 15.5px; padding: 12px 14px; border-radius: 12px; background: var(--brand-50); color: #0b5f55; }
.voice-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.vstat { background: var(--line-2); border-radius: 10px; padding: 10px; display: grid; gap: 2px; }
.vstat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.vstat b { text-transform: capitalize; }
.emoji-row { font-size: 22px; letter-spacing: 4px; }
.seg { display: inline-flex; background: #e9edf0; padding: 3px; border-radius: 10px; gap: 3px; width: max-content; }
.seg-btn { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.seg-btn.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); color: var(--brand-600); }
.report-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.report-out { display: grid; gap: 16px; min-width: 0; }
.report-out .kpis { margin-bottom: 0; }
.tpl-list { display: grid; gap: 8px; }
.tpl { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.tpl.on { border-color: var(--brand); background: var(--brand-50); }
.tpl .icon { margin-top: 2px; color: var(--brand-600); }
.link-btn { background: none; border: 0; text-align: left; cursor: pointer; padding: 0; }
.chart-legend.wrap { flex-wrap: wrap; margin-top: 8px; }
.simple { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.simple h2 { display: flex; align-items: center; gap: 6px; }
.simple .step-n { width: 26px; height: 26px; font-size: 14px; }
.week-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: start; padding-top: 10px; border-top: 1px solid var(--line-2); }
.week-row.done textarea { border-color: var(--green); }
.week-day { display: grid; padding-top: 6px; }
.week-row textarea { min-height: 56px; }
.week-tools { display: flex; gap: 4px; align-items: center; }
.week-tools input { width: 136px !important; }
.stack.tight { gap: 6px; }
.quick-msg { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.quick-msg:first-child { border-top: 0; padding-top: 0; }
.msg-text { font-size: 14px; color: var(--ink-2); }
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-kpis > div { background: var(--line-2); border-radius: 10px; padding: 10px; display: grid; }
.mini-kpis b { font-size: 20px; } .mini-kpis span { font-size: 12px; color: var(--muted); }
.top-post { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.rank { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; flex: none; }
@media (max-width: 1080px) {
  .nav-group { display: none; }
  .report-layout, .simple { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .more-list .nav-group { display: block; }
  .grid3, .lead-controls, .voice-stats { grid-template-columns: 1fr 1fr; }
  .helper-controls { grid-template-columns: 1fr 1fr; }
  .lead-list, .rule-grid { grid-template-columns: minmax(0, 1fr); }
  .week-row { grid-template-columns: 1fr; }
  .week-day { display: flex; gap: 8px; align-items: baseline; padding-top: 0; }
  .agent-hero { flex-direction: column; }
  .log-table .detail { min-width: 220px; }
}
.cal-layout > * { min-width: 0; }
@media (max-width: 1180px) { .cal-layout { grid-template-columns: minmax(0, 1fr); } }
.month { min-width: 0; }
.report-out, .simple-week, .voice .cards { grid-template-columns: minmax(0, 1fr); }
.report-layout > *, .simple > *, .lead-list > *, .rule-grid > * { min-width: 0; }
.sidebar > * { flex-shrink: 0; }
