/* ===========================================================================
   REST — light, professional UI
   =========================================================================== */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --border: #e4e7ec;
  --border-strong: #d4d9e0;
  --text: #0f1728;
  --text-2: #475467;
  --text-3: #667085;
  --brand: #0568ae;          /* AT&T blue */
  --brand-strong: #034b81;
  --brand-weak: #e7f1fb;
  --brand-cyan: #00a8e0;     /* AT&T cyan accent */
  --green: #1a7f47; --green-bg: #e7f6ec;
  --red: #c8322f; --red-bg: #fdeceb;
  --amber: #b25e09; --amber-bg: #fdf1e3;
  --yellow: #9a7a0a; --yellow-bg: #fbf5da;
  --teal: #0e7490; --teal-bg: #e2f4f7;
  --add-bg: #e6ffec; --add-fg: #1a7f37;
  --rm-bg: #ffebe9; --rm-fg: #c81e1e;
  --sev-red: #e5484d; --sev-orange: #f5a524; --sev-yellow: #f3d34a; --sev-green: #2f9e60;
  --radius: 10px; --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
  --shadow-md: 0 4px 12px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 15px; font-weight: 620; margin: 0; }
h3 { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 0 0 8px; }
small { color: var(--text-3); }

/* ---- app shell ---- */
.app-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  justify-content: space-between; height: 56px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand .mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-strong)); color: #fff;
  font-weight: 700; font-size: 14px; }
.brand .sub { color: var(--text-3); font-weight: 400; font-size: 12px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.top-nav { display: flex; gap: 4px; margin-right: 4px; }
.top-nav a { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text-2);
  font-size: 13px; font-weight: 550; }
.top-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2);
  padding: 5px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.user-chip .avatar { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-weak); color: var(--brand-strong); font-weight: 700; font-size: 11px; }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; }
.btn-ghost:hover { background: var(--surface-2); }

.container { width: 100%; max-width: 1280px; margin: 28px auto; padding: 0 24px; }
.container--wide { max-width: 1560px; }

/* ---- page header ---- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.crumb { display: inline-block; margin-bottom: 8px; font-size: 13px; color: var(--text-3); }
.crumb a { color: var(--text-2); }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.card > .card-head { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card > .card-body { padding: 18px; }
.card.flush > .card-body { padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-3 > * { min-width: 0; }  /* let columns shrink; long command lines scroll inside pre.cmd */
@media (max-width: 920px) { .grid-3 { grid-template-columns: 1fr; } }

/* command snippets + download list (CLI page) */
pre.cmd { background: #0f1728; color: #e6edf6; border-radius: 8px; padding: 12px 14px; margin: 0 0 6px;
  overflow-x: auto; white-space: pre; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
pre.cmd + h3 { margin-top: 14px; }
.dl-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.dl-list a { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.flag-list { margin: 0 0 12px; padding-left: 18px; }
.flag-list li { margin-bottom: 6px; }

/* ---- forms ---- */
label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
input, button, select { font: inherit; }
input[type=text], input[type=password], input[name=username], input[name=password], input[name=name] {
  width: 100%; padding: 9px 11px; background: #fff; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
input:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
input[type=file] { font-size: 12.5px; color: var(--text-2); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; margin-right: 10px; padding: 6px 12px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  border-radius: var(--radius-sm); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: #e9edf3; }
.field { margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--brand); color: #fff;
  border: 1px solid var(--brand); border-radius: var(--radius-sm); padding: 9px 16px; cursor: pointer;
  font-weight: 550; font-size: 13.5px; white-space: nowrap; }
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); filter: none; }
.btn.success { background: var(--green); border-color: var(--green); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.toolbar .grow { flex: 1 1 240px; }
.hint { color: var(--text-3); font-size: 12px; margin: 8px 0 0; }
.hint code, code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; font: 12px ui-monospace, Menlo, monospace; }
.error { color: var(--red); font-size: 13px; }
.ok { color: var(--green); font-size: 12.5px; font-weight: 550; }
.muted { color: var(--text-3); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid thead th { background: var(--surface-2); text-align: left;
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--border); }
table.grid tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover { background: var(--surface-2); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
td .cap-cell { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; white-space: nowrap; }
form.mini { display: inline-flex; gap: 6px; align-items: center; margin: 0; }

/* kebab (three-dots) menu — CSS-only via <details>; container must not clip it */
.table-wrap.menus { overflow: visible; }
.kebab { position: relative; display: inline-block; }
.kebab > summary { list-style: none; cursor: pointer; width: 26px; height: 26px; line-height: 1;
  border-radius: 6px; display: inline-grid; place-items: center; color: var(--text-3);
  border: 1px solid transparent; user-select: none; font-size: 18px; }
.kebab > summary::-webkit-details-marker { display: none; }
.kebab > summary::marker { content: ""; }
.kebab > summary:hover, .kebab[open] > summary { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.kebab-menu { position: absolute; right: 0; top: 32px; z-index: 40; min-width: 180px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-md); padding: 6px; }
.kebab-item { display: flex; align-items: center; gap: 8px; width: 100%; justify-content: flex-start;
  padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--text); font-size: 13px; font-weight: 500; }
.kebab-item:hover { background: var(--surface-2); text-decoration: none; }
.kebab-sep { height: 1px; background: var(--border); margin: 5px 6px; }
/* compact upload: a single button (the native file input is hidden but functional) */
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn .up { font-weight: 700; line-height: 1; }
.file-btn input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; font-size: 0; }
.file-btn input[type=file]::file-selector-button { display: none; }

/* ---- pills / status ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill--neutral, .pill--creado { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.pill--precheck { background: var(--brand-weak); color: var(--brand-strong); }
.pill--script_cargado { background: #eef1f5; color: #3f5063; }
.pill--ejecutado { background: var(--amber-bg); color: var(--amber); }
.pill--postcheck { background: var(--teal-bg); color: var(--teal); }
.pill--comparado { background: var(--green-bg); color: var(--green); }
.tag-ok { background: var(--green-bg); color: var(--green); border-color: transparent; }

.badge { display: inline-flex; align-items: center; border-radius: 7px; padding: 4px 11px;
  font-size: 12px; font-weight: 700; color: #fff; }
.badge-red { background: var(--sev-red); } .badge-yellow { background: var(--sev-yellow); color: #3a2e00; }
.badge-green { background: var(--sev-green); }

/* ---- stepper (MOP state machine) ---- */
.stepper { display: flex; align-items: center; width: 100%; padding: 4px 0; }
.step { display: flex; align-items: center; gap: 9px; color: var(--text-3); font-size: 12.5px;
  white-space: nowrap; flex: 0 0 auto; }
.step .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--border-strong); background: var(--surface); font-size: 11px; font-weight: 700;
  color: var(--text-3); flex: 0 0 auto; }
.step.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.step.current .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.current { color: var(--text); font-weight: 600; }
.stepper .line { flex: 1 1 auto; min-width: 24px; height: 2px; background: var(--border-strong); margin: 0 14px; }
.stepper .line.done { background: var(--green); }
@media (max-width: 760px) {
  .stepper { flex-wrap: wrap; gap: 10px 16px; }
  .stepper .line { display: none; }
}

/* ---- stat chips ---- */
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 96px; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.stat .v { font-size: 18px; font-weight: 680; }
.v.pos { color: var(--add-fg); } .v.neg { color: var(--rm-fg); } .v.mod { color: var(--amber); }

/* ---- subnav ---- */
.subnav { position: sticky; top: 56px; z-index: 10; display: flex; gap: 4px; padding: 8px 0;
  margin-bottom: 16px; background: var(--bg); border-bottom: 1px solid var(--border); }
.subnav a { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 13px; font-weight: 550; }
.subnav a:hover { background: var(--surface-2); text-decoration: none; }

/* ---- per-host change indicators (MOP table) ---- */
.chg-col { white-space: nowrap; font-size: 12.5px; }
.chg-col b { font-weight: 700; }
.chg-col b.pos { color: var(--add-fg); }
.chg-col b.neg { color: var(--rm-fg); }
.chg-col b.mod { color: var(--amber); }
.chg-col .est-ok { color: var(--green); font-weight: 600; }
.chg-col .est-bad { color: var(--rm-fg); font-weight: 600; }
.chg-col .badge { font-size: 10.5px; padding: 2px 9px; }

/* ---- capture toolbar + full-text links ---- */
.cap-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.cap-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-3); }
.cap-group { display: flex; align-items: center; gap: 6px; }
.full-links { margin-left: auto; font-size: 12px; color: var(--text-3); }
.full-links a { font-weight: 600; }
.d2h-view { width: 100%; }

/* ---- diffs ---- */
pre.diff, pre.script { background: #fbfcfe; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; margin: 0;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
pre.diff span { display: block; white-space: pre; padding: 0 4px; }
.d-add { background: var(--add-bg); color: var(--add-fg); }
.d-remove { background: var(--rm-bg); color: var(--rm-fg); }
.d-hunk { color: #0550ae; background: #f1f6fe; } .d-meta { color: var(--text-3); } .d-ctx { color: var(--text); }

table.sbs { width: 100%; border-collapse: collapse; table-layout: fixed;
  font: 12px/1.5 ui-monospace, Menlo, monospace; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
table.sbs th { text-align: left; color: var(--text-3); padding: 7px 10px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
table.sbs td { padding: 2px 10px; border-top: 1px solid var(--border); white-space: pre-wrap;
  vertical-align: top; width: 50%; word-break: break-word; }
.sbs-add td:last-child { background: var(--add-bg); }
.sbs-remove td:first-child { background: var(--rm-bg); }
.sbs-replace td:first-child { background: var(--rm-bg); }
.sbs-replace td:last-child { background: var(--add-bg); }
.diff-block + .diff-block { margin-top: 18px; }

/* diff2html: tint MODIFIED lines amber (have both d2h-del/ins AND d2h-change),
   distinct from pure additions (green) and pure deletions (red). */
.d2h-del.d2h-change,
.d2h-ins.d2h-change,
td.d2h-del.d2h-change .d2h-code-side-line,
td.d2h-ins.d2h-change .d2h-code-side-line { background-color: #fbf3e0 !important; }
.d2h-code-side-linenumber.d2h-change { background-color: #faecca !important; border-color: #f1dca0 !important; }
/* the precise words changed inside keep diff2html's red/green (Meld-style),
   so an amber line shows exactly what was removed/added within it. */

/* color legend for the diff */
.diff-legend { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 12px;
  color: var(--text-2); margin-bottom: 10px; }
.diff-legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px;
  vertical-align: -1px; border: 1px solid rgba(0,0,0,.08); }
.sw-add { background: var(--add-bg); } .sw-mod { background: #f7df9f; } .sw-del { background: var(--rm-bg); }

/* ---- severity ---- */
.sev-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .sev-grid { grid-template-columns: 1fr; } }
table.sev { width: 100%; border-collapse: separate; border-spacing: 4px; }
table.sev th { font-size: 11px; color: var(--text-3); font-weight: 600; padding: 2px; }
table.sev td { text-align: center; font-weight: 700; padding: 10px 0; border-radius: 7px; color: #fff; font-size: 15px; }
.sev-red { background: var(--sev-red); } .sev-orange { background: var(--sev-orange); color: #3a2400; }
.sev-yellow { background: var(--sev-yellow); color: #3a2e00; } .sev-green { background: var(--sev-green); }
.sev-none { background: var(--surface-2); color: var(--text-3); }
.loglines { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; font: 12px/1.5 ui-monospace, Menlo, monospace; }
.loglines li { display: flex; gap: 10px; align-items: baseline; padding: 7px 12px; border-bottom: 1px solid var(--border); }
.loglines li:last-child { border-bottom: 0; }
.sevtag { flex: 0 0 auto; min-width: 52px; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  padding: 1px 7px; border-radius: 5px; text-align: center; }
.sevtag.s-red { background: var(--red-bg); color: var(--red); }
.sevtag.s-orange { background: var(--amber-bg); color: var(--amber); }
.sevtag.s-yellow { background: var(--yellow-bg); color: var(--yellow); }
.sevtag.s-green { background: var(--green-bg); color: var(--green); }
.sevtag.s-none { background: var(--surface-2); color: var(--text-3); }

/* ---- misc ---- */
.verdict { display: flex; gap: 10px; align-items: center; padding: 12px 16px; background: var(--brand-weak);
  border: 1px solid #cfe3f5; border-radius: var(--radius); margin-bottom: 18px; color: var(--brand-strong); }
.empty-state { text-align: center; padding: 36px 20px; color: var(--text-3); }
select { padding: 8px 11px; background: #fff; color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font: inherit; cursor: pointer; }
select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.pager { display: flex; gap: 14px; align-items: center; margin-top: 14px; }
.kv { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 7px; margin: 0 2px 2px 0; font: 12px ui-monospace, Menlo, monospace; color: var(--text-2); }
.notice { padding: 12px 16px; border-radius: var(--radius); background: var(--amber-bg);
  border: 1px solid #f3d9b5; color: var(--amber); }
details.script-fold summary { cursor: pointer; color: var(--brand); font-size: 13px; margin-bottom: 8px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { font-size: 16px; }

/* ---- login (split screen) ---- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-aside { position: relative; overflow: hidden; color: #fff; padding: 56px 52px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 500px at 115% -10%, rgba(255,255,255,.22), transparent 60%),
    radial-gradient(700px 500px at -20% 120%, rgba(0,0,0,.18), transparent 55%),
    linear-gradient(140deg, var(--brand-cyan) 0%, var(--brand) 45%, var(--brand-strong) 100%); }
.auth-aside::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px;
  border-radius: 50%; border: 60px solid rgba(255,255,255,.10); }
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 16px; position: relative; z-index: 1; }
.auth-brand .mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); color: #fff; font-weight: 700; font-size: 18px; }
.auth-pitch { position: relative; z-index: 1; max-width: 460px; }
.auth-pitch h2 { color: #fff; font-size: 30px; line-height: 1.2; font-weight: 680; letter-spacing: -.02em; }
.auth-pitch p { color: rgba(255,255,255,.86); font-size: 15px; margin: 14px 0 26px; }
.auth-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-features li { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.95); font-size: 14px; }
.auth-features .ck { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); font-size: 12px; font-weight: 700; }
.auth-aside .foot { position: relative; z-index: 1; color: rgba(255,255,255,.7); font-size: 12px; }

.auth-main { display: grid; place-items: center; padding: 40px 28px; }
.auth-form { width: 100%; max-width: 360px; }
.auth-form .mark-sm { display: none; }
.auth-form h1 { font-size: 22px; } .auth-form .lead { color: var(--text-3); font-size: 13.5px; margin: 6px 0 26px; }
.auth-form .btn { width: 100%; justify-content: center; margin-top: 8px; padding: 11px 16px; }
.auth-foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 20px; }

@media (max-width: 880px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-form .mark-sm { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
    background: linear-gradient(135deg, var(--brand-cyan), var(--brand-strong)); color: #fff; font-weight: 700;
    font-size: 19px; margin-bottom: 18px; }
}
