:root {
  color-scheme: light;
  --bg: #f5efe4;
  --bg-strong: #ece2cf;
  --panel: rgba(255, 252, 246, 0.78);
  --panel-strong: #fffaf0;
  --line: rgba(35, 52, 62, 0.12);
  --line-strong: rgba(35, 52, 62, 0.24);
  --text: #21333d;
  --text-muted: #5f6f77;
  --brand: #0f766e;
  --brand-soft: #d7eeea;
  --accent: #b45309;
  --accent-soft: #f3dfc3;
  --danger: #be123c;
  --danger-soft: #f7d8df;
  --success: #166534;
  --success-soft: #ddf4df;
  --shadow: 0 18px 48px rgba(41, 52, 59, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-sans: "Segoe UI Variable", "Aptos", "Bahnschrift", "Trebuchet MS", sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(180, 83, 9, 0.16), transparent 32%),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.18), transparent 30%),
    linear-gradient(180deg, #f9f4eb 0%, #f3ebdd 100%);
  color: var(--text);
  font-family: var(--font-sans);
}

button,
input,
select,
textarea {
  font: inherit;
}

.ambient {
  pointer-events: none;
  position: fixed;
  inset: auto auto 0 0;
  width: 42vw;
  height: 42vw;
  border-radius: 999px;
  filter: blur(48px);
  opacity: 0.45;
}

.ambient-a {
  top: -10vw;
  left: -10vw;
  background: rgba(180, 83, 9, 0.18);
}

.ambient-b {
  right: -10vw;
  bottom: -12vw;
  left: auto;
  background: rgba(15, 118, 110, 0.14);
}

.is-hidden {
  display: none !important;
}

.login-shell,
.app-shell {
  position: relative;
  z-index: 2;
}

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

.login-card {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 36px;
  backdrop-filter: blur(18px);
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}

.login-card h1,
.topbar h2,
.brand-name {
  margin: 10px 0 0;
  font-family: "Bahnschrift", var(--font-sans);
  font-weight: 700;
}

.lede,
.login-hint,
.muted,
.table-subtle,
.metric-note {
  color: var(--text-muted);
  line-height: 1.6;
}

.stack-form {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.field label,
.section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  padding: 12px 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.48);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

.button {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.button-primary {
  background: linear-gradient(135deg, #0f766e 0%, #0e9186 100%);
  color: #f7fffd;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.18);
}

.button-secondary {
  background: var(--panel-strong);
  color: var(--text);
  border: 1px solid var(--line);
}

.button-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--line-strong);
}

.button-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.button-success {
  background: var(--success-soft);
  color: var(--success);
}

.button-link {
  background: transparent;
  color: var(--brand);
  padding: 0;
  border-radius: 0;
}

.inline-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(15, 118, 110, 0.08);
  color: var(--brand);
}

.inline-error {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: rgba(251, 246, 238, 0.72);
  backdrop-filter: blur(14px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.14), rgba(180, 83, 9, 0.18));
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.06em;
}

.nav-stack {
  display: grid;
  gap: 10px;
}

.nav-item {
  text-align: left;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 14px 16px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.56);
  color: var(--text);
}

.nav-item.is-active {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(180, 83, 9, 0.14));
  border-color: rgba(15, 118, 110, 0.14);
  color: var(--text);
}

.nav-item[hidden] {
  display: none !important;
}

.sidebar-foot {
  display: grid;
  gap: 12px;
}

.mini-card,
.panel,
.hero-panel,
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.mini-card {
  padding: 14px;
}

.mini-label {
  font-size: 12px;
  color: var(--text-muted);
}

.mini-value {
  margin-top: 6px;
  font-weight: 700;
}

.identity-role {
  margin-top: 6px;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 24px;
  gap: 22px;
}

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

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

.pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.pill strong {
  color: var(--text);
}

.pill--brand {
  background: var(--brand-soft);
  color: var(--brand);
}

.pill--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.pill--success {
  background: var(--success-soft);
  color: var(--success);
}

.view-container {
  display: grid;
  gap: 18px;
  align-content: start;
}

.hero-panel,
.panel,
.detail-panel {
  padding: 22px;
}

.hero-panel {
  display: grid;
  gap: 16px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.92)),
    linear-gradient(220deg, rgba(180, 83, 9, 0.08), transparent 34%);
}

.hero-title {
  margin: 0;
  font-size: clamp(24px, 2.4vw, 34px);
}

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

.metric-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
}

.metric-value {
  margin-top: 12px;
  font-size: clamp(26px, 2vw, 36px);
  font-weight: 800;
}

.insight-grid,
.form-grid,
.split-grid,
.list-detail,
.dual-stack {
  display: grid;
  gap: 16px;
}

.insight-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.split-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.list-detail {
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
}

.panel h3,
.detail-panel h3,
.hero-panel h3,
.section-heading {
  margin: 0 0 14px;
}

.section-heading {
  font-size: 18px;
}

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

.stack-item {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  padding: 14px;
}

.stack-item button {
  margin-top: 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: rgba(15, 118, 110, 0.06);
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

tbody tr {
  cursor: pointer;
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.64);
}

tbody tr.is-selected {
  background: rgba(15, 118, 110, 0.1);
}

.mono,
code,
pre {
  font-family: var(--font-mono);
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(33, 51, 61, 0.06);
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  font-size: 12px;
}

.detail-block {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

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

.detail-grid .meta-box,
.image-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.64);
  padding: 14px;
}

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

.meta-value {
  margin-top: 6px;
  word-break: break-word;
  font-weight: 700;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.image-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(33, 51, 61, 0.06);
}

.toolbar,
.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar {
  margin-bottom: 16px;
}

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

.filter-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.review-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.review-stage {
  display: grid;
  gap: 16px;
}

.review-image {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(33, 51, 61, 0.06);
}

.review-score-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.review-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.review-big {
  font-size: 28px;
  font-weight: 800;
}

.empty-state {
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.48);
  color: var(--text-muted);
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 10px;
  z-index: 20;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 251, 244, 0.92);
  box-shadow: var(--shadow);
}

.toast.toast--error {
  background: rgba(255, 243, 246, 0.96);
  color: var(--danger);
}

.loading-state {
  display: grid;
  gap: 14px;
}

.loading-bar {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.08), rgba(180, 83, 9, 0.18), rgba(15, 118, 110, 0.08));
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -20% 0; }
}

@media (max-width: 1280px) {
  .metric-grid,
  .insight-grid,
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-detail,
  .review-shell,
  .split-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .nav-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace,
  .login-shell {
    padding: 18px;
  }
}

@media (max-width: 640px) {
  .metric-grid,
  .insight-grid,
  .filter-grid,
  .detail-grid,
  .review-score-strip,
  .nav-stack {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .login-card,
  .panel,
  .hero-panel,
  .detail-panel {
    padding: 18px;
  }
}
