:root {
  --bg: #0f1420;
  --bg-panel: #161c2b;
  --bg-elev: #1e2740;
  --bg-input: #0c111b;
  --border: #2a3550;
  --border-soft: #212b42;
  --text: #e6ecf7;
  --text-muted: #8b97b3;
  --accent: #ff7a45;      /* Aruba-ish orange */
  --accent-hover: #ff8f60;
  --green: #37c98b;
  --amber: #f5b642;
  --red: #f2555a;
  --blue: #4f9dff;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #131a29 0%, var(--bg) 100%);
  padding: 26px 0 20px;
}
.site-header h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.01em; }
.site-header .arrow { color: var(--accent); }
.tagline { margin: 0 0 8px; color: var(--text-muted); max-width: 760px; }
.privacy { margin: 0; font-size: 13px; color: var(--green); }

/* Layout */
main.wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding-top: 22px; padding-bottom: 22px; }
@media (max-width: 900px) { main.wrap { grid-template-columns: 1fr; } }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 460px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 10px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

/* Input actions */
.input-actions, .output-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.link-btn {
  background: none; border: none; color: var(--blue);
  cursor: pointer; font-size: 13px; padding: 2px 0;
}
.link-btn:hover:not(:disabled) { color: #7ab6ff; text-decoration: underline; }
.link-btn:disabled { color: var(--text-muted); cursor: default; opacity: 0.5; }
.file-btn { color: var(--blue); cursor: pointer; font-size: 13px; }
.file-btn:hover { color: #7ab6ff; text-decoration: underline; }

textarea#config-input {
  flex: 1; width: 100%; resize: vertical; min-height: 260px;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font-family: var(--mono); font-size: 13px; line-height: 1.55;
  padding: 12px; tab-size: 2;
}
textarea#config-input:focus { outline: none; border-color: var(--accent); }

/* Controls */
.controls { display: flex; align-items: center; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.control-group { display: flex; align-items: center; gap: 8px; }
.control-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.segmented { display: inline-flex; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented button {
  background: none; border: none; color: var(--text-muted);
  padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.segmented button.active { background: var(--accent); color: #17121a; font-weight: 600; }
.toggles { gap: 14px; flex-wrap: wrap; }
.toggle { font-size: 13px; color: var(--text); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.toggle input { accent-color: var(--accent); }

button.primary {
  margin-left: auto;
  background: var(--accent); color: #17121a; font-weight: 600;
  border: none; border-radius: 8px; padding: 9px 20px; font-size: 14px; cursor: pointer;
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.primary:disabled { opacity: 0.55; cursor: default; }

/* Output */
.output { flex: 1; overflow: auto; border-radius: 8px; }
.placeholder { color: var(--text-muted); text-align: center; padding: 60px 20px; }
.placeholder .muted { font-size: 13px; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }

/* Badge */
.badge { font-size: 12px; padding: 3px 9px; border-radius: 20px; font-weight: 600; }
.badge-idle { background: #2a3550; color: var(--text-muted); }
.badge-run  { background: #2a3550; color: var(--amber); }
.badge-ok   { background: rgba(55,201,139,0.16); color: var(--green); }
.badge-warn { background: rgba(245,182,66,0.16); color: var(--amber); }
.badge-err  { background: rgba(242,85,90,0.16); color: var(--red); }

/* Result blocks */
.result-policy { border: 1px solid var(--border-soft); border-radius: 8px; margin-bottom: 16px; overflow: hidden; }
.result-policy > h3 {
  margin: 0; padding: 10px 12px; background: var(--bg-elev);
  font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pill { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #2a3550; color: var(--text-muted); font-weight: 600; }
.pill.role { background: rgba(79,157,255,0.16); color: var(--blue); }
.pill.warn { background: rgba(245,182,66,0.16); color: var(--amber); }
.pill.err  { background: rgba(242,85,90,0.16); color: var(--red); }

.sxs { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; }
.sxs th, .sxs td { text-align: left; padding: 7px 12px; vertical-align: top; border-top: 1px solid var(--border-soft); }
.sxs th { color: var(--text-muted); font-weight: 600; background: var(--bg-input); position: sticky; top: 0; }
.sxs td.aos8 { color: #cdd6ea; width: 42%; }
.sxs td.arrow { color: var(--accent); text-align: center; width: 24px; }
.sxs td.aos10 { color: var(--green); white-space: pre-wrap; }
.sxs tr.dropped td.aos10 { color: var(--red); }
.sxs tr.expanded td.arrow { color: var(--blue); }
.sxs .note { color: var(--text-muted); font-style: italic; }

pre.block {
  margin: 0; padding: 12px; background: var(--bg-input);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  white-space: pre; overflow-x: auto; color: #cdd6ea;
}
pre.block .cfg-role { color: var(--blue); }
pre.block .cfg-action-permit { color: var(--green); }
pre.block .cfg-action-deny { color: var(--red); }

/* Report */
.report { border: 1px solid var(--border-soft); border-radius: 8px; padding: 14px; margin-bottom: 16px; background: var(--bg-elev); }
.report h3 { margin: 0 0 10px; font-size: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 8px; }
.stat { background: var(--bg-input); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 10px; }
.stat .n { font-size: 20px; font-weight: 700; }
.stat .l { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.stat.warn .n { color: var(--amber); }
.stat.err .n { color: var(--red); }

.issues { margin: 8px 0 0; padding: 0; list-style: none; }
.issues li { padding: 5px 0 5px 22px; position: relative; font-size: 13px; border-top: 1px solid var(--border-soft); }
.issues li::before { position: absolute; left: 2px; }
.issues li.warn::before { content: "⚠"; color: var(--amber); }
.issues li.err::before  { content: "✕"; color: var(--red); }
.issues li.info::before { content: "ℹ"; color: var(--blue); }
.issues li.ok::before   { content: "✓"; color: var(--green); }

/* Errors */
.error-box { border: 1px solid var(--red); background: rgba(242,85,90,0.08); border-radius: 8px; padding: 14px; }
.error-box h3 { margin: 0 0 6px; color: var(--red); }
.error-box pre { margin: 8px 0 0; font-size: 12px; white-space: pre-wrap; color: #f0b5b7; }

/* Footer */
.site-footer { border-top: 1px solid var(--border-soft); padding: 18px 20px 30px; color: var(--text-muted); font-size: 13px; }
.site-footer a { color: var(--blue); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer code { font-family: var(--mono); font-size: 12px; color: var(--text); }

/* Spinner */
.spinner {
  display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Central "Create an Alias" preview card ---- */

/* Container for side-by-side split (mixed AF) */
.nd-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px; }
@media (max-width: 700px) { .nd-split { grid-template-columns: 1fr; } }

/* The preview panel itself — styled to echo the Central modal */
.alias-preview {
  background: #f9fafc;
  border: 1px solid #d0d7e3;
  border-radius: 10px;
  padding: 16px;
  font-size: 13.5px;
  color: #1a2038;
}
.alias-field { margin-bottom: 12px; }
.alias-field-row { display: flex; gap: 24px; margin-bottom: 12px; }
.alias-field-row .alias-field { margin-bottom: 0; flex: 1; }
.alias-label {
  display: block; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #5a6480; margin-bottom: 4px;
}
.alias-value {
  background: #fff; border: 1px solid #c8d0e0;
  border-radius: 6px; padding: 7px 10px;
  font-size: 13px; color: #1a2038;
}
.alias-value.name { font-weight: 700; font-size: 14px; color: #111827; }
.alias-af { display: flex; gap: 18px; padding: 6px 0; }
.af-radio {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: #5a6480;
  padding: 5px 12px; border-radius: 6px;
  border: 1px solid #c8d0e0; background: #fff;
}
.af-radio::before {
  content: ""; display: inline-block;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #b0b8cc; background: #fff;
  flex-shrink: 0;
}
.af-radio.af-selected {
  color: #1a2038; font-weight: 600;
  border-color: var(--accent); background: #fff8f5;
}
.af-radio.af-selected::before {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent) 45%, transparent 46%);
}

/* Entries section header */
.alias-entries-hdr {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 2px solid #d0d7e3; padding-top: 10px; margin-top: 4px; margin-bottom: 6px;
}
.alias-entries-hdr .alias-label { margin: 0; font-size: 13px; font-weight: 800; }

/* Entries table */
.nd-entries {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.nd-entries th {
  text-align: left; padding: 5px 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: #5a6480; border-bottom: 1px solid #d0d7e3;
}
.nd-entries td { padding: 7px 8px; border-bottom: 1px solid #edf0f5; color: #1a2038; }
.nd-entries tr:last-child td { border-bottom: none; }
.nd-entries td.nd-type { font-weight: 600; color: #334060; white-space: nowrap; }
.nd-entries td.nd-cond { font-family: var(--mono); word-break: break-all; }
.nd-empty { padding: 8px; color: #8b97b3; font-style: italic; margin: 0; }

/* ===================================================================
   CENTRAL GUIDE MODE
   =================================================================== */

/* Intro banner */
.guide-intro {
  background: linear-gradient(135deg, #f0f4ff 0%, #fdf6f0 100%);
  border: 1px solid #ccd3e8;
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 20px;
  color: #1a2038;
}
.guide-intro h3 { margin: 0 0 6px; font-size: 17px; color: #1a2038; }
.guide-intro .muted { color: #5a6480; margin: 4px 0 0; }

/* Sample badges inline in guide-intro */
.from-aos8-sample {
  display: inline-block; background: #fff5ef; border: 1px solid #ffd0b0;
  color: var(--accent); border-radius: 4px; padding: 0 5px; font-size: 12px;
  font-weight: 600; vertical-align: middle;
}
.placeholder-sample {
  display: inline-block; background: #f5f5f5; border: 1px solid #ccc;
  color: #888; border-radius: 4px; padding: 0 5px; font-size: 12px;
  vertical-align: middle;
}

/* Guide step container */
.guide-step {
  background: #f7f9fc;
  border: 1px solid #ccd3e8;
  border-radius: 10px;
  margin-bottom: 24px;
  overflow: hidden;
}

.guide-step-hdr {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(90deg, #1e2740 0%, #232e4a 100%);
  border-bottom: 1px solid #2a3550;
}
.guide-step-badge {
  flex-shrink: 0;
  background: var(--accent); color: #fff;
  border-radius: 20px; font-size: 11px; font-weight: 700;
  padding: 3px 10px; text-transform: uppercase; letter-spacing: 0.04em;
}
.guide-step-title {
  margin: 0; font-size: 16px; color: #e6ecf7; font-weight: 700;
}

.guide-nav-path {
  display: flex; align-items: center; flex-wrap: wrap;
  padding: 8px 20px;
  background: #eef1f8; border-bottom: 1px solid #d0d7e5;
  font-size: 12px; color: #334060;
}
.nav-crumb {
  font-weight: 600; color: #2a3a6a;
  background: #fff; border: 1px solid #c8d0e0;
  border-radius: 5px; padding: 2px 8px;
}
.nav-arrow { margin: 0 4px; color: var(--accent); font-weight: 700; }

.guide-step-desc {
  padding: 10px 20px 4px;
  font-size: 13px; color: #5a6480; margin: 0;
}
.guide-step-desc code { background: #e8ecf5; padding: 0 4px; border-radius: 3px; font-size: 12px; }

.guide-step-content {
  padding: 16px 20px;
}

/* Guide item wrapper (wraps alias preview + label) */
.guide-item { margin-bottom: 16px; }
.guide-item:last-child { margin-bottom: 0; }
.guide-item-label {
  font-weight: 700; font-size: 14px; color: #1a2038;
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}

/* -------- Role preview card -------- */
.role-preview {
  background: #fff;
  border: 1px solid #c8d0e0;
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.role-preview:last-child { margin-bottom: 0; }

.role-preview-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(90deg, #f4f7ff 0%, #fff 100%);
  border-bottom: 1px solid #e0e5f0;
}
.role-icon { font-size: 18px; line-height: 1; }
.role-preview-name { font-weight: 800; font-size: 15px; color: #1a2038; }

.role-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 12px 0;
}
.role-field {
  padding: 7px 16px;
  border-bottom: 1px solid #f0f2f8;
}
.role-field-wide { grid-column: span 2; }
.role-label {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: #7b87a8; margin-bottom: 3px;
}
.role-label .required { color: var(--red); }
.aos8-note { color: #aab; font-weight: 500; text-transform: none; letter-spacing: 0; }
.role-value { font-size: 13px; color: #1a2038; }
.role-value.placeholder { color: #9ea8c0; font-style: italic; }
.from-aos8 {
  background: #fff5ef; border: 1px solid #ffd0b0;
  color: #c05a00; border-radius: 4px; padding: 1px 6px;
  font-size: 12px; font-weight: 600; font-family: var(--mono);
}
.placeholder { color: #9ea8c0; font-style: italic; }
.cb-off { color: #a0a8bb; font-size: 14px; }

.role-policies-note {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 9px 16px 11px;
  background: #f7f9fc; border-top: 1px solid #e8ecf5;
  font-size: 12px;
}
.policy-chip {
  background: #e8edfa; color: #2a3a6a; border-radius: 4px;
  padding: 2px 7px; font-size: 12px; font-family: var(--mono);
  border: 1px solid #c4cce6;
}

/* -------- Policy guide block -------- */
.guide-policy {
  background: #fff;
  border: 1px solid #c8d0e0;
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.guide-policy:last-child { margin-bottom: 0; }

.guide-policy-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  background: linear-gradient(90deg, #f4f7ff 0%, #fff 100%);
  border-bottom: 1px solid #e0e5f0;
}
.guide-policy-icon { font-size: 18px; line-height: 1; }
.guide-policy-name { margin: 0; font-size: 15px; font-weight: 800; color: #1a2038; }
.guide-policy > .role-field { padding: 10px 16px; }

.policy-role-note {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 7px 16px 8px;
  background: #f0f4ff; border-top: 1px solid #e0e8f8;
  border-bottom: 1px solid #e0e8f8;
  font-size: 12px; color: #334060;
}

.guide-rules-hdr {
  padding: 8px 16px;
  font-size: 12px; font-weight: 700; color: #5a6480;
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid #edf0f5;
}

.guide-rules { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }

/* -------- Rule card -------- */
.rule-card {
  border: 1px solid #d0d8ea;
  border-radius: 7px;
  overflow: hidden;
  background: #f9fafd;
}

.rule-card-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px;
  background: #edf0f8; border-bottom: 1px solid #d8dff0;
}
.rule-num { font-weight: 700; font-size: 12px; color: #334060; text-transform: uppercase; letter-spacing: 0.04em; }

.rule-act-badge {
  font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 8px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.act-allow { background: #d4f5e5; color: #1a6b44; }
.act-deny  { background: #fde8e8; color: #901a1a; }
.act-other { background: #e8edfa; color: #2a4080; }

.rule-sections {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
}
@media (max-width: 900px) {
  .rule-sections { grid-template-columns: 1fr; }
}

.rule-section {
  padding: 10px 12px;
  border-right: 1px solid #dde3ef;
}
.rule-section:last-child { border-right: none; }
.rule-section-misc { background: #f4f7fc; }

.rule-section-lbl {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; color: #8b97b3; margin-bottom: 8px;
}

.rule-field { margin-bottom: 6px; }
.rule-field:last-child { margin-bottom: 0; }
.rule-label {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: #7b87a8; margin-bottom: 2px;
}
.rule-value { font-size: 12px; color: #1a2038; }
.rule-ref {
  font-family: var(--mono); font-size: 12px;
  background: #fff; border: 1px solid #ccd3e3;
  border-radius: 4px; padding: 2px 6px; display: inline-block;
  color: #2a3a6a; font-weight: 600;
}


