:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #697386;
  --line: #dfe4ec;
  --surface: #ffffff;
  --page: #f3f5f8;
  --accent: #ef6c4d;
  --accent-dark: #d95437;
  --accent-soft: #fff0eb;
  --navy: #101827;
  --success: #2c9a73;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  width: min(1040px, calc(100% - 48px));
  min-height: 620px;
  margin: 7vh auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid #e7eaf0;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(16, 24, 39, 0.11);
}

.intro-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px clamp(32px, 6vw, 78px);
  color: #fff;
  background: var(--navy);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 34px;
  color: var(--navy);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: #f7c7a5;
  border-radius: 8px;
}

.eyebrow, .section-label {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow { color: #f7c7a5; }

h1, h2, p { margin-top: 0; }

h1 {
  max-width: 280px;
  margin-bottom: 18px;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 280px;
  margin-bottom: 42px;
  color: #b8c2d2;
  font-size: 15px;
  line-height: 1.7;
}

.service-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #e5ebf3;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #54d59f;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(84, 213, 159, 0.13);
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px clamp(32px, 7vw, 90px);
}

.panel-heading { margin-bottom: 34px; }

.section-label { margin-bottom: 11px; color: var(--accent-dark); }

h2 {
  margin-bottom: 10px;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

.panel-subtitle, .security-note {
  color: var(--muted);
  font-size: 14px;
}

.panel-subtitle { margin-bottom: 0; }

.field-label {
  display: block;
  margin: 0 0 9px;
  color: #3c4658;
  font-size: 13px;
  font-weight: 650;
}

.input-wrap {
  display: flex;
  align-items: center;
  min-height: 50px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input-wrap:focus-within {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-icon {
  width: 42px;
  color: #9aa4b3;
  font-size: 15px;
  text-align: center;
}

input {
  width: 100%;
  min-width: 0;
  padding: 14px 12px 14px 0;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  border: 0;
  outline: 0;
  background: transparent;
}

input::placeholder { color: #a8b0bd; }

.icon-button {
  flex: 0 0 auto;
  margin-right: 9px;
  padding: 7px 8px;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover, .icon-button:focus-visible { color: var(--accent-dark); background: var(--accent-soft); outline: 0; }

.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  margin-top: 4px;
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.submit-button:hover { background: var(--accent-dark); }
.submit-button:active { transform: translateY(1px); }
.submit-button:disabled { cursor: wait; opacity: 0.75; }

.button-spinner {
  display: none;
  width: 16px;
  height: 16px;
  margin-left: 9px;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.submit-button.is-loading .button-spinner { display: inline-block; }
.form-message { min-height: 22px; margin: 13px 0 0; font-size: 13px; line-height: 1.6; }
.form-message.is-error { color: #c34537; }
.form-message.is-success { color: var(--success); }
.security-note { margin: 44px 0 0; font-size: 12px; }

.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10;
  max-width: min(360px, calc(100% - 48px));
  padding: 13px 16px;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 6px;
  background: #243047;
  box-shadow: 0 10px 28px rgba(16, 24, 39, 0.18);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-success { background: var(--success); }
.toast.is-error { background: #c34537; }

.is-hidden { display: none !important; }

.auth-mode-switch {
  display: flex;
  gap: 22px;
  margin: -4px 0 26px;
  border-bottom: 1px solid var(--line);
}

.mode-button {
  position: relative;
  padding: 0 0 11px;
  color: #8b95a5;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.mode-button.is-active { color: var(--accent-dark); }
.mode-button.is-active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; content: ''; background: var(--accent); }
.auth-mode-switch + form .input-wrap { margin-bottom: 18px; }

.home-shell {
  width: min(1120px, calc(100% - 48px));
  min-height: 640px;
  margin: 5vh auto;
  padding-bottom: 48px;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  margin-bottom: 48px;
  border-bottom: 1px solid var(--line);
}

.home-brand, .home-actions { display: flex; align-items: center; gap: 12px; }
.home-brand { color: var(--ink); font-size: 15px; font-weight: 750; }
.brand-mark.small { width: 32px; height: 32px; margin: 0; font-size: 10px; border-radius: 6px; }
.welcome-user { color: var(--muted); font-size: 13px; }
.text-button { padding: 6px 0; color: var(--accent-dark); font: inherit; font-size: 13px; font-weight: 700; border: 0; background: transparent; cursor: pointer; }
.text-button:hover { color: var(--ink); }

.progress-section, .points-section { padding: 0 clamp(0px, 4vw, 42px); }
.progress-section { max-width: 780px; margin-bottom: 58px; }
.progress-heading, .section-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.progress-heading { margin-bottom: 22px; }
.progress-heading h2 { margin: 0; font-size: 34px; }
.progress-count { color: var(--accent-dark); font-size: 24px; }
.progress-track { width: 100%; height: 8px; overflow: hidden; border-radius: 8px; background: #e6e9ee; }
.progress-bar { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 260ms ease; }
.progress-caption { margin: 13px 0 0; color: var(--muted); font-size: 13px; }

.points-section { max-width: 980px; }
.section-row { align-items: center; margin-bottom: 22px; }
.section-row h3 { margin: 0; font-size: 20px; }
.section-meta { color: var(--muted); font-size: 13px; }
.points-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.point-card { display: flex; align-items: center; min-height: 94px; padding: 18px 20px; color: var(--ink); text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.point-card:hover { border-color: #bcc6d4; box-shadow: 0 8px 22px rgba(16, 24, 39, 0.08); transform: translateY(-1px); }
.point-card.is-checked { border-color: #8acbb4; background: #f2fbf7; }
.point-number { display: grid; place-items: center; width: 42px; height: 42px; margin-right: 14px; color: #9ca6b5; font-size: 13px; font-weight: 800; border-radius: 7px; background: #edf0f4; }
.point-card.is-checked .point-number { color: #fff; background: var(--success); }
.point-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 5px; }
.point-copy strong { font-size: 15px; }
.point-copy small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.point-state { color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.point-state span { margin-left: 4px; font-size: 15px; }
.point-card.is-checked .point-state { color: var(--success); }

.completion-banner { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 17px 20px; color: #1e634b; border: 1px solid #b8e2d0; border-radius: 8px; background: #effbf5; }
.completion-icon { display: grid; place-items: center; width: 30px; height: 30px; color: #fff; font-weight: 800; border-radius: 50%; background: var(--success); }
.completion-banner strong { font-size: 14px; }
.completion-banner p { margin: 4px 0 0; color: #4d806e; font-size: 12px; }

.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(16, 24, 39, 0.56); }
.modal-card { width: min(480px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 28px; border-radius: 8px; background: var(--surface); box-shadow: 0 24px 60px rgba(16, 24, 39, 0.22); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.modal-header h2 { margin-bottom: 0; font-size: 24px; }
.close-button { width: 32px; height: 32px; color: var(--muted); font-size: 24px; line-height: 1; border: 0; border-radius: 5px; background: #f1f3f6; cursor: pointer; }
.close-button:hover { color: var(--ink); background: #e7ebf0; }
.modal-point { margin: 16px 0; color: var(--muted); font-size: 13px; }
.scanner-frame { position: relative; display: grid; place-items: center; min-height: 190px; margin-bottom: 20px; overflow: hidden; border-radius: 7px; background: #182235; }
.scanner-frame video { display: block; width: 100%; max-height: 250px; object-fit: cover; }
.scanner-line { position: absolute; top: 50%; right: 13%; left: 13%; height: 2px; background: #f7c7a5; box-shadow: 0 0 16px #f7c7a5; }
.scanner-frame p { position: absolute; right: 16px; bottom: 12px; left: 16px; margin: 0; color: #e5ebf3; font-size: 12px; text-align: center; }
.qr-input { width: 100%; min-height: 48px; margin-bottom: 9px; padding: 12px; color: var(--ink); font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: #fbfcfd; }
.qr-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qr-hint { margin: 0 0 18px; color: #9aa4b3; font-size: 11px; }

@media (max-width: 720px) {
  .home-shell { width: min(100% - 28px, 560px); margin: 20px auto; }
  .home-header { margin-bottom: 34px; }
  .welcome-user { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .progress-section, .points-section { padding: 0; }
  .progress-heading h2 { font-size: 30px; }
  .points-grid { grid-template-columns: 1fr; }
  .modal-card { padding: 22px; }
}

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

@media (max-width: 720px) {
  .page-shell {
    grid-template-columns: 1fr;
    width: min(100% - 28px, 520px);
    min-height: auto;
    margin: 14px auto;
  }

  .intro-panel { min-height: 260px; padding: 34px 30px; }
  .brand-mark { width: 44px; height: 44px; margin-bottom: 22px; }
  h1 { margin-bottom: 12px; font-size: 36px; }
  .intro-copy { margin-bottom: 24px; }
  .login-panel { padding: 38px 30px 34px; }
  .security-note { margin-top: 32px; }
  .toast { top: 14px; right: 14px; max-width: calc(100% - 28px); }
}
