
:root {
  color-scheme: light;
  --ink: #17191c;
  --muted: #646a73;
  --line: #dfe3e8;
  --canvas: #f4f5f6;
  --surface: #ffffff;
  --sidebar: #151719;
  --accent: #c9f24b;
  --accent-strong: #9fc51f;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --success: #166534;
  --success-soft: #ecfdf3;
  --shadow: 0 14px 40px rgba(18, 24, 32, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
}

button, input { font: inherit; }

button { cursor: pointer; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 22px;
  background: var(--sidebar);
  color: #fff;
}

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

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #43484f;
  border-radius: 9px;
  color: var(--accent);
  font-size: 19px;
  font-weight: 800;
}

.brand-name {
  display: block;
  letter-spacing: 0.12em;
  font-size: 13px;
  font-weight: 800;
}

.brand-product {
  display: block;
  margin-top: 3px;
  color: #8f969f;
  font-size: 12px;
}

.nav-label {
  margin: 0 10px 10px;
  color: #747b84;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #24272b;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
}

.security-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid #34383e;
  border-radius: 10px;
  color: #adb3bb;
  font-size: 12px;
  line-height: 1.55;
}

.security-note strong {
  display: block;
  margin-bottom: 5px;
  color: #fff;
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 34px clamp(24px, 5vw, 72px) 64px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: #69717c;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.lede {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

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

.button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #c8cdd3;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.button:hover { border-color: #858c95; }
.button:focus-visible, input:focus-visible {
  outline: 3px solid rgba(159, 197, 31, 0.35);
  outline-offset: 2px;
}

.button-primary {
  border-color: var(--accent-strong);
  background: var(--accent);
}

.button-primary:hover { background: #bdea37; }
.button:disabled { cursor: not-allowed; opacity: 0.48; }

.button-danger {
  border-color: #f2c6c2;
  color: var(--danger);
}

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

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.metric {
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
}

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

.metric-value {
  display: block;
  margin-top: 5px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.015em;
}

.revision {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
}

.rules {
  display: grid;
  gap: 14px;
}

.rule-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.rule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  background: #fafbfb;
}

.rule-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.rule-body { padding: 20px; }

.field-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}

.field label, .recipient-label {
  display: block;
  margin-bottom: 7px;
  color: #4f5660;
  font-size: 11px;
  font-weight: 750;
}

.field input, .recipient-row input {
  width: 100%;
  height: 44px;
  border: 1px solid #cfd4da;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 13px;
}

.field input:hover, .recipient-row input:hover { border-color: #9aa1aa; }

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

.audience {
  min-width: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.audience-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.audience-title {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
}

.recipient-list { display: grid; gap: 8px; }

.recipient-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(190px, 1.4fr) 34px;
  gap: 8px;
  align-items: center;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #777f89;
  font-size: 19px;
  line-height: 1;
}

.icon-button:hover {
  border-color: #f2c6c2;
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  padding: 38px;
  border: 1px dashed #bcc2c9;
  border-radius: 12px;
  text-align: center;
  color: var(--muted);
}

.notice {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 48px));
  padding: 13px 16px;
  border: 1px solid #bbdfc5;
  border-radius: 9px;
  background: var(--success-soft);
  color: var(--success);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
}

.notice.error {
  border-color: #f2c6c2;
  background: var(--danger-soft);
  color: var(--danger);
}

[hidden] { display: none; }

@media (max-width: 920px) {
  .shell { display: block; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 24px;
    padding: 18px 22px;
  }
  .brand { margin: 0; }
  .nav-label, .security-note { display: none; }
  .nav-item { margin-left: auto; }
}

@media (max-width: 720px) {
  .workspace { padding: 26px 16px 56px; }
  .topbar { flex-direction: column; }
  .actions { width: 100%; justify-content: stretch; }
  .actions .button { flex: 1; }
  .summary { grid-template-columns: 1fr; }
  .field-grid, .audience-grid { grid-template-columns: 1fr; }
  .recipient-row { grid-template-columns: 1fr 34px; }
  .recipient-row input[type="email"] { grid-column: 1; }
  .recipient-row .icon-button { grid-column: 2; grid-row: 1 / span 2; }
}
/* Routing editor: shared palette, compact configuration layout. */
.config-page .shell { grid-template-columns: 216px minmax(0, 1fr); }
.config-page .sidebar { padding: 28px 16px; }
.config-page .brand { padding: 0 8px; margin-bottom: 48px; }
.config-page .nav-item { background: transparent; color: #aeb4ba; text-decoration: none; margin: 5px 0; font-weight: 550; }
.config-page .nav-item:hover { background: #202426; color: white; }
.config-page .nav-item.active { background: #292e29; color: #d4f58b; }
.config-page .nav-history { width: 7px; font-size: 16px; }
.config-page .security-note { border: 0; border-top: 1px solid #303536; border-radius: 0; padding: 20px 8px 0; font-size: 11px; }
.config-page .workspace { width: 100%; max-width: 1430px; margin: 0 auto; padding: 40px clamp(24px, 3.4vw, 56px) 60px; }
.config-page .topbar { align-items: center; margin-bottom: 28px; }
.config-page h1 { font-size: 30px; font-weight: 650; letter-spacing: -.035em; line-height: 1.3; }
.config-page .eyebrow { font-size: 10px; letter-spacing: .12em; margin-bottom: 10px; }
.config-page .lede { font-size: 13px; margin-top: 9px; }
.config-page .button { min-height: 38px; font-weight: 600; border-radius: 7px; font-size: 12px; white-space: nowrap; }
.config-page .button-small { min-height: 32px; padding: 0 12px; }
.config-page .button-primary { background: #c9f24b; border-color: #badf4c; }
.config-page .button-primary:disabled { background: #e7eccf; border-color: #dce3c2; color: #87916d; opacity: 1; }
.config-page .summary { gap: 0; background: white; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 30px; padding: 20px 0; }
.config-page .metric { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px; background: none; border: 0; border-radius: 0; }
.config-page .metric + .metric { border-left: 1px solid var(--line); }
.config-page .metric-label { font-size: 12px; letter-spacing: 0; font-weight: 500; }
.config-page .metric-value { font-size: 23px; font-weight: 650; margin: 0; }
.config-page .section-heading { margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.config-page .section-heading h2 { font-size: 15px; font-weight: 650; margin-right: auto; }
.config-page .section-caption { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; font-weight: 400; }
.config-page .revision { font-family: inherit; font-size: 11px; }
.config-page .rule-card { border-radius: 10px; box-shadow: 0 2px 5px #18202204; }
.config-page .rule-header { padding: 16px 22px; background: white; }
.config-page .rule-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.config-page .rule-number { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #eff5df; color: #60772d; font-size: 12px; font-weight: 650; flex-shrink: 0; }
.config-page .rule-title { font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.config-page .rule-controls { display: flex; align-items: center; gap: 22px; flex-shrink: 0; }
.config-page .button-danger { border-color: transparent; background: transparent; color: #8a6362; padding: 0 3px; }
.config-page .button-danger:hover { color: #b42318; }
.config-page .switch-label { display: flex; align-items: center; gap: 8px; position: relative; cursor: pointer; font-size: 11px; color: #536442; white-space: nowrap; }
.config-page .switch-label input { position: absolute; opacity: 0; width: 34px; height: 20px; margin: 0; }
.config-page .switch-track { display: block; width: 32px; height: 18px; border-radius: 20px; background: #d1d6da; transition: background .15s; }
.config-page .switch-track::after { content: ''; display: block; margin: 3px; width: 12px; height: 12px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #0002; transition: transform .15s; }
.config-page .switch-label input:checked + .switch-track { background: #7d9d35; }
.config-page .switch-label input:checked + .switch-track::after { transform: translateX(14px); }
.config-page .switch-label input:focus-visible + .switch-track { outline: 3px solid #c9f24b; outline-offset: 3px; }
.config-page .is-disabled .rule-number { background: #f0f2f3; color: #7a838c; }
.config-page .is-disabled .switch-status { color: #7a838c; }
.config-page .rule-body { padding: 22px; }
.config-page .field-grid { gap: 18px; margin-bottom: 22px; }
.config-page .field label { font-size: 12px; font-weight: 500; }
.config-page .field input, .config-page .recipient-row input { height: 38px; border-color: #dce0e4; border-radius: 6px; font-size: 12px; }
.config-page .audience-grid { gap: 18px; }
.config-page .audience { padding: 16px; background: #f8f9fa; border: 1px solid #e8ebed; border-radius: 8px; }
.config-page .audience-header { margin-bottom: 14px; }
.config-page .audience-title { font-size: 12px; font-weight: 600; }
.config-page .audience .button { background: transparent; border: 0; color: #5b702c; min-height: 24px; padding: 0; }
.config-page .recipient-row { grid-template-columns: minmax(65px, .7fr) minmax(130px, 1.4fr) 24px; gap: 8px; align-items: end; }
.config-page .recipient-field { min-width: 0; color: #7b838c; font-size: 10px; line-height: 1.5; }
.config-page .recipient-field input { display: block; margin-top: 5px; }
.config-page .recipient-row .icon-button { width: 24px; height: 38px; }
.config-page .recipient-label { margin: 0; color: #939aa1; font-size: 12px; font-weight: 400; padding: 19px 0; }
.config-page .save-hint { color: #848c93; font-size: 11px; line-height: 1.8; margin-top: 18px; }
@media (max-width: 1150px) { .config-page .audience-grid { grid-template-columns: 1fr; } }
@media (max-width: 920px) {
 .config-page .shell { display: block; }
 .config-page .sidebar { padding: 16px 22px; justify-content: space-between; }
 .config-page .sidebar > div:nth-child(2) { display: flex; gap: 12px; }
 .config-page .brand { margin: 0; padding: 0; }
 .config-page .nav-item { margin: 0; }
 .config-page .workspace { padding: 28px 24px 40px; }
}
@media (max-width: 600px) {
 .config-page .sidebar { padding: 14px 16px; gap: 10px; }
 .config-page .brand-product { display: none; }
 .config-page .brand-name { font-size: 10px; }
 .config-page .brand { gap: 8px; }
 .config-page .sidebar > div:nth-child(2) { gap: 2px; }
 .config-page .nav-item { padding: 9px; font-size: 11px; }
 .config-page .workspace { padding: 26px 16px; }
 .config-page .topbar { align-items: stretch; gap: 20px; }
 .config-page .summary { grid-template-columns: repeat(3, 1fr); padding: 14px 0; }
 .config-page .metric { flex-direction: column; align-items: flex-start; padding: 0 14px; gap: 5px; }
 .config-page .metric-label { font-size: 10px; }
 .config-page .rule-header { padding: 14px; gap: 10px; flex-wrap: wrap; }
 .config-page .rule-controls { margin-left: auto; gap: 12px; }
 .config-page .rule-body { padding: 16px; }
 .config-page .field-grid { grid-template-columns: 1fr; }
 .config-page .audience { padding: 12px; }
 .config-page .recipient-row { grid-template-columns: minmax(65px, .65fr) minmax(100px, 1.4fr) 24px; }
 .config-page .recipient-row .icon-button { grid-column: auto; grid-row: auto; }
 .config-page .revision { order: 3; width: 100%; }
}

