:root {
  --primary: #D4AF37;
  --primary-dark: #C89B3C;
  --primary-light: #FFF6D8;
  --success: #2E7D32;
  --danger: #C62828;
  --warning: #F59E0B;
  --gray-50: #FDFBF5;
  --gray-100: #FFF6D8;
  --gray-200: #E6D8A8;
  --gray-300: #D8C27A;
  --gray-400: #9A7B2F;
  --gray-500: #777777;
  --gray-600: #555555;
  --gray-700: #333333;
  --gray-800: #111111;
  --gray-900: #111111;
  --header-bg: #1A1A1A;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(212,175,55,0.18), 0 1px 2px rgba(212,175,55,0.10);
  --shadow-md: 0 4px 6px rgba(212,175,55,0.18), 0 2px 4px rgba(212,175,55,0.10);
  --shadow-lg: 0 10px 15px rgba(212,175,55,0.22), 0 4px 6px rgba(212,175,55,0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* Navigation */
.navbar {
  background: var(--header-bg);
  border-bottom: 1px solid #2a2a2a;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: auto;
  padding: 0.5rem 0;
}

.nav-brand img {
  display: block;
  height: 80px;
  width: auto;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 700;
}

.nav-brand svg {
  width: 28px;
  height: 28px;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: #cccccc;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(212,175,55,0.15);
  color: var(--primary);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.page-header {
  text-align: center;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--gray-500);
  font-size: 0.95rem;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card h2 {
  font-size: 1rem;
  color: var(--gray-700);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-dark);
}

/* Form Elements */
.form-row {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--gray-800);
  background: white;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.18);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

/* Items Table */
.items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.items-table th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem;
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
}

.items-table td {
  padding: 0.4rem 0.5rem;
}

.items-table input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.items-table input:focus {
  outline: none;
  border-color: var(--primary);
}

.items-table .col-desc { width: 40%; }
.items-table .col-qty { width: 12%; }
.items-table .col-price { width: 18%; }
.items-table .col-total { width: 18%; }
.items-table .col-action { width: 12%; text-align: center; }

.item-total {
  font-weight: 600;
  color: var(--gray-700);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: #15803d; }

.btn-danger {
  background: white;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: #fef2f2; border-color: #b91c1c; }

.btn-outline {
  background: white;
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--primary); color: var(--primary-dark); }

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

/* Totals */
.totals-section {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.totals-table {
  width: 320px;
}

.totals-table tr td {
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
}

.totals-table tr td:first-child {
  color: var(--gray-600);
}

.totals-table tr td:last-child {
  text-align: right;
  font-weight: 600;
}

.totals-table .grand-total td {
  font-size: 1.1rem;
  color: var(--primary-dark);
  border-top: 2px solid var(--primary);
  padding-top: 0.6rem;
}

.totals-table input {
  width: 80px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.85rem;
  text-align: right;
}

.totals-table select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

/* Invoice Preview */
.invoice-preview {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.invoice-preview .inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid var(--primary);
}

.invoice-preview .inv-title {
  font-size: 2rem;
  color: var(--primary-dark);
  font-weight: 700;
}

.invoice-preview .inv-meta {
  text-align: right;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.invoice-preview .inv-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.invoice-preview .inv-party h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 0.3rem;
}

.invoice-preview .inv-party p {
  font-size: 0.9rem;
  line-height: 1.5;
}

.invoice-preview .inv-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.invoice-preview .inv-items-table th {
  background: var(--gray-100);
  padding: 0.6rem;
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--gray-600);
}

.invoice-preview .inv-items-table td {
  padding: 0.6rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.9rem;
}

.invoice-preview .inv-items-table .text-right {
  text-align: right;
}

.invoice-preview .inv-notes {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* Loan Calculator */
.calc-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.stat-box {
  text-align: center;
  padding: 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

.stat-box .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-box .stat-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
}

.savings-box {
  background: #f0fdf4;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  margin-top: 1rem;
}

.savings-box .savings-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--success);
}

/* Amortization Table */
.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 1rem;
}

.amort-table th {
  background: var(--gray-100);
  padding: 0.6rem;
  text-align: right;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--gray-600);
  position: sticky;
  top: 0;
}

.amort-table th:first-child { text-align: left; }

.amort-table td {
  padding: 0.5rem 0.6rem;
  text-align: right;
  border-bottom: 1px solid var(--gray-100);
}

.amort-table td:first-child { text-align: left; }

.amort-table tr:hover { background: var(--gray-50); }

.table-scroll {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

/* SEO Content */
.seo-content {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-top: 2rem;
}

.seo-content h2 {
  font-size: 1.3rem;
  color: var(--gray-900);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
}

.seo-content h3 {
  font-size: 1.05rem;
  color: var(--gray-800);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--primary-dark);
}

.seo-content p {
  color: var(--gray-600);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.seo-content ul,
.seo-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.seo-content li {
  color: var(--gray-600);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 0.3rem;
}

.seo-content li strong {
  color: var(--gray-800);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  background: var(--header-bg);
  color: #999999;
  font-size: 0.8rem;
  margin-top: 2rem;
  border-top: 1px solid #2a2a2a;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover {
  color: var(--primary-dark);
}

/* Extra payments table */
.extra-payments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.extra-payments-table th {
  background: var(--gray-100);
  padding: 0.5rem;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--gray-500);
}

.extra-payments-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--gray-100);
}

/* Amount in Words */
.amount-words {
  font-style: italic;
  color: var(--gray-600);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

/* Responsive */
@media (max-width: 768px) {
  .form-row.cols-2,
  .form-row.cols-3,
  .form-row.cols-4 {
    grid-template-columns: 1fr;
  }
  .calc-container {
    grid-template-columns: 1fr;
  }
  .nav-links { display: none; }
  .invoice-preview .inv-parties {
    grid-template-columns: 1fr;
  }
}
