/* Malath Authenticator — palette sampled from the Malath Insurance logo. */

:root {
  --teal: #007362;
  --teal-deep: #005347;
  --teal-soft: #E4F0ED;
  --sidebar-top: #06544A;
  --sidebar-bottom: #02322C;
  --taupe: #AAA297;
  --taupe-deep: #948C81;
  --sand: #EFEDE8;
  --card: #FFFFFF;
  --ink: #16211E;
  --ink-soft: #5C6A66;
  --line: #E6E3DD;
  --amber: #C98A21;
  --danger: #C0492F;
  --radius-lg: 26px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --shadow-card: 0 18px 44px -24px rgba(2, 50, 44, 0.34), 0 2px 6px -2px rgba(2, 50, 44, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

[x-cloak] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--sand);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-image:
    radial-gradient(1100px 620px at 88% -12%, rgba(0, 115, 98, 0.10), transparent 62%),
    radial-gradient(760px 520px at -8% 108%, rgba(170, 162, 151, 0.20), transparent 60%);
  background-attachment: fixed;
}

.ico {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---------------------------------------------------------------- lock page */

.lock-body { display: grid; place-items: center; }

.lock-shell {
  width: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: 28px 20px 20px;
}

.lock-card {
  width: min(100%, 420px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 38px 30px 30px;
  text-align: center;
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.lock-card.is-shaking { animation: shake 0.4s ease; }

.lock-logo {
  width: 118px;
  height: auto;
  margin: 0 auto 22px;
  display: block;
}

.lock-title {
  margin: 0 0 6px;
  font-size: 1.42rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.lock-sub {
  margin: 0 0 26px;
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.pin-form { display: grid; gap: 12px; }

.pin-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.pin-box {
  width: 100%;
  aspect-ratio: 3 / 4;
  min-width: 0;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #FBFAF8;
  font: 600 1.45rem/1 var(--font);
  color: var(--ink);
  text-align: center;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.pin-box:focus {
  outline: none;
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 115, 98, 0.13);
}

.pin-row.is-error .pin-box { border-color: rgba(192, 73, 47, 0.6); }

.reveal-btn {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: none;
  padding: 4px 6px;
  color: var(--ink-soft);
  font: 500 0.83rem var(--font);
  cursor: pointer;
  border-radius: 8px;
}

.reveal-btn:hover { color: var(--teal); }
.reveal-btn .ico { width: 17px; height: 17px; }

.pin-msg {
  margin: 0;
  min-height: 1.15em;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--danger);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.pin-msg.is-visible { opacity: 1; }

.lock-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--taupe-deep);
  font-size: 0.8rem;
}

.lock-note .ico { width: 15px; height: 15px; }

.lock-footer {
  padding: 22px 0 6px;
  color: var(--taupe-deep);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

/* -------------------------------------------------------------- app buttons */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--teal);
  color: #fff;
  font: 600 0.98rem var(--font);
  cursor: pointer;
  transition: background 0.16s ease, transform 0.12s ease, opacity 0.16s ease;
}

.btn-primary:hover:not(:disabled) { background: var(--teal-deep); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
  width: 100%;
  min-height: 46px;
  margin-top: 18px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: none;
  color: var(--ink-soft);
  font: 600 0.9rem var(--font);
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.btn-ghost:hover {
  border-color: rgba(192, 73, 47, 0.5);
  color: var(--danger);
  background: rgba(192, 73, 47, 0.04);
}

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------------------------------------------------------------- app shell */

.shell {
  display: grid;
  grid-template-columns: 288px 1fr;
  gap: 22px;
  min-height: 100dvh;
  padding: 22px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  padding: 26px 20px 22px;
  background: linear-gradient(168deg, var(--sidebar-top), var(--sidebar-bottom));
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 22px 50px -28px rgba(2, 50, 44, 0.7);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 22px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-badge {
  width: 52px;
  height: 52px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #fff;
  padding: 7px;
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.5);
}

.brand-badge img { width: 100%; height: auto; display: block; }

.brand-text { display: grid; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 1.06rem; font-weight: 650; color: #fff; letter-spacing: -0.01em; }
.brand-text span { font-size: 0.78rem; color: rgba(255, 255, 255, 0.62); }

.drawer-close {
  display: none;
  margin-inline-start: auto;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.75);
  padding: 6px;
  cursor: pointer;
}

.nav { display: grid; gap: 4px; }
.nav-form { display: contents; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: rgba(255, 255, 255, 0.74);
  font: 500 0.93rem var(--font);
  text-align: start;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.nav-item.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 600;
}

.nav-ico { display: grid; place-items: center; }
.nav-item--danger { margin-top: 6px; color: rgba(255, 255, 255, 0.52); }
.nav-item--danger:hover { background: rgba(192, 73, 47, 0.22); color: #fff; }

.side-foot { margin-top: auto; padding-top: 26px; }

.side-foot p {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.5);
}

.side-rule {
  height: 1px;
  margin: 16px 0 14px;
  background: rgba(255, 255, 255, 0.14);
}

.credit {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.62);
}

/* ---------------------------------------------------------------- main area */

.main { min-width: 0; display: flex; flex-direction: column; }

/* Keeps the topbar, panels and footer on one column edge. */
.topbar, .panel, .main-foot { width: 100%; max-width: 620px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px 20px;
}

.page-title {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.burger {
  display: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 11px;
  padding: 8px;
  color: var(--ink);
  cursor: pointer;
}

.status-dot {
  width: 9px;
  height: 9px;
  margin-inline-start: auto;
  border-radius: 50%;
  background: var(--taupe);
}

.status-dot.is-live {
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(0, 115, 98, 0.45);
  animation: pulse 2.4s ease-out infinite;
}

.status-dot.is-off { background: var(--amber); }

.panel {
  display: grid;
  gap: 16px;
  align-content: start;
  animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 26px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.card-head h2 {
  margin: 0 0 4px;
  font-size: 1.04rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.muted { margin: 0; color: var(--ink-soft); font-size: 0.85rem; }

.pill {
  flex: none;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  font: 600 0.8rem var(--font);
  font-variant-numeric: tabular-nums;
  transition: background 0.2s ease, color 0.2s ease;
}

.pill.is-warn { background: rgba(201, 138, 33, 0.14); color: #8A5D10; }
.pill.is-danger { background: rgba(192, 73, 47, 0.13); color: var(--danger); }
.pill--ok { background: var(--teal-soft); color: var(--teal-deep); }

/* ------------------------------------------------------------- code display */

.code-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
  margin-bottom: 20px;
}

.digit {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  background: linear-gradient(180deg, #F6F8F7, #EDF2F0);
  border: 1px solid var(--line);
  font-size: clamp(1.5rem, 6vw, 2.15rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--teal-deep);
  letter-spacing: -0.02em;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.code-row.is-warn .digit {
  color: var(--danger);
  border-color: rgba(192, 73, 47, 0.28);
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #EDEAE4;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--teal);
  transition: width 0.22s linear, background 0.3s ease;
}

.bar-fill.is-warn { background: var(--amber); }
.bar-fill.is-danger { background: var(--danger); }

.bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 10px 0 22px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.next strong {
  color: var(--teal-deep);
  letter-spacing: 0.06em;
}

.actions { display: grid; }

.card--hint {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: none;
}

.hint-ico { color: var(--teal); flex: none; margin-top: 1px; }

.card--hint p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------- stats */

.stat-list { display: grid; gap: 2px; }

.stat {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}

.stat:last-child { border-bottom: 0; }

.stat-ico {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  flex: none;
}

.stat-ico .ico { width: 18px; height: 18px; }
.stat-label { font-size: 0.9rem; color: var(--ink-soft); }

.stat-value {
  margin-inline-start: auto;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.prose p {
  margin: 0 0 13px;
  font-size: 0.89rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.prose p:last-child { margin-bottom: 0; }

/* The sidebar carries the credit on desktop; on mobile it hides in the drawer,
   so the page keeps its own footer. */
.main-foot {
  display: none;
  margin-top: auto;
  padding: 26px 4px 6px;
  color: var(--taupe-deep);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-align: center;
}

.scrim { display: none; }

/* ------------------------------------------------------------------ motion */

@keyframes rise {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 115, 98, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(0, 115, 98, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 115, 98, 0); }
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 16px;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    top: 0;
    inset-inline-start: 0;
    bottom: 0;
    width: min(84vw, 300px);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    transform: translateX(102%);
    transition: transform 0.28s cubic-bezier(0.3, 0.8, 0.3, 1);
  }

  .drawer-open .sidebar { transform: none; }
  .drawer-close { display: block; }
  .burger { display: grid; }

  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(2, 50, 44, 0.42);
    backdrop-filter: blur(2px);
  }

  .topbar, .panel, .main-foot { max-width: none; }
  .main-foot { display: block; }
  .card { padding: 20px; border-radius: var(--radius-md); }
  .code-row { gap: 6px; }
  .digit { border-radius: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
