/* rt.css — the styles every RainTech migration console shares
   (raintech-common). A tool's own app.css follows it and holds only what
   is that tool's alone.

   Deliberately plain. No framework, no build step, no CDN. A migration
   console that stops working because a CDN is unreachable would be a
   poor trade for looks, and the strict Content-Security-Policy the
   consoles send forbids remote assets anyway. */

:root {
  --bg: #12151a;
  --panel: #1a1f27;
  --panel-2: #222834;
  --line: #2e3644;
  --text: #e6e9ef;
  --dim: #97a1b2;
  --accent: #4c9aff;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

main { max-width: 1040px; margin: 0 auto; padding: 24px 20px 60px; }

/* ── nav ── */
nav {
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; min-height: 52px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
nav a { color: var(--dim); text-decoration: none; font-size: 14px; }
nav a:hover { color: var(--text); }
nav a.brand { color: var(--text); font-weight: 600; font-family: var(--mono); }
nav .spacer { flex: 1; }
nav .who { font-size: 13px; color: var(--dim); }

/* ── the RainTech Portal logo, leading back to the portal ── */
nav a.rt-portal {
  display: inline-flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1px; line-height: 1;
  padding: 4px 11px 5px; border-radius: 7px;
  background: #001647; border: 1px solid rgba(139, 219, 2, .35);
  text-decoration: none; flex: none;
}
nav a.rt-portal:hover, nav a.rt-portal:focus-visible {
  border-color: #8BDB02;
}
.rt-portal-cloud { width: 46px; height: 8px; display: block; }
.rt-portal-name {
  font: 700 14px/1 -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
        sans-serif;
  letter-spacing: .12em;
}
.rt-portal-rain { color: #F7F7FF; }
.rt-portal-tech { color: #8BDB02; }
.rt-portal-sub {
  font: 600 9px/1 -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
        sans-serif;
  letter-spacing: .42em; padding-left: .42em; color: #F7F7FF;
  opacity: .9;
}
form.inline { display: inline; }

button.link {
  background: none; border: 0; color: var(--dim);
  cursor: pointer; font-size: 14px; padding: 0; font-family: inherit;
}
button.link:hover { color: var(--text); text-decoration: underline; }

/* ── banners & flashes ── */
.banner { padding: 12px 20px; font-size: 14px; }
.banner-danger { background: #4a1113; border-bottom: 1px solid #7d1d1f; }
.banner-warn { background: #3a2d0d; border-bottom: 1px solid #6b5216; }

.flashes { margin-bottom: 18px; }
.flash {
  padding: 10px 14px; border-radius: 6px; margin-bottom: 8px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 14px;
}
.flash-error   { border-color: #7d2b28; background: #33191a; }
.flash-warning { border-color: #6b5216; background: #2c2413; }
.flash-success { border-color: #24623a; background: #16281d; }
.flash-info    { border-color: #2a4a6b; background: #16212c; }

/* ── layout pieces ── */
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
p.lede { color: var(--dim); margin: 0 0 22px; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 18px; margin-bottom: 18px;
}
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

.dim { color: var(--dim); }
.mono { font-family: var(--mono); font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row .spacer { flex: 1; }

/* ── forms ── */
label { display: block; font-size: 13px; color: var(--dim); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=time], input[type=file], textarea, select {
  width: 100%; padding: 9px 11px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; font-family: inherit;
}
textarea { font-family: var(--mono); font-size: 13px; line-height: 1.5; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
}
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.check input { width: auto; }
.check label { margin: 0; color: var(--text); font-size: 14px; }

button, .btn {
  display: inline-block; padding: 9px 16px;
  background: var(--accent); color: #06131f;
  border: 0; border-radius: 6px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; font-family: inherit;
}
button:hover, .btn:hover { filter: brightness(1.1); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary, .btn.secondary {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line);
}
button.danger { background: var(--err); color: #fff; }
button.small, .btn.small { padding: 5px 11px; font-size: 13px; }

/* ── pills / status ── */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--dim);
}
.pill-busy { border-color: #6b5216; color: #e3b341; }
.pill-dry  { border-color: #2a4a6b; color: #6cb6ff; }
.status-queued      { border-color: #2a4a6b; color: #6cb6ff; }
.status-running     { border-color: #6b5216; color: #e3b341; }
.status-succeeded   { border-color: #24623a; color: #56d364; }
.status-failed      { border-color: #7d2b28; color: #ff7b72; }
.status-cancelled   { border-color: var(--line); color: var(--dim); }
.status-interrupted { border-color: #7d2b28; color: #ff9492; }

/* ── tables ── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 500; font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }

/* ── code blocks ── */
pre {
  background: #0d1117; border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 14px; overflow-x: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.5;
  margin: 8px 0;
}
code { font-family: var(--mono); font-size: .92em; }
p code, li code, td code {
  background: var(--panel-2); padding: 1px 5px; border-radius: 4px;
}

/* ── log viewers ── */
#log, #vbody {
  background: #0d1117; border: 1px solid var(--line); border-radius: 6px;
  padding: 12px; height: 62vh; overflow-y: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}

/* ── numbered steps ── */
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li {
  counter-increment: s; position: relative;
  padding-left: 34px; margin-bottom: 16px;
}
.steps > li::before {
  content: counter(s);
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--dim); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}

footer {
  max-width: 1040px; margin: 0 auto; padding: 0 20px 30px;
  font-size: 12px;
}

.hidden { display: none !important; }

/* ── project switcher ── */
.projpick {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2);
}
.pill-proj { border-color: var(--accent); color: var(--accent); }

/* A CSS-only dropdown: the switcher decides which customer's tenants an
   action would touch, so it must work with no JavaScript at all. */
.switch { position: relative; cursor: pointer; color: var(--dim); }
.switch .menu {
  display: none; position: absolute; top: 22px; right: -8px; z-index: 50;
  min-width: 240px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.45);
}
.switch:hover .menu, .switch:focus-within .menu { display: block; }
.switch .menu form { display: block; }
.switch .menu button.link, .switch .menu a {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 6px; font-size: 13.5px;
  color: var(--text); text-decoration: none;
}
.switch .menu button.link:hover, .switch .menu a:hover {
  background: var(--panel-2); text-decoration: none;
}
.switch .menu a { border-top: 1px solid var(--line); margin-top: 4px;
  color: var(--accent); }

.projgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}
.projcard { margin-bottom: 0; }
.projcard table th { text-transform: none; font-size: 12px; padding-left: 0; }
.projcard table td { padding-right: 0; }

.subtabs {
  display: flex; gap: 4px; margin: 0 0 20px;
  border-bottom: 1px solid var(--line);
}
.subtabs a {
  padding: 9px 16px; font-size: 14px; color: var(--dim);
  text-decoration: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subtabs a:hover { color: var(--text); }
.subtabs a.active {
  color: var(--text); border-bottom-color: var(--accent); font-weight: 500;
}

/* ── dashboard stats ── */
.statgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
}
.stat {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat .num { font-size: 21px; font-weight: 600; font-family: var(--mono); }
.stat .num.ok  { color: #56d364; }
.stat .num.bad { color: #ff7b72; }
.stat .num.run { color: #e3b341; }
.stat .lbl {
  font-size: 11.5px; color: var(--dim);
  text-transform: uppercase; letter-spacing: .3px;
}

/* Only drawn when the total is exact — see dashboard.js. */
.bar {
  height: 4px; background: var(--panel-2); border-radius: 999px;
  overflow: hidden; margin-top: 4px;
}
.bar > span {
  display: block; height: 100%; background: var(--accent);
  border-radius: 999px;
}

/* ── confirmation overlay ── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 9, 14, .72);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
.modal-card {
  width: 100%; max-width: 840px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
.modal-card table { margin-top: 4px; }
.modal-card table th {
  text-transform: none; font-size: 12px; padding-left: 0; width: 42%;
}
.modal-card table td { padding-right: 0; }

/* ── tenants connected in the RainTech portal ── */
.tenant-pair { margin: 8px 0 4px; }
.tenant {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; background: var(--panel-2);
}
.tenant.missing { border-style: dashed; background: transparent; }
.tenant h3 {
  margin: 0 0 4px; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--dim);
}
.tenant-name { font-size: 15.5px; font-weight: 600; }
.tenant dl {
  display: grid; grid-template-columns: max-content minmax(0, 1fr);
  gap: 2px 12px; margin: 8px 0 0; font-size: 13px;
}
.tenant dt { color: var(--dim); }
.tenant dd { margin: 0; overflow-wrap: anywhere; }
label.choice {
  display: block; margin: 0 0 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-size: 14px; cursor: pointer;
}
label.choice:has(input:checked) { border-color: var(--accent); }
label.choice input[type=radio] { margin: 0; }

/* ── progress: the dashboard's overall bar, the job page's per-unit bars ── */
.bar-big { height: 10px; margin-top: 6px; }
.overall { margin-top: 16px; }
.overall:empty { display: none; }
.overall-head { align-items: baseline; font-size: 13.5px; }
.units { display: grid; gap: 10px; margin-top: 12px; max-height: 560px;
         overflow-y: auto; }
.unit-row { display: grid; grid-template-columns: minmax(0, 1.2fr) auto
            minmax(0, 1fr); gap: 12px; align-items: center; font-size: 13px; }
.unit-who { overflow-wrap: anywhere; }
.unit-progress .bar { margin: 0 0 3px; }
.unit-progress .dim { font-size: 12px; }
@media (max-width: 720px) {
  .unit-row { grid-template-columns: 1fr auto; }
  .unit-progress { grid-column: 1 / -1; }
}
