:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #b7791f;
  --danger: #b42318;
  --success: #067647;
  --radius: 8px;
  --shadow: 0 12px 36px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

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

a {
  color: inherit;
}

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

.login-shell {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #111827;
}

.login-panel {
  width: min(430px, 100%);
  padding: 34px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-logo {
  width: 154px;
  height: auto;
  display: block;
  padding: 12px 16px;
  margin-bottom: 18px;
  background: #111827;
  border-radius: var(--radius);
}

.login-panel h1 {
  margin: 0 0 24px;
  font-size: 30px;
}

.auth-form,
.product-form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 7px;
}

label span,
.form-section h2,
.summary-panel h2,
.workbench h2 {
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.22);
  border-color: var(--brand);
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 16px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}

.primary-button,
.icon-button.primary {
  background: var(--brand);
  color: #fff;
}

.primary-button:hover,
.icon-button.primary:hover {
  background: var(--brand-dark);
}

.secondary-button {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.icon-button {
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  padding: 22px;
  background: #121923;
  color: #eef4f6;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 800;
}

.brand img {
  width: 48px;
  height: 48px;
}

.sidebar nav {
  display: grid;
  align-content: start;
  gap: 6px;
  margin-top: 34px;
}

.sidebar nav a,
.user-box a {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: #cbd5e1;
  border-radius: 7px;
  padding: 10px 12px;
}

.nav-icon {
  width: 18px;
  text-align: center;
  line-height: 1;
}

.sidebar nav a.active,
.sidebar nav a:hover,
.user-box a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.user-box {
  display: grid;
  gap: 5px;
  color: #cbd5e1;
  font-size: 13px;
}

.user-box strong {
  color: #fff;
  overflow-wrap: anywhere;
}

.user-box a {
  padding-left: 0;
}

.content {
  width: min(1400px, 100%);
  padding: 34px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
}

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

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

.notice {
  padding: 13px 15px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.notice.error {
  border-color: rgba(180, 35, 24, 0.25);
  color: var(--danger);
}

.notice.success {
  border-color: rgba(6, 118, 71, 0.25);
  color: var(--success);
}

.empty-state {
  padding: 42px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.empty-state.small {
  padding: 18px;
  box-shadow: none;
}

.empty-state h2,
.empty-state h1 {
  margin-top: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.product-card,
.form-section,
.summary-panel,
.workbench,
.plan-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.product-card {
  display: grid;
  gap: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.product-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.product-card h2 a {
  text-decoration: none;
}

.product-card footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.muted,
.muted-link {
  color: var(--muted);
}

.muted-link {
  overflow-wrap: anywhere;
}

.product-form.narrow {
  max-width: 880px;
}

.form-section {
  padding: 22px;
}

.form-section h2 {
  margin: 0 0 16px;
  color: #344054;
  text-transform: uppercase;
}

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

.form-grid + label {
  margin-top: 4px;
}

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

.taxonomy-tree {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.taxonomy-tree .taxonomy-tree {
  margin-top: 8px;
  padding-left: 22px;
}

.stage-tree {
  gap: 6px;
}

.stage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid rgba(217, 222, 231, 0.65);
}

.stage-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.stage-title strong {
  font-size: 14px;
  line-height: 1.25;
}

.stage-title small {
  color: var(--muted);
  font-size: 12px;
}

.stage-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(74px, auto));
  gap: 7px;
}

.stage-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  white-space: nowrap;
}

.stage-option input {
  width: 14px;
  height: 14px;
  padding: 0;
}

.stage-option span {
  font-size: 12px;
  font-weight: 600;
}

.check-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 0;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.check-row span {
  display: grid;
  gap: 3px;
}

.check-row strong {
  font-size: 14px;
}

.check-row small,
.method-row em,
.small-text {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.method-platforms {
  padding-left: 28px;
}

.platform-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0 10px;
}

.platform-choice {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  width: auto;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  font-size: 13px;
}

.platform-choice input {
  width: 15px;
  height: 15px;
}

.country-select {
  min-height: 342px;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
}

.toggle-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-row input {
  width: 16px;
  height: 16px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.summary-panel {
  padding: 18px;
}

.summary-panel h2,
.workbench h2 {
  margin: 0 0 12px;
  color: #344054;
  text-transform: uppercase;
}

.chip-row,
.flag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stage-chip-group {
  display: grid;
  gap: 8px;
}

.stage-chip-group + .stage-chip-group {
  margin-top: 12px;
}

.stage-chip-group > strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  font-size: 13px;
}

.flag-list {
  margin-top: 12px;
}

.flag-list span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.flag-list img {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.workbench {
  padding: 20px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  color: var(--muted);
}

.section-title h2 {
  margin: 0;
}

.plan-list {
  display: grid;
  gap: 12px;
}

.plan-item {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  padding: 18px;
}

.plan-main h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.plan-main p:not(.eyebrow) {
  margin: 0 0 12px;
  color: #475467;
}

.plan-controls {
  display: grid;
  gap: 10px;
  align-content: start;
}

.inline-loader {
  display: inline-flex;
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

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

  .sidebar {
    position: static;
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sidebar nav {
    display: flex;
    margin-top: 0;
  }

  .summary-grid,
  .split-section,
  .plan-item,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 22px;
  }
}

@media (max-width: 760px) {
  .stage-row {
    grid-template-columns: 1fr;
  }

  .stage-options {
    justify-content: start;
  }
}

@media (max-width: 640px) {
  .page-head,
  .head-actions,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .page-head h1 {
    font-size: 27px;
  }

  .login-panel {
    padding: 24px;
  }
}
