/* Simplified Data Solutions brand: Montserrat, navy #0A2342, sky #009EF7, silver #A9ADB7, cream #FFF7D6, mist #F2FAFF */
:root {
  --navy: #0A2342;
  --sky: #009EF7;
  --sky-dark: #0077C2;   /* sky darkened for text links on white */
  --silver: #A9ADB7;
  --cream: #FFF7D6;
  --mist: #F2FAFF;

  --bg: var(--mist);
  --surface: #ffffff;
  --surface-2: #E8F4FD;
  --border: #DCE3EC;
  --text: var(--navy);
  --muted: #56657A;
  --accent: var(--sky);
  --accent-text: #ffffff;
  --link: var(--sky-dark);

  --pass: #1E8A4C;
  --pass-bg: #E3F4EA;
  --fail: #C62F2F;
  --fail-bg: #FBE5E5;
  --blocked: #B7791F;
  --blocked-bg: #FDF1DC;
  --notrun: #8A94A3;
  --notrun-bg: #ECEFF3;
  --pass-card: #D4EFDD;
  --fail-card: #F9D7D7;
  --blocked-card: #FBE6C2;
  --retest: #7A3FC2;
  --retest-bg: #EFE6FB;

  --shadow: 0 1px 2px rgba(10, 35, 66, .05), 0 4px 14px rgba(10, 35, 66, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.5 var(--font);
  overflow-x: hidden;
}
a { color: var(--link); }
a:hover { color: var(--sky); }
h1 { font-size: 1.45rem; font-weight: 800; margin: 0 0 .75rem; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; font-weight: 700; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1rem; font-weight: 700; margin: 0 0 .5rem; }
p { margin: .4rem 0; }
strong { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
code { font-size: .9em; background: var(--surface-2); padding: .05rem .3rem; border-radius: 4px; }

/* ---------- Header ---------- */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(10, 35, 66, .05);
  position: sticky; top: 0; z-index: 20;
}
.app-header .inner {
  max-width: 1200px; margin: 0 auto; padding: .55rem 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.25rem;
}
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--navy); white-space: nowrap; }
.brand img { height: 30px; width: auto; display: block; }
.brand span { font-weight: 800; font-size: 1.08rem; letter-spacing: -.01em; }
.cycle-name { color: var(--muted); font-size: .82rem; font-weight: 600; }
.app-nav { display: flex; gap: .15rem 1rem; flex-wrap: wrap; margin-left: auto; }
.app-nav a {
  text-decoration: none; color: var(--navy); padding: .3rem .1rem; font-size: .95rem; font-weight: 600;
  border-bottom: 2px solid transparent;
}
.app-nav a:hover { color: var(--sky); }
.app-nav a.active { color: var(--sky); border-bottom-color: var(--sky); }
.who { font-size: .82rem; color: var(--muted); display: flex; gap: .5rem; align-items: center; font-weight: 600; }
.who button { font-size: .78rem; padding: .2rem .7rem; }

main { max-width: 1200px; margin: 0 auto; padding: 1.25rem 16px 4rem; }
@media (max-width: 600px) {
  /* The header wraps on phones; let it scroll away so tests get the screen. */
  .app-header { position: static; }
}

/* ---------- Controls ---------- */
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  color: var(--navy); border-radius: 999px; padding: .45rem 1rem; text-decoration: none; display: inline-block;
  transition: background-color .15s, border-color .15s, color .15s;
}
button:hover, .btn:hover { border-color: var(--navy); color: var(--navy); }
button.primary, .btn.primary { background: var(--sky); color: #fff; border-color: var(--sky); font-weight: 700; }
button.primary:hover, .btn.primary:hover { background: #33B1F9; border-color: #33B1F9; color: #fff; }
button.danger { color: var(--fail); }
button:disabled { opacity: .55; cursor: default; }
input[type=text], input[type=email], input[type=search], input[type=number], input:not([type]), select, textarea {
  font: inherit; font-weight: 500; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .45rem .6rem; width: 100%; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sky); outline-offset: 0; border-color: var(--sky); }
textarea { resize: vertical; min-height: 2.4rem; }
label { display: block; font-size: .85rem; font-weight: 700; margin: .6rem 0 .2rem; }
.field-hint { font-weight: 500; color: var(--muted); }

.btn-group { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0 .85rem; }
.btn-group button { padding: .4rem .9rem; font-size: .88rem; }
.btn-group button[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-group button .count { opacity: .7; font-size: .8em; margin-left: .3rem; font-weight: 600; }
.group-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem;
}
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Result colours ---------- */
.r-Pass     { --c: var(--pass);    --cb: var(--pass-bg); }
.r-Fail     { --c: var(--fail);    --cb: var(--fail-bg); }
.r-Blocked  { --c: var(--blocked); --cb: var(--blocked-bg); }
.r-Not-run  { --c: var(--notrun);  --cb: var(--notrun-bg); }
.pill {
  display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px;
  background: var(--cb, var(--surface-2)); color: var(--c, var(--text)); white-space: nowrap;
}
.pill.retest { background: var(--retest-bg); color: var(--retest); }
.pill.sev-Critical, .pill.sev-High { background: var(--fail-bg); color: var(--fail); }
.pill.sev-Medium { background: var(--blocked-bg); color: var(--blocked); }
.pill.sev-Low { background: var(--notrun-bg); color: var(--muted); }

/* stacked progress bar */
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--notrun-bg); }
.bar span { display: block; height: 100%; }
.bar .b-Pass { background: var(--pass); }
.bar .b-Fail { background: var(--fail); }
.bar .b-Blocked { background: var(--blocked); }
.bar .b-Not-run { background: var(--notrun-bg); }
.counts { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .82rem; margin-top: .3rem; }
.counts .c::before {
  content: ""; display: inline-block; width: .6rem; height: .6rem; border-radius: 2px;
  background: var(--c); margin-right: .3rem; vertical-align: baseline;
}
.counts a { color: inherit; text-decoration: none; }
.counts a:hover { text-decoration: underline; }

/* ---------- Tests page ---------- */
details.help { margin-bottom: 1rem; background: var(--cream); border-color: #F0E3A8; }
details.help summary { cursor: pointer; font-weight: 600; }
details.help table { border-collapse: collapse; margin-top: .5rem; font-size: .88rem; width: 100%; }
details.help td, details.help th { border-top: 1px solid var(--border); padding: .35rem .4rem; text-align: left; vertical-align: top; }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: .5rem 0 1rem; }
.section-block { margin-top: 1.25rem; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem; margin-bottom: .4rem; }
.section-head h2 { margin: 0; }
.section-head .bar { width: 100%; }

.version-input { display: flex; align-items: center; gap: .25rem; margin: .25rem 0 .75rem; flex-wrap: wrap; }
.version-input input { width: 4.2rem; text-align: center; font-weight: 600; -moz-appearance: textfield; }
.version-input input::-webkit-outer-spin-button,
.version-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.version-input .v-prefix, .version-input .v-dot { font-weight: 700; color: var(--muted); }
.version-input .v-hint { margin-left: .5rem; color: var(--muted); }
.version-input.missing input { border-color: var(--fail); background: var(--fail-bg); }
.version-input.missing .v-hint { color: var(--fail); font-weight: 600; }

/* The whole card takes the result colour; Not run stays white. */
.test {
  background: var(--card-bg, var(--surface)); border: 1px solid var(--card-border, var(--border));
  border-left: 6px solid var(--c, var(--border));
  border-radius: var(--radius); padding: .75rem; margin: .5rem 0; scroll-margin-top: 90px;
  transition: background-color .2s;
}
.test.r-Pass    { --card-bg: var(--pass-card);    --card-border: var(--pass); }
.test.r-Fail    { --card-bg: var(--fail-card);    --card-border: var(--fail); }
.test.r-Blocked { --card-bg: var(--blocked-card); --card-border: var(--blocked); }
.test.r-Not-run { --card-bg: var(--surface);      --card-border: var(--border); }
.test .test-meta .pill:not(.retest) { background: var(--c); color: #fff; }
.test.r-Not-run .test-meta .pill:not(.retest) { background: var(--notrun-bg); color: var(--muted); }
.test.flash { outline: 3px solid var(--sky); outline-offset: 2px; }
.test-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.test-id { font-weight: 800; letter-spacing: .01em; color: var(--navy); }
.test-body { display: grid; grid-template-columns: 1fr; gap: .5rem; margin: .5rem 0; }
@media (min-width: 820px) { .test-body { grid-template-columns: 1fr 1fr; } }
.test-body .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.test-body p { margin: .15rem 0 0; }
.test-body a.ext { overflow-wrap: anywhere; }
.test-input { display: grid; grid-template-columns: 1fr; gap: .5rem; }
@media (min-width: 820px) { .test-input { grid-template-columns: 11rem 1fr; } }
.test-input select { font-weight: 600; color: var(--c, var(--text)); }
.test-meta { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; font-size: .82rem; color: var(--muted); margin-top: .4rem; }
.save-state { font-size: .82rem; }
.save-state.ok { color: var(--pass); }
.save-state.err { color: var(--fail); }
.save-state button { font-size: .78rem; padding: .1rem .45rem; margin-left: .3rem; }
.linkish { background: none; border: none; border-radius: 0; color: var(--link); padding: 0; text-decoration: underline; font-size: inherit; font-weight: 600; }
.linkish:hover { color: var(--sky); }
.no-issue { color: var(--fail); font-weight: 600; }
.history { margin-top: .5rem; font-size: .84rem; border-top: 1px dashed var(--border); padding-top: .4rem; }
.history div { padding: .2rem 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.data tr:hover td { background: var(--surface-2); }
@media (max-width: 719px) {
  table.stack thead { display: none; }
  table.stack tr { display: block; border-bottom: 1px solid var(--border); padding: .5rem 0; }
  table.stack td { display: flex; gap: .5rem; border: none; padding: .15rem 0; }
  table.stack td::before { content: attr(data-label); font-weight: 600; color: var(--muted); min-width: 7rem; font-size: .8rem; }
}

/* ---------- Dashboard ---------- */
.banner { border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; border: 1px solid; }
.banner.ready { background: var(--pass-bg); border-color: var(--pass); }
.banner.notready { background: var(--fail-bg); border-color: var(--fail); }
.banner h2 { margin: 0 0 .3rem; }
.banner ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem; text-decoration: none; color: var(--text); display: block; }
.tile .n { font-size: 1.6rem; font-weight: 700; color: var(--c, var(--text)); }
.tile .l { font-size: .8rem; color: var(--muted); }
.tile.blocker { border-color: var(--fail); background: var(--fail-bg); }
.matrix .acct { font-weight: 600; }
.matrix td.cell { min-width: 140px; }
.matrix td.cell a { text-decoration: none; color: inherit; display: block; }

/* ---------- Issue page ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--border); padding: .2rem 0 .7rem .8rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.timeline li.k-status_change::before { background: var(--accent); }
.timeline li.k-retest::before { background: var(--retest); }
.timeline .when { font-size: .8rem; color: var(--muted); }
.timeline .body { white-space: pre-wrap; }
.attachments { display: flex; flex-wrap: wrap; gap: .6rem; }
.attachments figure { margin: 0; width: 140px; font-size: .78rem; }
.attachments img, .attachments video { width: 140px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); }
.dev-panel { border-color: var(--sky); background: var(--mist); }
.pre { white-space: pre-wrap; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 15, 25, .5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 1rem 0; }
.modal { background: var(--surface); border-radius: var(--radius); width: min(680px, calc(100% - 32px)); padding: 1rem; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal .tabs { display: flex; gap: .3rem; margin-bottom: .5rem; }
.modal .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.issue-pick { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; margin-top: .5rem; }
.issue-pick button { display: block; width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--border); border-radius: 0; font-weight: 500; }

.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; font-weight: 600; padding: .55rem 1rem; border-radius: 6px; z-index: 60; max-width: calc(100% - 32px); font-size: .9rem; }
.toast.err { background: var(--fail); color: #fff; }

.center-box { max-width: 420px; margin: 12vh auto 0; }
.loading { color: var(--muted); padding: 2rem 0; text-align: center; }

/* ---------- Sign-in ---------- */
.signin-logo { display: block; width: min(260px, 80%); height: auto; margin: 0 auto 1.25rem; }
.signin-title { text-align: center; }
.signin-title h1 { margin-bottom: .2rem; }
.signin-title p { margin: 0 0 1rem; }
.powered { text-align: center; font-size: .78rem; color: var(--muted); margin-top: 1rem; }

@media (max-width: 600px) {
  .test { scroll-margin-top: 12px; } /* header isn't sticky on phones */
}
