:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273449;
  --accent: #f59e0b;
  --accent-ink: #1e1305;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --error: #f87171;
  --online: #4ade80;
  --offline: #f87171;
  --unknown: #64748b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2 { margin: 0 0 12px 0; }
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 20px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top));
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.status-pill {
  width: 14px; height: 14px; border-radius: 50%;
  border: none; padding: 0; flex-shrink: 0;
}
.status-online { background: var(--online); box-shadow: 0 0 8px var(--online); }
.status-offline { background: var(--offline); }
.status-unknown { background: var(--unknown); }

main { padding: 20px; max-width: 480px; margin: 0 auto; }
.screen.hidden { display: none; }

.hint-text { color: var(--text-dim); font-size: 14px; }

input[type="password"], input[type="text"] {
  width: 100%; padding: 12px 14px; margin: 12px 0;
  background: var(--surface); border: 1px solid var(--surface-2);
  border-radius: 10px; color: var(--text); font-size: 16px;
}
input:focus { outline: 2px solid var(--accent); }

button { font-family: inherit; cursor: pointer; }
.btn-primary, .btn-secondary, #tokenSave {
  width: 100%; padding: 14px; border-radius: 10px; border: none;
  font-size: 16px; font-weight: 600; margin: 6px 0;
}
.btn-primary, #tokenSave { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-text {
  background: none; border: none; color: var(--text-dim);
  font-size: 14px; padding: 12px 0; width: 100%; text-align: center;
}

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }
.toolbar .btn-secondary { width: auto; flex: 1; margin: 0; }
.icon-btn {
  background: var(--surface-2); border: none; color: var(--text);
  width: 44px; height: 44px; border-radius: 10px; font-size: 20px; flex-shrink: 0;
}

.cabinet-list { display: flex; flex-direction: column; gap: 10px; }
.cabinet-row {
  background: var(--surface); border: 1px solid var(--surface-2);
  border-radius: 12px; padding: 14px 16px; text-align: left; color: var(--text);
  display: flex; flex-direction: column; gap: 4px; width: 100%;
}
.cabinet-row:active { background: var(--surface-2); }
.cabinet-name { font-size: 16px; font-weight: 600; }
.cabinet-dims { font-size: 14px; color: var(--text-dim); }

.btn-back {
  background: none; border: none; color: var(--text-dim);
  font-size: 15px; padding: 8px 0; margin-bottom: 8px;
}

.detail-info {
  display: grid; grid-template-columns: auto 1fr; gap: 8px 16px;
  background: var(--surface); border-radius: 12px; padding: 16px; margin: 16px 0;
}
.detail-info dt { color: var(--text-dim); font-size: 14px; margin: 0; }
.detail-info dd { margin: 0; font-size: 14px; text-align: right; }

.export-buttons { margin-top: 16px; }

.error { color: var(--error); font-size: 14px; }
.empty { color: var(--text-dim); text-align: center; padding: 40px 0; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); color: var(--text); padding: 12px 20px;
  border-radius: 10px; font-size: 14px; max-width: 90vw; text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 100;
}
.toast-error { background: var(--error); color: #2b0a0a; }
.toast.hidden { display: none; }
.hidden { display: none; }


.assembly-progress {
  text-align: center; color: var(--text-dim); font-size: 14px; margin-bottom: 8px;
}
.assembly-image {
  width: 100%; border-radius: 12px; background: #f4f4f5; display: block; margin-bottom: 14px;
}
.assembly-done-check {
  display: flex; align-items: center; gap: 8px; color: var(--text-dim);
  font-size: 14px; margin: 14px 0; padding: 10px 0;
}
.assembly-done-check input { width: 20px; height: 20px; }
.assembly-nav { display: flex; gap: 10px; margin-top: 6px; }
.assembly-nav button { margin: 0; }