:root {
  --bg: #f3efe6;
  --surface: rgba(255, 252, 246, 0.86);
  --surface-strong: #fffdf8;
  --ink: #15211d;
  --muted: #60716a;
  --line: rgba(25, 37, 31, 0.12);
  --accent: #195e50;
  --accent-soft: #d9eee7;
  --accent-warm: #e6b85c;
  --danger: #b64c3b;
  --shadow: 0 24px 64px rgba(21, 33, 29, 0.12);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(25, 94, 80, 0.16), transparent 30%),
    radial-gradient(circle at right 10% top 15%, rgba(230, 184, 92, 0.16), transparent 18%),
    linear-gradient(180deg, #f7f2e8 0%, #efe8dc 100%);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.gate-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card,
.hero-panel,
.panel,
.sidebar,
.kpi-card {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.gate-card {
  width: min(100%, 440px);
  padding: 32px;
  border-radius: var(--radius-xl);
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.gate-copy,
.sidebar-copy,
.hero-copy,
.panel-header p,
.brand-detail-copy,
.empty-state,
.metric-note {
  color: var(--muted);
  line-height: 1.5;
}

.gate-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.gate-form input,
.filter-block input,
.filter-block select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
}

.gate-form input:focus,
.filter-block input:focus,
.filter-block select:focus {
  outline: 2px solid rgba(25, 94, 80, 0.2);
  border-color: var(--accent);
}

.gate-error {
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

.page-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  min-height: 100vh;
  padding: 20px;
}

.sidebar {
  position: sticky;
  top: 20px;
  align-self: start;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 22px;
  border-radius: 28px;
}

.brand-lockup {
  margin-bottom: 18px;
}

.sidebar-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.filter-panel {
  display: grid;
  gap: 18px;
}

.filter-header,
.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.filter-block {
  display: grid;
  gap: 8px;
}

.filter-block label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.chip.low {
  border-color: rgba(182, 76, 59, 0.32);
  color: var(--danger);
}

.chip.low.active {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.main-panel {
  display: grid;
  gap: 20px;
}

.hero-panel {
  padding: 26px 28px;
  border-radius: 28px;
  display: grid;
  gap: 18px;
}

.hero-panel h2 {
  max-width: 760px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.02;
}

.active-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(25, 94, 80, 0.1);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  padding: 18px;
  border-radius: 18px;
}

.kpi-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-value {
  margin-top: 10px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  font-family: Georgia, "Times New Roman", serif;
}

.section-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

.section-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 22px;
  border-radius: 24px;
}

.insight-list,
.snapshot-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.insight-item,
.snapshot-item,
.brand-card,
.creative-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 18px;
}

.insight-item {
  padding: 14px 16px;
  display: grid;
  gap: 6px;
}

.insight-item strong {
  font-size: 14px;
}

.snapshot-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.snapshot-item {
  padding: 14px;
}

.snapshot-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.snapshot-value {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  font-family: Georgia, "Times New Roman", serif;
}

.brand-card-grid,
.creative-sections {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.brand-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.brand-card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.brand-badges,
.tag-cloud,
.creative-tags,
.mini-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(25, 94, 80, 0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.mini-chip.warning {
  background: rgba(182, 76, 59, 0.12);
  color: var(--danger);
}

.brand-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.brand-stat {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(25, 37, 31, 0.08);
}

.brand-stat span {
  display: block;
}

.brand-stat .label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand-stat .value {
  margin-top: 6px;
  font-size: 18px;
  font-family: Georgia, "Times New Roman", serif;
}

.media-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.media-analysis-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(25, 37, 31, 0.08);
  display: grid;
  gap: 10px;
}

.bar-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 56px;
  gap: 12px;
  align-items: center;
}

.bar-label {
  font-size: 13px;
  font-weight: 600;
}

.bar-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(21, 33, 29, 0.08);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #2f917c);
}

.bar-fill.warm {
  background: linear-gradient(90deg, #d68e1d, var(--accent-warm));
}

.bar-value {
  font-size: 13px;
  text-align: right;
  color: var(--muted);
}

.table-wrap {
  margin-top: 16px;
  overflow: auto;
}

.analysis-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.analysis-table th,
.analysis-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.analysis-table th {
  position: sticky;
  top: 0;
  background: rgba(255, 252, 246, 0.96);
  z-index: 1;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.analysis-table tr:hover td {
  background: rgba(25, 94, 80, 0.04);
}

.creative-section {
  display: grid;
  gap: 12px;
}

.creative-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.creative-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.creative-card {
  overflow: hidden;
  display: grid;
}

.creative-thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(25, 94, 80, 0.12), rgba(230, 184, 92, 0.22));
}

.creative-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.creative-body h4 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.creative-meta {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.creative-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.button,
.text-button,
.ghost-link {
  border: 0;
  cursor: pointer;
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
}

.button-primary {
  background: var(--accent);
  color: #fff;
}

.button-secondary {
  background: var(--accent-soft);
  color: var(--accent);
}

.ghost-link,
.text-button {
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-weight: 700;
}

.ghost-link {
  padding: 10px 0 0;
}

.empty-state {
  padding: 22px;
  border: 1px dashed rgba(25, 37, 31, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1280px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-grid,
  .section-grid-wide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 14px;
  }

  .sidebar,
  .hero-panel,
  .panel {
    padding: 18px;
    border-radius: 20px;
  }

  .kpi-grid,
  .snapshot-grid,
  .brand-stat-grid,
  .media-analysis-grid {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .bar-value {
    text-align: left;
  }
}
