* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #0b1220;
  color: #e6edf7;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- login page ---------- */
.wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.card {
  width: 100%;
  max-width: 360px;
  background: #131c2e;
  border: 1px solid #1f2a44;
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.card h1 { margin: 0 0 6px; font-size: 22px; }
.card .sub { margin: 0 0 20px; color: #8b98b3; font-size: 14px; }
.card label { display: block; font-size: 13px; color: #8b98b3; margin-bottom: 6px; }
.card input[type=password] {
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  border-radius: 10px;
  border: 1px solid #2a3654;
  background: #0e1626;
  color: #e6edf7;
  outline: none;
}
.card input[type=password]:focus { border-color: #4a7dff; }
.card button {
  margin-top: 16px;
  width: 100%;
  padding: 14px;
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: #4a7dff;
  color: white;
  cursor: pointer;
}
.card button:active { background: #3865d6; }
.err {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #3a1620;
  color: #ffb3bf;
  font-size: 14px;
  text-align: center;
}

/* ---------- main page ---------- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 8px;
}
header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #8b98b3;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5c6680;
}
.dot.ok  { background: #2ecc71; box-shadow: 0 0 8px #2ecc7155; }
.dot.bad { background: #e74c3c; box-shadow: 0 0 8px #e74c3c55; }

main {
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.shutter {
  background: #131c2e;
  border: 1px solid #1f2a44;
  border-radius: 18px;
  padding: 18px 18px 22px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.shutter h2 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .2px;
}
.buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
button.action {
  position: relative;
  padding: 22px 12px;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  color: white;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease, background .2s ease;
  min-height: 84px;
}
button.action:active { transform: scale(0.97); filter: brightness(0.85); }
button.action.open  { background: #2ecc71; }
button.action.close { background: #e74c3c; }
button.action[disabled] { opacity: 0.55; cursor: not-allowed; }
button.action.busy::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 22px; height: 22px;
  margin: -11px 0 0 -11px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
button.action.busy .label { visibility: hidden; }
button.action.flash-ok  { animation: flashOk  .6s ease; }
button.action.flash-err { animation: flashErr .6s ease; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes flashOk  { 0%,100%{filter:none} 30%{filter:brightness(1.6) saturate(1.4)} }
@keyframes flashErr { 0%,100%{filter:none} 30%{filter:hue-rotate(20deg) brightness(1.4)} }

footer {
  text-align: center;
  padding: 18px 20px 24px;
  color: #5c6680;
  font-size: 12px;
}
footer button {
  background: none;
  border: none;
  color: #5c6680;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px;
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: #8b98b3;
}
