:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f3f4f6;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d1d5db;
  --dark: #111827;
  --danger: #b91c1c;
  --warn-bg: #fff7ed;
  --success-bg: #ecfdf5;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; background: #f3f4f6; }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: not-allowed; }
.topbar {
  min-height: 76px; padding: 12px 16px; background: var(--dark); color: white;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 900; letter-spacing: .08em; font-size: .78rem; }
h1 { margin: 2px 0 0; font-size: 1.35rem; }
.badge { border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 6px 10px; font-size: .8rem; white-space: nowrap; }
.badge.online { background: #065f46; }
.badge.offline { background: #991b1b; }
.app-shell { max-width: 760px; margin: 0 auto; padding: 18px 14px 38px; }
.view { background: var(--panel); border-radius: 18px; padding: 18px; box-shadow: 0 8px 28px rgba(17,24,39,.08); }
.intro { margin: 0 0 18px; color: var(--muted); }
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.menu-button {
  min-height: 112px; border: 1px solid var(--line); border-radius: 16px; background: white; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font-size: 1.05rem; font-weight: 800;
}
.menu-button span { font-size: 1.8rem; line-height: 1; }
.menu-button.primary { background: #111827; color: white; border-color: #111827; }
.menu-button.warning { background: #fff7ed; border-color: #fdba74; }
.menu-button.admin { grid-column: 1 / -1; min-height: 88px; }
.view-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.view-heading h2 { margin: 0; font-size: 1.35rem; }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; background: white; }
.card.success { background: var(--success-bg); border-color: #6ee7b7; }
.card.warning { background: var(--warn-bg); border-color: #fdba74; }
.card.danger { background: #fef2f2; border-color: #fca5a5; }
.big-prompt { font-size: 1.25rem; font-weight: 900; margin: 4px 0 8px; }
.muted { color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: baseline; }
.kv strong { text-align: right; }
.progress { height: 14px; border-radius: 999px; background: #e5e7eb; overflow: hidden; margin: 12px 0 5px; }
.progress > div { height: 100%; background: #111827; transition: width .15s ease; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
button.primary, button.secondary, button.danger, button.warning-action {
  min-height: 48px; border-radius: 12px; padding: 10px 15px; font-weight: 800; border: 1px solid transparent;
}
button.primary { background: #111827; color: white; }
button.secondary { background: white; border-color: var(--line); color: #111827; }
button.danger { background: #b91c1c; color: white; }
button.warning-action { background: #ea580c; color: white; }
button.compact { min-height: 38px; padding: 7px 10px; }
.manual-link { width: 100%; margin-top: 12px; border: 0; background: transparent; text-decoration: underline; color: #374151; padding: 8px; }
.scan-zone { border: 2px dashed #9ca3af; border-radius: 16px; padding: 24px 16px; text-align: center; background: #f9fafb; }
.scan-icon { font-size: 2.2rem; line-height: 1; }
.list { display: grid; gap: 8px; margin-top: 12px; }
.list-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; gap: 10px; }
.list-item.done { background: #ecfdf5; }
input[type="number"], dialog input { width: 100%; min-height: 50px; border: 1px solid #9ca3af; border-radius: 10px; padding: 10px 12px; font-size: 1.15rem; }
label { display: block; font-weight: 800; margin-bottom: 6px; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: min(92vw,640px); padding: 12px 16px; border-radius: 12px; background: #111827; color: white; z-index: 20; box-shadow: 0 8px 30px rgba(0,0,0,.24); }
.toast.error { background: #991b1b; }
.toast.success { background: #065f46; }
dialog { border: 0; border-radius: 16px; width: min(92vw, 480px); padding: 20px; box-shadow: 0 22px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(17,24,39,.55); }
dialog h3 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; border-bottom: 1px solid #e5e7eb; padding: 9px 7px; vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #4b5563; }
.admin-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.admin-grid button { min-height: 74px; }
@media (max-width: 520px) {
  .menu-grid, .admin-grid { grid-template-columns: 1fr 1fr; }
  .view { padding: 14px; border-radius: 14px; }
  .app-shell { padding: 12px 10px 26px; }
  .topbar { min-height: 68px; }
  h1 { font-size: 1.12rem; }
}
