:root {
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-bg: #ffffff;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --success: #16a34a;
  --danger: #dc2626;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont;
  background: var(--bg-gradient);
  color: var(--text-main);
}

/* ---------------- LAYOUT ---------------- */

.app-container {
  max-width: 1150px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.app-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

/* ---------------- HEADER ---------------- */

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

.app-header h1 {
  font-size: 34px;
  margin: 0;
}

.logout-btn {
  text-decoration: none;
  color: white;
  background: rgba(255,255,255,0.15);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* ---------------- SUMMARY ---------------- */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.summary-card {
  background: #f8fafc;
  border-radius: 18px;
  padding: 22px;
}

.summary-card span {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.summary-card.highlight {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border: 2px solid var(--primary);
}

/* ---------------- ACTIONS ---------------- */

.actions-row {
  display: flex;
  gap: 16px;
  margin-bottom: 36px;
}

.action-btn {
  flex: 1;
  text-decoration: none;
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  font-weight: 600;
  text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 10px 20px rgba(79,70,229,0.3);
}

.action-btn.secondary {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  box-shadow: 0 10px 20px rgba(100,116,139,0.3);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(0,0,0,0.25);
}

/* ---------------- FORM ---------------- */

.section-title {
  font-size: 22px;
  margin: 32px 0 16px;
}

.repayment-box {
  background: #f8fafc;
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 36px;
}

.repayment-form {
  display: flex;
  gap: 12px;
}

.repayment-form input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
}

.repayment-form button {
  padding: 12px 22px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.repayment-form button:hover {
  background: var(--primary-dark);
}

/* ---------------- TABLE ---------------- */

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 18px;
  overflow: hidden;
}

thead {
  background: #eef2ff;
}

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

th {
  font-size: 14px;
  color: var(--text-muted);
}

tbody tr:nth-child(even) {
  background: #f9fafb;
}

tbody tr:hover {
  background: #eef2ff;
}

/* ---------------- LOGIN ---------------- */
.app-background {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e1f29, #2a2d3e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Inter", system-ui, sans-serif;
}

.card {
  background: #1c1f2b;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  color: #fff;
}

.btn-primary {
  background: linear-gradient(135deg, #4f8cff, #6aa8ff);
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(79,140,255,.4);
}

/* -------------------------------------------------
   LOGIN – CARTE HORIZONTALE
------------------------------------------------- */

.login-frame {
  width: 100%;
  max-width: 820px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 22px;
  padding: 32px 36px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  animation: fadeInUp 0.6s ease;
}

.login-frame h1 {
  margin: 0;
  font-size: 28px;
  text-align: center;
}

.login-frame p {
  text-align: center;
  margin-bottom: 28px;
  color: #666;
}

/* --- Formulaire horizontal --- */
.login-form-horizontal {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 20px;
  align-items: end;
}

.login-field {
  display: flex;
  flex-direction: column;
}

.login-field label {
  margin-bottom: 6px;
  font-size: 14px;
  color: #444;
}

.login-submit {
  height: 52px;
  padding: 0 28px;
  white-space: nowrap;
}

/* -------------------------------------------------
   LOGIN PAGE
------------------------------------------------- */

.login-container {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.22);
  animation: fadeInUp 0.6s ease;
}

.login-container h1 {
  text-align: center;
  margin-bottom: 6px;
}

.login-container .subtitle {
  text-align: center;
  color: #6b7280;
  margin-bottom: 28px;
}

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

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 14px;
  color: #555;
}

.login-field input {
  background: #f6f7ff;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  transition: all 0.15s ease;
}

.login-field input:focus {
  background: #ffffff;
  border-color: #5b5ce2;
  box-shadow: 0 0 0 3px rgba(91, 92, 226, 0.15);
}

.btn.full {
  width: 100%;
  margin-top: 10px;
}

/* -------------------------------------------------
   LOGIN BUTTON
------------------------------------------------- */

.login-form button {
  margin-top: 14px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: none;

  background: linear-gradient(135deg, #5b5ce2, #6f72ff);
  color: white;
  font-size: 16px;
  font-weight: 600;

  cursor: pointer;
  box-shadow: 0 12px 25px rgba(91, 92, 226, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.login-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 35px rgba(91, 92, 226, 0.55);
}

.login-form button:active {
  transform: translateY(0);
  box-shadow: 0 10px 20px rgba(91, 92, 226, 0.35);
}

.login-form button:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(91, 92, 226, 0.25);
}

/* ---------------- RESPONSIVE ---------------- */

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

  .actions-row {
    flex-direction: column;
  }

  .repayment-form {
    flex-direction: column;
  }
}


.amortization-form {
  display: flex;
  gap: 16px;
  max-width: 480px;
  margin-top: 16px;
}

.amortization-form input {
  flex: 1;
}
