:root {
  --desktop: #8f8f8f;
  --window: #d7d7d7;
  --ink: #111;
  --shadow: #555;
  --light: #fff;
  --accent: #111;
  --ok: #1f7a37;
  --bad: #a02c2c;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Geneva, Chicago, Arial, sans-serif; color: var(--ink); background: var(--desktop); }
button, input, select { font: inherit; }
.desktop { min-height: 100vh; padding: 20px; display: grid; place-items: start center; }
.window { width: min(760px, 100%); background: var(--window); border: 2px solid #111; box-shadow: 5px 5px 0 #333; }
.titlebar { height: 32px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 9px; align-items: center; padding: 4px 8px; background: #ececec; border-bottom: 2px solid #111; }
.titlebar h1 { font-size: 15px; margin: 0; white-space: nowrap; }
.stripes { height: 14px; background: repeating-linear-gradient(to bottom, #111 0 1px, transparent 1px 3px); }
.content { padding: 16px; }
.status-line { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; min-height: 24px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: #777; border: 1px solid #111; }
.status-dot.ok { background: var(--ok); }
.status-dot.bad { background: var(--bad); }
.muted { color: #555; }
.small { font-size: 12px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
button, select, input { border: 2px solid #111; border-right-color: #666; border-bottom-color: #666; background: #efefef; min-height: 38px; padding: 7px 10px; border-radius: 0; }
button { cursor: pointer; box-shadow: inset 1px 1px 0 #fff; }
button:active { transform: translate(1px,1px); }
button.primary, .mode-btn.active { background: #111; color: #fff; border-color: #111; box-shadow: none; }
.mode-btn { font-weight: 700; }
.panel { border: 2px solid #111; background: #ececec; padding: 14px; margin-bottom: 14px; box-shadow: inset 1px 1px 0 #fff; }
.hidden { display: none !important; }
.hero { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.big-state { font-size: clamp(28px, 7vw, 46px); font-weight: 700; margin-top: 4px; }
.huge { min-height: 64px; min-width: 180px; font-weight: 800; }
.button-row { display: flex; gap: 8px; }
.facts { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin-top: 14px; }
.facts div { background: #d0d0d0; border: 1px solid #777; padding: 9px; display: grid; gap: 3px; }
.facts span { font-size: 11px; text-transform: uppercase; }
.settings { border: 2px solid #111; background: #e8e8e8; margin-top: 10px; }
.settings summary { cursor: pointer; font-weight: 700; padding: 9px 12px; background: #c9c9c9; border-bottom: 1px solid #777; }
.settings-body { padding: 12px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.toggle-row input { min-height: auto; width: 22px; height: 22px; }
.days { display: grid; grid-template-columns: repeat(7,1fr); gap: 5px; margin: 10px 0 14px; }
.day { min-width: 0; padding: 6px 2px; font-size: 12px; }
.day.active { background: #111; color: #fff; }
.settings-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 12px; }
.settings-grid label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; }
.device-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.events { display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.event { display: grid; grid-template-columns: 145px 1fr; gap: 8px; border-bottom: 1px dotted #777; padding-bottom: 5px; font-size: 12px; }
.message { position: sticky; bottom: 8px; margin-top: 12px; background: #fff; border: 2px solid #111; padding: 10px; font-weight: 700; box-shadow: 3px 3px 0 #555; }
.message.error { background: #ffdede; }
@media (max-width: 620px) {
  .desktop { padding: 8px; }
  .window { box-shadow: 3px 3px 0 #333; }
  .content { padding: 10px; }
  .hero { align-items: stretch; flex-direction: column; }
  .huge { width: 100%; }
  .settings-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .days { grid-template-columns: repeat(4,1fr); }
}

.clock-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(250px, 1fr);
  gap: 12px;
  border: 2px solid #111;
  background: #efefef;
  padding: 12px;
  margin-bottom: 14px;
  box-shadow: inset 1px 1px 0 #fff;
}
.clock-time {
  font-family: "Courier New", monospace;
  font-size: clamp(31px, 7vw, 52px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-top: 3px;
}
.clock-date { margin-top: 4px; font-size: 12px; color: #444; }
.clock-meta { display: grid; gap: 6px; }
.clock-meta div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  border-bottom: 1px dotted #777;
  padding: 5px 0;
}
.clock-meta span { font-size: 11px; text-transform: uppercase; }
.clock-meta strong { text-align: right; }
.status-good { color: var(--ok); }
.status-bad { color: var(--bad); }
@media (max-width: 620px) {
  .clock-panel { grid-template-columns: 1fr; }
  .clock-meta strong { text-align: left; }
}

.master-power {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  border: 3px double #111;
  background: #f6f6f6;
  padding: 14px;
  margin: -2px 0 14px;
  box-shadow: 3px 3px 0 #666, inset 1px 1px 0 #fff;
}
.master-state {
  font-size: clamp(30px, 7vw, 48px);
  line-height: 1;
  font-weight: 900;
  margin: 4px 0 5px;
}
.master-state.is-on { color: var(--ok); }
.master-state.is-off { color: #222; }
.master-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 210px;
}
.master-buttons button {
  min-height: 58px;
  font-size: 18px;
  font-weight: 900;
}
@media (max-width: 620px) {
  .master-power { grid-template-columns: 1fr; }
  .master-buttons { min-width: 0; width: 100%; }
}

.version-badge {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 5px;
  border: 1px solid #555;
  background: #eee;
  font-family: "Courier New", monospace;
  font-size: 10px;
  vertical-align: middle;
}

.remote-config {
  border: 2px solid #111;
  background: #e9e9e9;
  padding: 10px;
  margin-bottom: 12px;
}
.remote-row { display:flex; gap:8px; margin-top:5px; }
.remote-row input { flex:1; min-width:0; padding:8px; font:inherit; border:2px inset #bbb; }
.remote-row button { min-width:110px; }
@media (max-width:620px) {
  .remote-row { flex-direction:column; }
}
