/* FlyBusiness - hand-written CSS. Calm, card-based, system fonts, light + dark (prefers-color-scheme). No inline styles (CSP). */
:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f0efea;
  --text: #1d1d1b;
  --muted: #595853;
  --border: #dedcd5;
  --border-strong: #85837a; /* 3.8:1 on --surface, >= 3:1 on --bg / --surface-2 (WCAG 1.4.11, PMKT-116) */
  --accent: #2c55c9;
  --accent-hover: #2346a8;
  --accent-ink: #ffffff;
  --accent-soft: #e8eefc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #1d6f36;
  --success-soft: #e6f4ea;
  --warn: #7a4f00;
  --warn-soft: #fdf3dc;
  --acting: #6a3d9a;
  --acting-soft: #f1eafa;
  --focus: #2c55c9;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 20, 18, 0.05), 0 2px 10px rgba(20, 20, 18, 0.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181817;
    --surface: #222220;
    --surface-2: #2b2b28;
    --text: #edece7;
    --muted: #b0aea6;
    --border: #3a3936;
    --border-strong: #807e76; /* 3.9:1 on --surface (WCAG 1.4.11, PMKT-116) */
    --accent: #93b0ff;
    --accent-hover: #b0c6ff;
    --accent-ink: #0f1424;
    --accent-soft: #24304f;
    --danger: #ff9b8f;
    --danger-soft: #3d2120;
    --success: #7fd69a;
    --success-soft: #1d3324;
    --warn: #f2c66d;
    --warn-soft: #3a2f17;
    --acting: #d2b4ff;
    --acting-soft: #352a46;
    --focus: #93b0ff;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip-link { position: absolute; left: 12px; top: -48px; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: var(--radius-sm); z-index: 100; border: 1px solid var(--border); }
.skip-link:focus { top: 12px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- brand */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.12rem; min-height: 44px; }
.brand:hover { color: var(--text); }
.brand svg { width: 32px; height: 32px; flex: none; }
.brand .word-fly { color: var(--accent); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink);
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-quiet { background: transparent; color: var(--accent); border-color: transparent; padding-left: 10px; padding-right: 10px; }
.btn-quiet:hover { background: var(--accent-soft); color: var(--accent); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline-form { display: inline; margin: 0; }

/* ---------------------------------------------------------------- public layout */
.public-header, .public-footer { padding: 12px 16px; }
.public-header .inner, .public-footer .inner, .public-main { max-width: 1120px; margin: 0 auto; }
.public-header .inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.public-main { padding: 8px 16px 48px; }
.public-footer { border-top: 1px solid var(--border); margin-top: 32px; }
.public-footer .inner { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; padding: 0; margin: 0; }
.footer-links a { display: inline-block; padding: 10px 0; }

.hero { padding: 40px 0 24px; max-width: 760px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.1rem); margin-bottom: 14px; }
.hero .lede { font-size: 1.18rem; color: var(--muted); max-width: 640px; }
.feature-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 24px 0; padding: 0; list-style: none; }
@media (min-width: 600px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature .icon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 12px; }
.feature .icon svg { width: 22px; height: 22px; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.6em; }
.prose li { margin-bottom: 0.35em; }

/* ---------------------------------------------------------------- cards, banners, chips */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: 16px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 600px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.banner { border-radius: var(--radius-sm); padding: 12px 14px; border: 1px solid var(--border); background: var(--surface); margin: 0 0 16px; display: flex; gap: 10px; align-items: flex-start; }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.banner p:last-child { margin-bottom: 0; }
.banner-info { background: var(--accent-soft); border-color: transparent; }
.banner-success { background: var(--success-soft); border-color: transparent; }
.banner-warn { background: var(--warn-soft); border-color: transparent; }
.banner-error { background: var(--danger-soft); border-color: transparent; }
.banner-acting { background: var(--acting-soft); color: var(--acting); border-color: transparent; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.86rem; font-weight: 600; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); white-space: nowrap; }
.chip svg { width: 14px; height: 14px; }
.chip-ok { background: var(--success-soft); color: var(--success); border-color: transparent; }
.chip-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip-error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip-info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 6px 0 0; }

/* ---------------------------------------------------------------- forms */
form { margin: 0; }
.field { margin-bottom: 16px; }
.field > label, .field > .label, fieldset > legend { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { display: block; color: var(--muted); font-size: 0.92rem; margin-top: -2px; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; max-width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
textarea { min-height: 96px; resize: vertical; }
input[readonly], input:disabled, textarea:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex: none; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.check label { font-weight: 500; }
.radio-cards { display: grid; gap: 10px; }
.radio-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 12px 14px; }
.radio-card input { margin-top: 2px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
fieldset[disabled] .btn { display: none; }
.field-error { color: var(--danger); font-weight: 600; font-size: 0.94rem; margin: 6px 0 0; display: flex; gap: 6px; align-items: center; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--danger); border-width: 2px; }
.error-summary { border: 2px solid var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 18px; }
.error-summary h2 { font-size: 1.05rem; color: var(--danger); margin-bottom: 6px; }
.error-summary ul { margin: 0; padding-left: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 720px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.row-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; background: var(--surface); }
.row-card legend { font-weight: 700; }
.secret-current { font-family: var(--mono); color: var(--muted); }

/* ---------------------------------------------------------------- auth layout */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.auth-main { flex: 1; width: 100%; max-width: 480px; margin: 0 auto; padding: 16px 16px 48px; }
.auth-main .card { padding: 24px 20px; }
.auth-main h1 { font-size: 1.5rem; }
.qr { display: block; width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 10px; margin: 8px 0 12px; }
.qr path { fill: #000; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; list-style: none; padding: 0; margin: 12px 0; font-family: var(--mono); }
.codes li { background: var(--surface-2); border-radius: 8px; padding: 8px; text-align: center; }

/* ---------------------------------------------------------------- app shell */
.app-header { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.app-header .inner { display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 60px; flex-wrap: wrap; }
.app-header .spacer { flex: 1; }
.menu-button { display: none; }
.js .menu-button { display: inline-flex; }
.tenant-switch { display: flex; align-items: center; gap: 8px; }
.tenant-switch select { width: auto; max-width: 220px; min-height: 40px; padding: 6px 10px; }
.acting-badge { color: var(--acting); background: var(--acting-soft); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 0.92rem; }
.user-menu { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
@media (max-width: 599px) { .user-menu .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .user-menu .btn-quiet { padding: 8px; } }
.app-body { display: block; }
.app-nav { padding: 12px 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.js .app-nav { display: none; }
.js body.nav-open .app-nav { display: block; position: fixed; inset: 61px 0 0 0; z-index: 30; overflow-y: auto; }
.app-nav ul { list-style: none; margin: 0; padding: 0; }
.app-nav .nav-section { margin: 14px 10px 6px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.app-nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 500; }
.app-nav a:hover { background: var(--surface-2); color: var(--text); }
.app-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.app-nav svg { width: 20px; height: 20px; flex: none; }
.app-main { padding: 20px 16px 48px; max-width: 1080px; width: 100%; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.page-head p { margin: 0; color: var(--muted); }
@media (min-width: 1024px) {
  .menu-button, .js .menu-button { display: none; }
  .app-body { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 61px); }
  .app-nav, .js .app-nav { display: block; position: sticky; top: 61px; height: calc(100vh - 61px); overflow-y: auto; border-bottom: 0; border-right: 1px solid var(--border); }
  .js body.nav-open .app-nav { position: sticky; inset: auto; }
  .app-main { padding: 28px 32px 56px; }
}

/* ---------------------------------------------------------------- tabs, meter, lists, tables */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; list-style: none; padding-left: 0; }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--text); border: 1px solid var(--border); background: var(--surface); white-space: nowrap; }
.tabs a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.meter-wrap { display: flex; align-items: center; gap: 12px; }
meter { width: 100%; max-width: 360px; height: 14px; }
.meter-label { font-weight: 700; font-size: 1.4rem; white-space: nowrap; }
.meter-wrap meter { flex: 1 1 auto; min-width: 0; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.checklist li:first-child { border-top: 0; }
.checklist svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.checklist a, .step-list a { display: inline-flex; align-items: center; min-height: 44px; } /* tap targets >= 44 px (4.3.1, PMKT-117) */
.ok-ink { color: var(--success); }
.todo-ink { color: var(--muted); }
.item-list { list-style: none; padding: 0; margin: 0; }
.item-list > li { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 14px 0; border-top: 1px solid var(--border); }
.item-list > li:first-child { border-top: 0; }
.item-main { min-width: 0; flex: 1 1 260px; }
.item-title { font-weight: 600; }
.item-meta { color: var(--muted); font-size: 0.92rem; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.data th, table.data td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { font-size: 0.86rem; color: var(--muted); font-weight: 700; }
@media (max-width: 599px) {
  table.stack-sm, table.stack-sm tbody, table.stack-sm tr, table.stack-sm td { display: block; width: 100%; }
  table.stack-sm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack-sm tr { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; background: var(--surface); }
  table.stack-sm td { border: 0; padding: 4px 0; }
  table.stack-sm td::before { content: attr(data-label); display: block; font-size: 0.8rem; color: var(--muted); font-weight: 700; }
}

/* ---------------------------------------------------------------- uploads */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 24px 16px; text-align: center; background: var(--surface); }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .btn { margin-top: 8px; }
.upload-progress { list-style: none; padding: 0; margin: 12px 0 0; }
.upload-progress li { padding: 10px 0; border-top: 1px solid var(--border); }
.upload-progress progress { width: 100%; height: 10px; }
.upload-progress .state { font-size: 0.92rem; color: var(--muted); }
.upload-progress .err { color: var(--danger); font-weight: 600; }

details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }

/* ---------------------------------------------------------------- connectors (FB-S05..S12) */
.connector-grid { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 600px) { .connector-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .connector-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .connector-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.connector-grid > .card + .card { margin-top: 0; }
.connector-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.connector-card p { margin: 0; }
.connector-card .connector-actions { margin-top: auto; padding-top: 10px; }
.connector-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.connector-title { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; min-width: 0; }
.connector-title h2 { font-size: 1.12rem; margin: 0; }
.connector-note { display: flex; gap: 6px; align-items: flex-start; }
.connector-note svg { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.platform-logo { display: inline-flex; width: 44px; height: 44px; flex: none; }
.platform-logo svg { width: 44px; height: 44px; }
.detail-head .connector-head h1 { margin: 0; }
.detail-head p { max-width: 640px; }
.meta-banner .btn-row { margin-top: 10px; }
.account-list, .pick-list, .scope-list, .link-list, .step-list { list-style: none; padding: 0; margin: 0; }
.account-card { padding: 16px 0; border-top: 1px solid var(--border); }
.account-card:first-child { border-top: 0; padding-top: 4px; }
.account-head { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.account-head h3 { margin: 0; font-size: 1.05rem; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.facts { display: grid; grid-template-columns: 1fr; gap: 4px 20px; margin: 12px 0; }
@media (min-width: 720px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.facts div { display: flex; flex-wrap: wrap; gap: 0 8px; }
.facts dt { color: var(--muted); font-size: 0.92rem; min-width: 9.5em; }
.facts dd { margin: 0; }
.scope-list li { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.scope-list svg, .perm svg { width: 18px; height: 18px; flex: none; }
.warn-ink { color: var(--warn); }
.perm { display: inline-flex; gap: 4px; align-items: center; margin: 2px 12px 2px 0; }
.feature-table { margin: 8px 0 12px; }
.pick-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.pick-row:first-child { border-top: 0; }
.pick-row input { margin-top: 3px; }
.pick-row label { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; cursor: pointer; }
.pick-row.disabled label { color: var(--muted); cursor: not-allowed; }
.pick-row .field-error { flex-basis: 100%; margin: 0 0 0 34px; }
.radio-card.disabled label { color: var(--muted); }
.radio-card label { min-width: 0; }
.wizard-progress .step-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); }
.wizard-progress .step-list li:first-child { border-top: 0; }
.wizard-progress .step-list li[aria-current="step"] a { font-weight: 700; }
.step-list a { display: inline-flex; align-items: center; min-height: 44px; }
.wizard-progress .meter-wrap { margin-bottom: 10px; }
.step-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.step-head h2 { margin: 0; }
.instructions li { margin-bottom: 6px; }
.link-list { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 12px; }
.link-list a { display: inline-block; padding: 10px 0; }
.show-me img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; margin: 8px 0 12px; }
.check-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.check-form .hint { margin-bottom: 8px; }
fieldset.features { margin-top: 4px; }
.btn[aria-busy="true"] { cursor: progress; }
.chip { max-width: 100%; white-space: normal; }
.chip svg { flex: none; }

/* ---------------------------------------------------------------- service settings (FB-S13) */
section[id], .env-field, #draft { scroll-margin-top: 80px; }
.stop-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.diff-list, .result-list, .gate-list { list-style: none; padding: 0; margin: 0 0 12px; }
.diff-list li { padding: 4px 0; }
.result-list .banner { margin-bottom: 8px; }
.env-field { padding-top: 12px; border-top: 1px solid var(--border); }
.env-group .page-head + .env-field, .env-group .result-list + .env-field { border-top: 0; }
.env-field > label code { font-size: 0.95rem; font-weight: 700; }
.env-meta { display: inline; font-size: 0.86rem; }
.test-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: flex-end; }
.use-conn { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.use-conn select { width: auto; max-width: 100%; flex: 1 1 200px; }
.save-bar { position: sticky; bottom: 0; z-index: 10; margin-top: 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; box-shadow: var(--shadow); }
.save-bar p { margin: 0; flex: 1 1 240px; }
.draft-card { border-color: var(--warn); }
.service-usage { margin: 8px 0 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.service-usage h4 { margin: 0 0 6px; font-size: 1rem; }

/* ---------------------------------------------------------------- posts (FB-S14) */
.filter-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 600px) { .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tabs .count { display: inline-block; min-width: 1.6em; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 0.86rem; text-align: center; }
.tabs a[aria-current="page"] .count { background: var(--accent-ink); color: var(--accent); }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list > li + li { margin-top: 12px; }
.post-card { display: flex; gap: 16px; align-items: flex-start; }
.post-thumb { flex: none; width: 96px; height: 96px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.post-thumb img { width: 96px; height: 96px; object-fit: cover; display: block; }
.thumb-missing { font-size: 0.8rem; color: var(--muted); }
.post-body { min-width: 0; flex: 1 1 auto; }
.post-title { font-size: 1.05rem; margin: 0 0 4px; }
.post-title a { color: var(--text); }
.post-reason { margin: 6px 0 0; font-size: 0.95rem; }
@media (max-width: 599px) { .post-card { flex-direction: column; } .post-thumb, .post-thumb img { width: 100%; height: auto; aspect-ratio: 1 / 1; } }
.creative-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 720px) { .creative-grid { grid-template-columns: 1fr 1.4fr; align-items: start; } }
.creative-grid img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); display: block; }
.creative-grid figure { margin: 0; }
.creative-grid figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }
.published-text { white-space: pre-wrap; font-family: var(--font); background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); margin: 0 0 12px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0; border-top: 1px solid var(--border); }
.timeline li:first-child { border-top: 0; }
.empty-state h2 { margin-bottom: 4px; }

/* ---------------------------------------------------------------- analytics (FB-S15) */
:root { --chart-1: #2a78d6; --chart-grid: #e7e5df; }
@media (prefers-color-scheme: dark) { :root { --chart-1: #3987e5; --chart-grid: #34332f; } }
.filter-row .range-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filter-row .range-presets legend { width: 100%; }
.tile-grid { list-style: none; margin: 16px 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 600px) { .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile-grid > .card + .card { margin-top: 0; }
.stat-tile { padding: 16px; }
.stat-tile p { margin: 0; }
.tile-label { font-size: 0.95rem; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 1.9rem; font-weight: 650; line-height: 1.2; margin: 4px 0; font-variant-numeric: proportional-nums; }
.tile-reason { color: var(--text); font-size: 0.95rem; margin: 6px 0; display: flex; gap: 6px; align-items: flex-start; }
.tile-reason svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--muted); }
.tile-meta { font-size: 0.82rem; color: var(--muted); margin-top: 6px !important; }
.mini-tiles { display: grid; gap: 6px; margin: 10px 0 0; }
.mini-tiles div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mini-tiles dt { color: var(--muted); }
.mini-tiles dd { margin: 0; font-weight: 650; }
.mini-tiles .tile-value { font-size: 1.1rem; margin: 0; }
.mini-tiles .tile-reason { font-weight: 400; font-size: 0.9rem; margin: 0; }
.chart-figure { margin: 0 0 20px; }
.chart-figure figcaption { margin-bottom: 6px; }
.chart-scroll { position: relative; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
.chart-scroll svg.chart { display: block; width: 100%; min-width: 560px; height: auto; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart-label { fill: var(--text); font-size: 13px; font-weight: 600; font-family: var(--font); }
.chart-line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--chart-1); opacity: 0.1; }
.chart-dot, .chart-end { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }
.chart-cross { stroke: var(--border-strong); stroke-width: 1; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; top: 6px; pointer-events: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 4px 8px; font-size: 0.86rem; box-shadow: var(--shadow); white-space: nowrap; }
.chart-tip strong { font-weight: 700; }
.chart-tip span { color: var(--muted); }
@media (forced-colors: active) { .chart-line { stroke: CanvasText; } .chart-area { fill: none; } .chart-end, .chart-dot { fill: CanvasText; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .app-nav a, .tabs a { transition: background-color 0.12s ease, color 0.12s ease; }
}
