/* dconnect — social media command center */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --border: #e3e6ef;
  --text: #171a2b;
  --text-2: #5b6178;
  --text-3: #8c91a7;
  --brand: #5b4bff;
  --brand-2: #8b5cf6;
  --brand-soft: #eeebff;
  --good: #12a150;
  --good-soft: #e3f7ec;
  --warn: #d48806;
  --warn-soft: #fff4dc;
  --bad: #e5484d;
  --bad-soft: #feeced;
  --info: #0b84d8;
  --info-soft: #e3f2fd;
  --shadow: 0 1px 2px rgba(20, 23, 50, .05), 0 4px 16px rgba(20, 23, 50, .05);
  --radius: 14px;
  --sidebar: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1017; --surface: #161925; --surface-2: #1d2131; --border: #2a2f43;
    --text: #eceef7; --text-2: #a5abc3; --text-3: #737a96;
    --brand-soft: #25214a; --good-soft: #10301f; --warn-soft: #33270b; --bad-soft: #3a1618; --info-soft: #0d2a40;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1017; --surface: #161925; --surface-2: #1d2131; --border: #2a2f43;
  --text: #eceef7; --text-2: #a5abc3; --text-3: #737a96;
  --brand-soft: #25214a; --good-soft: #10301f; --warn-soft: #33270b; --bad-soft: #3a1618; --info-soft: #0d2a40;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--text-2); }
.faint { color: var(--text-3); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; }
code { background: var(--surface-2); padding: .1em .4em; border-radius: 6px; word-break: break-all; }

.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.ic-sm { width: 15px; height: 15px; flex: none; vertical-align: -2px; }
.ic-lg { width: 26px; height: 26px; flex: none; }
.ic-brand { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 14px; z-index: 40;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.25rem; color: var(--text); padding: 4px 8px 18px; letter-spacing: -.02em; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 16px rgba(91,75,255,.35); }
.logo-mark svg { width: 20px; height: 20px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 14px 10px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav .badge { margin-left: auto; }
.compose-btn { margin: 0 0 14px; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; display: flex; align-items: center; gap: 10px; }
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.sidebar-foot .who small { font-size: .78rem; }
.user-av { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; }
.user-av img { width: 100%; height: 100%; object-fit: cover; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 1.2rem; margin: 0; flex: 1; }
.menu-toggle { display: none; }
.content { padding: 26px 28px 60px; max-width: 1320px; width: 100%; }

/* ---------- Building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; flex: 1; }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.spacer { flex: 1; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; } .mt-s { margin-top: 8px; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--text-2); font-size: .82rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
.stat .delta { font-size: .8rem; font-weight: 600; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer;
  white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(91,75,255,.28); }
.btn-primary:hover { background: linear-gradient(135deg, #4c3cf0, #7c4ff0); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 31px; padding: 0 11px; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; }
.btn-social { width: 100%; height: 44px; justify-content: center; font-weight: 550; }
.btn-ai { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); background: var(--brand-soft); }
.btn-ai:hover { background: color-mix(in srgb, var(--brand-soft) 70%, var(--brand) 12%); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-brand { background: var(--brand-soft); color: var(--brand); }
.pill-plat { background: var(--surface-2); color: var(--text); font-weight: 550; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; }
.badge-bad { background: var(--bad); }

/* Forms */
label, .label { display: block; font-weight: 550; margin-bottom: 6px; font-size: .9rem; }
.hint { font-size: .82rem; color: var(--text-2); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.field { margin-bottom: 16px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; margin: 0; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.input-group { display: flex; gap: 8px; }
.input-group > input { flex: 1; }

/* Flash */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.flash-error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.flash-info { background: var(--info-soft); color: var(--info); }
.flash .x { margin-left: auto; cursor: pointer; opacity: .6; background: none; border: 0; color: inherit; padding: 0; }

/* Avatars */
.av { position: relative; display: inline-block; flex: none; }
.av img, .av .av-initial { border-radius: 50%; object-fit: cover; display: grid; place-items: center; color: #fff; font-weight: 700; background: var(--surface-2); }
.av-sm img, .av-sm .av-initial { width: 30px; height: 30px; font-size: .8rem; }
.av-md img, .av-md .av-initial { width: 40px; height: 40px; }
.av-lg img, .av-lg .av-initial { width: 54px; height: 54px; font-size: 1.3rem; }
.av-badge { position: absolute; right: -3px; bottom: -3px; background: var(--surface); border-radius: 50%; padding: 1px; display: grid; line-height: 0; }
.av-sm .av-badge .ic-brand { width: 12px; height: 12px; }

/* Lists & tables */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; border-top: 0; background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty .ic-lg { color: var(--text-3); width: 42px; height: 42px; margin-bottom: 10px; }
.empty h3 { color: var(--text); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }

/* Score ring */
.ring { --v: 0; --c: var(--good); width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 80% 100%), conic-gradient(var(--c) calc(var(--v) * 1%), var(--surface-2) 0); }
.ring b { font-size: 1.35rem; font-weight: 750; }
.ring.lg { width: 120px; height: 120px; } .ring.lg b { font-size: 2.1rem; }
.ring.sm { width: 48px; height: 48px; } .ring.sm b { font-size: .95rem; }
.ring.good { --c: var(--good); } .ring.warn { --c: var(--warn); } .ring.bad { --c: var(--bad); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--good); }
.bar.warn > span { background: var(--warn); } .bar.bad > span { background: var(--bad); }
.txt-good { color: var(--good); } .txt-warn { color: var(--warn); } .txt-bad { color: var(--bad); }

/* Platform cards (accounts) */
.plat-card { display: flex; flex-direction: column; gap: 10px; }
.plat-card .head { display: flex; gap: 12px; align-items: center; }
.plat-card .head .ic-brand { width: 34px; height: 34px; }
.plat-card p { font-size: .88rem; color: var(--text-2); flex: 1; margin: 0; }
.acct-card .meta { display: flex; gap: 16px; font-size: .85rem; color: var(--text-2); }
.acct-card .meta b { color: var(--text); display: block; font-size: 1.05rem; }

/* Composer */
.composer { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.acct-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.acct-pick label { margin: 0; cursor: pointer; }
.acct-pick input { position: absolute; opacity: 0; pointer-events: none; }
.acct-pick .chip { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border: 1.5px solid var(--border); border-radius: 999px; font-weight: 550; font-size: .88rem; transition: all .15s; background: var(--surface); }
.acct-pick input:checked + .chip { border-color: var(--brand); background: var(--brand-soft); }
.acct-pick input:disabled + .chip { opacity: .45; cursor: not-allowed; }
.editor { position: relative; }
.editor textarea { min-height: 190px; font-size: 1rem; padding: 14px; border-radius: 12px 12px 0 0; }
.editor-tools { display: flex; align-items: center; gap: 6px; padding: 8px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 12px 12px; background: var(--surface-2); flex-wrap: wrap; }
.counters { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.counter { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface); color: var(--text-2); display: inline-flex; gap: 4px; align-items: center; }
.counter.over { background: var(--bad-soft); color: var(--bad); }
.media-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.media-grid .thumb { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.media-grid .thumb img, .media-grid .thumb video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.media-grid .thumb button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 16px; text-align: center; color: var(--text-2); cursor: pointer; margin-top: 12px; transition: all .15s; }
.dropzone.drag, .dropzone:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.when { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.when label { margin: 0; }
.when input { position: absolute; opacity: 0; }
.when .opt { border: 1.5px solid var(--border); border-radius: 10px; padding: 10px; text-align: center; cursor: pointer; font-weight: 550; font-size: .88rem; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.when .opt small { font-weight: 400; font-size: .74rem; }
.when input:checked + .opt { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.preview { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface); }
.preview + .preview { margin-top: 12px; }
.preview .p-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.preview .p-head b { display: block; font-size: .9rem; }
.preview .p-head small { font-size: .76rem; }
.preview .p-body { white-space: pre-wrap; word-wrap: break-word; font-size: .93rem; }
.preview .p-img { margin-top: 10px; border-radius: 10px; overflow: hidden; display: grid; gap: 2px; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
.preview .p-img img, .preview .p-img video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #000; }
.preview-ig .p-img video { aspect-ratio: 9 / 16; max-height: 420px; object-fit: contain; }
.preview .p-link { margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: .82rem; color: var(--text-2); }
.preview-ig .p-img { grid-template-columns: 1fr; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1.1fr); gap: 0; height: calc(100vh - 150px); min-height: 520px; }
.inbox > * { overflow-y: auto; }
.inbox-filters { border-right: 1px solid var(--border); padding: 14px 10px; }
.inbox-filters a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-weight: 500; font-size: .9rem; }
.inbox-filters a:hover { background: var(--surface-2); text-decoration: none; }
.inbox-filters a.active { background: var(--brand-soft); color: var(--brand); }
.inbox-filters a .badge { margin-left: auto; }
.inbox-list { border-right: 1px solid var(--border); }
.inbox-search { padding: 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.msg { display: flex; gap: 11px; padding: 13px 14px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; }
.msg:hover { background: var(--surface-2); }
.msg.active { background: var(--brand-soft); }
.msg.unread::before { content: ""; position: absolute; left: 4px; top: 50%; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); transform: translateY(-50%); }
.msg .grow { flex: 1; min-width: 0; }
.msg .top { display: flex; gap: 6px; align-items: center; font-size: .86rem; }
.msg .top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg .top time { margin-left: auto; font-size: .75rem; color: var(--text-3); white-space: nowrap; }
.msg .body { font-size: .88rem; color: var(--text-2); margin-top: 2px; }
.msg .tags { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.msg .tags .pill { font-size: .7rem; padding: 1px 7px; }
.inbox-detail { padding: 22px; display: flex; flex-direction: column; }
.bubble { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.me { background: var(--brand-soft); margin-left: 40px; }
.bubble-meta { font-size: .75rem; color: var(--text-3); margin: 4px 2px 12px; }
.context { border-left: 3px solid var(--border); padding: 4px 12px; color: var(--text-2); font-size: .86rem; margin-bottom: 14px; }
.reply-box { margin-top: auto; padding-top: 14px; }
.reply-box textarea { min-height: 90px; }
.templates { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.templates button { font-size: .78rem; height: 27px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal .dow { padding: 8px; font-size: .74rem; font-weight: 600; text-transform: uppercase; color: var(--text-3); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal .day { min-height: 118px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); position: relative; }
.cal .day.other { background: var(--surface-2); opacity: .55; }
.cal .day.today .num { background: var(--brand); color: #fff; }
.cal .num { font-size: .8rem; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal .add { position: absolute; top: 6px; right: 6px; opacity: 0; color: var(--text-3); }
.cal .day:hover .add { opacity: 1; }
.cal .ev { display: block; font-size: .76rem; padding: 3px 6px; border-radius: 6px; margin-top: 4px; background: var(--info-soft); color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border-left: 3px solid var(--info); }
.cal .ev.published { background: var(--good-soft); border-color: var(--good); }
.cal .ev.failed, .cal .ev.partial { background: var(--bad-soft); border-color: var(--bad); }
.cal .ev:hover { text-decoration: none; filter: brightness(.97); }

/* Checks (audit / health) */
.check-row { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); }
.check-row:first-child { border-top: 0; }
.check-row .st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.st.pass { background: var(--good); } .st.warn { background: var(--warn); } .st.fail { background: var(--bad); }
.check-row .st .ic-sm { width: 13px; height: 13px; }
.check-row .tip { margin-top: 6px; font-size: .87rem; background: var(--surface-2); padding: 8px 11px; border-radius: 9px; }
.tip-list { list-style: none; padding: 0; margin: 0; }
.tip-list li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.tip-list li:first-child { border-top: 0; }
.tip-list .n { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; }
.ai-box { background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--brand-soft) 60%, var(--surface))); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--border)); border-radius: 12px; padding: 16px; white-space: pre-wrap; font-size: .92rem; }
.automation-card { display: flex; gap: 14px; align-items: flex-start; }
.automation-card .icon-box, .icon-box { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }

/* Toggle */
.switch { position: relative; width: 40px; height: 23px; flex: none; display: inline-block; margin: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::before { transform: translateX(17px); }

/* Auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: linear-gradient(145deg, #1d1650 0%, #4a2fd1 55%, #8b5cf6 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 65%); right: -160px; bottom: -160px; }
.auth-art .logo { color: #fff; padding: 0; }
.auth-art .logo-mark { background: rgba(255,255,255,.18); box-shadow: none; }
.auth-art h2 { font-size: 2.1rem; max-width: 460px; font-weight: 700; letter-spacing: -.03em; }
.auth-art ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; max-width: 440px; }
.auth-art li { display: flex; gap: 10px; align-items: center; opacity: .92; }
.auth-art .brands { display: flex; gap: 10px; margin-top: 28px; }
.auth-art .brands span { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.95); display: grid; place-items: center; }
.auth-art .brands .ic-brand { width: 22px; height: 22px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-box { width: 100%; max-width: 390px; }
.auth-box h1 { font-size: 1.7rem; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: .8rem; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.simple-page { max-width: 760px; margin: 40px auto; padding: 0 20px; }

/* Loading */
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 22px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast div { background: var(--text); color: var(--surface); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; max-width: 380px; animation: up .2s ease-out; }
.toast div.err { background: var(--bad); color: #fff; }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: rgba(10, 12, 25, .5); z-index: 90; display: none; place-items: center; padding: 20px; }
.modal-bg.open { display: grid; }
.modal { background: var(--surface); border-radius: 16px; padding: 22px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: 90vh; overflow-y: auto; }
.chart-box { position: relative; height: 260px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .composer { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .inbox-filters { display: none; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox-detail { display: none; }
  .inbox.detail-open .inbox-list { display: none; }
  .inbox.detail-open .inbox-detail { display: flex; }
  .when { grid-template-columns: repeat(2, 1fr); }
  .cal .day { min-height: 74px; }
  .cal .ev { font-size: 0; padding: 0; height: 6px; }
  .topbar .hide-sm { display: none; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat .value { font-size: 1.35rem; }
  .card { padding: 16px; }
}
.cal .ev .ic-brand { width: 12px; height: 12px; vertical-align: -2px; }
