:root {
  --bg: #f5f6f4;
  --card: #ffffff;
  --ink: #1d2125;
  --muted: #5f666e;
  --line: #e1e4e0;
  --green: #1f8a4c;
  --green-soft: #e3f4ea;
  --red: #c0392b;
  --red-soft: #fbe6e3;
  --amber: #b26a00;
  --amber-soft: #fdf1dc;
  --accent: #1f6f5c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.with-captions { padding-bottom: 150px; }
main { max-width: 1100px; margin: 0 auto; padding: 20px; }
h1 { font-size: 26px; margin: 8px 0 16px; }
h2 { font-size: 19px; margin: 24px 0 10px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.small { font-size: 14px; }

/* Header */
header.top {
  display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line);
}
header.top .brand { font-weight: 700; }
header.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
header.top nav a { padding: 6px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); }
header.top nav a.active { background: var(--green-soft); color: var(--accent); font-weight: 600; }
.demo-badge { font-size: 12px; font-weight: 600; color: var(--amber); background: var(--amber-soft); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.who { font-size: 14px; color: var(--muted); }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

/* Cards, grid, tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
tr.hidden-item td { color: var(--muted); font-style: italic; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.grey { background: #eceeec; color: var(--muted); }

button.primary, button.secondary, button.danger {
  font: inherit; font-weight: 600; border-radius: 8px; padding: 10px 16px; cursor: pointer; border: 1px solid transparent;
}
button.primary { background: var(--accent); color: #fff; }
button.secondary { background: var(--card); color: var(--accent); border-color: var(--accent); }
button.danger { background: var(--red); color: #fff; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
input[type="text"], input[type="password"], textarea {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
textarea { min-height: 80px; }

/* Health screen */
.status-hero { display: flex; align-items: center; gap: 22px; padding: 22px; border-radius: 14px; margin-bottom: 14px; }
.status-hero.up { background: var(--green-soft); border: 2px solid var(--green); }
.status-hero.down { background: var(--red-soft); border: 2px solid var(--red); }
.status-dot { width: 74px; height: 74px; border-radius: 50%; flex: none; }
.status-hero.up .status-dot { background: var(--green); }
.status-hero.down .status-dot { background: var(--red); }
.status-text { font-size: 34px; font-weight: 800; line-height: 1.1; }
.status-sub { font-size: 18px; color: var(--muted); }
.clock { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.clock .time { font-size: 32px; font-weight: 700; }
.metric .label { font-size: 13px; color: var(--muted); }
.metric .value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric .detail { font-size: 14px; color: var(--muted); }

/* Control panel */
.action-card { display: flex; flex-direction: column; gap: 8px; }
.action-card p { margin: 0; color: var(--muted); font-size: 15px; }
.running-banner { padding: 12px 16px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-weight: 700; margin-bottom: 12px; }

/* Field (phone) view */
.field main { max-width: 640px; padding: 12px; }
.netbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 700; }
.netbar.online { background: var(--green-soft); color: var(--green); }
.netbar.offline { background: var(--amber-soft); color: var(--amber); }
.job { display: block; text-decoration: none; color: inherit; margin-bottom: 10px; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos figure { margin: 0; width: 120px; }
.photos img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.photos figcaption { font-size: 12px; color: var(--muted); }
.note { border-left: 3px solid var(--line); padding: 4px 10px; margin: 8px 0; }
.note.pending { border-left-color: var(--amber); }
.pending-tag { font-size: 12px; font-weight: 700; color: var(--amber); }
pre.preview { background: #1d2125; color: #e9f5ee; padding: 12px; border-radius: 8px; overflow: auto; font-size: 13px; }

/* Caption bar for the recorded video: always at the BOTTOM of the screen */
#caption-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: rgba(15, 18, 20, 0.92); color: #fff; padding: 14px 28px 18px; text-align: center;
}
#caption-bar .chapter { font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; color: #9fd8bd; margin-bottom: 4px; }
#caption-bar .text { font-size: 28px; font-weight: 600; line-height: 1.3; max-width: 1200px; margin: 0 auto; }
#caption-bar .hint { font-size: 12px; color: #8a9096; margin-top: 6px; }
@media (max-width: 700px) {
  #caption-bar .text { font-size: 19px; }
  .status-text { font-size: 26px; }
  .clock .time { font-size: 22px; }
}
