:root {
  --bg: #0f172a;
  --bg-soft: #12233c;
  --ink: #e2e8f0;
  --muted: #9fb3c8;
  --accent: #06d6a0;
  --accent-2: #ffb703;
  --border: rgba(255, 255, 255, 0.08);
  --card: rgba(15, 23, 42, 0.72);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

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

body {
  margin: 0;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(6, 214, 160, 0.08), transparent 26%),
    radial-gradient(circle at 80% 0%, rgba(255, 183, 3, 0.1), transparent 24%),
    linear-gradient(135deg, #0b1627, #0f172a 55%, #0b1a3f);
  color: var(--ink);
  min-height: 100vh;
  padding: 32px 16px 64px;
}

.bg-texture {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(120deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(60deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 90px 90px;
  pointer-events: none;
  z-index: 0;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

.top-bar {
  position: relative;
  z-index: 2;
  max-width: 1080px;
  margin: 0 auto 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

.top-bar.centered {
  justify-content: center;
}

.top-bar .hero-logo {
  margin-bottom: 0;
}

.account-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0b1627;
  background: linear-gradient(135deg, #06d6a0, #34e89e);
  text-transform: uppercase;
  box-shadow: 0 12px 30px rgba(6, 214, 160, 0.25);
}

header.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  align-items: center;
  justify-items: center;
  text-align: center;
  margin: 0 auto 24px;
  max-width: 1080px;
}

.hero-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 6px 10px;
  border: 1px solid rgba(6, 214, 160, 0.35);
  border-radius: 14px;
  background: rgba(6, 214, 160, 0.08);
  box-shadow: 0 18px 40px rgba(6, 214, 160, 0.14);
}

.hero-logo .logo-mark {
  width: 48px;
  height: 48px;
}

.hero-logo .logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.hero-logo .logo-title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero-logo .logo-sub {
  font-size: 12px;
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 8px;
}

.lede {
  color: var(--muted);
  margin: 12px 0 16px;
  max-width: 720px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(6, 214, 160, 0.07);
  color: var(--accent);
  border: 1px solid rgba(6, 214, 160, 0.3);
  border-radius: 999px;
  font-size: 13px;
}

.totals-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  text-align: left;
}

.totals-card .label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.figure {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.by-currency {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
}

.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.tabs {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 4px;
  border: 1px solid var(--border);
  width: fit-content;
  max-width: 100%;
}

.tab-button {
  background: transparent;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}

.tab-button.active {
  background: rgba(6, 214, 160, 0.14);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(6, 214, 160, 0.35);
}

.tab-content.hidden {
  display: none;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px 20px;
  box-shadow: var(--shadow);
}

.trip-panel {
  margin: 0;
}

.app-top-row {
  max-width: 1080px;
  margin: 0 auto 12px;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 12px;
  align-items: stretch;
}

.app-top-row .totals-card {
  height: 100%;
}

.trip-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-items: end;
}

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

.trip-form input {
  flex: 1 1 200px;
}

.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.trip-card {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trip-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.trip-card input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.trip-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.trip-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.auth-panel {
  max-width: 560px;
  margin: 0 auto 18px;
}

.auth-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-inline input {
  flex: 1 1 220px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  font-size: 18px;
}

.legend {
  display: flex;
  gap: 8px;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(6, 214, 160, 0.12);
  color: var(--accent);
  border: 1px solid rgba(6, 214, 160, 0.3);
  font-size: 12px;
}

.badge.alt {
  background: rgba(255, 183, 3, 0.12);
  color: var(--accent-2);
  border-color: rgba(255, 183, 3, 0.3);
}

.form-panel form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.two-up label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.two-up {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  outline: 1px solid transparent;
  transition: outline-color 120ms ease, transform 120ms ease;
}

input:focus,
select:focus {
  outline-color: rgba(6, 214, 160, 0.45);
  transform: translateY(-1px);
}

select option {
  color: #0b1627;
  background: #e2e8f0;
}

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

.currency-chip {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

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

.currency-chip.active {
  background: rgba(6, 214, 160, 0.14);
  border-color: rgba(6, 214, 160, 0.35);
  box-shadow: 0 18px 40px rgba(6, 214, 160, 0.16);
  color: var(--ink);
}

button.primary {
  align-self: flex-start;
  padding: 12px 16px;
  background: linear-gradient(120deg, #06d6a0, #34e89e);
  border: none;
  border-radius: 12px;
  color: #0b1627;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 20px 40px rgba(6, 214, 160, 0.25);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 60px rgba(6, 214, 160, 0.32);
}

.ghost {
  padding: 12px 14px;
  background: transparent;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--ink);
  cursor: pointer;
}

.ghost.small {
  padding: 8px 10px;
  font-size: 13px;
}

.hidden {
  display: none;
}

.hint {
  font-size: 13px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.status-dot.live {
  background: radial-gradient(circle, rgba(6, 214, 160, 0.9), rgba(6, 214, 160, 0.2));
  box-shadow: 0 0 0 6px rgba(6, 214, 160, 0.15);
}

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

.category-card {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.category-card h3 {
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-card .value {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 700;
}

.category-card .sub {
  color: var(--muted);
  font-size: 13px;
}

.manage-panel {
  max-width: 1040px;
  margin: 0 auto;
}

.category-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.category-inline input {
  flex: 1 1 220px;
}

.manage-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.currency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.currency-card {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.currency-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.currency-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.currency-code,
.currency-label,
.currency-rate {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.currency-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.rate-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.currency-rate {
  width: 120px;
}

.category-card.manage {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-card-top {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.category-name-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.category-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.subcat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.subcat-add {
  display: flex;
  gap: 8px;
}

.subcat-add input {
  flex: 1;
}

.chip.removable {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-remove {
  background: transparent;
  border: none;
  color: #fca5a5;
  cursor: pointer;
  font-weight: 700;
}

.expense-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.expense-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.expense-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.expense-title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.expense-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.amount {
  text-align: right;
}

.amount .native {
  font-weight: 700;
}

.amount .converted {
  color: var(--muted);
  font-size: 13px;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.chip.small {
  font-size: 11px;
  padding: 3px 8px;
}

.chip.small.alt-tag {
  border-color: rgba(255, 183, 3, 0.4);
  color: var(--accent-2);
}

.delete-btn {
  background: transparent;
  color: #fca5a5;
  border: 1px solid rgba(252, 165, 165, 0.4);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

.edit-btn {
  background: transparent;
  color: #e2e8f0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

.filters select {
  min-width: 140px;
}

@media (max-width: 720px) {
  body {
    padding: 20px 12px 48px;
  }

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

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

  .controls {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}
