:root {
  color-scheme: light;
  --paper: #e7e1cf;
  --ink: #161611;
  --muted: #6d6759;
  --panel: #f8f2df;
  --line: #201e17;
  --accent: #5d7c46;
  --danger: #9b3b30;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #211f1a;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

a {
  color: inherit;
}

.shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--paper);
}

.brand {
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

nav a {
  color: var(--paper);
  text-decoration: none;
  opacity: 0.8;
}

.grid {
  display: grid;
  gap: 20px;
}

.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.wide {
  grid-column: 1 / -1;
}

.lower {
  margin-top: 20px;
}

.panel,
.eink-card,
.connector-card {
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 8px 8px 0 #000;
  padding: 22px;
}

.eink-card {
  background: var(--paper);
  min-height: 420px;
}

.device-topline,
.led-row,
.stat-row,
.actions,
.pill-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-topline {
  justify-content: space-between;
  border-bottom: 2px solid var(--line);
  padding-bottom: 10px;
  text-transform: uppercase;
  font-size: 13px;
}

.pet-stage {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 22px;
  min-height: 270px;
}

.pet-face {
  font-size: 28px;
  line-height: 1.1;
  margin: 0;
}

.speech {
  border: 2px solid var(--line);
  padding: 16px;
  background: #f3ecd5;
  font-size: 20px;
  line-height: 1.35;
}

.led-row {
  justify-content: space-between;
  border-top: 2px solid var(--line);
  padding-top: 14px;
}

.led-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  text-transform: uppercase;
}

.led {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #4f4b40;
}

.led.ptt {
  background: #2d5261;
}

.led.attention.on {
  background: #d4b843;
  box-shadow: 0 0 14px #d4b843;
}

.led.attention.high {
  background: var(--danger);
  box-shadow: 0 0 14px var(--danger);
}

.stat-list {
  display: grid;
  gap: 12px;
}

.task-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.task-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  border: 2px solid var(--line);
  background: #fffaf0;
  padding: 12px;
}

.task-row.green {
  background: #dce6c8;
}

.task-row.orange {
  background: #f2dfb8;
}

.task-row.red {
  background: #f0c6bc;
}

.task-row.unknown {
  background: #e4ded0;
}

.stoplight {
  border: 2px solid var(--line);
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-top: 2px;
}

.stoplight.small {
  width: 10px;
  height: 10px;
  border-width: 1px;
  margin: 0 6px 0 0;
}

.stoplight.green {
  background: #5d7c46;
}

.stoplight.orange {
  background: #d59b37;
}

.stoplight.red {
  background: #9b3b30;
}

.stoplight.unknown {
  background: #8f897d;
}

.task-row small,
.subtasks small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.subtasks {
  border-left: 2px solid #bdb49c;
  margin-top: 8px;
  padding-left: 10px;
}

.stat-row {
  justify-content: space-between;
}

.stat-row span {
  min-width: 120px;
}

meter {
  width: 100%;
  height: 18px;
}

button,
.button {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button.ghost,
button.secondary {
  background: transparent;
  color: var(--ink);
}

.actions {
  margin-top: 18px;
  flex-wrap: wrap;
}

.actions.compact {
  margin-top: 8px;
}

.stack {
  display: grid;
  gap: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid var(--line);
  background: #fffaf0;
  color: var(--ink);
  padding: 10px;
  font: inherit;
  margin-top: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.weekly-matrix th small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}

.weekly-matrix td,
.weekly-matrix th {
  min-width: 88px;
}

.weekly-matrix tbody th {
  width: 210px;
}

.weekly-cell {
  border: 2px solid var(--line);
  display: grid;
  gap: 5px;
  min-height: 58px;
  padding: 8px;
}

.weekly-cell.green {
  background: #dce6c8;
}

.weekly-cell.orange {
  background: #f2dfb8;
}

.weekly-cell.red {
  background: #f0c6bc;
}

.weekly-cell.unknown {
  background: #e4ded0;
}

th,
td {
  border-bottom: 1px solid #bdb49c;
  text-align: left;
  padding: 8px;
  vertical-align: top;
}

.connector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.connector-card {
  box-shadow: 5px 5px 0 #000;
}

.notice,
.sync-status {
  border: 2px solid var(--line);
  background: #fffaf0;
  padding: 10px;
  margin: 12px 0;
}

.notice {
  background: #dce6c8;
}

.sync-status {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.sync-status.success {
  background: #dce6c8;
}

.sync-status.partial_success {
  background: #f2dfb8;
}

.sync-status.error {
  background: #f0c6bc;
}

.sync-status.running,
.sync-status.idle {
  background: #f2dfb8;
}

.muted {
  color: var(--muted);
}

.pill-row {
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.pill {
  border: 2px solid var(--line);
  padding: 8px 10px;
  background: #fffaf0;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(100%, 460px);
}

.auth-panel h1 {
  margin-top: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 800px) {
  .two,
  .pet-stage {
    grid-template-columns: 1fr;
  }

  .header,
  .led-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
