:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #687385;
  --line: #d9dee7;
  --accent: #136f63;
  --accent-strong: #0f5b52;
  --warning: #9a3412;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(25, 34, 46, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  background: rgba(246, 247, 249, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  font-weight: 750;
  text-decoration: none;
}

.logout-form {
  margin: 0;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 72px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 750;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.02;
}

.muted,
.dashboard-note,
.form-message {
  color: var(--muted);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 48px;
  align-items: center;
  min-height: calc(100vh - 176px);
}

.login-copy p:last-child {
  max-width: 520px;
  font-size: 1.08rem;
  color: var(--muted);
}

.auth-form,
.upload-form,
.status-panel {
  display: grid;
  gap: 16px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-form label,
.file-picker span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.auth-form input,
.file-picker input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
}

.auth-form input:focus,
.file-picker input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(19, 111, 99, 0.15);
}

button,
.primary-action,
.secondary-action,
.icon-button,
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
}

.auth-form button,
.primary-action {
  background: var(--accent);
  color: #ffffff;
}

.auth-form button:hover,
.primary-action:hover {
  background: var(--accent-strong);
}

.secondary-action,
.icon-button,
.download-link {
  background: #e8edf2;
  color: var(--ink);
}

.icon-button {
  gap: 8px;
  min-height: 38px;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-weight: 650;
}

.dashboard-head {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
  margin-bottom: 30px;
}

.dashboard-note {
  max-width: 360px;
  margin: 0;
  line-height: 1.5;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.tool-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 148px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}

.active-card {
  border-color: rgba(19, 111, 99, 0.4);
  box-shadow: var(--shadow);
}

.placeholder-card {
  opacity: 0.62;
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: #e7f1ef;
  border-radius: 8px;
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 800;
}

.tool-body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.tool-body strong {
  font-size: 1.08rem;
}

.tool-body small {
  color: var(--muted);
  line-height: 1.45;
}

.tool-action {
  color: var(--accent);
  font-weight: 750;
}

.transfer-layout,
.phone-upload {
  display: grid;
  place-items: start center;
}

.transfer-main {
  width: min(820px, 100%);
}

.transfer-main > .muted {
  max-width: 680px;
  line-height: 1.55;
}

#create-transfer-form {
  margin: 28px 0;
}

.transfer-state {
  display: grid;
  gap: 20px;
}

.qr-panel {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.qr-code {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.qr-code svg {
  width: 94%;
  height: 94%;
}

.timer {
  font-size: 1.15rem;
}

.event-list {
  display: grid;
  gap: 10px;
}

.event-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.event-item.error {
  border-color: rgba(180, 35, 24, 0.4);
  color: var(--danger);
}

.event-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.phone-upload {
  min-height: calc(100vh - 176px);
}

.upload-form,
.status-panel {
  width: min(520px, 100%);
}

.upload-form h1,
.status-panel h1 {
  font-size: 2rem;
}

progress {
  width: 100%;
  height: 12px;
  accent-color: var(--accent);
}

.hidden {
  display: none !important;
}

@media (max-width: 780px) {
  .topbar {
    padding: 0 16px;
  }

  .page {
    width: min(100% - 24px, 1120px);
    padding-top: 26px;
  }

  .login-panel,
  .dashboard-head,
  .qr-panel {
    grid-template-columns: 1fr;
  }

  .dashboard-head {
    align-items: start;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tool-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .tool-action {
    grid-column: 2;
  }

  .qr-panel {
    padding: 16px;
  }
}
