/* tibia-vnc's palette (tibia_engine/vnc/style.py), so Clinic reads like the
   viewer the operators already use. */
:root {
  --bg: #0b0d10;
  --panel: #11151b;
  --panel-2: #161b22;
  --line: #20252d;
  --text: #c9d1d9;
  --title: #e6edf3;
  --muted: #8b949e;
  --heading: #61707e;
  --accent: #4fd0c9;
  --blue: #79c0ff;
  --healthy: #3fb950;
  --captcha: #a371f7;
  --stopped: #f85149;
  --disabled: #6e7681;
  --no_signal: #4c7dff; /* blue, not tibia-vnc's faded red: reads apart from Stopped */
  --human_assistance: #d29922;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: var(--blue); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.err { color: var(--stopped); min-height: 1em; margin: 6px 0; }
h2 { color: var(--title); font-size: 15px; font-weight: 600; margin: 0 0 2px; }
h3 { color: var(--heading); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin: 14px 0 6px; }

.top { display: flex; align-items: center; gap: 20px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: #0c0f14; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--title); font-weight: 600; font-size: 15px; }
.top nav { display: flex; gap: 4px; }
.top nav a { color: var(--muted); padding: 4px 10px; border-radius: 6px; }
.top nav a.on, .top nav a:hover { color: var(--title); background: var(--panel-2); }
.me { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.me img { border-radius: 50%; }
.me form { margin: 0; }

main { max-width: 1280px; margin: 0 auto; padding: 16px 20px 60px; }

.btn { font: inherit; font-size: 13px; color: var(--title); background: var(--panel-2); border: 1px solid #30363d; border-radius: 6px; padding: 6px 12px; cursor: pointer; display: inline-block; }
.btn:hover { border-color: #484f58; }
.btn.primary { background: #1f6f43; border-color: #2a8a55; }
.btn.primary:hover { background: #238651; }
.btn.sm { font-size: 12px; padding: 3px 9px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--title); }
.btn:disabled { opacity: .5; cursor: default; }
button.link { font: inherit; background: none; border: 0; color: var(--blue); cursor: pointer; padding: 0; }

.filters { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.filters input { flex: 1; min-width: 0; max-width: 420px; font: inherit; color: var(--title); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
.stamp { margin-left: auto; color: var(--heading); font-size: 12px; }

.summary { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 18px; }
.totals { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; color: var(--muted); }
.totals b { color: var(--title); font-size: 20px; font-weight: 600; }
.bar { display: flex; height: 8px; gap: 2px; border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.bar span { min-width: 3px; }
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.tile { font: inherit; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text); cursor: pointer; }
.tile:hover { border-color: #30363d; }
.tile.on { border-color: var(--blue); }
.tile .dot { width: 9px; height: 9px; border-radius: 50%; }
.tile .name { color: var(--muted); font-size: 12.5px; }
.tile .n, .tile .pct { font-variant-numeric: tabular-nums; }
.tile .n { display: block; grid-column: 2; grid-row: 2; color: var(--title); font-size: 20px; font-weight: 600; }
.tile .pct { grid-column: 2; grid-row: 2; justify-self: end; color: var(--muted); font-size: 12px; }

.c-healthy { --c: var(--healthy); }
.c-captcha { --c: var(--captcha); }
.c-stopped { --c: var(--stopped); }
.c-disabled { --c: var(--disabled); }
.c-no_signal { --c: var(--no_signal); }
.c-human_assistance { --c: var(--human_assistance); }
.bar span, .dot, .pips i { background: var(--c); }

/* Tinted pill: the colour faint behind, light in front. */
.pill { display: inline-block; font-size: 12px; font-weight: 500; line-height: 1; padding: 5px 11px; border-radius: 999px; white-space: nowrap; background: color-mix(in srgb, var(--c) 24%, var(--bg)); color: color-mix(in srgb, var(--c) 55%, #fff); }
.pill.c-disabled { background: color-mix(in srgb, var(--c) 30%, var(--bg)); color: color-mix(in srgb, var(--c) 40%, #fff); }
td.st .live { display: block; color: var(--heading); font-size: 11.5px; margin: 3px 0 0 4px; }

.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { font: inherit; font-size: 13px; color: var(--muted); background: transparent; border: 0; border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.seg button:hover { color: var(--title); }
.seg button.on { color: var(--title); background: var(--panel-2); box-shadow: inset 0 0 0 1px #30363d; }

table.sortable th[data-col] { cursor: pointer; user-select: none; white-space: nowrap; }
table.sortable th[data-col]:hover { color: var(--text); }
table.sortable th[data-col]::after { content: ""; display: inline-block; width: 1em; margin-left: 2px; font-size: 9px; }
table.sortable th.asc::after { content: "\25B2"; }
table.sortable th.desc::after { content: "\25BC"; }
.whgroup.hide { display: none; }

.list { margin-bottom: 26px; }
.list h2 .count { color: var(--muted); font-weight: 400; margin-left: 4px; }
.list > p.small { margin: 0 0 8px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--heading); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #0c0f14; }
td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.srv { color: var(--title); font-family: ui-monospace, Consolas, monospace; font-size: 13px; white-space: nowrap; }
td.host { color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; white-space: nowrap; }
td.why { width: 100%; word-break: break-word; }
td.for { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
td.acts { white-space: nowrap; text-align: right; }
.who { display: block; color: var(--heading); font-size: 12px; }
.fixed td.why { color: var(--accent); }
.empty { color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; padding: 14px; margin: 0; }
tr.hide, .hostcard.hide { display: none; }

.hosts .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.hostcard { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.hl { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.pips { display: flex; gap: 3px; }
.pips i { width: 9px; height: 13px; border-radius: 2px; }
.pips i.fx { outline: 1.5px solid var(--accent); outline-offset: 1px; }

dialog { background: var(--panel); color: var(--text); border: 1px solid #30363d; border-radius: 10px; padding: 18px; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h2 { font-size: 16px; }
dialog label { display: block; color: var(--muted); font-size: 12.5px; margin: 10px 0 4px; }
.prefixed { display: flex; align-items: flex-start; background: var(--bg); border: 1px solid #30363d; border-radius: 6px; }
.prefixed span { padding: 8px 0 8px 10px; color: var(--accent); white-space: nowrap; }
.prefixed span:empty { display: none; }
dialog textarea { flex: 1; font: inherit; color: var(--title); background: transparent; border: 0; padding: 8px 10px; resize: vertical; outline: none; }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
#hist { width: min(900px, calc(100vw - 32px)); max-height: 80vh; }
.hist-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
table.history td.ts { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.history del { color: var(--muted); display: block; }
.act { font-size: 12px; font-weight: 600; white-space: nowrap; }
.a-disable { color: var(--stopped); }
.a-fix { color: var(--accent); }
.a-enable { color: var(--healthy); }
.a-edit { color: var(--muted); }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid #30363d; border-radius: 8px; padding: 9px 14px; color: var(--title); opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; }

.login { max-width: 360px; margin: 12vh auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.login h1 { color: var(--title); margin: 8px 0 0; font-size: 24px; }
.login .btn { margin-top: 14px; padding: 9px 18px; font-size: 14px; background: #5865f2; border-color: #5865f2; }
.login .btn:hover { background: #4752c4; }

@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .filters { flex-wrap: wrap; }
  .filters input { flex-basis: 100%; max-width: none; }
  .stamp { margin-left: 0; }
  .top { padding: 10px 16px; gap: 12px; }
  .me span { display: none; }
  main { padding: 12px 16px 60px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  table, thead, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--line); padding: 8px 10px; display: grid; grid-template-columns: auto auto auto 1fr; grid-auto-flow: row dense; gap: 4px 10px; align-items: center; }
  tr:last-child { border-bottom: 0; }
  td { border: 0; padding: 0; }
  td.why { grid-column: 1 / -1; }
  td.for { grid-row: 1; grid-column: 4; justify-self: end; }
  td.acts { grid-column: 1 / -1; text-align: left; }
}
