/* AR-AT5000 test telemetry panel, in the display's Field Terminal look
   (ar-at5000-tablet qml/: Theme.qml colours and geometry, ChamferBox,
   Panel, NavBar, StatusBar, Tag, InfoRow). One file for every page; no
   inline styles (the pages' CSP forbids them). */

:root {
  /* Theme.qml */
  --bg: #0e1216;
  --panel: #1c2229;
  --raised: #242c35;
  --pressed: #303b46;
  --line: #354a63;
  --line-bright: #5a7290;
  --ghost: #2b3540;
  --text: #eef2f5;
  --label: #a3b1bf;
  --dim: #6b7784;
  --accent: #009bd9;
  --ink: #0e1216;
  --caution: #ffb236;
  --critical: #ff3b30;
  /* On the tablet Qt draws every label with Droid Sans; the nearest faces. */
  --face: "Droid Sans", "Noto Sans", "Open Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: 12px;
  --pad: 16px;
  --stroke: 2px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 16px/1.4 var(--face);
}
a { color: var(--accent); }

/* ---- ChamferBox: top-left and bottom-right corners cut, 2 px outline --- */
/* The element is the outline; ::before is the fill, inset by the stroke.
   On a 45 degree cut the inset fill's cut is 0.59 x stroke shorter. */

.chamfer {
  --cut: 16px;
  --fill: var(--panel);
  --edge: var(--line);
  position: relative; isolation: isolate; background: var(--edge);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)),
                     calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}
.chamfer::before {
  --inner: calc(var(--cut) - 1.17px);
  content: ""; position: absolute; inset: var(--stroke); z-index: -1;
  background: var(--fill);
  clip-path: polygon(var(--inner) 0, 100% 0, 100% calc(100% - var(--inner)),
                     calc(100% - var(--inner)) 100%, 0 100%, 0 var(--inner));
}

/* ---- StatusBar: nameplate, boxed fields, ruler ------------------------ */

.statusbar {
  position: relative; display: flex; align-items: center; gap: var(--gutter);
  min-height: 64px; padding: 10px var(--gutter) 18px; background: var(--panel);
}
.statusbar::after {                     /* ruler: line, ticks every 20 px, long every 100 px */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px;
  background:
    linear-gradient(var(--line), var(--line)) left bottom / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 100px) left bottom / 100% 8px no-repeat,
    repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 20px) left bottom / 100% 4px no-repeat;
}
.nameplate {
  --cut: 12px; --fill: var(--bg);
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 128px; height: 44px;
}
.nameplate img { height: 24px; width: auto; display: block; }
.product {
  display: flex; flex-direction: column; justify-content: center; margin-right: auto;
  text-transform: uppercase; line-height: 1.15;
}
.product b { font-size: 19px; letter-spacing: 2px; }
.product span { color: var(--label); font-size: 13px; font-weight: 700; letter-spacing: 2px; }

.fields { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.field {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  border: var(--stroke) solid var(--line); color: var(--label);
  font-size: 14px; text-transform: uppercase; letter-spacing: 1px;
}
.field b { color: var(--text); font-size: 15px; text-transform: none; letter-spacing: .5px; }

/* ---- page layout: soft-key rail and the plates ------------------------ */

.layout { display: flex; align-items: flex-start; gap: var(--gutter); padding: var(--gutter); }
.rail { display: flex; flex-direction: column; gap: 6px; width: 128px; flex: none; }
main { flex: 1; min-width: 0; display: grid; gap: var(--gutter); }
.plates { display: grid; gap: var(--gutter); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) {
  .plates { grid-template-columns: 3fr 2fr; }
}

/* NavBar keys: number top left, index rule top right, full name centred. */
.key {
  --cut: 12px;
  display: flex; align-items: flex-end; justify-content: center;
  height: 96px; padding: 0 8px 18px; color: var(--text); text-decoration: none;
  font-weight: 700; font-size: 16px; letter-spacing: 1px; text-transform: uppercase;
}
.key:hover { --fill: var(--pressed); }
.key .code {
  position: absolute; left: 16px; top: 8px; color: var(--accent); font-size: 15px;
}
.key::after {                            /* the short index rule */
  content: ""; position: absolute; right: 12px; top: 18px; width: 36px; height: 3px;
  background: var(--line);
}
.key[aria-current="page"] { --fill: var(--accent); --edge: var(--accent); color: var(--ink); }
.key[aria-current="page"] .code { color: var(--ink); }
.key[aria-current="page"]::after { background: var(--ink); }
.key:focus-visible { outline: none; --edge: var(--text); }

/* ---- Panel: "// TITLE", tag on the right, rule with a blue lead-in ----- */

.panel { padding: 0 var(--pad) var(--pad); min-width: 0; }
.panel-head {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 46px; margin-bottom: var(--gutter); border-bottom: 1px solid var(--line);
}
.panel-head::after {
  content: ""; position: absolute; left: 0; bottom: -1px; width: 36px; height: 3px;
  background: var(--accent);
}
.panel.stale .panel-head::after { background: var(--caution); }
.panel-head h2 {
  margin: 0 auto 0 6px; color: var(--label); font-size: 16px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
}
.panel-head h2 .slashes { color: var(--line-bright); margin-right: 6px; }
.panel p { margin: 0 0 10px; color: var(--label); }
.note, .panel p.note { color: var(--dim); font-size: 14px; margin: 14px 0 0; }

/* Tag: boxed label for units, states and flags. */
.tag {
  display: inline-flex; align-items: center; flex: none; height: 28px; padding: 0 8px;
  border: var(--stroke) solid var(--label); color: var(--label);
  font-size: 14px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  white-space: nowrap;
}
.tag.accent { border-color: var(--accent); color: var(--accent); }
.tag.caution { border-color: var(--caution); color: var(--caution); }
.tag.white { border-color: var(--text); color: var(--text); }
.tag.filled.caution { background: var(--caution); color: var(--ink); }
.tag.filled.accent { background: var(--accent); color: var(--ink); }

/* InfoRow: label left, value right. */
.rows { display: grid; gap: 2px; margin-bottom: var(--pad); }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; min-height: 30px; }
.row span:first-child { color: var(--label); text-transform: uppercase; letter-spacing: 1px; font-size: 15px; }
.row span:last-child { font-weight: 700; text-align: right; }

/* Empty state, as "NO ACTIVE ALARMS // ALL CLEAR". */
.empty { display: grid; place-items: center; gap: 10px; min-height: 220px; text-align: center; padding: 20px 8px; }
.empty b { color: var(--label); font-size: 20px; letter-spacing: 2px; text-transform: uppercase; }
.empty span { color: var(--dim); font-size: 15px; letter-spacing: 1px; text-transform: uppercase; }
.empty p { max-width: 460px; color: var(--dim); font-size: 14px; margin: 6px 0 0; }

/* ---- forms ------------------------------------------------------------ */

form { display: grid; gap: 14px; }
label {
  display: grid; gap: 6px; color: var(--label);
  font-size: 14px; letter-spacing: 1px; text-transform: uppercase;
}
label small { text-transform: none; letter-spacing: 0; color: var(--dim); font-size: 13px; }
input, select {
  width: 100%; min-height: 44px; padding: 9px 12px;
  background: var(--bg); color: var(--text); border: var(--stroke) solid var(--line);
  border-radius: 0; font: 16px/1.2 var(--face); letter-spacing: 0; text-transform: none;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.with-button { display: flex; gap: 8px; }
.with-button input { flex: 1; min-width: 0; }
.with-button button { flex: none; }

/* Keys: boxed like the display's selectors; a chosen or main action is a
   solid accent plate with dark text. */
button {
  min-height: 44px; padding: 0 16px; cursor: pointer;
  background: var(--raised); color: var(--text); border: var(--stroke) solid var(--line-bright);
  border-radius: 0; font: 700 15px/1 var(--face); letter-spacing: 1px; text-transform: uppercase;
}
button:hover { background: var(--pressed); }
button:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
button:disabled { opacity: .32; cursor: default; }
button:disabled:hover { background: var(--raised); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); }
button.primary:hover { background: #19aee8; }
button.danger { background: transparent; border-color: var(--critical); color: var(--critical); }
button.danger:hover { background: rgba(255, 59, 48, .14); }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.statusbar button { background: transparent; border-color: var(--line); color: var(--label); }
.statusbar button:hover { color: var(--text); background: var(--raised); }

.message {
  margin: 0; padding: 9px 12px; font-size: 15px; color: var(--text);
  border: var(--stroke) solid var(--critical); background: rgba(255, 59, 48, .12);
}
.message.ok { border-color: var(--accent); background: rgba(0, 155, 217, .12); }

/* ---- sign-in page ----------------------------------------------------- */

.signin { display: flex; justify-content: center; padding: 48px var(--gutter) var(--gutter); }
.signin .panel { width: 100%; max-width: 440px; }
.signin form { margin-top: 4px; }

/* ---- users (admin) ---------------------------------------------------- */

.users { display: grid; gap: 10px; }
.user {
  display: grid; gap: 10px; padding: 12px; border: var(--stroke) solid var(--line);
  background: var(--raised);
}
.user-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.user-name { font-size: 18px; font-weight: 700; margin-right: 4px; }
.user.disabled .user-name { color: var(--dim); }
.user-meta { color: var(--dim); font-size: 14px; letter-spacing: 1px; text-transform: uppercase; }
.user-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.user-actions select { width: auto; min-width: 120px; }
.user form { padding-top: 10px; border-top: 1px solid var(--line); }

/* ---- narrow screens: the rail becomes a row of keys -------------------- */

@media (max-width: 700px) {
  .layout { flex-direction: column; align-items: stretch; }
  .rail { flex-direction: row; width: auto; }
  .key { flex: 1; height: 64px; padding-bottom: 10px; }
  .statusbar { flex-wrap: wrap; }
  .nameplate { width: 104px; height: 40px; }
  .nameplate img { height: 20px; }
  .fields { width: 100%; justify-content: stretch; }
  .fields .field { flex: 1; }
  .user-actions button, .user-actions select { flex: 1 1 auto; }
}
