:root {
  color-scheme: dark;
  --bg: #07070b;
  --panel: #111116;
  --panel-2: #171714;
  --line: rgba(219, 177, 82, 0.18);
  --line-strong: rgba(238, 205, 130, 0.42);
  --text: #f4efe5;
  --muted: #a9a29a;
  --muted-2: #7b746d;
  --gold: #d4a64e;
  --gold-2: #f1d58b;
  --danger: #c75245;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 90% 4%, rgba(170, 118, 40, 0.18), transparent 31rem),
    radial-gradient(circle at 10% 95%, rgba(212, 166, 78, 0.1), transparent 25rem),
    linear-gradient(140deg, #050509 0%, #0a0a0f 48%, #11100c 100%);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(9, 9, 13, 0.96), rgba(13, 12, 10, 0.92)),
    repeating-radial-gradient(circle at 100% 12%, transparent 0 42px, rgba(212, 166, 78, 0.1) 43px 44px);
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid rgba(241, 213, 139, 0.42);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(241, 213, 139, 0.16), #020203 62%);
  box-shadow: 0 0 34px rgba(212, 166, 78, 0.2);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}

.eyebrow.gold {
  color: var(--gold);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

body[data-view="campaignDetail"] #pageTitle {
  max-width: min(100%, 820px);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.04;
}

h3 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.18;
}

.nav-list {
  display: grid;
  gap: 10px;
}

.nav-item,
.ghost-button,
.primary-button,
.danger-button,
.icon-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  border-color: var(--line-strong);
  background: rgba(212, 166, 78, 0.09);
  color: var(--text);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(212, 166, 78, 0.34);
  border-radius: 50%;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.sidebar-note p {
  margin-bottom: 0;
}

.main-content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar-actions,
.toolbar-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.ghost-button,
.primary-button,
.danger-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--text);
  white-space: nowrap;
}

.ghost-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.primary-button {
  border-color: rgba(241, 213, 139, 0.5);
  background: linear-gradient(135deg, #b98428, #e2bb63);
  color: #11100c;
  font-weight: 800;
}

.danger-button {
  border-color: rgba(199, 82, 69, 0.36);
  background: rgba(199, 82, 69, 0.1);
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-color: rgba(199, 82, 69, 0.28);
  background: rgba(199, 82, 69, 0.08);
  color: #f0b2aa;
  text-transform: uppercase;
}

.ghost-button:hover,
.primary-button:hover,
.danger-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.kpi-card,
.panel,
.campaign-card,
.campaign-form,
.campaign-detail-head {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(17, 17, 22, 0.98), rgba(15, 14, 12, 0.92)),
    radial-gradient(circle at 90% 8%, rgba(212, 166, 78, 0.08), transparent 18rem);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.kpi-card {
  display: grid;
  gap: 9px;
  min-height: 150px;
  min-width: 0;
  padding: 20px;
}

.kpi-card span,
.kpi-card small {
  color: var(--muted);
}

.kpi-card span {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.kpi-card strong {
  color: var(--gold-2);
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(22px, 2.4vw, 34px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-overflow: clip;
  white-space: nowrap;
}

.kpi-card small {
  align-self: end;
  font-size: 12px;
  line-height: 1.4;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 20px;
}

.panel-header,
.metrics-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header span {
  color: var(--muted);
  font-size: 13px;
}

.bar-list {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  gap: 7px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.bar-meta strong {
  color: var(--text);
}

.bar-sub {
  color: var(--muted-2);
  font-size: 12px;
}

.bar-track {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8c631f, #f1d58b);
}

.finance-list {
  display: grid;
  gap: 13px;
  margin: 0;
}

.finance-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.finance-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.finance-list dt {
  color: var(--muted);
  font-size: 13px;
}

.finance-list dd {
  margin: 0;
  max-width: 52%;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(15px, 1.4vw, 18px);
  font-weight: 800;
  text-align: right;
  text-overflow: clip;
  white-space: nowrap;
}

.metrics-toolbar {
  margin-bottom: 16px;
}

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

.campaign-card {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: 20px;
}

.campaign-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.campaign-card-head span,
.campaign-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.campaign-card p {
  min-height: 40px;
  margin-bottom: 0;
}

.preview-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
  gap: 10px;
}

.preview-kpis div,
.detail-kpis article {
  display: grid;
  align-content: center;
  gap: 7px;
  justify-items: center;
  min-width: 0;
  min-height: 92px;
  border: 1px solid rgba(241, 213, 139, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  text-align: center;
}

.preview-kpis div {
  padding: 10px 8px;
}

.detail-kpis article {
  padding: 12px;
}

.preview-kpis span,
.detail-kpis span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
}

.preview-kpis strong,
.detail-kpis strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--gold-2);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-overflow: clip;
  white-space: nowrap;
}

.preview-kpis strong {
  font-size: 13px;
}

.detail-kpis strong {
  font-size: 18px;
}

.open-campaign {
  width: 100%;
}

.campaign-form {
  max-width: 980px;
  padding: 24px;
}

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

.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-grid small {
  color: var(--muted-2);
  font-weight: 600;
}

.full-field {
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid textarea,
.date-input,
.metric-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(3, 3, 5, 0.72);
  color: var(--text);
  outline: none;
}

.form-grid input,
.date-input,
.metric-input {
  min-height: 40px;
  padding: 9px 10px;
}

.form-grid textarea {
  min-height: 120px;
  padding: 11px 12px;
  resize: vertical;
}

.form-grid input:focus,
.form-grid textarea:focus,
.date-input:focus,
.metric-input:focus {
  border-color: rgba(241, 213, 139, 0.62);
  box-shadow: 0 0 0 3px rgba(212, 166, 78, 0.12);
}

.form-actions {
  margin-top: 18px;
}

.campaign-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
  gap: 18px;
  margin-bottom: 16px;
  padding: 22px;
}

.campaign-summary h3 {
  margin-bottom: 10px;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.04;
}

.campaign-summary p:not(.eyebrow) {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.55;
}

.campaign-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.campaign-meta span {
  padding: 7px 10px;
  border: 1px solid rgba(241, 213, 139, 0.16);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.detail-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(128px, 1fr));
  gap: 10px;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 10, 14, 0.78);
  box-shadow: var(--shadow);
}

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

.metrics-table th,
.metrics-table td {
  border-right: 1px solid rgba(241, 213, 139, 0.12);
  border-bottom: 1px solid rgba(241, 213, 139, 0.12);
}

.metrics-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 14px;
  background: #11100d;
  color: var(--gold-2);
  text-align: left;
  vertical-align: top;
}

.metrics-table th:first-child,
.metric-label {
  position: sticky;
  left: 0;
  z-index: 3;
}

.metrics-table th:first-child {
  min-width: 280px;
}

.metric-label {
  min-width: 280px;
  padding: 14px;
  background: #0f0f12;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  vertical-align: middle;
}

.metric-label small {
  display: block;
  margin-top: 4px;
  color: var(--muted-2);
  font-weight: 600;
}

.metrics-table td {
  min-width: 190px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.metric-input.auto {
  color: var(--gold-2);
  background: rgba(212, 166, 78, 0.06);
}

.date-head {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 34px;
  align-items: end;
  gap: 8px;
}

.date-head label {
  display: grid;
  gap: 6px;
}

.date-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.empty-state {
  display: grid;
  grid-column: 1 / -1;
  gap: 6px;
  padding: 24px;
  border: 1px dashed rgba(241, 213, 139, 0.28);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

@media (max-width: 1180px) {
  .campaign-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .campaign-detail-head {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 18px;
  }

  .nav-list {
    grid-auto-flow: column;
    margin-left: auto;
  }

  .sidebar-note {
    display: none;
  }

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

  .wide-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .main-content {
    padding: 18px;
  }

  .topbar,
  .metrics-toolbar,
  .campaign-card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .toolbar-actions,
  .form-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .kpi-grid,
  .dashboard-grid,
  .campaign-grid,
  .form-grid,
  .detail-kpis,
  .preview-kpis {
    grid-template-columns: 1fr;
  }

  .sidebar {
    gap: 16px;
  }

  .nav-list {
    grid-auto-flow: row;
    width: 100%;
    margin-left: 0;
  }

  .nav-item {
    justify-content: center;
  }

  .ghost-button,
  .primary-button,
  .danger-button {
    flex: 1 1 160px;
  }
}
