:root {
  --ink: #16171d;
  --muted: #626675;
  --line: #e5e7ef;
  --paper: #ffffff;
  --soft: #f5f7fb;
  --brand: #f0442f;
  --brand-dark: #bd2818;
  --gold: #ffbf2f;
  --green: #16834a;
  --blue: #1769e0;
  --shadow: 0 16px 45px rgba(22, 23, 29, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(240, 68, 47, 0.09), transparent 34%),
    linear-gradient(215deg, rgba(255, 191, 47, 0.18), transparent 32%),
    var(--soft);
  line-height: 1.45;
}

a { color: inherit; }

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

button, .button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
}

button.primary, .button.primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px clamp(14px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--gold);
  border-radius: 8px;
  font-weight: 950;
}

.nav {
  grid-column: 1 / -1;
  display: none;
  gap: 6px;
  flex-wrap: wrap;
}

.nav.open { display: flex; }

.nav a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  text-decoration: none;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.nav a.active {
  color: white;
  background: var(--ink);
}

.logout-form { grid-column: 1 / -1; }
.logout-form button { width: 100%; }

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 30px);
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-card, .card, .panel, .snapshot, .quick-add {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(460px, 100%);
  padding: 24px;
}

.auth-card.inline {
  margin: 36px auto;
}

.flash {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-weight: 800;
  background: #fff3d1;
  border: 1px solid #ffd978;
}

.flash.success { background: #e9f8ef; border-color: #a5e0bd; }
.flash.error { background: #ffeceb; border-color: #ffb7b0; }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.money-move {
  min-height: 390px;
  padding: clamp(22px, 5vw, 42px);
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(140deg, rgba(22, 23, 29, 0.96), rgba(70, 22, 16, 0.92)),
    var(--ink);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-weight: 950;
  letter-spacing: 0;
}

h1, h2, h3, p { margin-top: 0; }

.money-move h1 {
  max-width: 800px;
  font-size: clamp(2rem, 8vw, 4.7rem);
  line-height: 0.97;
  margin-bottom: 16px;
  letter-spacing: 0;
}

.why {
  max-width: 780px;
  font-size: 1.08rem;
  color: rgba(255, 255, 255, 0.86);
}

.move-meta, .actions, .money-row, .dashboard-grid, .detail-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.money-row {
  margin: 22px 0;
}

.money-row div, .stat-line {
  min-width: 150px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.money-row span, .stat-line span, .detail span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.money-row span { color: rgba(255, 255, 255, 0.64); }
.money-row strong { font-size: 1.45rem; }

.snapshot, .quick-add, .card, .panel {
  padding: 18px;
}

.stat-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 10px;
  background: var(--soft);
}

.page-head, .detail-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.page-head h1, .detail-head h1 { margin-bottom: 4px; }
.page-head p, .detail-head p, .muted { color: var(--muted); }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin-top: 12px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  color: inherit;
  text-decoration: none;
  border-top: 1px solid var(--line);
}

.list-row small { color: var(--muted); }

.filters, .inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px 12px;
  color: var(--ink);
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.filters input, .filters select { min-width: min(230px, 100%); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.wide, .form-actions { grid-column: 1 / -1; }

.table-cards {
  display: grid;
  gap: 10px;
}

.record-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.record-card h3 { margin-bottom: 3px; }
.record-card p { margin-bottom: 0; color: var(--muted); }
.record-card small { display: block; color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef1f7;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
}

.badge-won, .badge-excellent, .badge-good, .badge-completed { background: #dff7e8; color: #0f6337; }
.badge-lost, .badge-at-risk, .badge-overdue { background: #ffe3df; color: #9d2418; }
.badge-proposal-sent, .badge-due-today, .badge-high, .badge-urgent { background: #fff1c7; color: #7a4f00; }
.badge-needs-attention { background: #fff1c7; color: #7a4f00; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  margin-bottom: 16px;
}

.detail {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.danger {
  border-color: #ffb7b0;
}

.empty {
  padding: 18px;
  background: white;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.compact button { min-height: 38px; padding: 7px 10px; }

@media (min-width: 760px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
  }
  .menu-toggle { display: none; }
  .nav {
    grid-column: auto;
    display: flex;
    justify-content: center;
  }
  .logout-form {
    grid-column: auto;
  }
  .logout-form button { width: auto; }
  .hero-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(290px, 0.8fr);
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .record-card {
    grid-template-columns: minmax(220px, 1.3fr) auto minmax(120px, 0.5fr) minmax(220px, 1fr);
  }
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .shell { padding: 12px; }
  .money-move { padding: 20px; }
  .money-row div, .stat-line { min-width: 100%; }
  .actions > *, .actions button, .actions .button { width: 100%; }
}

