:root {
  color-scheme: light;
  --ink: #17140f;
  --muted: #6c655b;
  --paper: #ffffff;
  --canvas: #f6f2e8;
  --gold: #f4c400;
  --gold-dark: #b98900;
  --gold-soft: #fff4bd;
  --line: #e7dfcf;
  --success: #137333;
  --success-soft: #e8f5ec;
  --danger: #b3261e;
  --danger-soft: #fcebea;
  --shadow: 0 16px 42px rgba(38, 30, 13, 0.10);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(244, 196, 0, 0.13), transparent 28rem),
    var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a { color: #755900; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
img { display: block; max-width: 100%; height: auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem max(1rem, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(23, 20, 15, 0.1);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--ink);
  text-decoration: none;
}

.brand__logo {
  width: 54px;
  height: 54px;
  border: 3px solid var(--gold);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 6px 18px rgba(23, 20, 15, 0.16);
}

.brand__title { display: block; font-size: 1.05rem; font-weight: 800; }
.brand__subtitle { display: block; color: var(--muted); font-size: 0.78rem; }

.user-panel { display: flex; align-items: center; gap: 0.8rem; }
.user-panel__logo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.user-panel__name { margin: 0; color: var(--muted); font-size: 0.86rem; }

.page { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 1.4rem 0 3rem; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.35fr);
  align-items: center;
  gap: 1.5rem;
  min-height: 260px;
  padding: clamp(1.4rem, 3vw, 2.5rem);
  overflow: hidden;
  border: 1px solid #2a251e;
  border-radius: 26px;
  color: white;
  background: linear-gradient(135deg, #18140e, #302719);
  box-shadow: var(--shadow);
}

.hero::after {
  position: absolute;
  inset: auto auto -70px -70px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: var(--gold);
  content: "";
  opacity: 0.14;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 { margin: 0; font-size: clamp(1.75rem, 4vw, 3rem); line-height: 1.08; }
.hero p:last-child { margin-bottom: 0; color: #eee8dc; }
.hero__banner { width: 100%; border-radius: 16px; background: white; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
  margin-top: 1.15rem;
}

.card {
  padding: clamp(1.15rem, 2.4vw, 1.7rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 8px 28px rgba(38, 30, 13, 0.06);
}

.card--wide { grid-column: 1 / -1; }
.card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card h2, .card h3 { margin-top: 0; }
.card h2 { margin-bottom: 0.25rem; font-size: 1.25rem; }
.card h3 { margin-bottom: 0.7rem; font-size: 1rem; }
.card__description { margin: 0; color: var(--muted); }

.metrics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.metric-panel { padding: 1rem; border-radius: 14px; background: #fbf9f3; }

.snapshot { margin: 0; color: var(--muted); font-size: 0.82rem; }
.summary-icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.summary-status-list { display: grid; gap: 0.55rem; margin: 0 0 0.9rem; padding: 0; list-style: none; }
.summary-status { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.7rem; padding: 0.7rem; border: 1px solid var(--line); border-radius: 12px; background: white; }
.summary-status__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: var(--ink); background: var(--gold-soft); }
.summary-status__icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.summary-status__icon--success { color: var(--success); background: var(--success-soft); }
.summary-status__icon--waiting { color: #765b00; background: var(--gold-soft); }
.summary-status__icon--info { color: #245b78; background: #e8f3f8; }
.summary-status__icon--danger { color: var(--danger); background: var(--danger-soft); }
.summary-status__icon--muted { color: var(--muted); background: #eeeae2; }
.summary-status__copy { display: grid; min-width: 0; }
.summary-status__copy strong { font-size: 0.9rem; line-height: 1.3; }
.summary-status__copy small { color: var(--muted); font-size: 0.76rem; line-height: 1.35; }
.summary-status__count { min-width: 2.25rem; padding: 0.25rem 0.5rem; border-radius: 999px; text-align: center; font-size: 0.9rem; font-variant-numeric: tabular-nums; background: #f4f0e8; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
td:last-child, th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.automation-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.automation-status { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 800; }
.automation-status::before { width: 0.65rem; height: 0.65rem; border-radius: 50%; content: ""; }
.automation-status--enabled { color: var(--success); }
.automation-status--enabled::before { background: var(--success); box-shadow: 0 0 0 5px var(--success-soft); }
.automation-status--disabled { color: var(--danger); }
.automation-status--disabled::before { background: var(--danger); box-shadow: 0 0 0 5px var(--danger-soft); }
.facebook-safety-stop { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.9rem; margin: 1rem 0; padding: 1rem; border: 1px solid #d99b97; border-radius: 14px; color: #6e1813; background: #fff0ef; }
.facebook-safety-stop[hidden] { display: none; }
.facebook-safety-stop__icon { display: grid; place-items: center; width: 2.45rem; height: 2.45rem; border-radius: 50%; color: white; background: var(--danger); font-size: 1.15rem; font-weight: 900; box-shadow: 0 0 0 5px rgba(180, 43, 35, 0.1); }
.facebook-safety-stop__copy { display: grid; gap: 0.25rem; }
.facebook-safety-stop__copy p { margin: 0; line-height: 1.45; }
.facebook-safety-stop__copy small { color: #7f3f3a; }

form { margin: 0; }
label { font-weight: 700; }
textarea {
  width: 100%;
  min-height: 118px;
  margin: 0.45rem 0 0.8rem;
  padding: 0.85rem;
  resize: vertical;
  border: 1px solid #cfc5b3;
  border-radius: 12px;
  color: var(--ink);
  background: #fffefb;
  font: inherit;
}
textarea:focus { outline: 3px solid rgba(244, 196, 0, 0.28); border-color: var(--gold-dark); }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 11px;
  color: white;
  background: var(--ink);
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
button:hover, .button:hover { color: white; transform: translateY(-1px); box-shadow: 0 7px 16px rgba(23, 20, 15, 0.18); }
button:focus-visible, .button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.button--gold { border-color: var(--gold); color: var(--ink); background: var(--gold); }
.button--ghost { color: var(--ink); background: white; }
.button--ghost:hover { border-color: var(--gold-dark); color: var(--ink); background: var(--gold-soft); }
.button--danger { border-color: var(--danger); background: var(--danger); }

.job-list { margin: 0; padding: 0; list-style: none; }
.job-list li { padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.job-list li:last-child { border-bottom: 0; }
.job-list a { font-weight: 750; }
.notice { padding: 0.8rem 1rem; border-radius: 12px; color: #6b5200; background: var(--gold-soft); }
.alert { padding: 0.8rem 1rem; border-radius: 12px; color: var(--danger); background: var(--danger-soft); }

.job-cards { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.job-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: #fbf9f3; }
.job-card__title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; margin-bottom: 0.25rem; }
.job-card__title strong { font-size: 1rem; }
.job-card__meta { margin: 0; color: var(--muted); font-size: 0.82rem; }
.job-card .button { min-height: 38px; padding: 0.5rem 0.8rem; }

.status-badge { display: inline-flex; align-items: center; width: fit-content; padding: 0.24rem 0.58rem; border-radius: 999px; font-size: 0.74rem; font-weight: 800; line-height: 1.35; }
.status-badge--queued, .status-badge--pending, .status-badge--submitted_unconfirmed, .status-badge--awaiting_approval, .status-badge--moderation_unknown { color: #6b5200; background: var(--gold-soft); }
.status-badge--running { color: var(--ink); background: var(--gold); }
.status-badge--succeeded, .status-badge--accepted, .status-badge--confirmed, .status-badge--published, .status-badge--posted { color: var(--success); background: var(--success-soft); }
.status-badge--failed, .status-badge--rejected, .status-badge--missing { color: var(--danger); background: var(--danger-soft); }
.status-badge--approved { color: var(--success); background: var(--success-soft); }
.status-badge--revoked { color: var(--danger); background: var(--danger-soft); }
.status-badge--muted { color: var(--muted); background: #eeeae2; }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin: 0 0 1rem; color: var(--muted); font-size: 0.86rem; }
.breadcrumb a { font-weight: 750; }
.detail-hero { padding: clamp(1.25rem, 3vw, 2rem); border-radius: 24px; color: white; background: linear-gradient(135deg, #18140e, #302719); box-shadow: var(--shadow); }
.detail-hero__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.detail-hero h1 { margin: 0.15rem 0 0; font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.1; }
.detail-hero .button--ghost { flex: 0 0 auto; }
.detail-meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem; margin-top: 1.35rem; }
.detail-meta { padding: 0.8rem; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 12px; background: rgba(255, 255, 255, 0.08); }
.detail-meta__label { display: block; color: #d9d1c4; font-size: 0.72rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.detail-meta__value { display: block; margin-top: 0.2rem; font-weight: 800; }
.listing-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.65rem; }
.listing-chip { display: inline-flex; padding: 0.28rem 0.55rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fbf9f3; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.78rem; }

.detail-stack { display: grid; gap: 1rem; margin-top: 1rem; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.section-heading h2 { margin: 0; }
.section-heading p { margin: 0; color: var(--muted); }
.result-grid { display: grid; gap: 1rem; }
.result-card { padding: clamp(1rem, 2.5vw, 1.5rem); border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: 16px; background: white; box-shadow: 0 7px 24px rgba(38, 30, 13, 0.05); }
.result-card--accepted { border-left-color: var(--success); }
.result-card--rejected { border-left-color: var(--danger); }
.result-card__header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.result-card h3 { margin: 0; font-size: 1.12rem; }
.result-card__title { margin: 0.35rem 0 0; color: var(--muted); }
.result-card__actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 0.9rem; }
.task-history-links { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.task-history-links h3 { margin: 0; }
.task-history-links .result-card__actions { margin-top: 0.65rem; }
.result-card__facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; margin-top: 1rem; }
.result-fact { padding: 0.7rem; border-radius: 10px; background: #fbf9f3; }
.result-fact span { display: block; color: var(--muted); font-size: 0.75rem; }
.result-fact strong, .result-fact time { display: block; margin-top: 0.15rem; font-size: 0.88rem; }
.check-list { margin: 1rem 0 0; padding-left: 1.15rem; }
.check-list li + li { margin-top: 0.35rem; }
.facebook-state { margin: 0.9rem 0 0; padding: 0.7rem 0.8rem; border-radius: 10px; font-weight: 700; }
.facebook-state--confirmed { color: var(--success); background: var(--success-soft); }
.facebook-state--missing { color: var(--danger); background: var(--danger-soft); }

.action-panel { padding: clamp(1rem, 2.5vw, 1.5rem); border: 1px solid #e4c95e; border-radius: 16px; background: #fffaf0; }
.action-panel--danger { border-color: #e5aaa6; background: #fff7f6; }
.action-panel h2 { margin: 0 0 0.35rem; }
.action-panel__lead { margin: 0 0 1rem; color: var(--muted); }
.choice-list { display: grid; gap: 0.55rem; margin-bottom: 1rem; }
.choice-card, .confirmation { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: 10px; background: white; font-weight: 650; }
.choice-card input, .confirmation input { width: 1.1rem; height: 1.1rem; margin: 0.18rem 0 0; accent-color: var(--gold-dark); }
.confirmation { margin-bottom: 0.8rem; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; margin-top: 1rem; }
.empty-state { padding: 1.4rem; border: 1px dashed #cfc5b3; border-radius: 14px; color: var(--muted); text-align: center; background: #fbf9f3; }
.error-card { width: min(680px, 100%); margin: 3rem auto 0; padding: clamp(1.4rem, 4vw, 2.4rem); border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); }
.error-card h1 { margin: 0 0 0.65rem; }

.log-page { max-width: 1180px; }
.log-hero p:last-child { margin-bottom: 0; color: #eee8dc; }
.log-card { margin-top: 1rem; }
.log-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.85rem; }
.log-toolbar__actions { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.log-status { margin: 0; color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.log-truncated { margin: 0 0 0.85rem; }
.log-output {
  height: min(62vh, 680px);
  min-height: 360px;
  margin: 0;
  padding: 1rem;
  overflow: auto;
  border: 1px solid #3c352a;
  border-radius: 14px;
  color: #f8f4e8;
  background: #17140f;
  font: 0.82rem/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
}
.log-output:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.confirmation-dialog {
  width: min(520px, calc(100% - 2rem));
  padding: clamp(1.25rem, 4vw, 1.8rem);
  border: 1px solid #e5aaa6;
  border-radius: 20px;
  color: var(--ink);
  background: white;
  box-shadow: 0 24px 70px rgba(23, 20, 15, 0.28);
}
.confirmation-dialog::backdrop { background: rgba(23, 20, 15, 0.68); backdrop-filter: blur(2px); }
.confirmation-dialog__icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 1rem; border-radius: 50%; color: var(--danger); background: var(--danger-soft); font-size: 1.45rem; font-weight: 900; }
.confirmation-dialog__icon svg { width: 25px; height: 25px; }
.confirmation-dialog h2 { margin: 0; font-size: clamp(1.35rem, 4vw, 1.7rem); }
.confirmation-dialog p { margin: 0.7rem 0 0; color: var(--muted); line-height: 1.55; }
.confirmation-dialog .confirmation-dialog__question { color: var(--ink); font-weight: 750; }
.confirmation-dialog__actions { display: flex; justify-content: flex-end; gap: 0.65rem; margin-top: 1.35rem; }
.message-variant-dialog { width: min(620px, calc(100% - 2rem)); }
.message-variant-dialog__options { display: grid; gap: 0.7rem; margin-top: 1rem; }
.message-variant-dialog__options button { display: grid; gap: 0.25rem; width: 100%; padding: 0.9rem; text-align: left; white-space: normal; }
.message-variant-dialog__options button span, .message-variant-dialog__options button small { color: var(--muted); font-weight: 500; line-height: 1.4; }
.message-variant-dialog__options .button--gold span { color: #2e291c; }
.analysis-message-dialog { width: min(720px, calc(100% - 2rem)); max-height: min(90dvh, 820px); overflow: auto; }
.analysis-message-dialog__default { display: grid; gap: 0.4rem; margin-top: 1rem; font-weight: 800; }
.analysis-message-dialog__reminder { padding: 0.8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); font-size: 0.9rem; }
.analysis-message-dialog__items { display: grid; gap: 0.6rem; max-height: 38dvh; margin-top: 1rem; overflow: auto; }
.analysis-message-dialog__item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, 0.65fr); align-items: center; gap: 0.8rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.analysis-message-dialog__item > span { display: grid; gap: 0.2rem; min-width: 0; }
.analysis-message-dialog__item small { color: var(--muted); line-height: 1.35; }

.publication-status-dialog {
  width: min(960px, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: clamp(1rem, 3vw, 1.5rem);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  background: white;
  box-shadow: 0 24px 70px rgba(23, 20, 15, 0.28);
  overscroll-behavior: contain;
}
.publication-status-dialog::backdrop { background: rgba(23, 20, 15, 0.68); backdrop-filter: blur(2px); }
.publication-status-dialog__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.publication-status-dialog__header h2 { margin: 0; font-size: clamp(1.35rem, 4vw, 1.8rem); }
.publication-status-dialog__header .snapshot { margin: 0.45rem 0 0; }
.publication-status-dialog__metrics { margin-top: 1rem; }

.access-hero p:last-child { margin-bottom: 0; color: #eee8dc; }
.message-stack { display: grid; gap: 0.65rem; margin-top: 1rem; }
.message-stack p { margin: 0; }
.notice--success { color: var(--success); background: var(--success-soft); }
.access-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.compact-form { display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr); gap: 0.8rem; margin-top: 1rem; }
.compact-form .form-control { margin-bottom: 0; }
.compact-form button { grid-column: 1 / -1; }
.security-list { margin: 0.8rem 0 0; padding-left: 1.2rem; }
.security-list li + li { margin-top: 0.45rem; }
.generated-invitations { margin-top: 1rem; border-color: #e4c95e; }
.generated-invitations h2 { margin-bottom: 0.7rem; }
.generated-code-list { display: grid; gap: 0.65rem; }
.generated-code { display: grid; gap: 0.35rem; padding: 0.8rem; border: 1px solid var(--line); border-radius: 12px; background: #fbf9f3; }
.generated-code__header { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.generated-code__header > span { color: var(--muted); font-size: 0.8rem; }
.generated-code__actions { display: flex; align-items: center; gap: 0.45rem; }
.generated-code__actions .button { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; min-height: 38px; padding: 0.45rem 0.7rem; }
.generated-code__actions svg { flex: 0 0 auto; }
.generated-code code { overflow-wrap: anywhere; font-size: 0.92rem; font-weight: 750; user-select: all; }
.generated-code__feedback { min-height: 1.1rem; margin: 0; }
.access-section { margin-top: 1rem; }
.admin-list { display: grid; gap: 0.7rem; margin-top: 1rem; }
.admin-row, .identity-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: #fbf9f3; }
.identity-profile { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.identity-profile img, .identity-profile__placeholder { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.identity-profile__placeholder { display: grid; place-items: center; color: var(--ink); background: var(--gold); font-size: 1.15rem; font-weight: 850; }
.identity-actions { display: flex; align-items: flex-end; gap: 0.55rem; }
.role-form { display: flex; align-items: flex-end; gap: 0.55rem; }
.role-form .form-control { min-width: 190px; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.auth-page { display: grid; place-items: center; padding: 1.25rem; background: linear-gradient(145deg, #17140f 0 48%, #f4c400 48% 100%); }
.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  width: min(1020px, 100%);
  min-height: 570px;
  overflow: hidden;
  border-radius: 28px;
  background: white;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}
.auth-visual { display: flex; flex-direction: column; justify-content: flex-start; gap: 1.5rem; padding: clamp(1.4rem, 4vw, 2.6rem); color: white; background: #18140e; }
.auth-visual__banner { border-radius: 15px; background: white; }
.auth-visual h2 { display: grid; flex: 1; place-items: center; width: 100%; max-width: 18ch; margin: 0 auto; padding: 1rem 0; text-align: center; font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.08; }
.auth-content { display: flex; flex-direction: column; justify-content: center; padding: clamp(1.6rem, 5vw, 3.5rem); }
.auth-content__logo { width: 108px; height: 108px; margin-bottom: 1.2rem; border-radius: 50%; object-fit: cover; box-shadow: 0 10px 30px rgba(23, 20, 15, 0.18); }
.auth-content h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; }
.auth-content__lead { margin: 0.7rem 0 1.5rem; color: var(--muted); }
.auth-content form .button { width: 100%; }
.auth-link { margin: 1.2rem 0 0; text-align: center; }
.legal-links { display: flex; justify-content: center; gap: 0.85rem; flex-wrap: wrap; margin-top: 0.9rem; font-size: 0.88rem; }

.legal-page { min-height: 100vh; background: radial-gradient(circle at 15% 10%, #50472f, transparent 28%), linear-gradient(145deg, #17140f, #2a2418 62%, #574618); }
.legal-shell { width: min(100% - 2rem, 920px); margin: 0 auto; padding: clamp(1rem, 4vw, 3rem) 0; }
.legal-card { overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.55); border-radius: 28px; background: #fffefb; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35); }
.legal-card__header { display: flex; align-items: center; gap: 1.25rem; padding: clamp(1.25rem, 4vw, 2.5rem); color: #fff; background: linear-gradient(120deg, #16130e, #302818); }
.legal-card__header img { width: clamp(88px, 15vw, 132px); height: auto; flex: 0 0 auto; }
.legal-card__header h1 { margin: 0.15rem 0 0.45rem; font-size: clamp(1.85rem, 5vw, 2.8rem); line-height: 1.05; }
.legal-card__header .snapshot { color: #e7ddc7; }
.legal-content { padding: clamp(1.25rem, 4vw, 2.5rem); }
.legal-content h2 { margin: 1.75rem 0 0.5rem; font-size: 1.2rem; }
.legal-content h2:first-of-type { margin-top: 1.25rem; }
.legal-content p, .legal-content li { color: #504a40; line-height: 1.68; }
.legal-content li + li { margin-top: 0.35rem; }
.legal-footer { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem clamp(1.25rem, 4vw, 2.5rem) 1.4rem; border-top: 1px solid var(--line); }

.invite-card {
  width: min(540px, 100%);
  padding: clamp(1.6rem, 5vw, 3.2rem);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 28px;
  background: white;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}
.invite-card__logo { width: 104px; height: 104px; margin: 0 auto 1.1rem; border-radius: 50%; object-fit: cover; box-shadow: 0 10px 30px rgba(23, 20, 15, 0.18); }
.invite-card .eyebrow { text-align: center; }
.invite-card h1 { margin: 0; text-align: center; font-size: clamp(1.8rem, 4vw, 2.25rem); line-height: 1.1; }
.invite-card__lead { margin: 0.65rem 0 1.5rem; color: var(--muted); text-align: center; }
.form-control {
  width: 100%;
  min-height: 46px;
  margin: 0.45rem 0 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #cfc5b3;
  border-radius: 12px;
  color: var(--ink);
  background: #fffefb;
  font: inherit;
}
.form-control:focus { outline: 3px solid rgba(244, 196, 0, 0.28); border-color: var(--gold-dark); }
.invite-card form .button { width: 100%; }

.listing-activity-panel {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.listing-activity-panel__header { margin-bottom: 0.85rem; }
.listing-activity-panel__header h3 { margin: 0 0 0.3rem; }
.listing-activity-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.45rem; margin-bottom: 1rem; padding: 0.35rem; border: 1px solid var(--line); border-radius: 14px; background: #f4f0e6; }
.listing-activity-tab { display: flex; align-items: center; justify-content: center; gap: 0.55rem; min-height: 46px; padding: 0.65rem 0.85rem; border: 1px solid transparent; border-radius: 10px; color: var(--ink); background: transparent; font: inherit; font-weight: 800; cursor: pointer; }
.listing-activity-tab:hover { border-color: #d6c9ad; color: var(--ink); background: #fffefb; }
.listing-activity-tab[aria-selected="true"] { border-color: var(--gold-dark); color: var(--ink); background: var(--gold); box-shadow: 0 4px 12px rgba(100, 76, 0, 0.12); }
.listing-activity-tab__count { display: inline-grid; place-items: center; min-width: 1.8rem; min-height: 1.8rem; padding: 0 0.45rem; border-radius: 999px; color: var(--ink); background: white; font-size: 0.78rem; line-height: 1; }
.listing-activity-content[hidden] { display: none; }
.listing-activity-content > .snapshot { margin: 0 0 0.8rem; }
.listing-change-list { margin-top: 0; }
.listing-change-list .job-card { background: rgba(255, 253, 246, 0.78); }
.listing-activity-panel__actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-top: 0.85rem; }
.publication-queue-entry { grid-template-columns: auto minmax(0, 1fr) auto; }
.publication-queue-entry--compact { grid-template-columns: minmax(0, 1fr) auto; }
.queue-position { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border: 2px solid var(--gold-dark); border-radius: 50%; color: var(--ink); background: var(--gold-soft); font-size: 0.82rem; font-weight: 900; }
.publication-queue-filters { grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(160px, 0.55fr)); }
.publication-queue-filters .history-filters__actions { grid-column: 1 / -1; }
.rejected-publication-entry { grid-template-columns: minmax(0, 1fr) auto; }
.rejected-publication-filters { grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(160px, 0.55fr)); }
.rejected-publication-filters .history-filters__actions { grid-column: 1 / -1; }
.rejection-reason { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.rejection-reason strong { color: var(--danger); }
.history-card { width: 100%; }
.history-filters { display: grid; grid-template-columns: minmax(150px, 0.9fr) minmax(190px, 1.2fr) repeat(2, minmax(145px, 0.7fr)); gap: 0.8rem; margin: 1.25rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: #fbf9f3; }
.history-filters > div { display: grid; align-content: start; gap: 0.4rem; }
.history-filters input, .history-filters select { width: 100%; min-height: 46px; padding: 0.7rem 0.8rem; border: 1px solid #cfc5b3; border-radius: 11px; color: var(--ink); background: #fffefb; font: inherit; }
.history-filters input:focus, .history-filters select:focus { outline: 3px solid rgba(244, 196, 0, 0.28); border-color: var(--gold-dark); }
.history-filters__actions { grid-column: 1 / -1; display: flex !important; grid-auto-flow: column; justify-content: start; align-items: center; }
.history-summary, .history-pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0; color: var(--muted); }
.history-results { margin-top: 0.8rem; }
.history-pagination { padding-top: 1rem; border-top: 1px solid var(--line); }
.automation-status--assisted { color: #8a5a00; }
.publication-mode-row { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.publication-mode-form fieldset { border: 0; margin: 1rem 0 0; padding: 0; }
.publication-mode-form legend { font-weight: 800; margin-bottom: 0.6rem; }
.status-badge--assisted { color: #6d4700; background: #fff2bf; border-color: #e5c251; }
.queue-entry-actions, .publication-choice-actions, .queue-mode-navigation { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.queue-entry-actions form { margin: 0; }
.publication-history-entry { grid-template-columns: minmax(0, 1fr); align-items: start; }
.publication-history-entry .queue-entry-actions { width: 100%; align-items: end; }
.publication-history-entry [data-manual-review-mark-form] { display: grid; grid-template-columns: minmax(240px, 1fr) auto; gap: 0.45rem 0.6rem; align-items: end; flex: 1 1 620px; min-width: 0; }
.publication-history-entry [data-manual-review-mark-form] label { grid-column: 1 / -1; font-size: 0.82rem; font-weight: 750; }
.publication-history-entry [data-manual-review-mark-form] input { width: 100%; min-width: 0; min-height: 42px; padding: 0.55rem 0.7rem; border: 1px solid #cfc5b3; border-radius: 8px; color: var(--ink); background: #fffefb; font: inherit; }
.publication-history-entry [data-manual-review-mark-form] input:focus { outline: 3px solid rgba(244, 196, 0, 0.28); border-color: var(--gold-dark); }
.publication-withdraw-form { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.publication-withdraw-form select { min-height: 42px; max-width: 190px; padding: 0.55rem 0.7rem; border: 1px solid #cfc5b3; border-radius: 10px; color: var(--ink); background: #fffefb; font: inherit; }
.publication-withdraw-form select:focus { outline: 3px solid rgba(180, 35, 35, 0.16); border-color: var(--danger); }
.assisted-publication-layout { display: grid; gap: 1rem; margin-top: 1.5rem; }
.assisted-publication-step { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 0.9rem; align-items: start; padding: 1.1rem; border: 1px solid var(--line); border-radius: 18px; background: #fffdf5; }
.step-number { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; color: #111; background: var(--gold); font-weight: 900; }
.assisted-message-option { margin-top: 0.9rem; padding: 0.9rem; border: 1px solid var(--line); border-radius: 14px; background: #fbf9f3; }
.assisted-message-option h3 { margin: 0 0 0.65rem; font-size: 0.96rem; }
.assisted-message-option .button--gold { margin-top: 0.65rem; }
.assisted-message { min-height: 150px; overflow-y: hidden; resize: none; }
.copy-feedback { min-height: 1.4em; color: #277448; }
.copy-feedback--error { color: var(--danger); }
.assisted-image-primary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; margin: 0.8rem 0; }
.assisted-image-primary-actions .copy-feedback { flex: 1 1 240px; margin: 0; }
.assisted-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.8rem; margin: 0.8rem 0; }
.assisted-image-card { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 8px 20px rgba(49, 39, 17, 0.06); }
.assisted-image-preview { display: block; width: 100%; padding: 0; border: 0; border-radius: 0; background: #f5f1e6; cursor: zoom-in; }
.assisted-image-preview:hover, .assisted-image-preview:focus-visible { transform: none; box-shadow: inset 0 0 0 3px var(--gold); }
.assisted-image-preview img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.assisted-image-card__actions { display: grid; gap: 0.5rem; padding: 0.65rem; }
.assisted-image-card__actions .button { width: 100%; }
.assisted-more-options { margin-top: 0.8rem; color: var(--muted); }
.assisted-more-options summary { width: fit-content; cursor: pointer; color: var(--ink); font-weight: 750; }
.assisted-more-options .button { margin-top: 0.7rem; }
.assisted-mark-form { display: grid; gap: 0.8rem; width: min(720px, 100%); margin-top: 1rem; }
.assisted-mark-form__field { display: grid; gap: 0.45rem; }
.assisted-mark-form input { width: 100%; min-height: 46px; padding: 0.7rem 0.8rem; border: 1px solid #cfc5b3; border-radius: 11px; color: var(--ink); background: #fffefb; font: inherit; }
.assisted-mark-form input:focus { outline: 3px solid rgba(244, 196, 0, 0.28); border-color: var(--gold-dark); }
.assisted-mark-form__actions { display: flex; justify-content: flex-start; }
.assisted-gallery { width: min(980px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); padding: 1rem; border: 1px solid var(--line); border-radius: 20px; background: #fffdf8; color: var(--ink); box-shadow: var(--shadow); }
.assisted-gallery::backdrop { background: rgba(14, 12, 9, 0.82); backdrop-filter: blur(3px); }
.assisted-gallery__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.assisted-gallery__header h2, .assisted-gallery__header p { margin: 0; }
.assisted-gallery__header p { margin-top: 0.2rem; color: var(--muted); }
.assisted-gallery__stage { display: grid; place-items: center; min-height: min(62dvh, 650px); overflow: hidden; border-radius: 14px; background: #171511; }
.assisted-gallery__stage img { display: block; max-width: 100%; max-height: min(62dvh, 650px); object-fit: contain; touch-action: pinch-zoom; }
.assisted-gallery__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 0.8rem; }
.assisted-gallery .copy-feedback { text-align: center; color: var(--muted); }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .dashboard-grid, .metrics-grid { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { min-height: 330px; }
  .user-panel__name, .user-panel__logo { display: none; }
  .detail-meta-grid { grid-template-columns: 1fr; }
  .access-grid { grid-template-columns: 1fr; }
  .identity-row { align-items: stretch; flex-direction: column; }
  .identity-actions { width: 100%; }
  .role-form { flex: 1; }
  .role-form .form-control { flex: 1; min-width: 0; }
  .history-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .topbar { align-items: flex-start; }
  .brand__subtitle { display: none; }
  .brand__logo { width: 44px; height: 44px; }
  .page { width: min(100% - 1rem, 1180px); }
  .hero { padding: 1.2rem; border-radius: 18px; }
  .card { border-radius: 16px; }
  .automation-row { align-items: stretch; flex-direction: column; }
  .automation-row button { width: 100%; }
  .facebook-safety-stop { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .facebook-safety-stop form { grid-column: 1 / -1; }
  .facebook-safety-stop form button { width: 100%; }
  .job-card { grid-template-columns: 1fr; }
  .job-card .button { width: 100%; }
  .detail-hero__top, .section-heading { align-items: stretch; flex-direction: column; }
  .detail-hero .button--ghost { width: 100%; }
  .result-card__facts { grid-template-columns: 1fr; }
  .page-actions .button { width: 100%; }
  .task-history-links .result-card__actions { display: grid; grid-template-columns: 1fr; }
  .task-history-links .button { width: 100%; }
  .confirmation-dialog { width: calc(100% - 1rem); padding: 1.15rem; border-radius: 16px; }
  .confirmation-dialog__actions { flex-direction: column-reverse; }
  .confirmation-dialog__actions .button, .confirmation-dialog__actions button { width: 100%; }
  .analysis-message-dialog { width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; margin: 0; padding: 1rem; border: 0; border-radius: 0; }
  .analysis-message-dialog__items { max-height: none; }
  .analysis-message-dialog__item { grid-template-columns: 1fr; }
  .publication-status-dialog { width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; margin: 0; padding: 1rem; border: 0; border-radius: 0; }
  .publication-status-dialog__header { align-items: stretch; flex-direction: column; }
  .publication-status-dialog__header .button { width: 100%; }
  .compact-form { grid-template-columns: 1fr; }
  .compact-form button { grid-column: auto; }
  .admin-row { align-items: stretch; flex-direction: column; }
  .admin-row button { width: 100%; }
  .generated-code__header { align-items: stretch; flex-direction: column; }
  .generated-code__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .generated-code__actions .button { width: 100%; }
  .identity-actions, .role-form { align-items: stretch; flex-direction: column; }
  .identity-actions form, .identity-actions button, .role-form .form-control { width: 100%; }
  .log-toolbar { align-items: stretch; flex-direction: column; }
  .log-toolbar__actions { display: grid; grid-template-columns: 1fr; }
  .log-toolbar__actions .button { width: 100%; }
  .log-output { height: 58vh; min-height: 320px; padding: 0.75rem; font-size: 0.74rem; }
  .legal-shell { width: min(100% - 1rem, 920px); }
  .legal-card { border-radius: 18px; }
  .legal-card__header { align-items: flex-start; }
  .legal-card__header img { width: 82px; }
  .legal-footer { align-items: stretch; flex-direction: column; }
  .legal-footer .button { width: 100%; }
  .listing-activity-tabs { gap: 0.3rem; padding: 0.3rem; }
  .listing-activity-tab { align-content: center; flex-wrap: wrap; gap: 0.3rem; padding: 0.55rem 0.35rem; font-size: 0.86rem; line-height: 1.15; }
  .listing-activity-panel__actions, .history-filters__actions { align-items: stretch; flex-direction: column; }
  .listing-activity-panel__actions .button, .history-filters__actions .button, .history-filters__actions button { width: 100%; }
  .publication-queue-entry { grid-template-columns: 1fr; align-items: start; }
  .queue-position { display: inline-flex; width: auto; height: auto; min-height: 1.75rem; padding: 0.2rem 0.55rem; justify-self: start; border-width: 1px; border-radius: 999px; }
  .queue-position::before { content: "Poz. "; margin-right: 0.2rem; font-weight: 700; }
  .publication-queue-entry .button { grid-column: 1 / -1; }
  .rejected-publication-entry { grid-template-columns: 1fr; }
  .history-filters { grid-template-columns: 1fr; padding: 0.8rem; }
  .history-filters__actions { grid-column: auto; }
  .history-summary { align-items: flex-start; flex-direction: column; gap: 0.25rem; }
  .history-pagination { display: grid; grid-template-columns: 1fr 1fr; }
  .history-pagination span { grid-column: 1 / -1; grid-row: 1; text-align: center; }
  .history-pagination .button { width: 100%; }
  .history-card .card__header { align-items: stretch; flex-direction: column; }
  .history-card .card__header .button { width: 100%; }
  .queue-entry-actions, .publication-choice-actions, .queue-mode-navigation { align-items: stretch; flex-direction: column; }
  .queue-entry-actions > *, .queue-entry-actions button, .publication-choice-actions button, .queue-mode-navigation a { width: 100%; }
  .publication-history-entry [data-manual-review-mark-form] { grid-template-columns: minmax(0, 1fr); width: 100%; flex-basis: auto; }
  .publication-history-entry [data-manual-review-mark-form] label { grid-column: 1; }
  .publication-withdraw-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .publication-withdraw-form select { width: 100%; max-width: none; }
  .publication-withdraw-form .button { width: auto; }
  .assisted-publication-step { grid-template-columns: 1fr; }
  .assisted-image-primary-actions, .assisted-gallery__header { align-items: stretch; flex-direction: column; }
  .assisted-image-primary-actions .button, .assisted-image-primary-actions .copy-feedback { width: 100%; flex-basis: auto; }
  .assisted-image-grid { grid-template-columns: 1fr; }
  .assisted-mark-form__actions .button--gold { width: 100%; }
  .assisted-gallery { width: calc(100% - 0.75rem); max-height: calc(100dvh - 0.75rem); padding: 0.65rem; border-radius: 14px; }
  .assisted-gallery__stage { min-height: 48dvh; }
  .assisted-gallery__stage img { max-height: 58dvh; }
  .assisted-gallery__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .assisted-gallery__actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
