/* ---------------------------------------------------------------
   Benmax Device Setup — design tokens

   Color   #1522af  brand blue     (from the Benmax logomark)
           #0c1868  deep navy      (headings, high-emphasis text)
           #eef0fb  tint           (card fields, subtle surfaces)
           #f6f7fd  canvas         (page background)
           #1f9d6c  confirm green  (decommission / success accent)
           #64698a  muted          (secondary text)
           #d4482f  error red

   Type    Manrope   — headings, buttons (geometric, matches the
                        squared-off diamond marks in the logo)
           Inter     — body copy, form fields (legible small, outdoors)

   Signature: the two rotated, cut-corner squares from the Benmax
   mark, echoed faintly as a background motif and as the loading
   glyph — the page always has a quiet trace of the logo's own shape
   language rather than a generic spinner or gradient.
------------------------------------------------------------------ */

:root {
  --brand: #1522af;
  --brand-dark: #0c1868;
  --tint: #eef0fb;
  --canvas: #f6f7fd;
  --confirm: #1f9d6c;
  --confirm-dark: #16794f;
  --muted: #64698a;
  --error: #d4482f;
  --white: #ffffff;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--canvas);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--brand-dark);
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

h1, h2, h3, .brand-word {
  font-family: 'Manrope', system-ui, sans-serif;
}

/* ---------------- background motif ---------------- */

.bg-motif {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.tile {
  position: absolute;
  width: 46vw;
  height: 46vw;
  max-width: 320px;
  max-height: 320px;
  background: var(--tint);
  border-radius: 30% 30% 30% 0;
  transform: rotate(45deg);
}

.tile-a {
  top: -14vw;
  right: -16vw;
}

.tile-b {
  bottom: -18vw;
  left: -18vw;
  opacity: 0.7;
}

/* ---------------- layout shell ---------------- */

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  min-height: 100dvh;
  padding: 28px 20px 24px;
  display: flex;
  flex-direction: column;
}

.brand-logo {
  height: 64px;
  width: auto;
}

.card {
  flex: 1;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(12, 24, 104, 0.04), 0 12px 32px rgba(12, 24, 104, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-banner {
  width: 100%;
  line-height: 0;
  background: var(--brand);
  flex: none;
}

.card-banner img {
  display: block;
  width: 100%;
  height: auto;
}

.card-content {
  flex: 1;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
}

.footnote {
  text-align: center;
  padding-top: 22px;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* ---------------- shared view elements ---------------- */

.eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 8px;
}

.view-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 8px;
  color: var(--brand-dark);
}

.view-body {
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 24px;
}

.device-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--tint);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 22px;
  align-self: flex-start;
}

.device-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--confirm);
  flex: none;
}

.actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

button {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  padding: 17px 20px;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

button:active { transform: scale(0.98); }

button:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  color: var(--white);
}

.btn-danger {
  background: var(--white);
  color: var(--brand-dark);
  border: 1.5px solid #e2e4f2;
}

.btn-danger:hover { border-color: var(--brand); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 12px;
}

.action-desc {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 13px;
  margin-top: 3px;
  opacity: 0.85;
}

.btn-primary .action-desc { color: #dfe3ff; }
.btn-danger .action-desc { color: var(--muted); }

/* ---------------- form ---------------- */

label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--brand-dark);
  margin-bottom: 8px;
}

input[type="text"] {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid #dfe1f2;
  background: var(--tint);
  color: var(--brand-dark);
  margin-bottom: 22px;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--white);
}

.field-error {
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
  margin: -14px 0 18px;
}

/* ---------------- loading ---------------- */

.loading-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px 0;
}

.glyph {
  width: 56px;
  height: 56px;
  position: relative;
}

.glyph span {
  position: absolute;
  inset: 0;
  border-radius: 30% 30% 30% 0;
  background: var(--brand);
  animation: pulse 1.15s ease-in-out infinite;
}

.glyph span:first-child {
  transform: rotate(45deg);
}

.glyph span:last-child {
  transform: rotate(225deg);
  animation-delay: 0.35s;
  opacity: 0.55;
}

@keyframes pulse {
  0%, 100% { opacity: 0.25; transform: rotate(45deg) scale(0.85); }
  50% { opacity: 1; transform: rotate(45deg) scale(1); }
}

.loading-text {
  font-size: 14.5px;
  color: var(--muted);
  font-weight: 500;
}

/* ---------------- success ---------------- */

.success-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 20px 0 8px;
}

.success-badge {
  width: 64px;
  height: 64px;
  border-radius: 30% 30% 30% 0;
  background: var(--confirm);
  transform: rotate(45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.success-badge svg {
  transform: rotate(-45deg);
}

.success-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--brand-dark);
  margin: 0 0 8px;
}

.success-detail {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 320px;
}

.success-detail strong {
  color: var(--brand-dark);
}

/* ---------------- error state ---------------- */

.error-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 20px 0;
}

.error-wrap .view-title { color: var(--error); }

@media (prefers-reduced-motion: reduce) {
  .glyph span { animation: none; opacity: 0.9; }
}
