:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --border: #2f3f56;
  --text: #e8eef7;
  --muted: #8fa3bf;
  --accent: #5b9cff;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --err: #f07178;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #1a2a44 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

.header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(8px);
}

.header__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 1.5rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.registry-badge {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  font-weight: 650;
}

.lede {
  margin: 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 0.95rem;
}

.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}

.card h2,
.card h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.card-note {
  margin: -0.25rem 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.upload-card {
  padding: 0;
  overflow: hidden;
}

.upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 2.5rem 1.5rem;
  cursor: pointer;
  transition: background 0.15s;
}

.upload:hover,
.upload:focus-within {
  background: var(--surface-2);
}

.upload__icon {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 1.25rem;
}

.upload__title {
  font-weight: 600;
}

.upload__hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.file-name {
  margin: 0;
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.status {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.status--loading {
  background: var(--surface-2);
  color: var(--muted);
}

.status--error {
  background: rgba(240, 113, 120, 0.12);
  border: 1px solid rgba(240, 113, 120, 0.35);
  color: var(--err);
}

.validation-summary {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.validation-summary--ok {
  color: var(--ok);
}

.validation-summary--fail {
  color: var(--err);
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.check-list li:first-child {
  border-top: none;
}

.badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.badge--ok {
  background: rgba(62, 207, 142, 0.15);
  color: var(--ok);
}

.badge--fail {
  background: rgba(240, 113, 120, 0.15);
  color: var(--err);
}

.grid-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.meta-list {
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.meta-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

.meta-list dt {
  color: var(--muted);
  font-weight: 400;
}

.meta-list dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -0.25rem;
}

.table-wrap--tall {
  max-height: 360px;
  overflow-y: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table th,
.table td {
  padding: 0.5rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--muted);
  font-weight: 500;
  position: sticky;
  top: 0;
  background: var(--surface);
}

.table--compact td,
.table--compact th {
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
}

.table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cell-ok {
  color: var(--ok);
}

.cell-fail {
  color: var(--err);
}

.warnings-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--warn);
  font-size: 0.85rem;
}

.footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.env-badge {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 100;
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 6px;
  background: rgba(91, 156, 255, 0.15);
  border: 1px solid rgba(91, 156, 255, 0.45);
  color: var(--accent);
}

.env-badge--prod {
  background: rgba(62, 207, 142, 0.12);
  border-color: rgba(62, 207, 142, 0.4);
  color: var(--ok);
}

.portfolio-hero .portfolio-total {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.portfolio-total__label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.portfolio-total__value {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.portfolio-total__sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.alloc-chart {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.alloc-bar__label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}

.alloc-bar__track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.alloc-bar__fill {
  height: 100%;
  border-radius: 4px;
  min-width: 2px;
}

.class-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.class-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  list-style: none;
  background: var(--surface-2);
}

.class-panel__head::-webkit-details-marker {
  display: none;
}

.class-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.class-panel__title {
  font-weight: 600;
}

.class-panel__meta {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.col-product {
  max-width: 220px;
  color: var(--muted);
  font-size: 0.78rem;
}

.details-fold summary {
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}

.details-fold__body {
  margin-top: 1rem;
}

.card--muted {
  background: transparent;
  border-style: dashed;
}

.imports-section h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.imports-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.imports-list__item {
  margin: 0;
}

.imports-list__btn {
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.imports-list__btn:hover {
  border-color: var(--accent);
  background: rgba(91, 156, 255, 0.08);
}

.imports-list__name {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.imports-list__meta {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.imports-list__meta .badge {
  margin-right: 0.35rem;
  vertical-align: middle;
}

.imports-list__empty,
.imports-list__loading {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.25rem 0;
}

.save-status {
  margin: 0 0 1rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.save-status--loading {
  background: rgba(91, 156, 255, 0.12);
  border: 1px solid rgba(91, 156, 255, 0.35);
  color: var(--accent);
}

.save-status--ok {
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid rgba(62, 207, 142, 0.35);
  color: var(--ok);
}

.save-status--warn {
  background: rgba(240, 180, 41, 0.12);
  border: 1px solid rgba(240, 180, 41, 0.35);
  color: var(--warn);
}

.save-status--error {
  background: rgba(240, 113, 120, 0.12);
  border: 1px solid rgba(240, 113, 120, 0.35);
  color: var(--err);
}

.auth-pending #app-shell {
  display: none;
}

.auth-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  background: var(--bg);
  color: var(--muted);
  z-index: 100;
}

body.auth-ready .auth-loading {
  display: none;
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.user-bar__label {
  color: var(--muted);
}

.user-bar__logout {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
}

.user-bar__logout:hover {
  border-color: var(--accent);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.login-form {
  margin-top: 1.25rem;
}

.login-field {
  display: block;
  margin-bottom: 1rem;
}

.login-field span {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.login-field input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  box-sizing: border-box;
}

.login-field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.login-error {
  color: var(--err);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

.login-submit {
  width: 100%;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #0f1419;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

.login-submit:hover {
  filter: brightness(1.08);
}

.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
