:root {
  color-scheme: light;
  --ink: #102348;
  --muted: #587196;
  --panel: rgba(248, 251, 255, 0.9);
  --panel-border: rgba(29, 91, 181, 0.14);
  --accent: #147fe2;
  --accent-ink: #fdfefe;
  --surface: #eaf4ff;
  --surface-strong: #cde4ff;
  --shadow: 0 24px 60px rgba(17, 68, 145, 0.14);
}

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

body {
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(20, 127, 226, 0.2), transparent 32%),
    radial-gradient(circle at top right, rgba(255, 210, 33, 0.14), transparent 24%),
    linear-gradient(180deg, #f4faff 0%, #dfeeff 100%);
  color: var(--ink);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent);
}

main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 48px 20px 56px;
  display: grid;
  gap: 24px;
}

.hero {
  display: grid;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.hero--bar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.hero__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1f6fd6;
  font-weight: 700;
}

.eyebrow--brand {
  text-transform: none;
  letter-spacing: 0.04em;
  font-size: clamp(1.45rem, 2.8vw, 2rem);
  font-weight: 900;
  margin-bottom: 8px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(20, 127, 226, 0.22);
  background: #1793e6;
  isolation: isolate;
  position: relative;
  z-index: 2;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hero h1 {
  font-size: clamp(1.3rem, 2.5vw, 2.2rem);
  line-height: 1;
  max-width: 16ch;
}

.subhead {
  font-size: 1.02rem;
  color: var(--muted);
  max-width: 640px;
  line-height: 1.5;
}

.subhead--tight {
  margin-top: 8px;
  max-width: 78ch;
  font-size: 0.98rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel--compact {
  max-width: 780px;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

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

.jobs-toolbar__search {
  max-width: none;
}

.jobs-toolbar__meta {
  justify-self: end;
  color: var(--muted);
  font-size: 0.95rem;
  padding-bottom: 10px;
}

.jobs-table-shell {
  border: 1px solid rgba(29, 91, 181, 0.14);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.7);
}

.jobs-table {
  display: grid;
}

.jobs-table__row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) minmax(160px, 1.1fr) 88px 88px 100px minmax(160px, 1.1fr) 160px;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid rgba(29, 91, 181, 0.09);
}

.jobs-table__row:first-child {
  border-top: none;
}

.jobs-table__row--head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(212, 230, 255, 0.95), rgba(239, 246, 255, 0.92));
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.jobs-table__row:not(.jobs-table__row--head):nth-child(even) {
  background: rgba(233, 243, 255, 0.42);
}

.jobs-table__primary {
  font-weight: 700;
  color: var(--ink);
}

.jobs-table__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.jobs-empty-state {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
}

.uploader {
  display: grid;
  gap: 20px;
}

.analysis-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(29, 91, 181, 0.14);
  background: linear-gradient(135deg, rgba(232, 244, 255, 0.92), rgba(255, 255, 255, 0.9));
}

.analysis-status__copy {
  display: grid;
  gap: 6px;
}

.analysis-status__copy h3 {
  font-size: 1.35rem;
}

.analysis-status__copy p:last-child {
  color: var(--muted);
  line-height: 1.45;
}

.analysis-status__badge {
  min-width: 128px;
  text-align: center;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(29, 91, 181, 0.16);
}

.analysis-status[data-state="analyzing"] {
  border-color: rgba(20, 127, 226, 0.32);
  background: linear-gradient(135deg, rgba(203, 233, 255, 0.96), rgba(236, 247, 255, 0.94));
}

.analysis-status[data-state="analyzing"] .analysis-status__badge {
  background: rgba(20, 127, 226, 0.12);
  border-color: rgba(20, 127, 226, 0.26);
  color: #0f5fab;
}

.analysis-status[data-state="completed"] {
  border-color: rgba(39, 126, 70, 0.22);
  background: linear-gradient(135deg, rgba(231, 248, 237, 0.95), rgba(248, 255, 250, 0.92));
}

.analysis-status[data-state="completed"] .analysis-status__badge {
  background: rgba(39, 126, 70, 0.12);
  border-color: rgba(39, 126, 70, 0.22);
  color: #22693d;
}

.analysis-status[data-state="failed"] {
  border-color: rgba(168, 40, 40, 0.2);
  background: linear-gradient(135deg, rgba(255, 239, 239, 0.95), rgba(255, 249, 249, 0.92));
}

.analysis-status[data-state="failed"] .analysis-status__badge {
  background: rgba(168, 40, 40, 0.1);
  border-color: rgba(168, 40, 40, 0.18);
  color: #8d2424;
}

.analysis-status[data-state="not_started"] .analysis-status__badge {
  color: var(--muted);
}

.dropzone {
  border: 1px dashed rgba(20, 127, 226, 0.35);
  border-radius: 18px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  text-align: center;
}

.dropzone input {
  display: none;
}

.dropzone__title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
}

.dropzone__hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.controls--stack {
  grid-template-columns: 1fr 1fr;
}

.control {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}

.control--wide {
  grid-column: 1 / -1;
}

.control input,
.control select,
.control textarea {
  border-radius: 12px;
  border: 1px solid rgba(114, 93, 71, 0.2);
  padding: 10px 12px;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.75);
  font: inherit;
}

.control input:focus,
.control select:focus,
.control textarea:focus {
  outline: 2px solid rgba(20, 127, 226, 0.2);
  border-color: rgba(20, 127, 226, 0.55);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  border-radius: 999px;
  border: 1px solid rgba(114, 93, 71, 0.2);
  font-size: 0.95rem;
  padding: 10px 16px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
}

.primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border-color: transparent;
}

.ghost {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(29, 91, 181, 0.18);
  color: var(--ink);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.preview {
  min-height: 160px;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
}

.preview__stack {
  position: relative;
  width: 100%;
  height: 100%;
}

.preview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 10px;
  width: 100%;
}

.preview__tile {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #f5f5f5;
}

.preview__tile--primary {
  grid-column: span 2;
  aspect-ratio: 16 / 9;
}

.preview__stack img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview__grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#mask-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.65;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--muted);
}

.toggle input {
  width: 18px;
  height: 18px;
}

.results {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(17, 18, 24, 0.1);
}

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

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

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(114, 93, 71, 0.15);
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.64);
}

.results__note {
  font-size: 0.95rem;
  color: var(--muted);
}

.results__meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.dashboard-meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.dashboard-meta--warning {
  color: #8c4a1b;
}

.room-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.room-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(114, 93, 71, 0.12);
}

.room-card--warning {
  background: rgba(255, 246, 236, 0.86);
  border-color: rgba(180, 102, 39, 0.28);
}

.room-card--empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
}

.room-card__meta,
.room-card__summary {
  color: var(--muted);
  font-size: 0.94rem;
}

.room-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.review-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(114, 93, 71, 0.12);
}

.review-panel[hidden] {
  display: none;
}

.review-panel__header,
.review-panel__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.review-panel__summary {
  color: var(--muted);
  font-size: 0.95rem;
}

.review-panel__notes {
  max-width: none;
}

.table {
  display: grid;
  gap: 12px;
}

.row {
  display: grid;
  grid-template-columns: 1.2fr 0.45fr 0.8fr 1.15fr 0.8fr 0.65fr 0.95fr;
  gap: 12px;
  background: rgba(255, 255, 255, 0.68);
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(114, 93, 71, 0.1);
  align-items: center;
}

.row span {
  font-size: 0.95rem;
}

.row strong {
  font-weight: 600;
}

.row--review[data-status="approved"] {
  border-color: rgba(39, 126, 70, 0.28);
}

.row--review[data-status="removed"] {
  opacity: 0.7;
  border-color: rgba(145, 60, 46, 0.26);
}

.row--empty {
  grid-template-columns: 1fr;
  text-align: center;
  color: var(--muted);
}

.row--review[data-status="approved"] input,
.row--review[data-status="approved"] select,
.row--review[data-status="removed"] input,
.row--review[data-status="removed"] select {
  display: none;
}

.table__head {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 0 4px;
}

.row input,
.row select,
.row textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(114, 93, 71, 0.16);
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.9);
  font: inherit;
}

.row input[type="number"]::-webkit-outer-spin-button,
.row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.row input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.cell-stack {
  display: grid;
  gap: 8px;
}

.dims-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.row__hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(234, 244, 255, 0.95);
  border: 1px solid rgba(29, 91, 181, 0.14);
  font-size: 0.85rem;
  font-weight: 600;
}

.ghost--small {
  padding: 8px 12px;
  font-size: 0.84rem;
}

.tips ul {
  display: grid;
  gap: 10px;
  padding-left: 18px;
  color: var(--muted);
}

footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  padding-bottom: 32px;
}

.login-shell {
  display: grid;
  place-items: center;
}

.login-layout {
  width: min(1100px, 100%);
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
  align-items: center;
  gap: 36px;
}

.login-copy {
  display: grid;
  gap: 18px;
}

.brand-mark--login {
  width: 108px;
  height: 108px;
  margin-bottom: 2px;
}

.login-panel {
  justify-self: end;
  width: 100%;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-form__header {
  display: grid;
  gap: 8px;
}

.login-form__header p {
  color: var(--muted);
  line-height: 1.5;
}

.login-form__submit {
  margin-top: 8px;
}

.form-message {
  min-height: 1.4em;
  font-size: 0.95rem;
  color: var(--muted);
}

.form-message[data-state="error"] {
  color: #a22828;
}

.session-chip {
  border: 1px solid rgba(114, 93, 71, 0.16);
  background: rgba(255, 255, 255, 0.66);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  main {
    padding-top: 40px;
  }

  .hero--bar,
  .login-layout {
    grid-template-columns: 1fr;
  }

  .controls--stack {
    grid-template-columns: 1fr;
  }

  .hero__actions,
  .login-panel {
    justify-self: start;
  }

  .jobs-toolbar {
    grid-template-columns: 1fr;
  }

  .jobs-toolbar__meta {
    justify-self: start;
    padding-bottom: 0;
  }

  .jobs-table__row {
    grid-template-columns: 1fr;
  }

  .jobs-table__row--head {
    display: none;
  }

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

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

  .table__head {
    display: none;
  }

  .dims-editor {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
  }
}
