* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f3f4f6;
  color: #1f2937;
  min-height: 100vh;
}

body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: #fff;
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.06);
  width: 100%;
  max-width: 360px;
}

.card h1 {
  font-size: 1.4rem;
  margin: 0 0 1.5rem;
  text-align: center;
  color: #111827;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #374151;
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}

.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.checkbox-item input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 0.65rem;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.25rem;
  text-align: center;
  text-decoration: none;
}

.btn:hover { background: #1d4ed8; }

.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* Ust navigasyon */

.topnav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 1.5rem;
}

.topnav-brand {
  font-weight: 700;
  color: #111827;
  text-decoration: none;
}

.topnav-links {
  display: flex;
  gap: 1.25rem;
  flex: 1;
}

.topnav-links a {
  color: #4b5563;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.topnav-links a:hover { color: #2563eb; }

.topnav-logout {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.topnav-username {
  font-size: 0.85rem;
  color: #6b7280;
}

.topnav-logout button {
  padding: 0.35rem 0.8rem;
  border: none;
  border-radius: 6px;
  background: #6b7280;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}

.topnav-logout button:hover { background: #4b5563; }

/* Icerik sayfalari */

.page {
  max-width: 1500px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page h1 {
  font-size: 1.3rem;
  color: #111827;
  margin: 0 0 1rem;
}

.page h2 {
  font-size: 1.05rem;
  color: #111827;
  margin: 2rem 0 0.75rem;
}

.field-hint {
  font-weight: 400;
  color: #9ca3af;
  font-size: 0.8rem;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid #e5e7eb;
  margin: 1rem 0 1.5rem;
}

.tab {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #6b7280;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.tab:hover { color: #2563eb; }

.tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.summary-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  min-width: 220px;
}

.summary-card-currency {
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary-card-net {
  font-size: 1.4rem;
  font-weight: 700;
  color: #111827;
  margin: 0.2rem 0;
}

.summary-card-detail {
  font-size: 0.8rem;
  color: #6b7280;
}

.summary-card-highlight {
  border: 2px solid #2563eb;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-header h1 { margin: 0; flex: 1; }

/* Panel'deki butce karti dugmesiyle (bkz. .budget-card) ayni gorunumde - Gelirler/Giderler/Kredi
   Kartlari/Krediler sayfalarindaki baslik da artik ayni "kutucuk" hissini versin diye. */
.budget-header-link {
  display: block;
  padding: 1.5rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  color: #111827;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
}
.budget-header-link:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.btn-inline {
  width: auto;
  margin-top: 0;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-link {
  color: #6b7280;
  font-size: 0.9rem;
  text-decoration: none;
  align-self: center;
}

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

.form-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 480px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.form-actions .btn { width: auto; padding: 0.6rem 1.5rem; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f2f4;
}

.data-table th {
  background: #f9fafb;
  color: #374151;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.sort-link {
  color: inherit;
  text-decoration: none;
}

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

.data-table tbody tr:nth-child(odd) { background: #ffffff; }
.data-table tbody tr:nth-child(even) { background: #fafafa; }
.data-table tbody tr:hover { background: #f3f4f6; }
.data-table tbody tr.row-pending { background: #fffbeb; }
.data-table tbody tr.row-pending:hover { background: #fef3c7; }
.data-table tbody tr.row-cancelled { background: #f3f4f6; opacity: 0.65; }
.data-table tbody tr.row-cancelled:hover { background: #e5e7eb; }

.data-table .empty {
  text-align: center;
  color: #9ca3af;
  padding: 1.5rem;
}

.data-table .actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-start;
}

.actions-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.data-table .actions form { margin: 0; }

.btn-danger,
.btn-success, .btn-warning {
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-warning { background: #eab308; color: #1f2937; }
.btn-warning:hover { background: #ca8a04; }

.btn-neutral {
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  background: #2563eb;
  color: #fff;
}

.btn-neutral:hover { background: #1d4ed8; }

.badge {
  display: inline-block;
  background: #2563eb;
  color: #fff;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-muted {
  background: #e5e7eb;
  color: #4b5563;
  margin-left: 0.35rem;
}

.collapsible-section {
  display: none;
}

.collapsible-section.open {
  display: block;
}

tr.collapsible-section.open {
  display: table-row;
}

.upcoming-months-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
}

.upcoming-months-table th,
.upcoming-months-table td {
  text-align: left;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid #f1f2f4;
}

.upcoming-months-table th {
  color: #6b7280;
  font-weight: 600;
}

.month-row {
  cursor: pointer;
}

.month-row:hover {
  background: #f9fafb;
}

.upcoming-months-table .upcoming-months-table {
  margin: 0.25rem 0 0.25rem 1rem;
}

.color-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  margin-right: 0.4rem;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 400;
  color: #374151;
}

.empty-hint {
  color: #9ca3af;
  font-size: 0.85rem;
  margin: 0;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.inline-form input {
  flex: 1;
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
}

.budget-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.budget-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.budget-card {
  min-width: 200px;
  padding: 1.5rem;
  border: none;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
  cursor: pointer;
  text-align: center;
}

.budget-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.budget-quick-actions {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.budget-quick-actions.open {
  display: flex;
}

.budget-quick-buttons {
  display: flex;
  gap: 0.5rem;
}

.quick-action {
  flex: 1;
  padding: 0.75rem;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
}

.quick-action-expense { background: #dc2626; }
.quick-action-expense:hover { background: #b91c1c; }

.quick-action-income { background: #16a34a; }
.quick-action-income:hover { background: #15803d; }

.budget-pending-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge-link {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  color: #1f2937;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.badge-link:hover { opacity: 0.85; }

.budget-nav-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quick-action-income-nav { background: #059669; }
.quick-action-income-nav:hover { background: #047857; }

.quick-action-expense-nav { background: #ea580c; }
.quick-action-expense-nav:hover { background: #c2410c; }

.quick-action-cards-nav { background: #7c3aed; }
.quick-action-cards-nav:hover { background: #6d28d9; }

.quick-action-loans-nav { background: #2563eb; }
.quick-action-loans-nav:hover { background: #1d4ed8; }

.quick-action-ai { background: #0891b2; cursor: pointer; border: none; }
.quick-action-ai:hover { background: #0e7490; }

.ai-chat-panel {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.ai-chat-filters { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; }
.ai-chat-filter-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.ai-chat-filter-btn.active { background: #0891b2; border-color: #0891b2; color: #fff; }

.ai-chat-messages {
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-chat-message {
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.ai-chat-message-user { background: #e0f2fe; align-self: flex-end; max-width: 90%; }
.ai-chat-message-assistant { background: #fff; border: 1px solid #e5e7eb; align-self: flex-start; max-width: 90%; }

.ai-chat-form { display: flex; gap: 0.5rem; }
.ai-chat-form input { flex: 1; }

.ai-chat-error { color: #dc2626; font-size: 0.85rem; margin: 0.25rem 0; }

.ai-chat-message-loading { font-style: italic; color: #6b7280; animation: ai-chat-pulse 1.2s ease-in-out infinite; }

@keyframes ai-chat-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.summary-card-clickable { cursor: pointer; }
.summary-card-clickable:hover { box-shadow: 0 0 0 2px #0891b2 inset; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-box h3 { margin: 0 0 0.75rem; }
.modal-close { float: right; border: none; background: none; font-size: 1.1rem; cursor: pointer; color: #6b7280; }
.modal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.modal-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; }
.modal-list li:last-child { border-bottom: none; }
.modal-list .modal-list-name { color: #374151; }
.modal-list .modal-list-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.modal-empty { color: #6b7280; font-size: 0.9rem; }
