/*
 * Zapam — jak aplikacja Flutter: home_page (niebo), Theme ColorScheme.fromSeed(Colors.deepPurple),
 * Logo: jak Flutter — login StartScreen assets/icons/logo_bez_tła.png, sidebar jak TopBar logo_bez_tła_ani_glowy.png.
 */
:root {
  /* Niebo / tło — home_page.dart */
  --sky-top: #b3e5fc;
  --sky-mid: #81d4fa;
  --bg-page: #e3f2fd;
  --cream: #fafdf7;
  --cream-tint: #f2f4d9;
  /* Powierzchnie */
  --bg-card: #fafdf7;
  --bg-elevated: #ffffff;
  --bg-sidebar: rgba(255, 255, 255, 0.92);
  --bg-input: #ffffff;
  --border: rgba(62, 47, 39, 0.14);
  --border-outline: #79747e;
  /* Tekst — brąz jak w UI apki */
  --text: #3e2f27;
  --text-muted: #6d5e53;
  /* Material 3 — ColorScheme.fromSeed(deepPurple), wartości zbliżone do motywu apki */
  --md-primary: #6750a4;
  --md-primary-hover: #7965af;
  --md-on-primary: #ffffff;
  --md-primary-container: #eaddff;
  --md-on-primary-container: #21005d;
  /* Kompatybilność ze starymi klasami */
  --accent: var(--md-primary);
  --accent-hover: #9575cd;
  --accent-deep: #4f378b;
  --gold: #ffc107;
  --gold-soft: #ffd54f;
  --success: #2e7d32;
  --error: #c62828;
  --warning: #ef6c00;
  /* M3 shape — duże zaokrąglenia jak w Material 3 */
  --radius: 12px;
  --radius-pill: 20px;
  --shadow: 0 4px 20px rgba(62, 47, 39, 0.08);
  --shadow-sidebar: 4px 0 24px rgba(41, 98, 150, 0.12);
  /* Elevation 1 (ElevatedButton) */
  --elevation-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --elevation-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(
    180deg,
    var(--sky-top) 0%,
    var(--bg-page) 38%,
    var(--bg-page) 100%
  );
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

a {
  color: var(--md-primary);
  text-decoration: none;
  font-weight: 700;
}
a:hover {
  color: var(--md-primary-hover);
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-sidebar);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 10;
}

/* Wordmark w sidebarze — bez półprzezroczystego tła (samo PNG) */
.sidebar-brand {
  display: block;
  margin-bottom: 24px;
  text-decoration: none;
  align-self: flex-start;
}

.logo-pill {
  display: inline-block;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.logo-pill--large {
  padding: 16px 28px;
}

.brand-logo {
  height: clamp(48px, 6vw, 72px);
  width: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
  object-position: left center;
}

.brand-logo--hero {
  height: 56px;
}

@media (min-width: 480px) {
  .brand-logo--hero {
    height: 72px;
  }
}

.sidebar-nav {
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 14px;
  transition: all 0.15s;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  border-color: rgba(103, 80, 164, 0.25);
}

.sidebar-user {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.sidebar-user img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.main {
  flex: 1;
  margin-left: 260px;
  padding: 32px 40px;
  min-height: 100vh;
}

/* ── Typography ──────────────────────────────────────────────────────────── */

h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--text);
  letter-spacing: -0.02em;
}
h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text);
}
h3 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text);
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text);
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.card:hover {
  border-color: rgba(103, 80, 164, 0.35);
  box-shadow: 0 6px 28px rgba(103, 80, 164, 0.1);
  cursor: pointer;
}

/* Book grid tiles — link + overflow menu */
.book-tile {
  position: relative;
  padding: 0;
  overflow: visible;
}

.book-tile__link {
  display: block;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius);
}

.book-tile__link:hover .card-title {
  color: var(--accent, #6750a4);
}

/* Portrait frame — full cover visible (no crop); letterboxing on wide images */
.book-tile__cover-frame {
  width: 100%;
  aspect-ratio: 2 / 3;
  margin-bottom: 12px;
  border-radius: 8px;
  background: linear-gradient(165deg, #f4efe8 0%, #e8e0d6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.book-tile__cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
}

.collection-tile__cover-frame {
  aspect-ratio: 2 / 3;
}

.book-tile__actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
}

.book-tile__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.book-tile__more:hover,
.book-tile__more[aria-expanded="true"] {
  border-color: rgba(103, 80, 164, 0.45);
  background: #fff;
}

.book-tile__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 168px;
  padding: 4px 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.book-tile__menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.book-tile__menu-item:hover {
  background: rgba(103, 80, 164, 0.08);
}

.book-tile__menu-item--danger {
  color: #b3261e;
}

.book-tile__menu-item--danger:hover {
  background: rgba(179, 38, 30, 0.08);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn.is-loading {
  cursor: wait;
  opacity: 0.7;
  pointer-events: none;
}
.btn.is-loading::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-loading-spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes btn-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Material 3 ElevatedButton — kolor primary z motywu, zaokrąglenie ~20px */
.btn-primary {
  background: var(--md-primary);
  color: var(--md-on-primary);
  border-radius: var(--radius-pill);
  box-shadow: var(--elevation-1);
  letter-spacing: 0.02em;
}
.btn-primary:hover {
  background: var(--md-primary-hover);
  color: var(--md-on-primary);
  box-shadow: var(--elevation-2);
}
.btn-primary:active {
  box-shadow: var(--elevation-1);
}

.btn-login-wide {
  width: 100%;
  justify-content: center;
  padding: 14px 24px;
  font-size: 16px;
}

/* Material 3 OutlinedButton */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-outline);
  color: var(--md-primary);
  border-radius: var(--radius-pill);
}
.btn-outline:hover {
  border-color: var(--md-primary);
  color: var(--md-primary);
  background: rgba(103, 80, 164, 0.08);
}

.btn-gold {
  background: linear-gradient(135deg, #ffb300 0%, var(--gold) 100%);
  color: #3e2723;
  font-weight: 800;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-danger {
  background: var(--error);
  color: #fff;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(126, 87, 194, 0.2);
}

select.form-control {
  appearance: none;
  cursor: pointer;
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(62, 47, 39, 0.45);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 90%;
  max-width: 520px;
  box-shadow: 0 16px 48px rgba(62, 47, 39, 0.18);
}

.modal h2 {
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.modal--book-create {
  max-width: 720px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.book-create-title {
  margin-bottom: 8px;
}

.book-form-subhead {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 22px 0 12px;
  color: var(--text);
}

.book-form-grid {
  display: grid;
  gap: 14px;
}

.book-form-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.book-form-grid--2 {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 720px) {
  .book-form-grid--3,
  .book-form-grid--2 {
    grid-template-columns: 1fr;
  }
}

.book-form-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.book-form-caption {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.label-help {
  cursor: help;
  opacity: 0.55;
  font-weight: 800;
  font-size: 0.85em;
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* Firestore / API identifiers shown in staff UI */
.entity-id {
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
  word-break: break-all;
  margin-top: 4px;
  line-height: 1.35;
}

.book-desc-textarea {
  min-height: 120px;
}

.toc-preview-wrap {
  margin-bottom: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  max-height: 200px;
}

.toc-preview-img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
  background: #fff;
}

.generate-status {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.toc-desc-panels {
  margin: 16px 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.toc-desc-panels-title {
  font-size: 15px;
  margin: 0 0 12px;
}

.toc-desc-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .toc-desc-columns {
    grid-template-columns: 1fr;
  }
}

.toc-desc-col-label {
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--md-primary);
}

.toc-desc-item {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--bg-elevated);
}

.toc-desc-item summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}

.toc-desc-text {
  font-size: 13px;
  line-height: 1.45;
  margin: 8px 0;
  white-space: pre-wrap;
}

.toc-desc-item .btn-sm {
  margin-top: 6px;
}

.book-create-actions {
  flex-wrap: wrap;
  justify-content: space-between;
}

.btn-course-create {
  background: #c62828;
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 800;
  box-shadow: var(--elevation-1);
  flex: 1;
  min-width: 200px;
  justify-content: center;
}

.btn-course-create:hover {
  background: #b71c1c;
  color: #fff;
  filter: brightness(1.02);
}

/* Karta kursu nad listą kolekcji (okładka + opis) */
.book-overview {
  margin-bottom: 28px;
  padding: 20px 22px;
}
.book-overview__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 28px;
  align-items: flex-start;
}
.book-overview__cover-wrap {
  flex: 0 0 auto;
}
.book-overview__cover {
  display: block;
  width: min(220px, 36vw);
  height: auto;
  max-height: 320px;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--bg-input);
}
.book-overview__text {
  flex: 1 1 220px;
  min-width: 0;
}
.book-overview__title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.25;
}
.book-overview__meta {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 12px;
  font-weight: 600;
}
.book-overview__description {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 560px) {
  .book-overview__cover {
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
  }
  .book-overview__grid {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .book-overview__text {
    width: 100%;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

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

.cover-input-row .form-control {
  flex: 1;
  min-width: 180px;
}

.cover-paste-status {
  font-size: 13px;
  font-weight: 700;
  margin-top: 8px;
  min-height: 1.2em;
  color: var(--text-muted);
}

.cover-paste-status--ok {
  color: var(--success);
}

.cover-paste-status--err {
  color: var(--error);
}

.cover-paste-status:empty {
  display: none;
}

.cover-variants-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .cover-variants-grid {
    grid-template-columns: 1fr;
  }
}

.cover-variant-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-elevated);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cover-variant-card:hover {
  border-color: var(--md-primary);
}

.cover-variant-card.is-selected {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(103, 80, 164, 0.25);
}

.cover-variant-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
}

.cover-variant-label {
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  padding: 8px;
  color: var(--text-muted);
}

.cover-ai-actions {
  margin-top: 4px;
}

kbd {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
}

/* ── Flash messages ──────────────────────────────────────────────────────── */

.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 700;
}

.flash-success {
  background: rgba(46, 125, 50, 0.1);
  border: 1px solid rgba(46, 125, 50, 0.45);
  color: var(--success);
}
.flash-error {
  background: rgba(198, 40, 40, 0.08);
  border: 1px solid rgba(198, 40, 40, 0.4);
  color: var(--error);
}

.flash-pending {
  background: rgba(25, 118, 210, 0.1);
  border: 1px solid rgba(25, 118, 210, 0.35);
  color: #1565c0;
}

.btn-outline.is-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

/* ── Set creation panels ─────────────────────────────────────────────────── */

.panels-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.batch-set-card {
  margin-bottom: 24px;
}

.batch-set-card__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

@media (max-width: 760px) {
  .batch-set-card__header {
    flex-direction: column;
  }
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  box-shadow: var(--shadow);
}

.set-desc-option {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.set-desc-option span {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}

.set-cover-preview {
  display: inline-flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  font-weight: 800;
  color: var(--success);
}

.set-cover-preview img {
  width: min(260px, 100%);
  height: auto;
  max-height: 380px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 800;
}

.status-idle {
  background: var(--cream-tint);
  color: var(--text-muted);
}
.status-generating {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}
.status-done {
  background: rgba(46, 125, 50, 0.12);
  color: var(--success);
}
.status-error {
  background: rgba(198, 40, 40, 0.1);
  color: var(--error);
}

.progress-bar {
  height: 4px;
  background: var(--cream-tint);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--md-primary), var(--accent-hover));
  border-radius: 2px;
  transition: width 0.3s;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-weight: 700;
}

.breadcrumb a {
  color: var(--text-muted);
}
.breadcrumb a:hover {
  color: var(--accent-deep);
}
.breadcrumb span {
  color: var(--text-muted);
}

/* ── Login (spójny z panelem admin / StartScreen) ─────────────────────────── */

.login-page {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 100vh;
  width: 100%;
  padding: 16px 28px 32px;
  overflow: hidden;
  background: linear-gradient(180deg, #e3f2fd 0%, #b3e5fc 100%);
}

.login-page::before,
.login-page::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.login-page::before {
  width: 460px;
  height: 460px;
  left: -180px;
  top: -170px;
  background: rgba(255, 255, 255, 0.22);
}

.login-page::after {
  width: 520px;
  height: 520px;
  right: -220px;
  bottom: -260px;
  background: rgba(244, 253, 233, 0.26);
}

.login-logo-chip {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 24px;
  z-index: 1;
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  max-width: min(96vw, 560px);
}

.login-logo {
  height: clamp(88px, 22vmin, 160px);
  width: auto;
  max-width: min(94vw, 520px);
  display: block;
  object-fit: contain;
  object-position: left center;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  text-align: center;
  padding: 28px 24px 24px;
  margin-top: clamp(168px, 36vmin, 260px);
  background: rgba(244, 253, 233, 0.96);
  border-radius: 28px;
  box-shadow: 0 10px 28px rgba(76, 175, 80, 0.12);
}

.login-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7a9a5b;
  margin-bottom: 16px;
}

.login-title {
  margin: 0;
  color: #3e2f27;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.login-subtitle {
  color: #616161;
  margin-top: 8px;
  margin-bottom: 28px;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.4;
}

.btn-google {
  height: 56px;
  background: #7a9a5b;
  color: #ffffff;
  padding: 0 24px;
  font-size: 15px;
  border-radius: 25px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 0 #5e7a43;
  font-family: inherit;
  width: 100%;
  justify-content: center;
  margin-bottom: 14px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn-google:hover {
  background: #7a9a5b;
  color: #fff;
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow: 0 5px 0 #5e7a43;
}

.btn-google:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #5e7a43;
}

.btn-dev {
  background: #d6ebf9;
  color: #37474f;
  box-shadow: 0 4px 0 #a1cbe8;
}

.btn-dev:hover {
  background: #d6ebf9;
  color: #37474f;
  box-shadow: 0 5px 0 #a1cbe8;
}

.btn-dev:active {
  box-shadow: 0 1px 0 #a1cbe8;
}

.google-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #ffffff;
}

.login-note {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.login-note code {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.85);
  padding: 2px 6px;
  border-radius: 4px;
}

@media (min-height: 760px) {
  .login-page {
    align-items: center;
  }
  .login-card {
    margin-top: clamp(160px, 34vmin, 240px);
  }
}

@media (max-width: 600px) {
  .login-page {
    padding: 16px 28px 32px;
  }
  .login-logo-chip {
    left: 20px;
  }
  .login-logo {
    height: clamp(72px, 26vw, 120px);
    max-width: min(92vw, 400px);
  }
  .login-card {
    margin-top: clamp(140px, 42vw, 220px);
  }
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-weight: 600;
}

.empty-state p {
  font-size: 15px;
  margin-bottom: 20px;
}

/* ── Drag handle ─────────────────────────────────────────────────────────── */

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 18px;
  user-select: none;
}

/* ── File upload area ────────────────────────────────────────────────────── */

.drop-zone {
  border: 2px dashed rgba(126, 87, 194, 0.35);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--md-primary);
  color: var(--md-on-primary-container);
  background: var(--md-primary-container);
}

.drop-zone input[type="file"] {
  display: none;
}

/* ── Local dev banner ───────────────────────────────────────────────────── */

.local-banner {
  background: rgba(255, 243, 224, 0.95);
  border: 1px solid rgba(239, 108, 0, 0.35);
  color: #5c3d2e;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 600;
}

.local-banner code {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
  border: 1px solid var(--border);
}

/* Generation guard — block double-clicks while a request is in flight */
.btn.is-guarded,
.btn[aria-busy="true"] {
  opacity: 0.72;
  cursor: wait;
  pointer-events: none;
}
