/* Shared tokens and primitives. This file is public (the login page needs it). */
:root {
  --bg: #f4f5f9;
  --bg-2: #eceef5;
  --surface: #ffffff;
  --ink: #15161c;
  --ink-2: #3c3f4c;
  --muted: #6d7183;
  --line: #e2e4ee;
  --accent: #4f46e5;
  --accent-ink: #3730a3;
  --accent-soft: #eceafe;
  --warm: #f59e0b;
  --danger: #d93a4a;
  --danger-soft: #fdecee;
  --ok: #12996b;
  --radius: 16px;
  --shadow-1: 0 1px 2px rgba(22, 24, 40, .06), 0 2px 8px rgba(22, 24, 40, .05);
  --shadow-2: 0 10px 30px rgba(31, 33, 71, .14), 0 2px 8px rgba(31, 33, 71, .08);
  --ring: 0 0 0 4px rgba(79, 70, 229, .35);
  --font: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

button, input, select { font: inherit; color: inherit; }

.hidden { display: none !important; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.btn:hover { border-color: #cfd2e2; background: #fafaff; }
.btn:active { transform: scale(.98); }
.btn:focus { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; margin-right: 8px; flex: none; }
.btn.icon-only { width: 44px; padding: 0; }
.btn.icon-only svg { margin: 0; }

.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, #5b54f0, #7c3aed);
  color: #fff;
  box-shadow: 0 6px 16px rgba(91, 84, 240, .32);
}
.btn-primary:hover { background: linear-gradient(135deg, #514ae6, #7231e0); border-color: transparent; }

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #f4c4ca; }

svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i .f { fill: currentColor; stroke: none; }

/* ------------------------------------------------------------ login */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 12% 8%, rgba(124, 58, 237, .16), transparent 60%),
    radial-gradient(800px 520px at 92% 92%, rgba(245, 158, 11, .16), transparent 60%),
    radial-gradient(700px 480px at 85% 10%, rgba(79, 70, 229, .14), transparent 60%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 36px 32px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 28px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow-2);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #5b54f0, #7c3aed);
  color: #fff;
  box-shadow: 0 10px 22px rgba(91, 84, 240, .35);
}
.brand-mark svg { width: 28px; height: 28px; }

.login-card h1 { margin-top: 22px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.login-card .sub { margin-top: 6px; color: var(--muted); }

.pin-card { max-width: 380px; text-align: center; }
.pin-card .brand-mark { margin: 0 auto; }

/* A real text input sits invisibly on top of four boxes that draw its contents. */
.pin-field { position: relative; width: 268px; max-width: 100%; margin: 26px auto 0; }
.pin-boxes { display: flex; justify-content: space-between; }
.pin-boxes span {
  position: relative;
  width: 58px;
  height: 66px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.pin-boxes span.on::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: var(--ink);
}
.pin-field.focused .pin-boxes span.on { border-color: #b9b5f5; }
.pin-field.focused .pin-boxes span.active { border-color: var(--accent); box-shadow: var(--ring); }
.pin-field.focused .pin-boxes span.active::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--accent);
  animation: caret 1.1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.pin-field.off .pin-boxes span { background: var(--bg); }
.pin-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  outline: none;
  opacity: 0;
  cursor: text;
}

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 12px; margin-top: 26px; }
.keypad.off { opacity: .45; }
.key {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, transform .12s, box-shadow .12s;
}
.key:hover { border-color: #cfd2e2; background: #fafaff; }
.key:active { transform: scale(.95); background: var(--accent-soft); }
.key[disabled] { cursor: not-allowed; }
.key-soft { border-color: transparent; background: transparent; color: var(--muted); font-size: 16px; }
.key-soft svg { width: 26px; height: 26px; }
.keys .key:focus { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: var(--ring); transform: scale(1.05); }

.notice {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--danger-soft);
  color: #a3212f;
  font-size: 15px;
  font-weight: 600;
}

.lock-panel {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #f6d9a8;
  border-radius: 16px;
  background: #fff8ea;
  text-align: center;
}
.lock-panel .lock-title { font-weight: 700; color: #8a5a00; }
.lock-panel .lock-time {
  margin-top: 6px;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: #5c3c00;
}
.lock-panel .lock-hint { margin-top: 2px; font-size: 14px; color: #8a6a2a; }

.login-foot { margin-top: 22px; text-align: center; font-size: 13px; color: var(--muted); }

@keyframes shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}
.shake { animation: shake .4s; }

@media (min-width: 1900px) {
  .login-card { max-width: 520px; padding: 52px 48px 40px; }
  .login-card h1 { font-size: 34px; }
  .pin-card { max-width: 480px; }
  .pin-field { width: 348px; }
  .pin-boxes span { width: 76px; height: 86px; border-radius: 20px; }
  .keypad { grid-gap: 16px; }
  .key { height: 84px; font-size: 34px; border-radius: 22px; }
  .key-soft { font-size: 20px; }
}
