/* custom.css — design tokens and component classes on top of Tailwind utilities.
   Light theme: neutral slate surfaces, one indigo accent; colour otherwise signals status. */
:root {
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-ring: rgba(79, 70, 229, .28);
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e8ef;
  --border-strong: #d4d8e2;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 6px -2px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, .22), 0 6px 12px -6px rgba(15, 23, 42, .08);
  --sidebar-w: 256px;
  --sidebar-w-c: 72px;
  --banner-h: 30px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
.icon { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: #fff; padding: 8px 12px; border-radius: 8px; box-shadow: var(--shadow); }
.skip-link:focus { left: 8px; }

/* ---------- Type ---------- */
.page-title { font-size: 22px; line-height: 30px; font-weight: 650; letter-spacing: -.015em; color: var(--text); }
.page-sub { margin-top: 2px; color: var(--muted); font-size: 14px; }
.section-title { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--text); letter-spacing: -.005em; }
.caption { font-size: 12.5px; color: var(--muted); line-height: 18px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.link { color: var(--accent); font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ---------- Shell ---------- */
#demo-banner { position: fixed; inset: 0 0 auto 0; height: var(--banner-h); z-index: 40; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 12.5px; color: #3730a3; background: linear-gradient(90deg, #eef2ff, #f5f3ff); border-bottom: 1px solid #e0e7ff; padding: 0 12px; white-space: nowrap; overflow: hidden; }
#demo-banner a:hover { text-decoration: underline; }
.banner-sep { width: 1px; height: 14px; background: #c7d2fe; }
.engine-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); display: inline-block; animation: pulse 2s infinite; }
.engine-dot.off { background: #94a3b8; box-shadow: 0 0 0 3px rgba(148, 163, 184, .2); animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, .08); } }

#sidebar { position: fixed; top: var(--banner-h); bottom: 0; left: 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); z-index: 30; display: flex; flex-direction: column; transition: width .22s var(--ease), transform .22s var(--ease); }
#main-col { margin-left: var(--sidebar-w); padding-top: var(--banner-h); min-height: 100vh; transition: margin .22s var(--ease); min-width: 0; }
.sb-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sb-logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #6366f1, #4338ca); color: #fff; display: grid; place-items: center; flex-shrink: 0; overflow: hidden; box-shadow: 0 4px 10px -4px rgba(79, 70, 229, .6); }
.sb-logo img { width: 100%; height: 100%; object-fit: cover; }
.sb-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sb-group + .sb-group { margin-top: 14px; }
.sb-group-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 0 10px 6px; white-space: nowrap; }
.sb-item { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; transition: background .15s, color .15s; white-space: nowrap; }
.sb-item:hover { background: var(--surface-2); color: var(--text); }
.sb-item.active { background: var(--accent-soft); color: var(--accent-hover); }
.sb-item.active .icon { color: var(--accent); }
.sb-foot { padding: 12px 14px; border-top: 1px solid var(--border); }
.sb-engine { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; }
.sb-engine:hover { background: var(--surface-2); }
body.sb-collapsed #sidebar { width: var(--sidebar-w-c); }
body.sb-collapsed #main-col { margin-left: var(--sidebar-w-c); }
body.sb-collapsed .sb-label, body.sb-collapsed .sb-group-label { display: none; }
body.sb-collapsed .sb-item { justify-content: center; padding: 0; }
body.sb-collapsed .sb-brand { justify-content: center; padding: 0; }
body.sb-collapsed .sb-engine { justify-content: center; }
#sb-overlay { display: none; }

#topbar { position: sticky; top: var(--banner-h); z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: rgba(255, 255, 255, .86); backdrop-filter: saturate(1.6) blur(10px); border-bottom: 1px solid var(--border); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.crumbs a:hover { color: var(--accent); }
.topbar-title { font-weight: 600; font-size: 15px; color: var(--text); }
.gsearch { position: relative; width: min(360px, 32vw); }
.gsearch .input { padding-left: 36px; background: var(--surface-2); }
.gsearch-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.gsearch-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); max-height: 70vh; overflow-y: auto; padding: 6px; z-index: 50; }
.gsearch-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: 8px 10px 4px; }
.gsearch-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.gsearch-item:hover, .gsearch-item:focus { background: var(--surface-2); }
.bell-count { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; border-radius: 9px; background: #ef4444; color: #fff; font-size: 10.5px; font-weight: 600; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; }
.profile-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 10px; transition: background .15s; }
.profile-btn:hover { background: var(--surface-2); }

#view { display: block; outline: none; }
.view-inner { padding: 24px; max-width: 1480px; margin: 0 auto; }
.fade-in { animation: fadeIn .22s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } }
#live-root { display: none; }
body.live-mode #sidebar, body.live-mode #main-col, body.live-mode #demo-banner { display: none; }
body.live-mode #live-root { display: block; }

/* ---------- Layout primitives ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.card-hover { transition: box-shadow .18s, transform .18s, border-color .18s; }
a.card-hover:hover, .card-hover.clickable:hover { box-shadow: 0 8px 20px -10px rgba(15, 23, 42, .18); border-color: var(--border-strong); transform: translateY(-1px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-body { padding: 20px; }
.stat { display: block; padding: 18px 20px; }
.stat-value { font-size: 26px; line-height: 34px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; color: var(--text); }
.stat-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.tone-indigo { background: #eef2ff; color: #4f46e5; }
.tone-green { background: #ecfdf5; color: #059669; }
.tone-red { background: #fef2f2; color: #dc2626; }
.tone-amber { background: #fffbeb; color: #d97706; }
.tone-blue { background: #eff6ff; color: #2563eb; }
.tone-slate { background: #f1f5f9; color: #475569; }
.grid-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.empty { text-align: center; padding: 40px 20px; }
.empty-icon { width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); border: 1px solid var(--border); }
.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); font-size: 13.5px; border: 1px solid; }
.notice-blue { background: #eff6ff; border-color: #dbeafe; color: #1e3a8a; }
.notice-amber { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.notice-red { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.notice-green { background: #ecfdf5; border-color: #a7f3d0; color: #064e3b; }
.notice-indigo { background: var(--accent-soft); border-color: #e0e7ff; color: #312e81; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: var(--surface-2); }
.avatar { border-radius: 50%; background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #3730a3; font-weight: 600; display: inline-grid; place-items: center; flex-shrink: 0; object-fit: cover; }
.thumb { width: 44px; height: 32px; border-radius: 6px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); flex-shrink: 0; }
.logo-sq { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 550; border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; white-space: nowrap; cursor: pointer; user-select: none; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .3), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: #fff; color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-danger-soft { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.btn-danger-soft:hover { background: #fee2e2; }
.btn-soft { background: var(--accent-soft); color: var(--accent-hover); }
.btn-soft:hover:not(:disabled) { background: #e0e7ff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.btn-icon { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--r-sm); color: var(--muted); transition: background .15s, color .15s; flex-shrink: 0; }
.btn-icon:hover:not(:disabled) { background: #f1f5f9; color: var(--text); }
.btn-icon:disabled { opacity: .35; cursor: not-allowed; }
.btn-icon-danger:hover:not(:disabled) { background: #fef2f2; color: #dc2626; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.row-actions .btn-icon { width: 30px; height: 30px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.help { font-size: 12px; color: var(--muted); }
.err { font-size: 12px; color: #dc2626; font-weight: 500; }
.input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: #fff; color: var(--text); font-size: 14px; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input::placeholder { color: var(--faint); }
.input:hover { border-color: #b8bfcc; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input[aria-invalid=true] { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .12); }
.input:disabled { background: var(--surface-2); color: var(--muted); }
.input-auto { width: auto; min-width: 140px; }
.input-sm { height: 30px; font-size: 12.5px; min-width: 100px; }
.checkbox { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.search-box { position: relative; flex: 1 1 220px; max-width: 320px; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search-box .input { padding-left: 34px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; padding: 4px 0; }
.switch { position: relative; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { display: block; width: 38px; height: 22px; border-radius: 11px; background: #cbd5e1; transition: background .18s; position: relative; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .18s var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-check { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; font-weight: 500; font-size: 13px; transition: all .15s; background: #fff; user-select: none; }
.chip-check:hover { border-color: #a5b4fc; }
.chip-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }
.chip-check input { accent-color: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: var(--text-2); font-size: 12px; font-weight: 500; }
.chip-warn { background: #fffbeb; color: #b45309; }
.drop { border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); padding: 22px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; cursor: pointer; }
.drop:hover, .drop.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .15s, border-color .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-hover); border-bottom-color: var(--accent); }
.tab-count { font-size: 11px; background: #f1f5f9; color: var(--muted); border-radius: 999px; padding: 1px 7px; }
.tab.active .tab-count { background: var(--accent-soft); color: var(--accent-hover); }
.seg { display: inline-flex; background: #f1f5f9; border-radius: 9px; padding: 3px; gap: 2px; }
.seg a { height: 28px; padding: 0 12px; border-radius: 7px; font-weight: 550; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; }
.seg a.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.seg button { height: 28px; padding: 0 12px; border-radius: 7px; font-weight: 550; font-size: 13px; color: var(--muted); }
.seg button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap; border: 1px solid transparent; }
.badge-slate { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.badge-amber { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-indigo { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.badge-green { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge-red { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge-spin { position: relative; overflow: hidden; }
.badge-spin::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.badge-demo { background: #faf5ff; color: #7e22ce; border-color: #e9d5ff; height: 20px; font-size: 11px; padding: 0 7px; gap: 3px; }
.badge-sim { background: #fdf4ff; color: #a21caf; border-color: #f5d0fe; height: 20px; font-size: 11px; padding: 0 7px; gap: 3px; }
.score-pill { display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 7px; border-radius: 7px; font-weight: 650; font-size: 12.5px; }
.score-green { background: #ecfdf5; color: #047857; }
.score-amber { background: #fffbeb; color: #b45309; }
.score-red { background: #fef2f2; color: #b91c1c; }
.platform-dot { width: 24px; height: 24px; border-radius: 7px; display: inline-grid; place-items: center; color: var(--pc); background: color-mix(in srgb, var(--pc) 11%, white); flex-shrink: 0; }

/* ---------- Tables ---------- */
.tbl-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.tbl-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; background: var(--accent-soft); border-bottom: 1px solid #e0e7ff; }
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 0 14px; height: 40px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: #fafbfd; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: inherit; }
.th-sort .icon { opacity: .45; }
.th-sort:hover, .th-sort.active { color: var(--text); }
.th-sort.active .icon { opacity: 1; color: var(--accent); }
.tbl-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); }
.tbl-foot:empty { display: none; }
.cell-title { font-weight: 550; color: var(--text); display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.cell-title:hover { color: var(--accent); }
.cell-sub { font-size: 12px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .42); opacity: 0; transition: opacity .18s; backdrop-filter: blur(2px); }
.modal-panel { position: relative; width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px) scale(.985); transition: opacity .18s, transform .2s var(--ease); }
.modal-wrap.show .modal-backdrop { opacity: 1; }
.modal-wrap.show .modal-panel { opacity: 1; transform: none; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-foot:empty { display: none; }
.modal-side { justify-content: flex-end; padding: 0; }
.modal-side .modal-panel { height: 100%; max-height: 100vh; width: min(460px, 100vw); border-radius: 0; transform: translateX(24px); }
.modal-side .modal-foot { border-radius: 0; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s var(--ease); }
.toast.show { opacity: 1; transform: none; }
.toast-icon { flex-shrink: 0; }
.toast-success .toast-icon { color: #16a34a; }
.toast-error .toast-icon { color: #dc2626; }
.toast-warning .toast-icon { color: #d97706; }
.toast-info .toast-icon { color: var(--accent); }
.toast-close { color: var(--faint); flex-shrink: 0; }
.toast-close:hover { color: var(--text); }
.toast-action { margin-top: 6px; color: var(--accent); font-weight: 600; font-size: 13px; }

/* ---------- Popover / menu ---------- */
.popover { position: fixed; z-index: 70; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); animation: popIn .14s var(--ease); overflow: hidden; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px); } }
.menu { padding: 6px; min-width: 190px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; color: var(--text-2); }
.menu-item:hover, .menu-item:focus { background: var(--surface-2); color: var(--text); outline: none; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- Charts ---------- */
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid { stroke: #eef0f4; stroke-width: 1; }
.chart-axis { fill: #94a3b8; font-size: 11px; font-family: Inter, sans-serif; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i, .donut-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.chart-empty { height: 200px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--faint); font-size: 13px; }
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut-svg { width: 170px; height: 170px; flex-shrink: 0; }
.donut-total { font-size: 28px; font-weight: 650; fill: var(--text); font-family: Inter, sans-serif; }
.donut-legend { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.donut-legend span { flex: 1; color: var(--text-2); }
.donut-legend b { font-weight: 600; }

/* ---------- Editor ---------- */
.editor { border: 1px solid var(--border-strong); border-radius: var(--r-md); background: #fff; overflow: hidden; }
.editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
.editor-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; color: var(--text-2); }
.editor-btn:hover { background: #e2e8f0; }
.editor-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 4px; }
.editor-area { min-height: 420px; padding: 20px 22px; outline: none; font-size: 15px; line-height: 1.7; }
.editor-area:empty::before { content: attr(data-placeholder); color: var(--faint); }
.prose-content h2 { font-size: 20px; font-weight: 650; margin: 1.3em 0 .5em; letter-spacing: -.01em; color: var(--text); }
.prose-content h3 { font-size: 17px; font-weight: 600; margin: 1.2em 0 .4em; color: var(--text); }
.prose-content p { margin: 0 0 .9em; color: #1e293b; }
.prose-content ul { list-style: disc; padding-left: 1.4em; margin: 0 0 1em; }
.prose-content ol { list-style: decimal; padding-left: 1.4em; margin: 0 0 1em; }
.prose-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose-content blockquote { border-left: 3px solid #c7d2fe; padding: 4px 0 4px 14px; color: var(--text-2); margin: 0 0 1em; font-style: italic; }
.prose-content figure { margin: 1.2em 0; }
.prose-content img { max-width: 100%; border-radius: 10px; display: block; }
.prose-content figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 6px; }

/* ---------- SEO ring & checklist ---------- */
.seo-ring { position: relative; width: 92px; height: 92px; flex-shrink: 0; }
.seo-ring svg { transform: rotate(-90deg); }
.seo-ring-val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.seo-ring circle { transition: stroke-dashoffset .4s var(--ease), stroke .3s; }
.check-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.check-item:last-child { border-bottom: 0; }
.serp { font-family: Arial, sans-serif; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.serp-url { font-size: 12.5px; color: #202124; display: flex; gap: 6px; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.serp-title { font-size: 18px; color: #1a0dab; line-height: 1.3; margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp-desc { font-size: 13px; color: #4d5156; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Social previews ---------- */
.pv { border: 1px solid var(--border); border-radius: 12px; background: #fff; overflow: hidden; font-size: 13.5px; max-width: 420px; margin: 0 auto; }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 12px; }
.pv-name { font-weight: 600; color: #050505; }
.pv-text { padding: 0 12px 10px; white-space: pre-wrap; overflow-wrap: anywhere; color: #1c1e21; }
.pv-tags { color: #1d4ed8; }
.pv-img { width: 100%; display: block; object-fit: cover; background: #f1f5f9; }
.pv-react { display: flex; justify-content: space-around; border-top: 1px solid #e4e6eb; padding: 6px; color: #65676b; font-weight: 600; font-size: 12.5px; }
.pv-react span { display: inline-flex; align-items: center; gap: 6px; padding: 6px; }
.pv-pin { max-width: 260px; border-radius: 18px; }
.pv-pin .pv-img { aspect-ratio: 2/3; border-radius: 18px; }
.pv-link { margin: 0 12px 12px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-ph { aspect-ratio: 16/9; display: grid; place-items: center; background: #0f172a; color: #cbd5e1; }

/* ---------- Calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head { font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); text-align: left; }
.cal-cell { min-height: 118px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: background .12s; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.muted { background: #fbfcfd; }
.cal-cell.muted .cal-day { color: var(--faint); }
.cal-cell.today .cal-day { background: var(--accent); color: #fff; }
.cal-cell.drop-target { background: var(--accent-soft); }
.cal-day { font-size: 12px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.cal-item { display: flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 3px 6px; border-radius: 6px; cursor: pointer; overflow: hidden; white-space: nowrap; min-width: 0; text-align: left; width: 100%; border: 1px solid transparent; transition: transform .1s, box-shadow .1s; }
.cal-item:hover { box-shadow: 0 2px 6px -2px rgba(15, 23, 42, .25); }
.cal-item span { overflow: hidden; text-overflow: ellipsis; }
.cal-item[draggable=true] { cursor: grab; }
.cal-item.blog { color: #fff; }
.cal-item.social { background: #fff; }
.cal-more { font-size: 11.5px; color: var(--accent); font-weight: 600; text-align: left; padding-left: 4px; }
.st-draft { --sc: #64748b; } .st-pending { --sc: #d97706; } .st-approved { --sc: #2563eb; } .st-scheduled { --sc: #4f46e5; } .st-publishing { --sc: #6366f1; } .st-published { --sc: #16a34a; } .st-failed { --sc: #dc2626; }
.cal-item.blog { background: var(--sc); }
.cal-item.social { border-color: var(--sc); color: var(--sc); }
.week-col { min-height: 360px; }
.slot-grid { display: grid; grid-template-columns: 90px repeat(7, minmax(84px, 1fr)); min-width: 720px; }
.slot-grid > div { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 8px; min-height: 48px; font-size: 12px; }
.slot-pill { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 3px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; margin-bottom: 4px; }

/* ---------- Media grid ---------- */
.media-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.media-card { overflow: hidden; display: flex; flex-direction: column; }
.media-card img { aspect-ratio: 4/3; width: 100%; object-fit: cover; background: var(--surface-2); border-bottom: 1px solid var(--border); cursor: zoom-in; }
.media-pick { position: relative; border-radius: 10px; overflow: hidden; border: 2px solid transparent; cursor: pointer; }
.media-pick img { aspect-ratio: 4/3; width: 100%; object-fit: cover; }
.media-pick.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ---------- Demo live page ---------- */
.live-banner { position: sticky; top: 0; z-index: 10; background: #1e1b4b; color: #e0e7ff; font-size: 13px; padding: 10px 16px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; text-align: center; }

/* ---------- Misc ---------- */
.kbd { font-family: ui-monospace, monospace; font-size: 11px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--muted); background: #fff; }
.code-box { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 14px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; overflow: auto; max-height: 420px; white-space: pre; }
.progress { height: 6px; border-radius: 3px; background: #eef0f4; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.timeline-item { position: relative; padding-left: 26px; padding-bottom: 14px; }
.timeline-item::before { content: ''; position: absolute; left: 7px; top: 22px; bottom: 0; width: 1px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { position: absolute; left: 0; top: 3px; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; }
.qa-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: #fff; transition: all .15s; text-align: left; font-weight: 550; }
.qa-btn:hover { border-color: #a5b4fc; background: #fafaff; transform: translateY(-1px); }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  #sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; box-shadow: var(--shadow-lg); }
  #main-col, body.sb-collapsed #main-col { margin-left: 0; }
  body.sb-collapsed .sb-label, body.sb-collapsed .sb-group-label { display: initial; }
  body.sb-collapsed .sb-item { justify-content: flex-start; padding: 0 10px; }
  body.sb-collapsed .sb-brand { justify-content: flex-start; padding: 0 16px; }
  body.sb-drawer-open #sidebar { transform: none; }
  body.sb-drawer-open #sb-overlay { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 25; }
  .gsearch { width: min(280px, 30vw); }
}
@media (max-width: 767px) {
  :root { --topbar-h: 58px; }
  #topbar { padding: 0 12px; gap: 6px; }
  .gsearch { display: none; }
  #topbar.search-open .gsearch { display: block; position: absolute; left: 12px; right: 12px; top: 10px; width: auto; }
  .view-inner { padding: 16px; }
  .page-title { font-size: 20px; line-height: 28px; }
  .card-head { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .btn, .input { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .btn-icon { width: 38px; height: 38px; }
  .search-box { max-width: none; flex-basis: 100%; }
  .tbl-toolbar .input-auto { flex: 1 1 140px; }
  .cal-cell { min-height: 84px; padding: 3px; }
  .cal-item { font-size: 10.5px; padding: 2px 4px; }
  .cal-item .ci-time { display: none; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .stat-value { font-size: 22px; }
  #demo-banner { font-size: 11.5px; gap: 8px; }
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal-panel { max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal-foot { border-radius: 0; }
}

/* ---------- Simple blog scheduler ---------- */
.steps { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.step { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); height: 100%; transition: border-color .15s, transform .15s; }
a.step:hover { border-color: #a5b4fc; transform: translateY(-1px); }
.step-n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-hover); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.date-chip { width: 48px; height: 52px; border-radius: 12px; background: #fff; border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.date-chip b { font-size: 18px; color: var(--text); }
.date-chip span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.date-chip.today { background: var(--accent); border-color: var(--accent); }
.date-chip.today b, .date-chip.today span { color: #fff; }
.post-card { display: flex; gap: 16px; padding: 14px; align-items: stretch; }
.post-img { width: 148px; height: auto; aspect-ratio: 16/10; align-self: flex-start; object-fit: cover; border-radius: 10px; flex-shrink: 0; border: 1px solid var(--border); }
.portal-top { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
@media (max-width: 1023px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) {
  .post-card { flex-direction: column; }
  .post-img { width: 100%; }
  .steps { grid-template-columns: 1fr; }
}

/* ---------- Client cards ---------- */
.client-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.client-card { position: relative; display: flex; flex-direction: column; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); transition: box-shadow .18s var(--ease), border-color .18s, transform .18s var(--ease); }
.client-card:hover { border-color: var(--border-strong); box-shadow: 0 12px 28px -14px rgba(15, 23, 42, .22); transform: translateY(-2px); }
.client-card:focus-within { border-color: var(--accent); }
.cc-name { display: block; font-weight: 600; font-size: 15.5px; color: var(--text); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; outline: none; }
.cc-name::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* the whole card opens the client */
.cc-raise { position: relative; z-index: 1; }
.cc-site { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; margin-top: 3px; font-size: 13px; color: var(--muted); }
.cc-site:hover { color: var(--accent); }
.cc-go { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--faint); flex-shrink: 0; transition: background .18s, color .18s, transform .18s var(--ease); }
.client-card:hover .cc-go { background: var(--accent-soft); color: var(--accent); transform: translateX(2px); }
.cc-login { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; font-size: 13px; }
.cc-login.ok { background: #f0fdf4; color: #15803d; }
.cc-login.warn { background: #f8fafc; color: #475569; }
.cc-login-title { font-weight: 600; line-height: 1.25; }
.cc-login-sub { color: var(--muted); font-size: 12px; line-height: 1.3; }
.cc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cc-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; min-width: 0; }
.cc-stat b { font-size: 18px; font-weight: 650; color: var(--text); line-height: 1; }
.cc-stat > span:last-child { font-size: 12px; color: var(--muted); }
.cc-stat-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; }
.cc-next { display: flex; align-items: center; gap: 6px; padding-top: 14px; margin-top: -2px; border-top: 1px dashed var(--border); font-size: 12.5px; color: var(--muted); }
.cc-next b { color: var(--text); font-weight: 600; }
.seg button { height: 28px; padding: 0 12px; border-radius: 7px; font-weight: 550; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; }
.seg button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
@media (max-width: 400px) { .client-grid { grid-template-columns: 1fr; } .cc-stat { padding: 8px 10px; } }

/* ---------- Blog post editor ---------- */
.pe { display: flex; flex-direction: column; gap: 18px; }
.pe-nav { position: sticky; top: -20px; z-index: 6; display: flex; gap: 4px; overflow-x: auto; margin: -20px -20px 0; padding: 10px 16px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); scrollbar-width: none; }
.pe-nav::-webkit-scrollbar { display: none; }
.pe-nav button { flex-shrink: 0; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 550; color: var(--muted); }
.pe-nav button:hover { background: var(--accent-soft); color: var(--accent); }
.pe-sec { border: 1px solid var(--border); border-radius: 14px; padding: 18px; scroll-margin-top: 56px; background: #fff; }
.pe-sec-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.pe-sec-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.pe-sec-title { font-weight: 600; color: var(--text); font-size: 15px; line-height: 1.3; }
.counter { white-space: nowrap; }
.slug-input { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: #fff; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.slug-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.slug-prefix { display: block; flex-shrink: 0; line-height: 38px; padding: 0 6px 0 12px; background: var(--surface-2); color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--border); }
.slug-input .input { flex: 1; width: auto; border: 0; box-shadow: none !important; border-radius: 0; min-width: 0; }
.slug-input:has([aria-invalid=true]) { border-color: #ef4444; }
.tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: #fff; cursor: text; transition: border-color .15s, box-shadow .15s; }
.tag-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.tag-input-field { flex: 1; min-width: 120px; border: 0; outline: 0; font-size: 14px; padding: 4px; background: transparent; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--accent-soft); color: #3730a3; font-size: 13px; font-weight: 500; }
.tag button { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 999px; color: #6366f1; }
.tag button:hover { background: #c7d2fe; }
.serp { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: #fff; font-family: Arial, sans-serif; }
.serp-site { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #4d5156; margin-bottom: 4px; min-width: 0; }
.serp-site span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp-title { color: #1a0dab; font-size: 18px; line-height: 1.3; margin-bottom: 3px; }
.serp-desc { color: #4d5156; font-size: 13.5px; line-height: 1.5; }
.seo-checks { display: grid; gap: 6px; }
.seo-checks li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.seo-checks li .icon { color: #cbd5e1; flex-shrink: 0; }
.seo-checks li.ok { color: var(--text-2); }
.seo-checks li.ok .icon { color: #10b981; }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; align-items: center; }
.schema-ta { font-size: 12.5px; line-height: 1.55; min-height: 160px; white-space: pre; tab-size: 2; }
.pe-editor { min-height: 400px; }
.rte-loading { display: flex; align-items: center; justify-content: center; gap: 8px; height: 400px; border: 1px dashed var(--border-strong); border-radius: var(--r-md); color: var(--muted); font-size: 14px; }
.tox.tox-tinymce { border-radius: 12px !important; border-color: var(--border-strong) !important; }
.tox .tox-toolbar__primary, .tox .tox-editor-header { background: var(--surface-2) !important; }
.tox-tinymce-aux { z-index: 1300 !important; }
.kw-chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: #4338ca; font-size: 11.5px; font-weight: 550; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
  .link-row { grid-template-columns: 1fr; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
  .pe-sec { padding: 14px; }
  .slug-prefix { flex-shrink: 1; max-width: 45%; }
}

/* ---------- Post preview (post.html) ---------- */
.pv-bar { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.pv-bar-in { max-width: 1320px; margin: 0 auto; padding: 10px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pv-note { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 16px; background: #eef2ff; color: #4338ca; font-size: 12px; }
.pv-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--text); }
.pv-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pv-pill.scheduled { background: #fffbeb; color: #b45309; }
.pv-pill.live { background: #ecfdf5; color: #047857; }
.pv-pill.draft { background: #eef2ff; color: #4338ca; }
.pv-layout { max-width: 1320px; margin: 0 auto; padding: 24px 20px 48px; display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.pv-layout.solo { grid-template-columns: minmax(0, 1fr); }
.pv-stage { min-width: 0; }
.pv-frame { margin: 0 auto; background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; transition: max-width .3s var(--ease); max-width: 920px; }
.pv-frame[data-frame="mobile"] { max-width: 390px; border-radius: 28px; border-width: 8px; border-color: #0f172a; }
.pv-site-head { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-bottom: 1px solid var(--border); min-width: 0; }
.pv-url { margin-left: auto; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pv-frame[data-frame="mobile"] .pv-url { display: none; }
.pv-article { padding: 36px 44px 48px; }
.pv-frame[data-frame="mobile"] .pv-article { padding: 22px 18px 32px; }
.pv-h1 { font-size: 36px; line-height: 1.2; font-weight: 750; letter-spacing: -.02em; color: var(--text); margin-bottom: 8px; }
.pv-frame[data-frame="mobile"] .pv-h1 { font-size: 26px; }
.pv-cover { width: 100%; border-radius: 14px; margin-bottom: 28px; display: block; }
.pv-cover-missing { display: grid; place-items: center; aspect-ratio: 16 / 7; margin-bottom: 28px; border: 2px dashed #fca5a5; border-radius: 14px; background: #fef2f2; color: #b91c1c; font-size: 14px; font-weight: 550; text-align: center; padding: 12px; }
.pv-body { font-size: 17px; line-height: 1.75; }
.pv-frame[data-frame="mobile"] .pv-body { font-size: 16px; }
.pv-body table { width: 100%; border-collapse: collapse; margin: 0 0 1em; font-size: .92em; }
.pv-body td, .pv-body th { border: 1px solid var(--border); padding: 8px 10px; }
.pv-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; min-width: 0; }
.pv-side > .card { flex-shrink: 0; min-width: 0; overflow: hidden; }
.pv-side .serp { min-width: 0; overflow: hidden; }
.pv-summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; }
.pv-summary.red { background: #fef2f2; color: #b91c1c; }
.pv-summary.amber { background: #fffbeb; color: #b45309; }
.pv-summary.green { background: #ecfdf5; color: #047857; }
.pv-summary .caption { color: inherit; opacity: .8; }
.pv-checks { display: flex; flex-direction: column; }
.pv-check { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.pv-check:first-child { border-top: 0; }
.pv-check-text { font-size: 13.5px; color: var(--text-2); line-height: 1.4; }
.pv-check.error .pv-check-text { color: #991b1b; font-weight: 550; }
.pv-check.ok .pv-check-text { color: var(--muted); }
.pv-fix { flex-shrink: 0; height: 28px; color: var(--accent); }
.pv-dl { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; font-size: 13px; }
.pv-dl dt { color: var(--muted); }
.pv-dl dd { color: var(--text-2); min-width: 0; }
.kw-soft { background: #f1f5f9; color: #475569; margin: 0 4px 4px 0; }
.pe-sec.pe-flash { animation: pe-flash 1.6s var(--ease); }
@keyframes pe-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent-ring); border-color: var(--accent); } 100% { box-shadow: none; } }
@media (max-width: 1080px) {
  .pv-layout { grid-template-columns: minmax(0, 1fr); }
  .pv-side { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 640px) {
  .pv-article { padding: 22px 18px 32px; }
  .pv-h1 { font-size: 26px; }
  .pv-bar-in { padding: 8px 12px; }
  .pv-layout { padding: 14px 12px 32px; }
  .pv-frame[data-frame="mobile"] { border-width: 0; border-radius: 16px; }
}

/* ---------- Dashboard ---------- */
.d-wrap { max-width: 1180px; }
.d-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }
.d-date { font-size: 13px; font-weight: 550; color: var(--muted); }
.d-h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; color: var(--text); margin-top: 2px; }
.d-lead { margin-top: 6px; font-size: 15px; color: var(--text-2); }
.d-lead-warn { color: #b45309; font-weight: 550; text-decoration: underline; text-decoration-color: #fcd34d; text-underline-offset: 3px; }
.d-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 24px; overflow: hidden; }
.d-stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; border-left: 1px solid var(--border); transition: background .15s; }
.d-stat:first-child { border-left: 0; }
.d-stat:hover { background: #fafbff; }
.d-stat b { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.2; letter-spacing: -.01em; }
.d-stat span { font-size: 13px; color: var(--muted); }
.d-grid { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.d-side { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.d-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 6px 0 8px; min-width: 0; scroll-margin-top: 90px; }
.d-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 14px 20px 8px; }
.d-card-head h2 { font-size: 15px; font-weight: 650; color: var(--text); }
.d-card-head span { font-size: 12.5px; color: var(--muted); }
.d-day { padding: 4px 0 6px; }
.d-day + .d-day { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }
.d-day-label { display: flex; align-items: baseline; gap: 8px; padding: 6px 20px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.d-day-label span { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.d-post { display: flex; align-items: center; gap: 14px; padding: 9px 20px; min-width: 0; transition: background .15s; }
.d-post:hover { background: #f8f9ff; }
.d-thumb { width: 64px; height: 42px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #f1f5f9; display: block; }
.d-post.compact .d-thumb { width: 48px; height: 34px; border-radius: 7px; }
.d-post-title { display: block; font-size: 14px; font-weight: 550; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-post-meta { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.d-post-time { font-size: 13px; font-weight: 550; color: var(--text-2); white-space: nowrap; }
.d-post-go { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--faint); flex-shrink: 0; transition: color .15s, background .15s; }
.d-post:hover .d-post-go { color: var(--accent); background: var(--accent-soft); }
.d-attn { display: flex; align-items: flex-start; gap: 12px; padding: 10px 20px; transition: background .15s; }
.d-attn:hover { background: #f8f9ff; }
.d-dot { width: 8px; height: 8px; border-radius: 999px; margin-top: 6px; flex-shrink: 0; }
.d-dot.red { background: #ef4444; box-shadow: 0 0 0 3px #fee2e2; }
.d-dot.amber { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.d-dot.slate { background: #94a3b8; }
.d-attn-title { display: block; font-size: 13.5px; font-weight: 550; color: var(--text); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.d-attn-text { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.d-attn-cta { font-size: 12.5px; font-weight: 600; color: var(--accent); white-space: nowrap; margin-top: 1px; }
.d-allclear { display: flex; align-items: center; gap: 8px; margin: 6px 20px 10px; padding: 12px 14px; border-radius: 10px; background: #ecfdf5; color: #047857; font-size: 14px; font-weight: 550; }
.d-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 10px 20px 14px; color: var(--muted); font-size: 14px; }
@media (max-width: 1100px) { .d-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .d-h1 { font-size: 24px; }
  .d-hero { align-items: flex-start; }
  .d-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-stat:nth-child(3) { border-left: 0; }
  .d-stat:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .d-post, .d-attn, .d-card-head, .d-day-label { padding-left: 14px; padding-right: 14px; }
  .d-thumb { width: 52px; height: 36px; }
  .d-post-go { display: none; }
}

/* ---------- Calendar ---------- */
.d-card-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.d-card-link:hover { color: var(--accent); }
.cv-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.cv-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--text); margin: 0 6px; white-space: nowrap; }
.cv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cv-select { width: auto; max-width: 190px; height: 34px; font-size: 13px; padding-right: 28px; }
.cv-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.cv-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 4px; }
.cv-key:first-child { margin-left: 0; }
.cv-key.scheduled { background: #f59e0b; }
.cv-key.published { background: #10b981; }
.cv-hint { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; font-size: 12px; color: var(--faint); }
.cv-month { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.cv-week-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cv-week-head div { padding: 9px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cv-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cv-cell { position: relative; min-height: 128px; padding: 6px 6px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: background .12s; }
.cv-cell:nth-child(7n) { border-right: 0; }
.cv-cell.out { background: #fbfcfd; }
.cv-cell.out .cv-num { color: #cbd5e1; }
.cv-cell.past:not(.out) { background: #fcfcfd; }
.cv-cell.drop-ok { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.cv-cell-top { display: flex; align-items: center; justify-content: space-between; height: 26px; }
.cv-num { display: grid; place-items: center; min-width: 26px; height: 26px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.cv-cell.today .cv-num { background: var(--accent); color: #fff; }
.cv-add { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: var(--accent); opacity: 0; transition: opacity .15s, background .15s; }
.cv-cell:hover .cv-add, .cv-add:focus-visible { opacity: 1; }
.cv-add:hover { background: var(--accent-soft); }
.cv-chip { display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; padding: 4px 6px; border-radius: 7px; font-size: 12px; text-align: left; background: #fffbeb; border: 1px solid #fde68a; color: #78350f; transition: box-shadow .12s, transform .12s; }
.cv-chip:hover { box-shadow: 0 4px 10px -6px rgba(15, 23, 42, .35); transform: translateY(-1px); }
.cv-chip.published { background: #ecfdf5; border-color: #a7f3d0; color: #064e3b; }
.cv-chip.publishing { background: #eef2ff; border-color: #c7d2fe; color: #312e81; }
.cv-chip[draggable="true"] { cursor: grab; }
.cv-chip.dragging { opacity: .45; }
.cv-chip > span:first-child { flex-shrink: 0; }
.cv-chip-time { font-weight: 650; flex-shrink: 0; font-size: 11px; opacity: .85; }
.cv-chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cv-chip.wide { padding: 10px 12px; font-size: 13.5px; gap: 8px; }
.cv-chip.wide .cv-chip-title { flex: 1; white-space: normal; }
.cv-more { font-size: 11.5px; font-weight: 600; color: var(--accent); text-align: left; padding: 2px 6px; border-radius: 6px; }
.cv-more:hover { background: var(--accent-soft); }
.cv-list { padding-top: 2px; }
@media (max-width: 1100px) { .cv-chip-time { display: none; } }
@media (max-width: 760px) {
  .cv-tools { width: 100%; }
  .cv-select { flex: 1 1 calc(50% - 4px); max-width: none; min-width: 0; }
  .cv-hint { display: none; }
  .cv-cell { min-height: 84px; padding: 4px; }
  .cv-chip .cv-chip-title { display: none; }
  .cv-week-head div { padding: 8px 4px; text-align: center; }
}

/* ---------- Sign-in page ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--bg); }
.auth-brand { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at -10% -20%, #6366f1 0%, transparent 60%), radial-gradient(900px 600px at 120% 120%, #0ea5e9 0%, transparent 55%), #1e1b4b; color: #c7d2fe; }
.auth-brand::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 40px 40px; mask-image: linear-gradient(180deg, #000, transparent 85%); }
.auth-brand-in { position: relative; z-index: 1; height: 100%; max-width: 520px; margin: 0 auto; padding: 48px 48px 36px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.auth-logo.sm { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); }
.auth-pitch { font-size: 32px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; color: #fff; max-width: 420px; }
.auth-points { margin-top: 28px; display: grid; gap: 14px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-size: 15px; color: #e0e7ff; }
.auth-points li .icon { width: 30px; height: 30px; padding: 7px; border-radius: 9px; background: rgba(255,255,255,.1); color: #fff; flex-shrink: 0; }
.auth-foot { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #a5b4fc; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 28px; color: var(--text); }
.auth-title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.auth-sub { margin: 6px 0 26px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.auth-card .input { height: 44px; font-size: 15px; }
.auth-check { width: 16px; height: 16px; accent-color: var(--accent); }
@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { display: none; }
  .auth-mobile-brand { display: flex; }
  .auth-main { place-items: start center; padding-top: 56px; }
}

/* ---------- Signed-in user menu ---------- */
.user-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 4px; border-radius: 999px; border: 1px solid var(--border); background: #fff; transition: border-color .15s, box-shadow .15s; }
.user-btn:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.user-av { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 650; }
.user-name { font-size: 13.5px; font-weight: 550; color: var(--text); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-head { display: flex; flex-direction: column; padding: 10px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-head b { font-size: 14px; color: var(--text); }
.user-head span { font-size: 12.5px; color: var(--muted); }
.user-pop { min-width: 220px; }
@media (max-width: 640px) { .user-name { display: none; } .user-btn { padding: 0 8px 0 4px; } }

/* ---------- Failed posts ---------- */
.fail-reason { display: flex; gap: 6px; align-items: flex-start; margin-top: 2px; padding: 6px 10px; border-radius: 8px; background: #fef2f2; color: #b91c1c; font-size: 12.5px; line-height: 1.4; }
.fail-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 18px; border-radius: 12px; border: 1px solid #fecaca; background: #fef2f2; color: #991b1b; }
.fail-banner b { display: block; font-size: 14px; }
.fail-banner span { display: block; font-size: 13px; color: #b91c1c; }
.fail-count { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: #fef2f2; color: #dc2626; font-weight: 600; font-size: 12.5px; }
.cc-fail { display: flex; align-items: center; gap: 6px; margin-top: -6px; font-size: 12.5px; font-weight: 550; color: #dc2626; }
.d-stat.bad b { color: #dc2626; }
.d-stat.bad { background: #fffafa; }
.d-lead-fail { color: #dc2626; font-weight: 600; text-decoration: underline; text-decoration-color: #fca5a5; text-underline-offset: 3px; }
.cv-chip.failed { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.cv-key.failed { background: #ef4444; }
.pv-pill.failed { background: #fef2f2; color: #b91c1c; max-width: 520px; }
.post-card:has(.fail-reason) { border-color: #fecaca; }
.notice-slate { background: #f8fafc; border-color: #e2e8f0; color: #334155; }

/* ---------- Settings ---------- */
.st-grid { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 1100px; align-items: start; }
.st-card { padding: 22px; scroll-margin-top: 90px; }
.st-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.st-head .stat-icon { flex-shrink: 0; }
.st-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.st-row .btn { flex-shrink: 0; }
.st-backup-state { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 550; margin-bottom: 6px; }
.st-backup-state.ok { background: #ecfdf5; color: #047857; }
.st-backup-state.warn { background: #fffbeb; color: #b45309; }
.st-meter { height: 10px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.st-meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.st-meter span.mid { background: #f59e0b; }
.st-meter span.bad { background: #ef4444; }
.st-danger { border-color: #fecaca; }
@media (max-width: 900px) { .st-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .st-row { flex-direction: column; align-items: stretch; } }
