/* GarageDesk — automotive dashboard */
:root {
  --bg: #0c0e12;
  --bg-elevated: #141820;
  --bg-card: #1a1f2a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8eaef;
  --text-muted: #8b93a5;
  --accent: #3d8bfd;
  --accent-dim: rgba(61, 139, 253, 0.15);
  --success: #34c759;
  --warning: #ff9f0a;
  --danger: #ff453a;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(61, 139, 253, 0.12), transparent),
    radial-gradient(ellipse 80% 50% at 100% 100%, rgba(52, 199, 89, 0.06), transparent);
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 2rem) 3rem;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 1.25rem;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: var(--radius);
}

.header__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header__tagline {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.nav__btn {
  padding: 0.5rem 0.85rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.nav__btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav__btn.is-active {
  color: var(--text);
  background: var(--bg-elevated);
  border-color: var(--border);
}

.main {
  min-height: 50vh;
}

.view {
  display: none;
  animation: fadeIn 0.25s ease;
}

.view.is-visible {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view__title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view__lead {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  max-width: 52ch;
  line-height: 1.5;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid--stats {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin-bottom: 1.25rem;
}

.card {
  padding: 1.1rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card--wide {
  margin-top: 0;
}

.card__title {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.card__muted {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.stat__label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat__value {
  margin: 0.5rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: -0.02em;
}

.stat__value--sm {
  font-size: 1rem;
  font-family: var(--font);
  font-weight: 600;
}

.stat__hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat--accent {
  background: linear-gradient(135deg, rgba(61, 139, 253, 0.12), var(--bg-card));
  border-color: rgba(61, 139, 253, 0.25);
}

.split {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 880px) {
  .split {
    grid-template-columns: minmax(280px, 380px) 1fr;
  }

  .split--loan {
    grid-template-columns: 1fr 1fr;
  }
}

.form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.form-block {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-block .field {
  margin: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.field--full {
  grid-column: 1 / -1;
  width: 100%;
}

.field__label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  color: #fff;
  background: var(--accent);
}

.btn--primary:hover {
  filter: brightness(1.08);
}

.btn--light {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.btn--light:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn--sm {
  margin-top: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.btn--danger {
  color: #fff;
  background: rgba(255, 69, 58, 0.25);
}

.btn--danger:hover {
  background: rgba(255, 69, 58, 0.4);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.list li:last-child {
  border-bottom: none;
}

.list--compact li {
  padding: 0.55rem 0;
  font-size: 0.9rem;
}

.list-item__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.list-item__title {
  font-weight: 600;
}

.list-item__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

.list-item__note {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.list-item__actions {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 4px;
}

.badge--soon {
  background: rgba(255, 159, 10, 0.2);
  color: var(--warning);
}

.badge--normal {
  background: rgba(61, 139, 253, 0.2);
  color: var(--accent);
}

.badge--low {
  background: rgba(139, 147, 165, 0.25);
  color: var(--text-muted);
}

.badge--done {
  background: rgba(52, 199, 89, 0.2);
  color: var(--success);
}

.empty {
  margin: 0;
  padding: 1rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.empty[hidden] {
  display: none;
}

.value-chart {
  height: 140px;
  margin-bottom: 1rem;
}

.value-chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

.value-chart .axis {
  stroke: var(--border);
  stroke-width: 1;
}

.value-chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.value-chart .point {
  fill: var(--accent);
}

.value-chart .fill {
  fill: url(#chartGradient);
  opacity: 0.35;
}

.loan-result {
  margin-top: 0.5rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.loan-result__label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.loan-result__amount {
  margin: 0.35rem 0 0;
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
}

.loan-result__meta {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-msg {
  margin: 1rem 0 0;
  padding: 0.75rem;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  display: none;
}

.status-msg.is-visible {
  display: block;
  background: rgba(52, 199, 89, 0.15);
  border: 1px solid rgba(52, 199, 89, 0.35);
  color: var(--success);
}

.footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.account-bar {
  margin-bottom: 1.25rem;
}

.account-bar__signed-out {
  display: block;
}

.account-bar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
