/* Mark+ interface — design layer (loaded after styles.css).
   Calm, dense and consistent, in the style of enterprise SaaS products:
   neutral surfaces, one accent color, sentence-case labels, line icons,
   status colors used only for status. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f5f7fa;
  --bg-subtle: #eef2f6;
  --bg-card: #ffffff;
  --border: #e3e8ef;
  --border-strong: #cdd5df;
  --text: #101828;
  --text-2: #344054;
  --text-muted: #667085;
  --primary: #0468fa;
  --primary-dark: #0354cc;
  --primary-soft: #eef4ff;
  --success: #079455;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --warning-border: #fedf89;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --danger-border: #fecdca;
  --info: #175cd3;
  --info-soft: #eff8ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 24px -6px rgba(16, 24, 40, .12), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --sidebar-bg: #0b1a2b;
  --sidebar-text: #a3b1c4;
  --sidebar-muted: #62748a;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn .icon { width: 16px; height: 16px; }

/* ---------- Sidebar ---------- */
.sidebar { width: 248px; padding: 18px 12px 12px; background: var(--sidebar-bg); overflow-y: auto; }
.sidebar-brand { padding: 2px 10px 18px; margin-bottom: 6px; text-decoration: none; border-bottom: 0; }
.brand-mark { height: 28px; }
.brand-name { font-size: 19px; }
.sidebar-nav { gap: 1px; }
.nav-section-label { font-size: 11px; font-weight: 600; letter-spacing: .6px; color: var(--sidebar-muted); padding: 18px 12px 6px; }
.nav-link { gap: 10px; padding: 0 12px; height: 36px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--sidebar-text); position: relative; }
.nav-link .nav-icon { width: 18px; height: 18px; font-size: inherit; opacity: .9; }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.active { background: rgba(255, 255, 255, .09); color: #fff; box-shadow: none; }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-cyan); }
.nav-link.active .nav-icon { color: var(--brand-cyan); opacity: 1; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .08); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-gradient); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--sidebar-muted); font-size: 11.5px; }
.user-logout { margin: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--sidebar-text); cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(245, 247, 250, .88); backdrop-filter: saturate(180%) blur(10px); padding: 20px 32px 16px; gap: 16px; }
.topbar-title { font-size: 21px; font-weight: 650; letter-spacing: -.3px; line-height: 1.3; }
.topbar-subtitle { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.content { padding: 4px 32px 48px; }

/* ---------- Cards ---------- */
.card { border-color: var(--border); box-shadow: var(--shadow); border-radius: var(--radius); padding: 20px 22px; }
.card-header { margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -.1px; }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---------- KPI tiles ---------- */
.metric-cards { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.metric-card { padding: 18px 20px; }
.metric-card:hover { transform: none; box-shadow: var(--shadow); }
.metric-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text-muted); }
.metric-label .icon { width: 16px; height: 16px; color: var(--text-muted); }
.metric-value { font-size: 30px; font-weight: 650; letter-spacing: -.6px; margin-top: 10px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--text-muted); }
.delta { display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { background: var(--success-soft); color: var(--success); }
.delta.down { background: var(--danger-soft); color: var(--danger); }
.delta.flat { background: var(--bg-subtle); color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn { height: 36px; padding: 0 14px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-light { background: #fff; color: var(--text-2); border-color: var(--border-strong); }
.btn-light:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.btn-ghost { box-shadow: none; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-subtle); }
/* Destructive actions are quiet until confirmed. */
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.btn:disabled { opacity: .55; }

/* ---------- Forms ---------- */
.input { height: 38px; padding: 0 12px; border-color: var(--border-strong); border-radius: var(--radius-sm); font-size: 14px; box-shadow: var(--shadow); }
textarea.input, .textarea { height: auto; padding: 10px 12px; }
select.input { padding-right: 32px; }
.input-sm { height: 32px; font-size: 13px; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(4, 104, 250, .12); }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.form-note, .hint { color: var(--text-muted); }
.select-inline { font-size: 13px; color: var(--text-muted); }

/* ---------- Segmented control ---------- */
.segmented { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg-btn { height: 30px; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--text-muted); border-radius: 7px; }
.seg-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, .1), 0 1px 2px rgba(16, 24, 40, .06); font-weight: 600; }

/* ---------- Tables ---------- */
.table th { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-muted); background: var(--bg); border-bottom-color: var(--border); padding: 10px 12px; }
.table td { padding: 12px; color: var(--text-2); border-bottom-color: var(--border); font-size: 13.5px; }
.table tbody tr:hover { background: #f9fafb; }
.table-wrap { border: 1px solid var(--border); border-radius: 10px; }
.table-wrap .table tbody tr:last-child td { border-bottom: none; }

/* ---------- Badges ---------- */
.badge { padding: 2px 9px; font-size: 12px; font-weight: 500; border-radius: 999px; }
.badge-neutral { background: var(--bg-subtle); color: var(--text-2); }
.badge-status { text-transform: none; }
.badge-status.published, .badge-status.partial { background: var(--success-soft); color: var(--success); }
.badge-status.scheduled, .badge-status.publishing { background: var(--primary-soft); color: var(--primary); }
.badge-status.awaiting_approval { background: var(--warning-soft); color: var(--warning); }
.badge-status.failed { background: var(--danger-soft); color: var(--danger); }
.badge-status.draft, .badge-status.expired, .badge-status.rejected { background: var(--bg-subtle); color: var(--text-muted); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; background: var(--info-soft); border: 1px solid #b2ddff; color: var(--text-2); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; }
.alert-warn, .alert.warn { background: var(--warning-soft); border-color: var(--warning-border); }
.alert-danger { background: var(--danger-soft); border-color: var(--danger-border); }
.alert .icon { margin-top: 1px; color: var(--info); }
.alert-warn .icon { color: var(--warning); }

/* ---------- Empty states ---------- */
.empty-state { color: var(--text-muted); text-align: center; padding: 28px 16px; font-size: 13.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { width: 64px; padding: 16px 8px; }
  .sidebar-brand { padding: 0 0 14px; justify-content: center; }
  .nav-link { justify-content: center; padding: 0; }
  .nav-link.active::before { left: -8px; }
  .user-meta, .user-avatar { display: none; }
  .sidebar-footer { justify-content: center; padding: 10px 0 0; display: flex; }
  .topbar { padding: 16px; }
  .topbar-subtitle { display: none; }
  .topbar-actions .btn-label { display: none; }
  .content { padding: 4px 16px 32px; }
}

/* ---------- Page toolbar (filters above the content they affect) ---------- */
.page-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin-bottom: 18px; }
.toolbar-group { display: flex; align-items: center; gap: 8px; }
.toolbar-group .input-sm { width: auto; min-width: 150px; }
.toolbar-end { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 12.5px; }
.notice-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.inline-help { margin: -4px 0 12px; font-size: 13px; color: var(--text-muted); }
.inline-help summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--text-muted); font-weight: 500; }
.inline-help summary::-webkit-details-marker { display: none; }
.inline-help summary .icon { width: 15px; height: 15px; }
.inline-help p { margin-top: 8px; line-height: 1.55; max-width: 900px; }
.queue-error { color: var(--danger); font-size: 12.5px; }
.dash-attention-item { border-radius: 10px; padding: 10px 12px; }
.dash-attention-item:hover { border-color: var(--border-strong); background: #fcfcfd; }
.dash-attention-head strong { font-size: 13.5px; font-weight: 600; }
.alert { max-width: none; margin: 0; }

/* ---------- Integrations (settings) ---------- */
.integration-row { padding: 0; margin-bottom: 10px; }
.integration-row[open] { padding-bottom: 18px; }
.integration-summary, .guide-card summary { display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; list-style: none; }
.integration-summary::-webkit-details-marker, .guide-card summary::-webkit-details-marker { display: none; }
.integration-logo { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; }
.integration-name { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.integration-name strong { font-size: 14.5px; font-weight: 600; }
.integration-name .hint { font-size: 12.5px; }
.integration-chevron { color: var(--text-muted); transition: transform .15s; }
details[open] > summary .integration-chevron { transform: rotate(180deg); }
.integration-row .settings-form { padding: 4px 18px 0; border-top: 1px solid var(--border); margin-top: 0; }
.integration-row .settings-form .form-group:first-child { margin-top: 14px; }
.guide-card { padding: 0; }
.guide-card summary > span { display: flex; flex-direction: column; flex: 1; line-height: 1.35; }
.guide-card summary > .icon:first-child { color: var(--info); }
.guide-steps { margin: 0 18px 16px 52px; line-height: 1.7; font-size: 13.5px; color: var(--text-2); }
.section-note { font-size: 13px; color: var(--text-muted); margin: 0 0 14px; max-width: 920px; }

/* ---------- Resources (settings/features) ---------- */
.feature-groups { display: flex; flex-direction: column; gap: 22px; }
.group-title { font-size: 12px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px 2px; }
.resource-card { padding: 0; margin-bottom: 10px; }
.resource-summary { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 16px; padding: 16px 18px; cursor: pointer; list-style: none; }
.resource-summary::-webkit-details-marker { display: none; }
.resource-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.resource-icon .icon { width: 20px; height: 20px; }
.resource-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.resource-text strong { font-size: 14.5px; font-weight: 600; color: var(--text); }
.resource-text span { font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.resource-status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--text-muted); }
.resource-status.on { color: var(--success); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.resource-status.on .status-dot { background: #17b26a; box-shadow: 0 0 0 3px rgba(23, 178, 106, .15); }
.resource-card[open] .resource-configure { background: var(--bg-subtle); }
.resource-form { border-top: 1px solid var(--border); padding: 16px 18px 18px 74px; }
.scope-options { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.scope-option { position: relative; }
.scope-option input { position: absolute; opacity: 0; pointer-events: none; }
.scope-option span { display: block; padding: 7px 14px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; border-right: 1px solid var(--border-strong); }
.scope-option:last-child span { border-right: 0; }
.scope-option input:checked + span { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.scope-option input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.feature-accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-top: 14px; }
.account-check { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 13.5px; cursor: pointer; }
.account-check:has(input:checked) { border-color: #84adff; background: var(--primary-soft); }
.account-check .hint { margin-left: auto; font-size: 12px; }
.resource-form .form-actions { align-items: center; margin-top: 16px; }
@media (max-width: 900px) {
  .resource-summary { grid-template-columns: 40px minmax(0, 1fr); }
  .resource-status, .resource-configure { grid-column: 2; justify-self: start; }
  .resource-form { padding-left: 18px; }
}

/* ---------- Connected accounts ---------- */
.accounts-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.account-card { border-radius: 12px; padding: 16px; gap: 14px; }
.account-card:hover { transform: none; box-shadow: var(--shadow-lg); }
.account-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; font-size: 15px; }
.account-name { font-size: 14.5px; font-weight: 600; }
.account-handle { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.account-handle .platform-badge { font-size: 12.5px; font-weight: 500; }
.account-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.account-state.on { color: var(--success); }
.account-state.on .status-dot { background: #17b26a; box-shadow: 0 0 0 3px rgba(23, 178, 106, .15); }
.account-metrics { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 6px; }
.account-metric .am-value { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.account-metric .am-label { font-size: 11.5px; text-transform: none; letter-spacing: 0; }
.account-card-actions { align-items: center; justify-content: space-between; }
.account-card-more { display: inline-flex; gap: 2px; }
.btn-ghost-danger { color: var(--danger); }
.btn-ghost-danger:hover { background: var(--danger-soft); color: var(--danger); }
.connect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.connect-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.connect-tile:hover { border-color: var(--border-strong); }
.connect-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.connect-text strong { font-size: 14px; font-weight: 600; }
.connect-text .hint { font-size: 12.5px; }
.token-body { border-top: 1px solid var(--border); padding: 16px 18px; }

/* ---------- In-page tabs ---------- */
.page-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 18px; overflow-x: auto; }
.page-tab { border: 0; background: none; padding: 10px 12px; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.page-tab:hover { color: var(--text); }
.page-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.planner-account-bar { padding: 12px 18px; }
.planner-account-row { gap: 14px; }
.badge-icon { gap: 4px; }
.badge-icon .icon { width: 13px; height: 13px; }
.queue-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.card-title-icon { display: inline-flex; align-items: center; gap: 8px; }
.card-title-icon .icon { color: var(--primary); }
.grid-alert { display: flex; gap: 8px; align-items: flex-start; }
.grid-alert .icon { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.grid-alert.warn .icon { color: var(--warning); }

/* ---------- Empty / disabled panels ---------- */
.empty-panel { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 24px; }
.empty-panel-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: 14px; }
.empty-panel-icon .icon { width: 24px; height: 24px; }
.empty-panel h2 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty-panel p { font-size: 13.5px; color: var(--text-muted); max-width: 460px; margin-bottom: 18px; line-height: 1.55; }
@media (max-width: 640px) {
  .metric-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { padding: 14px; }
  .metric-value { font-size: 24px; }
  .metric-foot span:not(.delta) { display: none; }
  .toolbar-group { flex-wrap: wrap; width: 100%; }
  .toolbar-group .input-sm { flex: 1; min-width: 0; }
  .toolbar-end { margin-left: 0; width: 100%; justify-content: space-between; }
  .segmented { max-width: 100%; overflow-x: auto; }
}
.metric-cards > .card { margin-bottom: 0; }

/* ---------- Public legal pages ---------- */
.legal-body { background: #fff; }
.legal-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 860px; margin: 0 auto; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.legal-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brand-navy); font-weight: 800; font-size: 19px; }
.legal-brand img { height: 28px; width: auto; }
.legal-header nav { display: flex; gap: 18px; font-size: 13.5px; }
.legal-header nav a { color: var(--text-2); text-decoration: none; }
.legal-header nav a:hover { color: var(--primary); }
.legal-doc { max-width: 860px; margin: 0 auto; padding: 36px 24px 56px; color: var(--text-2); font-size: 15px; line-height: 1.7; }
.legal-doc h1 { font-size: 30px; font-weight: 700; letter-spacing: -.5px; color: var(--text); margin-bottom: 6px; }
.legal-doc h2 { font-size: 18px; font-weight: 650; color: var(--text); margin: 32px 0 8px; }
.legal-doc h3 { font-size: 15px; font-weight: 600; color: var(--text); margin: 18px 0 6px; }
.legal-doc p { margin: 0 0 12px; }
.legal-doc ul, .legal-doc ol { margin: 0 0 12px 22px; }
.legal-doc li { margin-bottom: 6px; }
.legal-meta { color: var(--text-muted); font-size: 13.5px; }
.legal-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; max-width: 860px; margin: 0 auto; padding: 18px 24px 32px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.login-legal { text-align: center; font-size: 12.5px; margin-top: 16px; color: var(--text-muted); }
.login-legal a { color: var(--text-muted); }
