/* OfficeWeather console. Warm paper and ink, one accent red — the screens supply
   the colour, the interface stays out of the way. */

:root {
  --surface: #fafaf8;
  --panel: #ffffff;
  --ink: #16171b;
  --muted: #6b6b66;
  --line: #e7e4dc;
  --brand: #e8413c;
  --brand-text: #c5302b;
  --ok: #1f8a54;
  --warn: #b8760a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 0.9em; }

/* ---------------------------------------------------------------- chrome */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 14px 28px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 17px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); display: inline-block; }
.topbar nav { display: flex; gap: 22px; }
.topbar nav a { color: var(--muted); font-weight: 500; }
.topbar nav a:hover { color: var(--ink); text-decoration: none; }

main { max-width: 1400px; margin: 0 auto; padding: 26px 28px 80px; }

.page-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; margin: 0; font-weight: 650; }
.back { margin-left: auto; font-size: 14px; }
.summary { margin: 0; display: flex; gap: 10px; align-items: center; }

h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em;
     color: var(--muted); margin: 28px 0 10px; font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.bad-text { color: var(--brand-text); }

/* ---------------------------------------------------------------- flashes */

.flashes { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
.flash.ok { border-left: 3px solid var(--ok); }
.flash.error { border-left: 3px solid var(--brand); }

/* ---------------------------------------------------------------- fleet grid */

.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: var(--ink); display: block; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: #cfc9bd; text-decoration: none; transform: translateY(-1px); }

.shot { position: relative; aspect-ratio: 16 / 9; background: #14151a; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot.big { aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.noshot {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #6a6a72; font-size: 13px; text-align: center; padding: 12px;
}

.meta { padding: 11px 13px; display: flex; flex-direction: column; gap: 2px; }
.meta strong { font-weight: 600; }
.meta .url { font-size: 12.5px; color: var(--muted); font-family: ui-monospace, Menlo, monospace;
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  position: absolute; top: 9px; right: 9px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: rgba(255,255,255,.94); color: var(--ink);
}
.badge.ok { background: rgba(31,138,84,.95); color: #fff; }
.badge.offline { background: rgba(107,107,102,.95); color: #fff; }
.badge.dark { background: rgba(232,65,60,.96); color: #fff; }
.badge.no-browser { background: rgba(184,118,10,.96); color: #fff; }
.page-head .badge { position: static; }

.pill { padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
        border: 1px solid var(--line); background: var(--panel); }
.pill.ok { color: var(--ok); border-color: rgba(31,138,84,.35); }
.pill.bad { color: var(--brand-text); border-color: rgba(232,65,60,.35); }

.empty { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
         padding: 40px; text-align: center; }
.empty h2 { text-transform: none; letter-spacing: 0; font-size: 19px; color: var(--ink); margin-top: 0; }
.empty pre { background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
             padding: 14px; overflow-x: auto; text-align: left; }

/* ---------------------------------------------------------------- detail */

.detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
.wide { margin-top: 34px; }

.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; font-weight: 500; color: var(--muted); padding: 5px 12px 5px 0;
         white-space: nowrap; vertical-align: top; font-size: 14px; }
.kv td { padding: 5px 0; word-break: break-word; font-size: 14px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

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

button, .stack input, .stack select, .stack textarea, .shell input, .inline-form input {
  font: inherit; border-radius: 8px; border: 1px solid var(--line);
}
button {
  padding: 8px 14px; background: var(--panel); color: var(--ink); cursor: pointer;
  transition: border-color .15s, background .15s;
}
button:hover { border-color: #c9c3b6; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 550; }
button.primary:hover { background: var(--brand-text); border-color: var(--brand-text); }
button.danger { color: var(--brand-text); }
button.danger:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
button.small-btn { font-size: 13px; padding: 6px 11px; margin-top: 22px; }

.stack { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.stack label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); }
.stack input, .stack select, .stack textarea { padding: 8px 11px; background: var(--panel); color: var(--ink); }
.stack textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 13.5px; line-height: 1.7; }
.stack button { align-self: flex-start; }

.shell { display: flex; gap: 8px; max-width: 760px; }
.shell input { flex: 1; padding: 8px 11px; font-family: ui-monospace, Menlo, monospace; }

.inline-form { display: flex; gap: 8px; margin-top: 18px; }
.inline-form input { padding: 8px 11px; min-width: 260px; }

.help { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius);
        background: var(--panel); padding: 12px 16px; }
.help summary { cursor: pointer; font-weight: 550; }
.help ul { margin: 12px 0 4px; padding-left: 20px; color: var(--muted); }
.help li { margin-bottom: 7px; }

/* ---------------------------------------------------------------- tables */

.list, .history { width: 100%; border-collapse: collapse; background: var(--panel);
                  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list th, .history th { text-align: left; font-size: 12.5px; text-transform: uppercase;
                        letter-spacing: 0.05em; color: var(--muted); font-weight: 600;
                        padding: 10px 14px; border-bottom: 1px solid var(--line); }
.list td, .history td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list tr:last-child td, .history tr:last-child td { border-bottom: none; }
.history pre { margin: 0; white-space: pre-wrap; word-break: break-word;
               max-height: 220px; overflow-y: auto; font-size: 12.5px; color: var(--muted); }

.status { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.status.done { color: var(--ok); }
.status.failed { color: var(--brand-text); }
.status.queued { color: var(--muted); }
.status.running { color: var(--warn); }

.screens { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.screens li { display: flex; align-items: center; gap: 9px; justify-content: space-between; }
.screens .badge { position: static; }

/* ---------------------------------------------------------------- fleet machine groups */

.machine-group { margin-bottom: 34px; }
.machine-group h2 { display: flex; align-items: baseline; gap: 12px; margin: 0 0 12px; }
.machine-count { font-size: 12.5px; font-weight: 600; letter-spacing: 0;
                 text-transform: none; color: var(--brand-text); }
.machine-count.all-on { color: var(--ok); }

/* ---------------------------------------------------------------- layout editor */

.editor { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
          gap: 28px; align-items: start; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } }

.preset-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.preset-row button { font-size: 13px; padding: 6px 11px; }

.canvas { position: relative; aspect-ratio: 16 / 9; background: #14151a;
          border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
          touch-action: none; }
.rgn { position: absolute; border: 1.5px solid rgba(255,255,255,.45); background: rgba(90,120,200,.28);
       cursor: move; display: flex; flex-direction: column; align-items: flex-start;
       justify-content: flex-start; gap: 2px; padding: 8px; overflow: hidden; user-select: none; }
.rgn.selected { border-color: var(--brand); background: rgba(232,65,60,.25); }
.rgn .tag { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
            color: #fff; background: rgba(0,0,0,.45); border-radius: 4px; padding: 2px 7px; }
.rgn .what { font-size: 11.5px; color: rgba(255,255,255,.85);
             font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
.rgn .handle { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px;
               cursor: nwse-resize; background:
                 linear-gradient(135deg, transparent 50%, rgba(255,255,255,.75) 50%); }

.inspector h2 { margin-top: 0; }
.inspector .pair { display: flex; gap: 10px; }
.inspector .pair label { flex: 1; display: flex; flex-direction: column; gap: 5px;
                         font-size: 14px; color: var(--muted); }
.inspector .pair input { padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px;
                         font: inherit; background: var(--panel); color: var(--ink); width: 100%; }

/* ---------------------------------------------------------------- remote control */

.shot.big img.controlling, img#shot.controlling { cursor: crosshair; }
.shot.big:has(img.controlling) { outline: 2px solid var(--brand); outline-offset: 2px; }
.rc-type { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.rc-type input[type="password"], .rc-type input[type="text"] {
  flex: 1; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: var(--panel); color: var(--ink);
}
.rc-show { display: flex; gap: 5px; align-items: center; white-space: nowrap; }
#rc-status { align-self: center; }

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

body.centred { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.signin {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 34px; width: min(380px, 92vw); display: flex; flex-direction: column; gap: 13px;
}
.signin h1 { font-size: 20px; margin: 0; display: flex; align-items: center; gap: 9px; }
.signin p { margin: 0 0 6px; }
.signin label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); }
.signin input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
                font: inherit; background: var(--surface); color: var(--ink); }
.signin button { margin-top: 6px; }
