/* ============================================================
   Trawick Financial — Design System
   ============================================================ */

:root {
  --green:        #1caa5c;
  --green-light:  #e8f7ef;
  --amber:        #f59e0b;
  --amber-light:  #fef3c7;
  --amber-text:   #92400e;
  --purple:       #7c3aed;
  --purple-light: #ede9fe;
  --purple-text:  #5b21b6;
  --text:         #212327;
  --text-grey:    #6b7280;
  --text-light:   #9ca3af;
  --border:       #E3E5EB;
  --bg:           #f8f9fa;
  --white:        #ffffff;
  --btn-hover:    #000000;
}

/* ============================================================
   Reset & Base
   ============================================================ */

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--green);
  text-decoration: none;
}

/* ============================================================
   Navigation
   ============================================================ */

.top-nav {
  display: flex;
  align-items: center;
  padding: 14px 32px;
  background: var(--white);
  border-bottom: 2px solid var(--border);
  gap: 24px;
  flex-wrap: nowrap;
}

.nav-brand {
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  white-space: nowrap;
}

.nav-brand-light {
  font-weight: 400;
  color: var(--text-grey);
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 8px 16px;
  color: var(--text-grey);
  font-size: 13px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--green-light);
  color: var(--green);
}

.nav-link.active {
  background: var(--green);
  color: var(--white);
  font-weight: 600;
}

.nav-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.nav-username {
  color: var(--text-grey);
  font-size: 13px;
}

.nav-logout {
  color: var(--text-grey);
  font-size: 13px;
  text-decoration: none;
}

.nav-logout:hover {
  color: var(--text);
}

/* ============================================================
   Auth Pages
   ============================================================ */

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--white);
  border-radius: 12px;
  padding: 40px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
}

.auth-title-light {
  font-weight: 400;
  color: var(--text-grey);
}

.auth-subtitle {
  color: var(--text-grey);
  font-size: 14px;
  text-align: center;
  margin-bottom: 24px;
}

.auth-link {
  text-align: center;
  font-size: 13px;
  color: var(--text-grey);
  margin-top: 16px;
}

.auth-link a {
  color: var(--green);
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-grey);
  font-weight: 600;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--green);
}

textarea.form-input {
  resize: vertical;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--green);
  color: var(--white);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--btn-hover);
  color: var(--white);
}

.btn-full {
  display: block;
  width: 100%;
  text-align: center;
  padding: 14px;
}

/* ============================================================
   Flash Messages
   ============================================================ */

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid transparent;
}

.flash-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.flash-success {
  background: var(--green-light);
  color: #166534;
  border-color: #bbf7d0;
}

/* ============================================================
   Page Layout
   ============================================================ */

.content {
  min-height: calc(100vh - 65px);
}

.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
}

.page-subtitle {
  color: var(--text-grey);
  font-size: 14px;
  margin-top: 4px;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}

.card-body {
  padding: 20px;
}

/* ============================================================
   Summary Cards
   ============================================================ */

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

.summary-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.summary-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-grey);
  font-weight: 600;
}

.summary-card .value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}

.summary-card .value.green {
  color: var(--green);
}

/* ============================================================
   Ledger Table
   ============================================================ */

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ledger-table th {
  padding: 10px 16px;
  background: var(--bg);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-grey);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.ledger-table td {
  padding: 9px 16px;
  text-align: right;
  border-bottom: 1px solid #f5f5f5;
}

.ledger-table th.text-left,
.ledger-table td.text-left {
  text-align: left;
}

.ledger-table tr:nth-child(even) {
  background: #fafafa;
}

.ledger-table tr.income-row {
  background: #f0fdf4;
}

.text-green {
  color: var(--green);
}

.text-amber {
  color: var(--amber);
}

.text-grey {
  color: var(--text-grey);
}

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

/* ============================================================
   Badges
   ============================================================ */

.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}

.badge-horizon {
  background: var(--green-light);
  color: var(--green);
}

.badge-rothx {
  background: var(--amber-light);
  color: var(--amber-text);
}

.badge-excelerator {
  background: var(--purple-light);
  color: var(--purple-text);
}

/* ============================================================
   Benchmark Cards
   ============================================================ */

.benchmark-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.benchmark-icon {
  width: 40px;
  height: 40px;
  background: var(--green-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.benchmark-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-grey);
  font-weight: 600;
}

.benchmark-value {
  font-size: 18px;
  font-weight: 700;
}

/* ============================================================
   Links
   ============================================================ */

.link-green {
  color: var(--green);
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
}

.link-green:hover {
  text-decoration: underline;
}

/* ============================================================
   Empty State
   ============================================================ */

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-grey);
}

/* ============================================================
   Utility
   ============================================================ */

.text-left   { text-align: left; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mt-1        { margin-top: 8px; }
.mb-1        { margin-bottom: 8px; }

/* ============================================================
   Learning Center
   ============================================================ */

.learning-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.learning-card .card-body {
  min-height: 120px;
}

/* ============================================================
   Responsive — Tablet
   ============================================================ */

@media (max-width: 768px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .learning-grid {
    grid-template-columns: 1fr;
  }

  .top-nav {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 12px;
  }

  .nav-user {
    margin-left: 0;
  }

  .page-container {
    padding: 20px 16px;
  }
}

/* ============================================================
   Strategy buttons
   ============================================================ */

.strategy-btn {
  flex: 1;
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  color: var(--text-grey);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.strategy-btn.active {
  background: var(--green-light);
  border: 2px solid var(--green);
  color: var(--green);
  font-weight: 600;
}
.strategy-btn:hover {
  border-color: var(--green);
}

/* Qualified toggle buttons */
.qual-btn {
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-grey);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.qual-btn.active {
  background: white;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Delete button */
.btn-delete {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-grey);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  line-height: 1;
  font-family: inherit;
}
.btn-delete:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}
