:root {
  --bg: #0b1220;
  --panel: #111a2e;
  --surface: rgba(255,255,255,0.03);
  --accent: #7c9cff;
  --accent-2: #2ad2c9;
  --accent-3: #ffca80;
  --text: #edf1ff;
  --muted: #a9b5d0;
  --danger: #ff7a7a;
  --ok: #8affb3;
  --ring: 0 0 0 3px rgba(124, 156, 255, 0.25);
  --shadow: 0 14px 40px rgba(0, 0, 0, .38);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  background:
    radial-gradient(1200px 800px at 15% -10%, rgba(124,156,255,0.16), transparent 60%),
    radial-gradient(900px 600px at 85% -15%, rgba(42,210,201,0.12), transparent 55%),
    linear-gradient(180deg, #0a101d 0%, #101a32 100%);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  margin: 0;
}

body {
  padding-bottom: 80px;
}

a {
  color: inherit;
}

.wrap {
  max-width: 1320px;
  margin: 40px auto;
  padding: 0 24px;
}

@media (max-width: 768px) {
  .wrap {
    margin: 24px auto;
    padding: 0 18px;
  }
}

header.hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 36px;
}

header.hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  margin: 0;
  letter-spacing: -0.02em;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, #c4d1ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.6;
  font-size: 15px;
}

.quick-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 28px;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(124,156,255,0.25);
  background: rgba(12,20,40,0.85);
  color: var(--text);
  font-weight: 600;
  letter-spacing: .3px;
  text-decoration: none;
  transition: transform .08s ease, border-color .15s ease, background .15s ease;
}

.nav-button:hover {
  border-color: rgba(124,156,255,0.45);
  background: rgba(20,32,56,0.92);
  transform: translateY(-1px);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 36px;
  padding: 8px 10px;
  background: linear-gradient(135deg, rgba(17,26,46,0.95), rgba(12,20,40,0.92));
  border-radius: 14px;
  border: 1px solid rgba(124,156,255,0.12);
  flex-wrap: wrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 11px 20px;
  border-radius: 10px;
  color: rgba(233,238,252,0.7);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  transition: background .2s ease, color .2s ease, transform .15s ease;
  position: relative;
}

.nav-link:hover {
  background: rgba(124,156,255,0.1);
  color: rgba(233,238,252,0.95);
  transform: translateY(-1px);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(124,156,255,0.22), rgba(42,210,201,0.18));
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(124,156,255,0.2);
}

.nav-link.active::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(124,156,255,0.6), transparent);
  border-radius: 2px 2px 0 0;
}

.nav-button-logout {
  margin-left: auto;
  font-size: 13px;
  padding: 9px 18px;
  font-weight: 600;
}

.dashboard-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

@media (max-width: 768px) {
  .dashboard-actions {
    grid-template-columns: 1fr;
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.action-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 36px;
  background: 
    linear-gradient(135deg, rgba(124,156,255,0.06) 0%, rgba(42,210,201,0.04) 100%),
    rgba(12,20,40,0.85);
  border: 1px solid rgba(124,156,255,0.15);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
  position: relative;
  overflow: hidden;
}

.action-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(124,156,255,0.1), transparent 70%);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}

.action-card:hover {
  transform: translateY(-4px);
  border-color: rgba(124,156,255,0.35);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}

.action-card:hover::after {
  opacity: 1;
}

.action-icon {
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.action-card h3 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.action-card p {
  margin: 0;
  color: rgba(169,181,208,0.85);
  line-height: 1.55;
  font-size: 14px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  text-decoration: none;
  border-radius: 10px;
}

.panel {
  background:
    radial-gradient(1000px 600px at 0% -15%, rgba(124,156,255,.14), transparent 65%),
    radial-gradient(800px 500px at 100% 0%, rgba(42,210,201,.12), transparent 70%),
    linear-gradient(135deg, rgba(17,26,46,0.98), rgba(13,21,38,0.96));
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% -20%, rgba(255,202,128,0.06), transparent 60%);
  pointer-events: none;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124,156,255,0.3), transparent);
}

.panel > * {
  position: relative;
  z-index: 1;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding: 32px;
}

@media (max-width: 768px) {
  .summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    padding: 24px;
  }
}

.summary-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 140px;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(124,156,255,0.4), rgba(42,210,201,0.3));
  opacity: 0;
  transition: opacity .2s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124,156,255,0.2);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.summary-card:hover::before {
  opacity: 1;
}

.summary-card h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(169,181,208,0.75);
  line-height: 1.3;
}

.summary-card .value {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 4px;
  word-break: break-word;
}

.summary-card .sub {
  color: rgba(233,238,252,0.55);
  font-size: 12px;
  line-height: 1.45;
  margin-top: auto;
  font-weight: 400;
}

.grid-layout {
  display: grid;
  gap: 22px;
  margin-top: 34px;
}

@media (min-width: 980px) {
  .grid-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  }
}

.form-section {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.form-section h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 32px);
}

.form-section p.muted {
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: grid;
  gap: 16px;
}

@media (min-width: 680px) {
  .form-row.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

label {
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}

input, select, textarea {
  width: 100%;
  background: #0c1427;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color .14s ease, box-shadow .14s ease, transform .08s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
  transform: translateY(-1px);
}

button {
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.01em;
}

button.primary {
  background: linear-gradient(135deg, #7c9cff 0%, #6b86ff 100%);
  color: #0a0f1a;
  box-shadow: 0 4px 16px rgba(124,156,255,0.35);
  font-weight: 700;
}

button.primary:hover {
  box-shadow: 0 6px 24px rgba(124,156,255,0.45);
  transform: translateY(-1px);
}

button.secondary {
  background: linear-gradient(135deg, rgba(28,39,68,0.95), rgba(20,30,56,0.92));
  color: var(--text);
  border: 1px solid rgba(124,156,255,0.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

button.secondary:hover {
  border-color: rgba(124,156,255,0.25);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transform: translateY(-1px);
}

button.ghost {
  background: transparent;
  border: 1px solid rgba(124,156,255,0.2);
  color: rgba(233,238,252,0.8);
}

button.ghost:hover {
  background: rgba(124,156,255,0.08);
  border-color: rgba(124,156,255,0.3);
  color: rgba(233,238,252,0.95);
}

button:active {
  transform: translateY(0px);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(124,156,255,0.18), rgba(42,210,201,0.12));
  border: 1px solid rgba(124,156,255,0.25);
  color: rgba(233,238,252,0.9);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(124,156,255,0.18);
  color: rgba(233,238,252,0.85);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.table-wrap {
  padding: 32px 36px;
  overflow-x: auto;
}

.table-wrap.compact {
  padding: 0;
  margin-top: 18px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
}

.table-wrap.compact table {
  border-radius: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 14px;
  overflow: hidden;
}

thead {
  background: rgba(255,255,255,0.04);
}

th, td {
  padding: 12px 16px;
  font-size: 14px;
  text-align: left;
}

th {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(169,181,208,0.82);
}

tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

tbody tr:last-child {
  border-bottom: none;
}

.money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.progress {
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress span {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent-2) 0%, var(--accent) 100%);
  transition: width .25s ease;
}

.progress.over span {
  background: linear-gradient(90deg, rgba(255,122,122,0.85) 0%, rgba(255,202,128,0.9) 100%);
}

.status-badge {
  font-weight: 600;
}

.status-badge.bad {
  color: var(--danger);
}

.status-badge.good {
  color: var(--ok);
}

.loan-scenarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .loan-scenarios-grid {
    grid-template-columns: 1fr;
  }
}

.loan-scenario-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  transition: all .2s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  min-height: 220px;
}

.loan-scenario-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124,156,255,0.25);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.03) 100%);
}

.loan-scenario-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.loan-scenario-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text);
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.loan-scenario-badge {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
}

.loan-scenario-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.loan-scenario-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  min-height: 20px;
}

.loan-scenario-label {
  color: rgba(169,181,208,0.75);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.loan-scenario-value {
  font-weight: 700;
  color: var(--text);
  text-align: right;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.loan-scenario-value.highlight {
  color: var(--accent);
}

.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.035) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid rgba(255,255,255,0.06);
  transition: background .2s ease, border-color .2s ease, transform .15s ease;
}

.transaction-item:hover {
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.03) 100%);
  border-color: rgba(124,156,255,0.12);
  transform: translateX(2px);
}

.transaction-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.transaction-amount {
  font-weight: 700;
  font-size: 16px;
}

.transaction-meta {
  font-size: 12px;
  color: rgba(169,181,208,0.78);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.empty-state {
  padding: 48px 32px;
  text-align: center;
  color: rgba(169,181,208,0.65);
  font-size: 14px;
  line-height: 1.6;
  background: rgba(255,255,255,0.02);
  border-radius: 12px;
  border: 1px dashed rgba(124,156,255,0.15);
}

.inline-input {
  background: rgba(12,20,39,0.92);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 8px 10px;
  width: 120px;
  font-size: 14px;
  color: var(--text);
}

.inline-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.flex-between h2 {
  margin: 6px 0 0 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.muted {
  color: rgba(169,181,208,0.74);
  font-size: 13px;
}

.spacer-sm { height: 12px; }

.auth-grid {
  display: grid;
  gap: 22px;
}

@media (min-width: 840px) {
  .auth-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.auth-card {
  background: rgba(255,255,255,0.04);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-card h2 {
  margin: 0;
}

.hidden {
  display: none !important;
}

.loan-grid {
  display: grid;
  gap: 18px;
}

@media (min-width: 720px) {
  .loan-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.loan-card {
  background: rgba(12,20,37,0.9);
  border-radius: 16px;
  border: 1px solid rgba(124,156,255,0.2);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.loan-card label {
  color: #f5f8ff;
  font-weight: 700;
}

.loan-card .field-hint {
  color: rgba(169,181,208,0.78);
  font-size: 12px;
  margin-bottom: 6px;
}

.loan-card .control {
  position: relative;
}

.loan-card .control span {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  background: linear-gradient(135deg, rgba(124,156,255,0.25) 0%, rgba(42,210,201,0.18) 100%);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
}

.loan-card input {
  padding-left: 60px;
  background: rgba(12,20,40,0.9);
  border: 1px solid rgba(255,255,255,0.12);
}

.loan-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.loan-actions-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.loan-manager {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 980px) {
  .loan-manager {
    flex-direction: row;
    align-items: stretch;
  }
}

.loan-sidebar {
  flex: 1;
  background: rgba(12,20,37,0.78);
  border: 1px solid rgba(124,156,255,0.15);
  border-radius: 18px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 980px) {
  .loan-sidebar {
    flex: 0 0 280px;
  }
}

.loan-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.loan-item button {
  width: 100%;
  border: 1px solid rgba(124,156,255,0.18);
  background: rgba(15,24,44,0.8);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .08s ease;
}

.loan-item button:hover {
  border-color: rgba(124,156,255,0.4);
  background: rgba(20,32,56,0.92);
}

.loan-item.active button {
  border-color: rgba(124,156,255,0.65);
  background: linear-gradient(135deg, rgba(124,156,255,0.28), rgba(42,210,201,0.2));
  transform: translateY(-1px);
}

.loan-name {
  font-weight: 700;
  letter-spacing: .2px;
}

.loan-meta {
  font-size: 12px;
  color: rgba(169,181,208,0.8);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.loan-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.loan-table h3 {
  margin: 0;
}

.loan-table .table-wrap {
  background: rgba(12,20,37,0.6);
}

.loan-table .muted {
  max-width: 520px;
}

.loan-table button {
  font-size: 13px;
  padding: 10px 12px;
}

.loan-table-actions {
  display: inline-flex;
  gap: 8px;
}

.loan-table table tr.active {
  background: rgba(124,156,255,0.18);
}

button.danger {
  border: 1px solid rgba(255,122,122,0.4);
  color: var(--danger);
}

button.danger:hover {
  filter: brightness(1.05);
}

#loanEmpty {
  display: none;
  padding: 24px;
  font-size: 14px;
}

#loanTableEmpty {
  display: none;
  padding: 24px;
  font-size: 14px;
}

.loan-summary {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.loan-summary .card {
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.loan-summary .card h3 {
  margin: 0;
  font-size: 11px;
  color: rgba(169,181,208,0.75);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
}

.loan-summary .card .num {
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  word-break: break-word;
  line-height: 1.2;
}

.schedule-table {
  max-height: 420px;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
}

table.schedule {
  border-radius: 0;
}

.tax-results {
  margin-top: 24px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
}

.tax-breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tax-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.tax-row:last-child {
  border-bottom: none;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 2px solid rgba(124,156,255,0.3);
  font-size: 18px;
  font-weight: 700;
}

.tax-label {
  color: rgba(169,181,208,0.85);
  font-size: 14px;
}

.tax-value {
  font-weight: 700;
  color: var(--text);
  font-size: 15px;
}

.tax-row:last-child .tax-value {
  color: var(--accent);
  font-size: 20px;
}

.recommendations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.recommendation-card {
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(124,156,255,0.08) 0%, rgba(42,210,201,0.05) 100%);
  border-radius: 14px;
  border: 1px solid rgba(124,156,255,0.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recommendation-card.eligible {
  border-color: rgba(138,255,179,0.3);
  background: linear-gradient(135deg, rgba(138,255,179,0.08) 0%, rgba(42,210,201,0.05) 100%);
}

.recommendation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.recommendation-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.recommendation-badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.recommendation-badge.eligible {
  background: rgba(138,255,179,0.15);
  color: var(--ok);
  border: 1px solid rgba(138,255,179,0.3);
}

.recommendation-badge.check {
  background: rgba(124,156,255,0.15);
  color: var(--accent);
  border: 1px solid rgba(124,156,255,0.3);
}

.recommendation-desc {
  color: rgba(169,181,208,0.85);
  font-size: 13px;
  line-height: 1.5;
}

.recommendation-savings {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.recommendation-savings .amount {
  color: var(--ok);
  font-weight: 700;
  font-size: 16px;
}

.recommendation-card {
  cursor: pointer;
  user-select: none;
}

.recommendation-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.recommendation-card.applied {
  opacity: 0.6;
  border-color: rgba(138,255,179,0.5);
  background: linear-gradient(135deg, rgba(138,255,179,0.15) 0%, rgba(42,210,201,0.08) 100%);
}

.recommendation-card.applied::after {
  content: "✓ Applied";
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  background: rgba(138,255,179,0.3);
  color: var(--ok);
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Modal Styles */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 1001;
  background: linear-gradient(135deg, rgba(17,26,46,0.98), rgba(13,21,38,0.96));
  border: 1px solid rgba(124,156,255,0.25);
  border-radius: 20px;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: rgba(169,181,208,0.7);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all .2s ease;
}

.modal-close:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.modal-body {
  padding: 28px;
}

.modal-body > p {
  margin: 0 0 24px 0;
  color: rgba(169,181,208,0.85);
  line-height: 1.6;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

#modalInputs {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#modalInputs .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#modalInputs label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

#modalInputs .input-hint {
  font-size: 12px;
  color: rgba(169,181,208,0.7);
  margin-top: 4px;
}

#modalInputs input,
#modalInputs select {
  padding: 12px 16px;
  background: rgba(12,20,39,0.92);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}

#modalInputs input:focus,
#modalInputs select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.toast {
  position: fixed;
  inset: 24px auto auto 50%;
  transform: translateX(-50%);
  background: rgba(12,20,37,0.95);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(124,156,255,0.3);
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  display: none;
  z-index: 999;
}

.toast.show {
  display: block;
}

.right {
  text-align: right;
}

.error {
  color: var(--danger);
  font-size: 13px;
}

/* Income Sources */
.income-section {
  margin-bottom: 24px;
}

.income-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.income-summary h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.income-sources {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.income-source-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.income-source-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.income-source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.income-source-item:last-child {
  border-bottom: none;
}

.income-source-info h5 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.income-source-info .company {
  color: var(--text-secondary);
  font-size: 13px;
}

.income-source-amount {
  font-size: 16px;
  font-weight: 600;
  color: var(--success);
}

.income-source-actions {
  display: flex;
  gap: 8px;
}

.income-source-actions button {
  padding: 6px 12px;
  font-size: 12px;
}

.income-source-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.income-source-form.hidden {
  display: none;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

/* Invoice Editor Styles */
.invoice-item-card {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fff;
  color: white;
}

.invoice-item-card .form-row.three {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.invoice-item-card .item-line-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
  font-weight: 500;
}

.line-total-label {
  color: #000;
}

.line-total-value {
  font-weight: bold;
  color: #2c5aa0;
}

.invoice-item-card .item-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.invoice-item-card input,
.invoice-item-card textarea,
.invoice-item-card select {
  color: #000;
}

.invoice-item-card label {
  color: #000;
}

.invoice-totals-large {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 24px;
  margin-top: 24px;
}

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

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.total-row.final {
  border-top: 2px solid #2c5aa0;
  padding-top: 16px;
  margin-top: 16px;
  font-size: 1.1em;
  font-weight: bold;
}

.total-label {
  font-weight: 500;
  color: #000;
}

.total-value {
  font-weight: bold;
  color: #000;
}

.tax-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tax-input-row label {
  font-weight: 500;
  white-space: nowrap;
}

.action-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

/* Status badges for invoice view */
.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: bold;
  text-transform: uppercase;
}

.status-badge.draft {
  background: #e9ecef;
  color: #6c757d;
}

.status-badge.sent {
  background: #cce5ff;
  color: #0066cc;
}
.item-quantity{
  background: #cce5ff;
  color: #0066cc;
}
.item-description{
  background: #cce5ff;
  color: #0066cc;
}
.item-unit-price{
  background: #cce5ff;
  color: #0066cc;
}
.status-badge.paid {
  background: #d4edda;
  color: #155724;
}

.status-badge.overdue {
  background: #f8d7da;
  color: #721c24;
}

/* Invoice view styles */
.invoice-header {
  margin-bottom: 24px;
}

.invoice-info h3 {
  margin: 0 0 8px 0;
  color: #333;
}

.invoice-info p {
  margin: 4px 0;
  color: #666;
}

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.invoice-items-table th,
.invoice-items-table td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.invoice-items-table th {
  background: #f8f9fa;
  font-weight: bold;
}

.invoice-totals {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px solid #2c5aa0;
}

.invoice-notes {
  margin-top: 24px;
  padding: 16px;
  background: #f9f9f9;
  border-radius: 6px;
}

.invoice-notes h4 {
  margin: 0 0 8px 0;
  color: #333;
}

/* Professional Invoice View Modal */
.invoice-view-modal {
  max-width: 900px;
  width: 100%;
}

.invoice-header-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.invoice-title-block h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #2c5aa0;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
}

.invoice-number-display {
  font-size: 1.5rem;
  font-weight: 600;
  color: #666;
  letter-spacing: 0.02em;
}

.status-badge-large {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge-large.draft {
  background: #f8f9fa;
  color: #6c757d;
  border: 1px solid #dee2e6;
}

.status-badge-large.sent {
  background: #e3f2fd;
  color: #1976d2;
  border: 1px solid #bbdefb;
}

.status-badge-large.paid {
  background: #e8f5e8;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.status-badge-large.overdue {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

.invoice-content {
  padding: 0;
}

.invoice-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
  padding: 2rem;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e9ecef;
}

.client-section .section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #2c5aa0;
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.875rem;
}

.client-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 0.5rem 0;
}

.client-email {
  color: #666;
  margin: 0;
  font-size: 1rem;
}

.invoice-details-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e9ecef;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 500;
  color: #666;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  font-weight: 600;
  color: #1a1a1a;
  font-size: 1rem;
}

.invoice-items-section {
  margin-bottom: 2rem;
}

.invoice-items-section .section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 1.5rem 0;
}

.table-container {
  background: white;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
}

.invoice-items-table thead {
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
}

.invoice-items-table th {
  padding: 1rem 1.5rem;
  text-align: left;
  font-weight: 600;
  color: #495057;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
}

.invoice-items-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e9ecef;
  vertical-align: top;
}

.description-cell {
  font-weight: 500;
  color: #1a1a1a;
  max-width: 300px;
}

.qty-cell {
  text-align: center;
  font-weight: 600;
  color: #495057;
  background: #f8f9fa;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  display: inline-block;
  min-width: 60px;
}

.price-cell, .total-cell {
  text-align: right;
  font-weight: 600;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 1rem;
}

.price-cell {
  color: #666;
}

.total-cell {
  color: #2c5aa0;
  font-size: 1.1rem;
}

.invoice-summary-section {
  margin-bottom: 2rem;
}

.totals-container {
  background: white;
  border-radius: 12px;
  border: 2px solid #2c5aa0;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.totals-breakdown {
  padding: 2rem;
  border-bottom: 2px solid #e9ecef;
}

.total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.total-line:not(:last-child) {
  border-bottom: 1px solid #f0f0f0;
}

.total-label {
  font-weight: 500;
  color: #666;
  font-size: 1.125rem;
}

.total-amount {
  font-weight: 700;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 1.25rem;
  color: #1a1a1a;
}

.total-line.grand-total {
  background: #2c5aa0;
  color: white;
  padding: 2rem;
  margin: 0;
  border-radius: 0;
}

.total-line.grand-total .total-label {
  color: white;
  font-size: 1.5rem;
  font-weight: 600;
}

.total-line.grand-total .total-amount {
  color: white;
  font-size: 1.75rem;
  font-weight: 700;
}

.invoice-notes-section {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 2rem;
  border: 1px solid #e9ecef;
}

.invoice-notes-section .section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 1rem 0;
}

.notes-content {
  background: white;
  padding: 1.5rem;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.notes-content p {
  margin: 0;
  color: #495057;
  line-height: 1.6;
}

.modal-actions.professional {
  padding: 2rem;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.action-group {
  display: flex;
  gap: 1rem;
}

.btn-secondary, .btn-primary, .btn-danger {
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-primary {
  background: #2c5aa0;
  color: white;
}

.btn-primary:hover {
  background: #24478f;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .invoice-details-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .invoice-title-block h1 {
    font-size: 2rem;
  }

  .totals-breakdown {
    padding: 1.5rem;
  }

  .total-line.grand-total {
    padding: 1.5rem;
  }

  .modal-actions.professional {
    flex-direction: column;
    gap: 1rem;
  }

  .action-group {
    width: 100%;
    justify-content: space-between;
  }
}

