: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); }

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--awaiting_approval { 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); }

.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; }
.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; }

.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; }

.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%; }

@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; }
}

@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%; }
  .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%; }
}

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