@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  color-scheme: light;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 104, 104, 0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(82, 115, 255, 0.18), transparent 30%),
    linear-gradient(180deg, #f6f1eb 0%, #f5f7fb 100%);
  color: #152033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-shell[hidden] {
  display: none;
}

.auth-panel {
  width: min(520px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #152033, #304260);
  color: #fff;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
}

button:hover:not(:disabled) {
  opacity: 0.96;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(21, 32, 51, 0.12);
}

button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.ghost-button {
  background: rgba(245, 247, 251, 0.92);
  color: #152033;
  border: 1px solid rgba(21, 32, 51, 0.1);
}

.danger-button {
  background: linear-gradient(135deg, #7f1d1d, #b91c1c);
}

.shell {
  max-width: 1580px;
  margin: 0 auto;
  padding: 28px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow,
.badge,
.library-meta,
.selection-chip,
.problem-kicker,
.preview-label,
.empty-state small {
  font-family: "IBM Plex Mono", monospace;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7b6a5a;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 0.94;
}

h2 {
  font-size: 1.18rem;
  margin-bottom: 4px;
}

.lede,
.panel-copy {
  color: #566173;
  line-height: 1.55;
}

.badge {
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: #fff6e8;
  border: 1px solid rgba(123, 106, 90, 0.16);
  color: #7b4d12;
}

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.status-card,
.panel,
.problem-row,
.upload-file,
.preview-image {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(21, 32, 51, 0.08);
  box-shadow: 0 16px 40px rgba(21, 32, 51, 0.08);
}

.status-card {
  padding: 16px;
  border-radius: 20px;
  display: grid;
  gap: 8px;
}

.status-card strong {
  font-size: 1.6rem;
}

.status-card.warm {
  background: #fff1df;
}

.status-card.blue {
  background: #e6efff;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.55fr);
  gap: 18px;
  align-items: start;
}

.library-area {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.library-area > .preview-panel {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

.sidebar {
  display: grid;
  gap: 18px;
}

.panel {
  border-radius: 26px;
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.inline-actions,
.button-stack {
  display: grid;
  gap: 10px;
}

.inline-actions {
  grid-auto-flow: column;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px)) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.filter-grid label,
.search-field,
.upload-dropzone {
  display: grid;
  gap: 6px;
}

select,
input[type="search"] {
  width: 100%;
  border: 1px solid rgba(21, 32, 51, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  padding: 14px 16px;
}

.library-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: #5d6778;
  font-size: 13px;
}

.problem-list {
  display: grid;
  gap: 10px;
  max-height: 70vh;
  overflow: auto;
  padding-right: 4px;
}

.problem-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border-radius: 22px;
}

.problem-row.active {
  border-color: rgba(48, 66, 96, 0.28);
  box-shadow: 0 18px 42px rgba(48, 66, 96, 0.14);
}

.problem-row input[type="checkbox"] {
  margin-top: 5px;
  inline-size: 18px;
  block-size: 18px;
}

.problem-row button {
  min-width: 94px;
  padding-inline: 14px;
}

.problem-main {
  display: grid;
  gap: 7px;
}

.problem-kicker {
  color: #7b6a5a;
  font-size: 12px;
}

.problem-title {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.problem-title strong {
  font-size: 1rem;
}

.problem-chip,
.selection-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(230, 239, 255, 0.8);
  color: #27446d;
  font-size: 12px;
}

.problem-chip.image {
  background: rgba(255, 241, 223, 0.95);
  color: #8a4b00;
}

.problem-meta {
  color: #566173;
  line-height: 1.5;
}

.problem-tags {
  color: #425067;
  font-size: 0.95rem;
}

.upload-dropzone {
  padding: 20px;
  border-radius: 22px;
  border: 1px dashed rgba(21, 32, 51, 0.18);
  background: rgba(245, 247, 251, 0.8);
  margin-bottom: 12px;
  cursor: pointer;
}

.upload-dropzone input {
  display: none;
}

.upload-list,
.selection-summary,
.preview-gallery,
.publish-status {
  display: grid;
  gap: 10px;
}

.upload-file,
.empty-state,
.selection-card,
.preview-image {
  border-radius: 18px;
  padding: 14px;
}

.upload-file {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.selection-card {
  background: rgba(245, 247, 251, 0.86);
  border: 1px solid rgba(21, 32, 51, 0.08);
}

.selection-card strong {
  display: block;
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.selection-chip {
  background: rgba(255, 255, 255, 0.82);
  margin-right: 8px;
}

.publish-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.publish-note {
  margin-top: 10px;
  color: #5d6778;
  line-height: 1.5;
}

.preview-meta {
  margin-bottom: 12px;
  color: #566173;
}

.preview-image {
  display: grid;
  gap: 10px;
}

.preview-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7b6a5a;
}

.preview-image img {
  width: 100%;
  border-radius: 14px;
  display: block;
  background: #f8fafc;
}

.empty-state {
  border: 1px dashed rgba(21, 32, 51, 0.16);
  background: rgba(245, 247, 251, 0.8);
  color: #5d6778;
}

.auth-notice {
  min-height: 22px;
  color: #991b1b;
}

.progress-bar {
  height: 8px;
  border-radius: 8px;
  background: rgba(21, 32, 51, 0.08);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar[hidden] {
  display: none;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 8px;
  background: linear-gradient(90deg, #304260, #5273ff);
  transition: width 300ms ease;
}

.progress-bar-fill.indeterminate {
  width: 100%;
  animation: indeterminate 1.4s ease-in-out infinite;
}

.progress-modal {
  position: fixed;
  inset: 0;
  background: rgba(21, 32, 51, 0.28);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 15;
}

.progress-modal[hidden] {
  display: none;
}

.progress-modal-card {
  width: min(560px, calc(100vw - 32px));
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(21, 32, 51, 0.08);
  box-shadow: 0 24px 60px rgba(21, 32, 51, 0.18);
  border-radius: 28px;
  padding: 24px;
  display: grid;
  gap: 14px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #5d6778;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.progress-bar-modal {
  margin-bottom: 0;
  height: 10px;
}

.progress-detail strong {
  font-size: 1.05rem;
}

.progress-detail p {
  color: #566173;
  line-height: 1.55;
}

@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 14px 18px;
  border-radius: 16px;
  background: #152033;
  color: #fff;
  box-shadow: 0 20px 40px rgba(21, 32, 51, 0.22);
  max-width: min(420px, calc(100vw - 32px));
  z-index: 10;
}

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

  .library-area {
    grid-template-columns: 1fr;
  }

  .problem-list {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .panel-head {
    flex-direction: column;
  }

  .status-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .problem-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .problem-row button {
    grid-column: 1 / -1;
  }

  .inline-actions {
    grid-auto-flow: row;
  }
}
