:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --text: #17201d;
  --muted: #68736f;
  --line: #dce5e1;
  --green: #0b7f5f;
  --green-dark: #075b45;
  --blue: #315b8c;
  --rose: #b94a62;
  --amber: #9b6a18;
  --shadow: 0 14px 38px rgba(19, 32, 28, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 22px;
  background: #182522;
}

.login-page {
  width: 100%;
  max-width: 430px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-logo {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  display: block;
  object-fit: cover;
  margin-bottom: 18px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.login-copy {
  margin: 0 0 18px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 7px;
  background: #fdecef;
  color: #8c2638;
  font-weight: 800;
}

.login-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.login-links a,
.secondary-link {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #182522;
  color: #f6fbf9;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  background: #ffffff;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #afbbb6;
  font-size: 13px;
}

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

.nav-list a {
  color: #dce7e3;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.nav-list a:hover,
.nav-list a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.client-chip {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #dce7e3;
  font-size: 14px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #48d597;
}

.workspace {
  padding: 28px;
  display: grid;
  gap: 22px;
  min-width: 0;
}

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

.topbar h1,
.panel h2 {
  margin: 0;
  line-height: 1.15;
}

.topbar h1 {
  font-size: 30px;
}

.panel h2 {
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.icon-btn {
  border: 0;
  border-radius: 7px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-btn {
  background: var(--green);
  color: #ffffff;
}

.primary-btn:hover {
  background: var(--green-dark);
}

.secondary-btn,
.icon-btn {
  background: var(--surface-2);
  color: var(--text);
}

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

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
  min-height: 118px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 22px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr);
  gap: 18px;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.75fr);
  gap: 18px;
}

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

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

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.pill {
  background: #e7f4ef;
  color: var(--green-dark);
}

.tag.muted {
  background: #eef1f0;
  color: var(--muted);
}

.tag.ready {
  background: #e8eef7;
  color: var(--blue);
}

.campaign-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #394540;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdfc;
  color: var(--text);
  padding: 11px 12px;
  min-height: 42px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11, 127, 95, 0.12);
}

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

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.timeline li {
  position: relative;
  padding: 12px 12px 12px 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 18px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
}

.timeline strong,
.timeline span {
  display: block;
}

.timeline span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

th,
td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.dropzone {
  display: grid;
  gap: 10px;
  place-items: center;
  min-height: 150px;
  border: 1px dashed #9eb0aa;
  border-radius: 8px;
  background: #fbfdfc;
  text-align: center;
  padding: 18px;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.dropzone label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 7px;
  background: #182522;
  color: #ffffff;
}

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

.config-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.config-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.config-list span {
  color: var(--muted);
}

.config-list a {
  color: var(--blue);
  font-weight: 800;
  text-align: right;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.policy-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 34px 22px 56px;
}

.policy-page header,
.policy-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.policy-page header {
  padding: 24px;
  margin-bottom: 16px;
}

.policy-page h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.policy-page p,
.policy-page li {
  color: #394540;
  line-height: 1.58;
}

.policy-section {
  padding: 20px 24px;
  margin-bottom: 14px;
}

.policy-section h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.policy-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  background: #182522;
  color: #ffffff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow-x: auto;
  }

  .client-chip {
    margin-top: 0;
  }

  .metrics-grid,
  .content-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 18px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .form-actions,
  .form-row {
    grid-template-columns: 1fr;
  }

  .form-row {
    display: grid;
  }

  .primary-btn,
  .secondary-btn,
  .icon-btn {
    width: 100%;
  }
}
