/*
 * console.css — the RMM console look, modelled on the ScreenConnect host portal:
 * a dark icon rail, a group panel, a dense centre list and a detail pane with a
 * vertical tab strip. Tokens first; components after. Layout utilities come from Tailwind.
 */
:root {
  --rail: #1b1b1b;
  --groups: #252525;
  --list: #1e1e1e;
  --detail: #2b2b2b;
  --strip: #262626;
  --raised: #333333;
  --row-hover: #2a2a2a;
  --row-selected: #3a3a3a;
  --group-selected: #5a5a5a;
  --line: #353535;
  --field-line: #6e6e6e;
  --ink: #eeeeee;
  --ink-2: #c4c4c4;
  --ink-3: #9a9a9a;
  --primary: #026ccf;
  --primary-hover: #0b7be0;
  --link: #4ea3ff;
  --online: #34c759;
  --offline: #6b6b6b;
  --danger: #ff6b6b;
  --radius: 4px;
  color-scheme: dark;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--list);
  color: var(--ink);
  font-family: Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars: thin and quiet, like the reference */
* { scrollbar-width: thin; scrollbar-color: #4a4a4a transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #4a4a4a; border-radius: 4px; }

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

/* ---------- Rail ---------- */
.rail { background: var(--rail); }
.rail-logo { background: var(--primary); color: #fff; }
.rail-item {
  color: var(--ink-2); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-size: 12px; text-decoration: none; position: relative; min-height: 64px;
}
.rail-item:hover { color: #fff; background: #242424; }
.rail-item[aria-current="page"] { color: #fff; background: #2d2d2d; }
.rail-item[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary);
}
.rail-foot { background: #262626; border-radius: 999px; }
.rail-btn { color: var(--ink-2); width: 44px; height: 44px; display: grid; place-items: center; border-radius: 999px; }
.rail-btn:hover { color: #fff; background: #333; }
.avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 500; }

/* ---------- Group panel ---------- */
.groups { background: var(--groups); }
.panel-title { font-size: 24px; font-weight: 400; letter-spacing: 0; color: #fff; }
.panel-desc { color: var(--ink); font-size: 13px; line-height: 1.45; }
.group-row {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; padding: 7px 12px 7px 18px;
  border-radius: 2px; color: var(--ink-2); font-size: 14px; min-height: 34px;
}
.group-row:hover { background: #2f2f2f; color: #fff; }
.group-row[aria-selected="true"] { background: var(--group-selected); color: #fff; font-weight: 500; }
.group-row .count { margin-left: auto; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.group-row[aria-selected="true"] .count { color: #fff; }
.group-row.is-site { padding-left: 40px; font-size: 13px; min-height: 30px; }
.group-label { padding: 14px 18px 4px; font-size: 12px; color: var(--ink-3); }
.chev { width: 16px; height: 16px; flex-shrink: 0; transition: transform 150ms ease-out; color: var(--ink-3); }
.chev.open { transform: rotate(90deg); }

/* ---------- Buttons and fields ---------- */
.btn-primary {
  background: var(--primary); color: #fff; font-weight: 500; font-size: 14px; border-radius: var(--radius);
  min-height: 34px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-quiet {
  background: #3a3a3a; color: var(--ink); font-size: 13px; border-radius: var(--radius);
  min-height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
}
.btn-quiet:hover { background: #474747; }
.tool {
  color: var(--ink); display: inline-flex; align-items: center; gap: 6px; font-size: 14px;
  min-height: 34px; padding: 0 8px; border-radius: var(--radius);
}
.tool:hover:not(:disabled) { background: #2d2d2d; color: #fff; }
.tool:disabled { opacity: .4; cursor: not-allowed; }
.link { color: var(--link); }
.link:hover { text-decoration: underline; }
.field {
  width: 100%; background: transparent; border: 1px solid var(--field-line); border-radius: 2px; color: #fff;
  font-size: 14px; min-height: 34px; padding: 0 10px;
}
.field::placeholder { color: var(--ink-3); }
.field:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 1px var(--link); }
.field:disabled { opacity: .45; }
select.field { background: var(--detail); }
.search-pill {
  width: 100%; border: 1px solid var(--field-line); border-radius: 999px; background: transparent; color: #fff;
  min-height: 34px; padding: 0 34px 0 36px; font-size: 13px;
}
.search-pill::placeholder { color: var(--ink-3); }
.search-pill:focus { outline: none; border-color: var(--link); }
.err { color: var(--danger); font-size: 12px; }

/* ---------- Centre list ---------- */
.list { background: var(--list); }
.list-head { border-bottom: 1px solid var(--line); }
.list-title { font-size: 20px; font-weight: 400; color: #fff; }
.mrow {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center; width: 100%;
  text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); min-height: 64px;
}
.mrow:hover { background: var(--row-hover); }
.mrow[aria-selected="true"] { background: var(--row-selected); }
.mrow .name { font-size: 16px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .meta { font-size: 11px; color: var(--ink); line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .meta b { font-weight: 500; }
.dot { width: 10px; height: 10px; border-radius: 999px; background: var(--offline); }
.dot.on { background: var(--online); }
.state { text-align: right; min-width: 96px; font-size: 11px; color: var(--ink-2); }
.state .bar { height: 3px; border-radius: 2px; background: #4a4a4a; margin-top: 4px; }
.state.on { color: #b8f5c8; }
.state.on .bar { background: var(--online); }
.badge-ok { color: #b8f5c8; font-family: ui-monospace, Consolas, monospace; font-size: 11px; }
.badge-bad { color: var(--danger); font-size: 11px; }

/* ---------- Detail pane ---------- */
.detail { background: var(--detail); }
.detail-head { background: var(--list); }
.strip { background: var(--strip); }
.strip-tab { width: 42px; height: 40px; display: grid; place-items: center; color: var(--ink-2); position: relative; }
.strip-tab:hover { color: #fff; background: #303030; }
.strip-tab[aria-selected="true"] { color: #fff; background: var(--detail); }
.strip-tab[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.sec-head { display: flex; align-items: center; justify-content: space-between; font-size: 17px; color: #fff; padding-bottom: 6px; border-bottom: 1px solid #4a4a4a; }
.kv { display: grid; grid-template-columns: minmax(96px, 36%) 1fr; gap: 6px 12px; font-size: 13px; padding: 10px 0 18px; }
.kv dt { color: var(--ink); font-weight: 500; }
.kv dd { color: var(--ink); margin: 0; word-break: break-word; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* ---------- Dialog ---------- */
.dialog-backdrop { background: rgba(0, 0, 0, .62); }
.dialog { background: var(--detail); box-shadow: 0 20px 60px rgba(0, 0, 0, .55); border-radius: 2px; }
.dialog-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; align-items: center; }
.code-box { background: #161616; border: 1px solid var(--line); color: #b8f5c8; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* ---------- Responsive shells ---------- */
.slide { transition: transform 200ms ease-out, opacity 200ms ease-out; }
@media (prefers-reduced-motion: reduce) { .slide, .chev { transition: none; } }

@media (max-width: 767px) {
  .rail-item { min-height: 56px; }
  .rail-item[aria-current="page"]::before { top: auto; right: 0; bottom: 0; width: auto; height: 3px; }
  .mrow { min-height: 64px; }
  .group-row, .tool, .btn-primary, .btn-quiet, .field, .search-pill, .strip-tab { min-height: 44px; }
  .kv { grid-template-columns: 120px 1fr; }
  .dialog-grid { grid-template-columns: 1fr; gap: 4px; }
}
