/*
  Diseño del login de C&E: el mismo del "Dispatch Login" / Inventory Login
  (apps/supply/dispatch/apps-script/src/frontend/styles/login.html),
  adaptado a página completa servida por el Worker (sin el marco de Apps Script).
  Se usa en app.cebmfl.com: login, código, primera vez, menú y avisos.
*/
:root {
  --bg: #f2f2f7;
  --login-bg-image: url("https://cebmfl.com/assets/modern-miami-service-tower-full-D0Jfh3b2.jpg");
  --card: rgba(255,255,255,0.78);
  --text: #0b0b0f;
  --muted: rgba(60,60,67,.72);
  --line: rgba(60,60,67,.14);
  --accent: #007aff;
  --accent-pressed: #0062cc;
  --danger: #ff3b30;
  --ok: #248a3d;
  --shadow: 0 20px 60px rgba(15, 23, 42, .12);
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
}

.lg-page {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background:
    linear-gradient(rgba(242,242,247,.45), rgba(242,242,247,.45)),
    radial-gradient(circle at top left, rgba(0,122,255,.08), transparent 28%),
    radial-gradient(circle at bottom right, rgba(52,199,89,.06), transparent 25%),
    var(--login-bg-image),
    var(--bg);
  background-size: auto, auto, auto, cover, auto;
  background-position: center, top left, bottom right, center, center;
  background-repeat: no-repeat;
}

.lg-shell {
  width: 100%;
  max-width: 470px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lg-card {
  width: min(100%, 470px);
  max-width: calc(100vw - 20px);
  min-width: 0;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,.65);
  box-shadow: 0 18px 52px rgba(15, 23, 42, .14);
  padding: 26px 22px 24px;
  display: flex;
  flex-direction: column;
}

.lg-switcher {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 8px 20px rgba(15,23,42,.06);
  margin-bottom: 22px;
  width: 100%;
}

.lg-switch-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 750;
}

.lg-switch-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(0,122,255,.22);
}

.lg-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.lg-brand > div { min-width: 0; }

.lg-badge {
  width: 44px;
  height: 74px;
  min-width: 44px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
  border: 1px solid rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(0,122,255,.10);
  padding: 6px;
}

.lg-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lg-eyebrow {
  font-size: 13px;
  line-height: 1.25;
  color: var(--muted);
  margin: 0 0 6px;
  letter-spacing: .2px;
}

.lg-title {
  margin: 0;
  font-size: clamp(30px, 8.2vw, 40px);
  line-height: 1.05;
  letter-spacing: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.lg-subtitle {
  margin: 16px 0 26px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 40ch;
}

.lg-form {
  width: 100%;
  display: grid;
  gap: 16px;
  margin: 0;
}

.lg-field {
  width: 100%;
  display: grid;
  gap: 8px;
}

.lg-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  padding-left: 2px;
}

.lg-input {
  width: 100%;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.92);
  padding: 0 16px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.lg-input::placeholder { color: rgba(60,60,67,.45); }

.lg-input:focus {
  border-color: rgba(0,122,255,.45);
  box-shadow: 0 0 0 5px rgba(0,122,255,.12);
}

.lg-input--code {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .35em;
  text-align: center;
}

.lg-button {
  margin-top: 4px;
  width: 100%;
  min-height: 60px;
  border: 0;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0,122,255,.22);
  transition: transform .16s ease, filter .16s ease, background .16s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.lg-button:hover { filter: brightness(.98); }

.lg-button:active {
  transform: translateY(1px);
  background: var(--accent-pressed);
}

.lg-button:focus-visible {
  outline: 3px solid var(--accent-pressed);
  outline-offset: 3px;
}

.lg-button--ghost {
  background: rgba(255,255,255,.92);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
  font-weight: 700;
}

.lg-button--ghost:active { background: #fff; }

.lg-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--text);
}

.lg-check input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.lg-status {
  min-height: 24px;
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
}

.lg-error { margin: 0; color: var(--danger); }
.lg-ok { margin: 0; color: var(--ok); }

.lg-qr {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.lg-qr svg {
  width: 220px;
  height: 220px;
  max-width: 100%;
}

.lg-key {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  word-break: break-all;
  background: rgba(255,255,255,.92);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0;
  user-select: all;
}

.lg-steps {
  margin: 0 0 18px;
  padding-left: 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.lg-links {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.lg-who {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
}

.lg-who form { margin: 0; }

.lg-link-button {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 0;
}

.lg-footer {
  margin-top: 26px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(60,60,67,.62);
  text-align: center;
}

.lg-footer a { color: inherit; }

/* Computadora con mouse: igual que Inventory/Dispatch en escritorio. */
@media (min-width: 820px) and (hover: hover) and (pointer: fine) {
  .lg-page {
    padding: 28px;
    background-attachment: fixed, fixed, fixed, fixed, scroll;
  }

  .lg-card {
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: var(--shadow);
    padding: 34px 30px 30px;
    background: var(--card);
  }

  .lg-switcher { width: fit-content; }
  .lg-switch-btn { flex: 0 0 auto; min-height: auto; padding: 10px 16px; font-size: 14px; font-weight: 700; }

  .lg-badge { width: 48px; height: 81px; min-width: 48px; }

  .lg-title { font-size: clamp(30px, 6vw, 38px); font-weight: 750; line-height: 1.06; }

  .lg-input { height: 62px; font-size: 18px; border-radius: 8px; padding: 0 18px; }
  .lg-input--code { font-size: 26px; }

  .lg-button { min-height: 62px; font-size: 18px; border-radius: 8px; font-weight: 700; margin-top: 8px; }

  .lg-qr { border-radius: 8px; }
}

@media (max-width: 380px) {
  .lg-page { padding: 6px; }

  .lg-card {
    max-width: calc(100vw - 12px);
    padding: 22px 16px;
    border-radius: 22px;
  }

  .lg-title { font-size: clamp(28px, 8vw, 36px); }
  .lg-subtitle { margin: 12px 0 24px; }
  .lg-form { gap: 14px; }
  .lg-input { height: 56px; font-size: 16px; }
  .lg-button { min-height: 58px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
