:root {
  --paper: #f4f2ec;
  --surface: #fffefa;
  --ink: #171917;
  --muted: #62665f;
  --line: #cfcec7;
  --line-strong: #9a9d95;
  --blue: #174f85;
  --blue-dark: #10385f;
  --green: #1b6947;
  --green-bg: #e8f4ed;
  --amber: #8a5600;
  --amber-bg: #fff4d9;
  --red: #a22c2c;
  --red-bg: #fff0ef;
  --lcd-case: #123861;
  --lcd-screen: #0b2140;
  --lcd-char: #d9edff;
  --focus: #1467ad;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, textarea { font: inherit; }
button, summary, input[type="range"], input[type="file"] { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 25%);
  outline-offset: 2px;
}

.site-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 750; }
.brand-mark {
  width: 64px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--lcd-char);
  background: var(--lcd-screen);
  border: 4px solid var(--lcd-case);
  border-radius: 5px;
  font-family: "Courier New", monospace;
  font-weight: 700;
  letter-spacing: -1px;
}
.brand-mark-small { width: 48px; height: 32px; border-width: 3px; font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.status-badge, .delivery-state {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f6f1;
  color: #464943;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-dot { width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--line-strong); }
.status-online { color: #124d35; background: var(--green-bg); border-color: #a3cfb7; }
.status-online .status-dot { background: var(--green); }
.status-offline { color: #742020; background: var(--red-bg); border-color: #e5b2ae; }
.status-offline .status-dot { background: var(--red); }

.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: clamp(36px, 7vw, 88px) 0 64px; }
.intro { max-width: 720px; margin-bottom: 42px; }
.eyebrow, .section-number { margin: 0 0 10px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.intro h1 { margin: 0; max-width: 660px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 6vw, 68px); line-height: .98; letter-spacing: -.045em; font-weight: 600; }
.intro > p:last-child { max-width: 560px; margin: 20px 0 0; color: var(--muted); font-size: 17px; line-height: 1.55; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.primary-column, .status-section, .maintenance-section { border-top: 1px solid var(--ink); padding-top: 18px; }
.section-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 24px; }
.section-heading-compact { align-items: center; margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.section-number { margin-bottom: 5px; }
.delivery-applied { color: #124d35; background: var(--green-bg); border-color: #a3cfb7; }
.delivery-pending { color: #6d4400; background: var(--amber-bg); border-color: #e2c582; }

.lcd-frame { position: relative; padding: 34px clamp(24px, 5vw, 50px) 24px; border: 1px solid #0a2948; border-radius: var(--radius); background: var(--lcd-case); }
.lcd-screen { padding: clamp(14px, 3vw, 24px); border: 2px solid #07172a; border-radius: 4px; background: var(--lcd-screen); box-shadow: inset 0 0 16px #061426; }
.lcd-row { height: clamp(31px, 5vw, 44px); display: grid; grid-template-columns: repeat(16, 1fr); align-items: center; font-family: "Courier New", monospace; font-size: clamp(17px, 3.5vw, 28px); font-weight: 700; line-height: 1; color: var(--lcd-char); text-shadow: 0 0 6px #81bfff; }
.lcd-row span { min-width: 0; text-align: center; border-right: 1px solid rgb(160 204 255 / 8%); }
.lcd-screws { position: absolute; inset: 9px; display: grid; grid-template-columns: 1fr 1fr; align-content: space-between; pointer-events: none; }
.lcd-screws i:nth-child(even) { justify-self: end; }
.lcd-screws i { width: 7px; height: 7px; border-radius: 50%; background: #c2c7c9; border: 1px solid #667078; }
.lcd-caption { display: block; margin-top: 12px; color: #b9d1e7; font-size: 9px; font-weight: 800; letter-spacing: .16em; text-align: center; }

.message-form { margin-top: 30px; }
.field-block { display: block; margin-bottom: 22px; }
.field-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 8px; color: var(--ink); font-size: 13px; font-weight: 750; }
.field-heading > span:last-child, .field-heading output { color: var(--muted); font-variant-numeric: tabular-nums; }
textarea, input:not([type="range"]):not([type="file"]) {
  width: 100%;
  min-height: 46px;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface);
}
textarea { resize: vertical; line-height: 1.45; }
textarea:hover, input:not([type="range"]):not([type="file"]):hover { border-color: #656962; }
textarea:focus, input:not([type="range"]):not([type="file"]):focus { border-color: var(--focus); }
.field-hint, .range-labels { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.compact-field { max-width: 420px; }
input[type="range"] { width: 100%; accent-color: var(--blue); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.button { min-height: 42px; padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--ink); background: var(--surface); font-weight: 750; font-size: 13px; }
.button:hover:not(:disabled) { border-color: var(--ink); background: #f3f1ea; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .55; }
.button-primary { border-color: var(--blue-dark); color: white; background: var(--blue); }
.button-primary:hover:not(:disabled) { color: white; background: var(--blue-dark); }
.button-danger { border-color: #7f2020; color: white; background: var(--red); }
.button-danger:hover:not(:disabled) { color: white; background: #7e2020; }
.button-secondary { background: transparent; }
.button-quiet { min-height: 36px; padding: 7px 9px; border-color: transparent; background: transparent; color: var(--muted); }
.button-full { width: 100%; }
.form-feedback { min-height: 20px; margin: 12px 0 0; color: var(--green); font-size: 13px; }
.feedback-error, .form-error { color: var(--red); }
.notice { margin-bottom: 24px; padding: 12px 14px; border: 1px solid; border-radius: 5px; }
.notice-error { color: #742020; border-color: #e5b2ae; background: var(--red-bg); }

.status-column { display: grid; gap: 34px; }
.device-list { margin: 0; }
.device-list div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.device-list dt { color: var(--muted); font-size: 13px; }
.device-list dd { margin: 0; font-size: 13px; font-weight: 750; text-align: right; font-variant-numeric: tabular-nums; }
.maintenance-section { margin: 0; }
.maintenance-section summary { display: flex; justify-content: space-between; align-items: end; gap: 16px; list-style: none; font-weight: 750; }
.maintenance-section summary::-webkit-details-marker { display: none; }
.maintenance-section summary > span:first-child { display: grid; gap: 3px; }
.summary-hint { color: var(--muted); font-size: 11px; font-weight: 600; }
.maintenance-body { padding: 18px 0 0; }
.maintenance-body > p { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.file-field { display: grid; gap: 8px; margin: 0 0 20px; font-size: 13px; font-weight: 750; }
input[type="file"] { width: 100%; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--muted); }

.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 20px clamp(16px, 4vw, 48px); border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.auth-page { display: grid; place-items: center; padding: 28px; }
.auth-shell { width: min(100%, 400px); }
.auth-shell h1 { margin: 18px 0 6px; font-family: Georgia, "Times New Roman", serif; font-size: 42px; letter-spacing: -.04em; }
.auth-shell .eyebrow { margin-top: 34px; }
.lede { margin: 0 0 30px; color: var(--muted); line-height: 1.5; }
.auth-form { padding-top: 24px; border-top: 1px solid var(--ink); }
.auth-form label { display: grid; gap: 8px; margin-bottom: 18px; font-size: 13px; font-weight: 750; }
.form-error { margin: 0 0 16px; font-size: 13px; }

@media (max-width: 820px) {
  .workspace { grid-template-columns: 1fr; }
  .status-column { grid-template-columns: 1fr 1fr; }
  .intro { margin-bottom: 34px; }
}

@media (max-width: 600px) {
  .site-header { align-items: flex-start; }
  .header-actions { flex-direction: column; align-items: end; }
  .status-badge { min-height: 30px; }
  .page-shell { width: min(100% - 24px, 1180px); padding-top: 42px; }
  .intro h1 { font-size: 42px; }
  .workspace { gap: 44px; }
  .status-column { grid-template-columns: 1fr; }
  .lcd-frame { padding-inline: 18px; }
  .lcd-screen { padding: 12px 8px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .site-footer { flex-direction: column; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
