/* Hydra Fleet — HydraSystem house style: red #c0392b on dark #1a1a1a, Segoe UI.
   Same palette as the user manuals, the firmware portal and the HRS panel. */

:root {
  --red: #c0392b;
  --red-dark: #a5312455;
  --dark: #1a1a1a;
  --dark-2: #262626;
  --green: #27ae60;
  --orange: #e67e22;
  --grey: #6b7280;
  --line: #e2e2e2;
  --bg: #f4f5f6;
  --card: #ffffff;
  --text: #22252a;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .06);
}

* { box-sizing: border-box; }

/* The browser's own [hidden] rule is display:none, but ANY author rule that
   sets display beats it — .app is display:flex, label.f is display:block — so
   elements marked hidden were rendering anyway: the terminal list showed under
   the login card, and the name field showed while logging in. Author-level and
   !important, so marking something hidden actually hides it. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
}

a { color: var(--red); }

/* ── top bar ───────────────────────────────────────────────────────────── */
header.bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--dark);
  color: #fff;
  padding: .55rem 1rem;
  border-bottom: 3px solid var(--red);
}
header.bar .brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: .5rem;
}
header.bar .brand span.dot {
  width: .7rem; height: .7rem; border-radius: 50%;
  background: var(--red);
}
header.bar .spacer { flex: 1; }
header.bar a, header.bar .who {
  color: #d9d9d9;
  text-decoration: none;
  font-size: .9rem;
}
header.bar a:hover { color: #fff; }
header.bar .lang a.on { color: #fff; font-weight: 700; }

/* ── layout ────────────────────────────────────────────────────────────── */
.app {
  display: flex;
  height: calc(100% - 3.1rem);
  min-height: 0;
}
aside {
  width: 22rem;
  min-width: 18rem;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
aside .head {
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
aside .list { overflow-y: auto; flex: 1; }
main { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }

/* ── terminal list ─────────────────────────────────────────────────────── */
.term {
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  gap: .6rem;
  align-items: flex-start;
}
.term:hover { background: #fafafa; }
.term.sel { background: #fdeceb; border-left: 3px solid var(--red); padding-left: calc(.9rem - 3px); }
.term .pip {
  width: .6rem; height: .6rem; border-radius: 50%;
  background: var(--grey); margin-top: .35rem; flex: none;
}
.term.on .pip { background: var(--green); box-shadow: 0 0 0 3px rgba(39, 174, 96, .18); }
.term .nm { font-weight: 600; }
.term .sub { color: var(--grey); font-size: .8rem; margin-top: .1rem; }
.term .quick { font-size: .8rem; color: #444; margin-top: .25rem; }
.term .quick b { font-weight: 600; }

.empty { padding: 2rem 1.2rem; color: var(--grey); text-align: center; }
.empty p { margin: .4rem 0; }

/* ── buttons ───────────────────────────────────────────────────────────── */
button, .btn {
  font: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: .45rem .85rem;
  cursor: pointer;
  background: var(--red);
  color: #fff;
  font-weight: 600;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: default; filter: none; }
button.ghost, .btn.ghost {
  background: transparent; color: var(--text); border-color: var(--line);
  font-weight: 500;
}
button.ghost:hover { background: #f0f0f0; }
button.small { padding: .25rem .55rem; font-size: .82rem; }
button.danger { background: #fff; color: var(--red); border-color: var(--red); }
button.danger:hover { background: var(--red); color: #fff; }

/* ── detail panel ──────────────────────────────────────────────────────── */
.panel {
  position: absolute;
  top: .75rem; right: .75rem; bottom: .75rem;
  width: 25rem; max-width: calc(100% - 1.5rem);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column;
  z-index: 500;
  overflow: hidden;
}
.panel .ph {
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem .9rem;
  background: var(--dark); color: #fff;
}
.panel .ph .nm { font-weight: 700; flex: 1; }
.panel .ph button { background: transparent; color: #ccc; padding: .2rem .4rem; }
.panel .pb { overflow-y: auto; padding: .9rem; flex: 1; }
.panel h3 {
  margin: 1.1rem 0 .5rem; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .6px; color: var(--grey);
}
.panel h3:first-child { margin-top: 0; }

.badge {
  display: inline-block; padding: .1rem .45rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
}
.badge.on { background: rgba(39, 174, 96, .15); color: #1e7e45; }
.badge.off { background: rgba(107, 114, 128, .15); color: var(--grey); }

/* readouts */
.vals { display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; }
.vals .k { color: var(--grey); }
.vals .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.vals .v .u { color: var(--grey); font-weight: 400; font-size: .82em; margin-left: .15rem; }

/* checkbox list */
.fields { max-height: 14rem; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.fields label {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .6rem; cursor: pointer; font-size: .92rem;
}
.fields label:hover { background: #fafafa; }
.fields input { width: 1.05rem; height: 1.05rem; accent-color: var(--red); }
.hint { color: var(--grey); font-size: .82rem; margin: .3rem 0 .5rem; }

/* forms */
label.f { display: block; margin: .55rem 0; font-size: .88rem; color: #444; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  font: inherit; width: 100%;
  padding: .45rem .6rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--red-dark); border-color: var(--red); }
textarea { resize: vertical; min-height: 4.5rem; }
.row { display: flex; gap: .6rem; align-items: flex-end; }
.row > * { flex: 1; }
.row > .fit { flex: none; }

.note {
  padding: .6rem .75rem; border-radius: var(--radius);
  background: #fdf3e7; border: 1px solid #f0d3ae; color: #8a5416; font-size: .88rem;
}
.note.good { background: #eaf7f0; border-color: #bfe4cf; color: #1e7e45; }
.note.bad { background: #fdecea; border-color: #f3c4be; color: #a5312b; }

/* credential card */
.creds { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.creds .cr {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .6rem; border-bottom: 1px solid var(--line);
}
.creds .cr:last-child { border-bottom: 0; }
.creds .cr .k { width: 7.5rem; color: var(--grey); font-size: .85rem; flex: none; }
.creds .cr .v {
  flex: 1; font-family: 'Cascadia Mono', Consolas, monospace; font-size: .9rem;
  word-break: break-all;
}

/* ── centred card pages (login, admin) ─────────────────────────────────── */
.wrap { max-width: 62rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.2rem; margin-bottom: 1.2rem;
}
.card h2 { margin: 0 0 .2rem; font-size: 1.15rem; }
.card .sub { color: var(--grey); font-size: .88rem; margin-bottom: .9rem; }
.narrow { max-width: 26rem; margin: 3rem auto; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th {
  text-align: left; background: var(--dark-2); color: #fff;
  padding: .45rem .6rem; font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .4px;
}
td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: #fafafa; }
.mono { font-family: 'Cascadia Mono', Consolas, monospace; font-size: .86rem; }
.right { text-align: right; }

.tabs { display: flex; gap: .3rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a {
  padding: .4rem .8rem; border-radius: var(--radius);
  text-decoration: none; color: var(--text); background: #e9eaec; font-size: .9rem;
}
.tabs a.on { background: var(--red); color: #fff; font-weight: 600; }

/* ── map vehicle marker ────────────────────────────────────────────────── */
.veh { transition: transform .4s linear; }
.veh-label {
  background: rgba(26, 26, 26, .85); color: #fff;
  padding: .1rem .4rem; border-radius: 4px;
  font-size: .75rem; white-space: nowrap;
  transform: translateY(-.2rem);
}
.leaflet-container { background: #dfe3e6; font: inherit; }

/* ── responsive ────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .app { flex-direction: column; height: auto; }
  aside { width: 100%; min-width: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  aside .list { max-height: 40vh; }
  main { height: 60vh; min-height: 20rem; }
  .panel { top: auto; left: .5rem; right: .5rem; bottom: .5rem; width: auto; max-height: 70%; }
}
