/* The Control Centre UI (PCC-TS-001 §4.8, CC-5; the grid and drawer from PCC-58). Plain CSS, no build step.
   Inter is named first but not loaded: the page pulls no web fonts, so a machine without it uses the system face. */

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1c2330;
  --quiet: #5e6673;
  --line: #e3e6ea;
  --line-soft: #edeff2;
  --accent: #2f5bd3;
  --accent-dark: #1e3f9e;
  --accent-soft: #eef3ff;
  --accent-line: #c9d5f5;
  --accent-ink: #ffffff;
  --band: #f2f4f7;
  --danger: #a3261b;
  --danger-bg: #fbe7e5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 17px; margin: 0; }
.where { color: var(--quiet); font-size: 12px; }

nav { display: flex; gap: 4px; }
nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
}
nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }

.who { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--quiet); font-size: 13px; }

main { padding: 20px 24px 40px; max-width: 1440px; margin: 0 auto; }

h2 { font-size: 18px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 18px 0 8px; }

a { color: var(--accent); }
.quiet { color: var(--quiet); }

.notice {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  margin-bottom: 12px;
}
.notice.error { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }

button, .button {
  font: inherit;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { background: var(--accent-dark); }
button.small { padding: 1px 7px; font-size: 12px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn {
  font-weight: 600;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid #d9dde3;
  background: var(--panel);
  color: var(--ink);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

select, input[type="text"], input[type="url"] {
  font: inherit;
  padding: 4px 6px;
  border: 1px solid #c9ced6;
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }

.scroll { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; background: var(--panel); }
th, td { text-align: left; vertical-align: top; padding: 8px 10px; border: 1px solid var(--line); }
th { font-weight: 600; background: var(--bg); white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg); }

.version, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 16px;
}
.tag.prd, .tag-prd { background: #ddf3e4; color: #14572e; }
.tag.pre-live, .tag-dev { background: #fff1d6; color: #7a4b00; }
.tag-stg, .tag-uat { background: #e1eaff; color: #1e3f9e; }
.tag.bad { background: var(--danger-bg); color: var(--danger); }
.ival .tag { margin-left: 6px; vertical-align: 1px; }

/* --- The grid --- */

.gridbox {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
  max-height: calc(100vh - 230px);
  min-height: 320px;
  box-shadow: 0 1px 2px rgb(28 35 48 / 4%);
}
.gridin { min-width: 1100px; }

.grow { display: grid; grid-template-columns: 200px repeat(4, minmax(220px, 1fr)); }

.ghead { position: sticky; top: 0; z-index: 3; background: #fafbfc; border-bottom: 1px solid #dde1e6; }
.envhead { padding: 12px 14px; border-left: 1px solid var(--line-soft); }
.envname { font-size: 15px; font-weight: 700; }
.sub { font-size: 12px; color: var(--quiet); margin-top: 2px; }

.glabel {
  position: sticky;
  left: 0;
  z-index: 1;
  padding: 10px 16px;
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  background: var(--panel);
}
.ghead .glabel { z-index: 4; background: #fafbfc; }
.sortbtn {
  border: 0;
  background: none;
  min-height: 36px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #2a3240;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.shead { background: var(--band); border-top: 1px solid #dde1e6; border-bottom: 1px solid var(--line); }
.shead .glabel { background: var(--band); }
.studycode { font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.lastchange {
  padding: 8px 10px 8px 14px;
  border-left: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  color: var(--accent);
  background: var(--panel);
  border: 1px solid var(--accent-line);
  border-radius: 8px;
}
.iconbtn:hover { background: var(--accent-soft); border-color: var(--accent); }

.irow { border-bottom: 1px solid var(--line-soft); }
.lbl { font-size: 14px; font-weight: 600; color: #2a3240; }
.icell {
  padding: 10px 12px 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-left: 1px solid var(--line-soft);
  min-height: 44px;
}
.ival { min-width: 0; overflow-wrap: anywhere; }
.val { font-size: 14px; font-weight: 500; }
.val-muted { font-size: 13px; color: #6b7380; font-style: italic; }
.val-unset { font-size: 14px; font-weight: 500; color: #4a5260; }

/* The rows nothing reports yet: deliberately knocked back, pale, light and grey, with no button. */
.irow.dim, .irow.dim .glabel { background: #fafbfc; }
.irow.dim .lbl { font-weight: 400; color: #7c838e; }
.val-dim { font-size: 13px; font-weight: 400; color: #7c838e; }

.chg {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  padding: 6px 10px;
  min-height: 32px;
  white-space: nowrap;
}
.chg:hover { background: var(--accent-soft); border-color: var(--accent); }

.proof { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; color: #4a5260; font-size: 13px; }

/* --- The side drawer --- */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: min(520px, 100%);
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--accent-line);
  box-shadow: -12px 0 32px rgb(28 35 48 / 12%);
}
.drawer[hidden] { display: none; }
.drawer-body { padding: 24px 24px 32px; display: flex; flex-direction: column; gap: 14px; }
.drawer h2 { font-size: 18px; margin: 0; }
.drawer .help { margin: 0; color: #4a5260; }
.drawer .now { margin: 0; color: var(--quiet); font-size: 13px; }
.drawer .now strong { color: var(--ink); }
.drawer .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.drawer .field input { width: 100%; min-height: 44px; padding: 10px 12px; font-size: 14px; font-weight: 400; border-radius: 10px; }
.drawer .choices { display: flex; flex-direction: column; gap: 8px; }
.drawer .buttons { display: flex; flex-wrap: wrap; gap: 10px; }

.opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid #d9dde3;
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
}
.opt:hover { border-color: var(--accent); }
.opt:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-soft); padding: 9px 11px; }
.opt.disabled { cursor: not-allowed; background: #f3f4f6; color: #6b7380; border-style: dashed; }
.opt input { margin-top: 3px; }
.opt-text { display: flex; flex-direction: column; gap: 2px; }
.opt-label { font-size: 14px; font-weight: 600; }
.opt-sub { font-size: 12px; color: var(--quiet); }

.confirm { border: 1px solid var(--danger); background: var(--danger-bg); color: var(--danger); padding: 10px; border-radius: 10px; }
.confirm input { width: 100%; margin-top: 6px; min-height: 44px; }

.trail { display: flex; flex-direction: column; }
.trail-item { padding: 12px 0; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; }
.trail-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; }
