/* GeoBox Link — app-specific additions on top of the starter design system.
   Only domain widgets live here (e-paper frame, slots, battery, chips). */

:root {
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #e6f5f3;
  --paper: #f4f1ea;
  --bezel: #d9d5cc;
}
@media (prefers-color-scheme: dark) {
  :root { --accent-soft: #0e2e2b; --bezel: #3a3833; }
}

.proto-banner {
  background: linear-gradient(90deg, #0f766e, #4f46e5);
  color: #fff; font-size: 12.5px; padding: 7px 16px; text-align: center;
}
.proto-banner a { color: #fff; text-decoration: underline; font-weight: 600; }
.proto-banner code { background: rgba(255,255,255,.15); padding: 1px 5px; border-radius: 4px; }

/* e-paper frame: what the box screen shows, pixel for pixel */
.epaper {
  display: inline-block; padding: 12px; background: var(--bezel); border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), var(--shadow); max-width: 100%;
}
.epaper img {
  display: block; width: 400px; max-width: 100%; height: auto; aspect-ratio: 4 / 3;
  background: var(--paper); image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 3px;
}
.epaper--sm { padding: 7px; border-radius: 8px; }
.epaper--sm img { width: 200px; }
.epaper__caption { font-size: 11.5px; color: var(--text-faint); margin-top: 8px; }
.epaper--blank { display: grid; place-items: center; width: 400px; max-width: 100%; aspect-ratio: 4/3; background: var(--paper); color: #888; font-size: 13px; border-radius: 3px; }
.epaper--sm .epaper--blank { width: 200px; font-size: 11px; }

/* status */
.dot { width: 9px; height: 9px; border-radius: 999px; background: var(--text-faint); display: inline-block; flex: 0 0 9px; }
.dot--online { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent); }
.dot--offline { background: var(--danger); }
.dot--waiting { background: var(--warning); }

.battery { position: relative; width: 34px; height: 14px; border: 1.5px solid var(--text-muted); border-radius: 3px; display: inline-block; vertical-align: middle; }
.battery::after { content: ""; position: absolute; right: -5px; top: 3px; width: 2.5px; height: 6px; background: var(--text-muted); border-radius: 1px; }
.battery i { position: absolute; left: 1.5px; top: 1.5px; bottom: 1.5px; background: var(--success); border-radius: 1px; }
.battery--low i { background: var(--danger); }
.battery--mid i { background: var(--warning); }

/* instrument slots */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.slot {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
  cursor: pointer; text-align: left; font-family: inherit; width: 100%;
}
.slot:hover { border-color: var(--border-strong); }
.slot .dot { background: var(--success); }
.slot--missing { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.slot--missing .dot { background: var(--danger); }
.slot small { margin-left: auto; font-weight: 500; opacity: .8; font-size: 11px; }

/* chips + tiles */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); background: var(--surface); cursor: pointer; font-family: inherit; }
.chip:hover { text-decoration: none; background: var(--surface-2); color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.tile img { width: 100%; height: auto; aspect-ratio: 4/3; border-radius: 6px; border: 1px solid var(--border); image-rendering: pixelated; background: var(--paper); }
.tile .card__body { padding: 14px 16px; }
.tile__title { font-weight: 650; margin: 10px 0 4px; }

/* misc */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 12px; }
.alert--danger { border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: var(--danger-soft); color: var(--danger); }
.alert--warning { border-color: color-mix(in srgb, var(--warning) 50%, transparent); background: var(--warning-soft); color: #92400e; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 14px; font-size: 13px; align-items: center; }
.kv dt { color: var(--text-muted); margin: 0; } .kv dd { margin: 0; font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend code { background: var(--surface-2); border: 1px solid var(--border); padding: 2px 7px; border-radius: 5px; font-size: 12px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 452px; gap: 18px; align-items: start; }
@media (max-width: 1040px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; align-items: baseline; }
.events li:last-child { border-bottom: 0; }
.events time { color: var(--text-faint); flex: 0 0 72px; font-size: 11.5px; }
.queue-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.queue-row:last-child { border-bottom: 0; }
.queue-row .pos { width: 22px; height: 22px; border-radius: 999px; background: var(--surface-2); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--text-muted); flex: 0 0 22px; }
.queue-row .btn--sm { padding: 3px 7px; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .select, .inline-form .input { width: auto; min-width: 160px; }
.stack > * + * { margin-top: 18px; }
.textarea--mono { font-family: var(--font-mono); font-size: 13px; min-height: 170px; }
.btn--danger-ghost { color: var(--danger); border-color: transparent; background: transparent; }
.btn--danger-ghost:hover { background: var(--danger-soft); }
.sidebar__brand .logo { background: linear-gradient(135deg, #0f766e, #0ea5e9); }

/* ── Mobile discipline: no horizontal overflow at phone widths ─────────── */
.main, .content, .card, .grid > *, .kv, .topbar__title { min-width: 0; }
.epaper--blank { max-width: 100%; }
.box-row { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.box-row > .box-row__meta { flex: 1 1 180px; min-width: 0; }
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; height: auto; }
  .topbar__actions { flex-wrap: wrap; width: 100%; }
  .topbar__actions .inline-form { flex: 1 1 100%; }
  .topbar__actions .inline-form .input { flex: 1 1 120px; min-width: 0; }
  .grid--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .stat__value { font-size: 24px; }
  .epaper--sm img { width: 160px; }
  .epaper--sm .epaper--blank { width: 160px; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-form .select, .inline-form .input { min-width: 0; flex: 1 1 140px; }
  .queue-row { flex-wrap: wrap; }
  .table { display: block; overflow-x: auto; }
  .chips { gap: 5px; }
}
@media (max-width: 420px) {
  .grid--stats { grid-template-columns: minmax(0, 1fr); }
  .card__head { flex-wrap: wrap; gap: 6px; }
}
