.auth-page,
.workspace-page {
  min-height: 100vh;
  background: #0b111b;
  color: #eef3fb;
}

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

.auth-card {
  width: min(100%, 460px);
  padding: 38px;
  background: #172131;
  border: 1px solid #2f3f59;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

.auth-brand,
.workspace-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #eef3fb;
  text-decoration: none;
  font-weight: 700;
}

.auth-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #26b3ff;
  color: #06101c;
  font-weight: 900;
}

.auth-card h1 {
  margin: 8px 0 12px;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.04;
}

.eyebrow {
  margin: 0;
  color: #26b3ff;
  font: 700 11px/1.4 "JetBrains Mono", monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.auth-intro {
  color: #9cb0cc;
  line-height: 1.7;
}

.auth-form,
.field-stack {
  display: grid;
  gap: 9px;
}

.auth-form {
  margin-top: 24px;
}

.auth-form input,
.workspace-toolbar select {
  width: 100%;
}

.auth-form button,
.auth-button,
.workspace-actions button,
.file-picker {
  min-height: 42px;
}

.auth-button,
.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-button.secondary,
.workspace-actions button.secondary,
.control-row button.secondary,
.batch-box button.secondary {
  background: transparent;
  border-color: #2f3f59;
  color: #c8d5e7;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
  color: #6e829e;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #2f3f59;
}

.auth-status,
.status-strip,
.status-box {
  min-height: 22px;
  margin-top: 12px;
  color: #9cb0cc;
  font-size: 13px;
  line-height: 1.5;
}

.auth-status.good,
.status-strip.good {
  color: #42c58a;
}

.auth-status.bad,
.status-strip.bad {
  color: #ff6d6d;
}

.auth-note,
.back-link {
  color: #9cb0cc;
  font-size: 12px;
  line-height: 1.6;
}

.back-link {
  display: inline-block;
  margin-top: 24px;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px max(20px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid #2f3f59;
  background: rgba(15, 21, 32, .94);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

.workspace-account,
.workspace-actions,
.control-row,
.download-row,
.preview-tabs,
.zoom-row,
.tool-buttons,
.semantic-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.workspace-account {
  color: #9cb0cc;
  font-size: 13px;
}

.workspace-layout {
  width: min(100% - 36px, 1440px);
  margin: 0 auto;
  padding: 28px 0 48px;
}

.workspace-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(420px, 1.5fr);
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.workspace-toolbar h1 {
  margin: 8px 0;
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.05;
}

.workspace-actions {
  justify-content: flex-end;
}

.workspace-actions select,
.workspace-actions button,
.file-picker {
  width: auto;
  min-width: 126px;
}

.workspace-actions select {
  max-width: 180px;
}

.file-picker {
  padding: 9px 12px;
  border: 1px solid #1f7fb6;
  border-radius: 8px;
  background: #1d8ecb;
  color: #fff;
  cursor: pointer;
}

.file-picker input {
  display: none;
}

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

.lower-grid {
  grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr);
  margin-top: 18px;
}

.preview-card,
.control-card,
.candidates-card {
  min-width: 0;
}

.preview-viewport {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: 10px;
}

.magnifier-canvas {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 180px;
  height: 180px;
  border: 2px solid #26b3ff;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .42);
  background: #0d1420;
  pointer-events: none;
  display: none;
}

.magnifier-canvas.visible {
  display: block;
}

.pixel-readout {
  min-height: 22px;
  margin-top: 8px;
  color: #9cb0cc;
  font: 12px/1.5 "JetBrains Mono", monospace;
}

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

.section-heading h2 {
  margin: 4px 0 0;
}

.preview-canvas {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: clamp(420px, 58vh, 780px);
  min-height: 0;
  background: #0d1420;
  border: 1px solid #2f3f59;
  border-radius: 10px;
  cursor: grab;
  touch-action: none;
}

.preview-canvas:active {
  cursor: grabbing;
}

.preview-tabs {
  margin-bottom: 8px;
}

.preview-tab {
  padding: 6px 10px;
  border-color: transparent;
  background: transparent;
  color: #9cb0cc;
}

.preview-tab.active {
  background: #1e2a3e;
  color: #fff;
}

.zoom-row {
  margin: 12px 0 8px;
  color: #9cb0cc;
  font: 11px "JetBrains Mono", monospace;
}

.zoom-row input {
  flex: 1;
  min-width: 150px;
  accent-color: #26b3ff;
}

.tool-card-inner,
.stage-card {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #2f3f59;
}

.tool-buttons {
  align-items: stretch;
}

.tool-button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #2f3f59;
  border-radius: 8px;
  background: #122033;
  color: #c8d5e7;
  cursor: pointer;
}

.tool-button:hover,
.tool-button.active {
  border-color: #26b3ff;
  background: #1e5278;
  color: #fff;
}

.parameter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(86px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.parameter-grid label {
  display: grid;
  gap: 5px;
  color: #9cb0cc;
  font-size: 11px;
}

.parameter-grid input {
  width: 100%;
  min-height: 32px;
  box-sizing: border-box;
}

.parameter-grid input[type="color"] {
  padding: 2px;
}

.semantic-row {
  margin-top: 12px;
  align-items: stretch;
}

.semantic-row input {
  flex: 1 1 190px;
  min-width: 0;
}

.semantic-row button {
  min-height: 36px;
}

.candidate-actions {
  margin-top: 12px;
}

.stage-list {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  padding-left: 22px;
  color: #c8d5e7;
  font-size: 12px;
}

.stage-list li::marker {
  color: #26b3ff;
}

.stage-list li.active {
  color: #fff;
  font-weight: 700;
}

.stage-list li.complete {
  color: #42c58a;
}

.download-row {
  margin-top: 10px;
}

.download-link {
  color: #26b3ff;
  font-size: 12px;
}

.download-link.disabled {
  opacity: .45;
  pointer-events: none;
}

.status-strip,
.status-box {
  padding: 10px 12px;
  border: 1px solid #2f3f59;
  border-radius: 9px;
  background: #122033;
}

.batch-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #2f3f59;
}

.batch-box h2 {
  font-size: 15px;
}

.candidate-list {
  max-height: 440px;
  overflow: auto;
  display: grid;
  gap: 7px;
}

.candidate-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #2f3f59;
  border-radius: 8px;
  background: #122033;
}

.candidate-item small {
  color: #9cb0cc;
  white-space: nowrap;
}

.candidate-item input {
  accent-color: #26b3ff;
}

@media (max-width: 920px) {
  .workspace-toolbar,
  .workspace-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }
  .workspace-actions {
    justify-content: flex-start;
  }
  .parameter-grid {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
  }
}

@media (max-width: 620px) {
  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .auth-card {
    padding: 26px 20px;
  }
  .workspace-layout {
    width: min(100% - 24px, 1440px);
  }
  .workspace-actions > * {
    flex: 1 1 140px;
  }
  .preview-canvas {
    height: clamp(300px, 48vh, 560px);
  }
  .parameter-grid {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
  .magnifier-canvas {
    width: 140px;
    height: 140px;
  }
}
