/* ======= CARDS, TABLES, BUTTONS, MODALS ======= */

.settings-card,
.card,
#budget-summary,
#actuals-summary,
#dues-summary {
  background: var(--tt-surface);
  border-radius: var(--tt-radius);
  box-shadow: var(--tt-shadow);
  border: 1px solid var(--tt-border);
  padding: 20px 0 16px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  box-sizing: border-box;
}

.card-content {
  padding: 0 20px;
  max-width: 100%;
  box-sizing: border-box;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  margin-bottom: 0;
}

#budget-table,
#actuals-table,
#dues-table,
#overdue-dues-table {
  width: 100%;
  background: var(--tt-surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: none;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 0;
}

#dues-table th,
#dues-table td {
  min-width: 88px;
  white-space: nowrap;
}

#dues-table th:nth-child(5),
#dues-table td:nth-child(5) {
  min-width: 140px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#budget-table th,
#budget-table td,
#actuals-table th,
#actuals-table td,
#dues-table th,
#dues-table td {
  border: none;
  padding: 12px 12px;
  text-align: left;
  font-size: 0.95rem;
}

#dues-table td:last-child {
  vertical-align: middle;
}

#budget-table th,
#actuals-table th,
#dues-table th {
  background: #f4f7fb;
  font-weight: 650;
  color: var(--tt-blue);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--tt-border);
}

#budget-table tr,
#actuals-table tr,
#dues-table tr {
  border-bottom: 1px solid var(--tt-border);
}

#budget-table tr:last-child,
#actuals-table tr:last-child,
#dues-table tr:last-child {
  border-bottom: none;
}

#budget-table tr:nth-child(even),
#actuals-table tr:nth-child(even),
#dues-table tr:nth-child(even) {
  background: #f8fafc;
}

#budget-table button,
#actuals-table button,
#dues-table button {
  background: var(--tt-danger);
  color: #fff;
  border: none;
  padding: 10px 14px;
  min-height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.15s;
}

#budget-table button:hover,
#actuals-table button:hover,
#dues-table button:hover {
  background: var(--tt-danger-hover);
}

#dues-table .reminder-btn {
  background: var(--tt-blue) !important;
  color: #fff !important;
  border: none;
  padding: 10px 14px;
  min-height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0;
}

#dues-table .reminder-btn:hover {
  background: var(--tt-blue-hover) !important;
  color: #fff !important;
}

#dues-table .edit-btn {
  background-color: #64748b !important;
  color: #fff !important;
  border: none;
  padding: 10px 14px;
  min-height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0;
  width: 100%;
  display: block;
}

#dues-table .edit-btn:hover {
  background-color: #475569 !important;
}

.primary-btn,
#add-budget-entry,
#add-actual-entry,
#add-due-entry,
#team-name-form button {
  background: var(--tt-blue);
  color: #fff;
  border: none;
  padding: 0 20px;
  height: var(--tt-tap);
  min-height: var(--tt-tap);
  font-size: 0.95rem;
  border-radius: var(--tt-radius-sm);
  cursor: pointer;
  font-weight: 650;
  transition: background 0.15s, transform 0.12s;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: 0 1px 2px rgba(36, 99, 235, 0.25);
  margin: 0 0 16px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.primary-btn:hover,
#add-budget-entry:hover,
#add-actual-entry:hover,
#add-due-entry:hover,
#team-name-form button:hover {
  background: var(--tt-blue-hover);
  color: #fff;
}

.primary-btn.secondary-action {
  background: #e8eef7;
  color: var(--tt-navy);
  box-shadow: none;
}

.primary-btn.secondary-action:hover {
  background: #d7e2f2;
  color: var(--tt-navy);
}

.danger-btn {
  background: var(--tt-danger);
  color: #fff;
  border: none;
  padding: 12px 18px;
  min-height: var(--tt-tap);
  font-size: 0.95rem;
  border-radius: var(--tt-radius-sm);
  cursor: pointer;
  font-weight: 650;
  transition: background 0.15s;
  margin-bottom: 10px;
  letter-spacing: 0;
}

.danger-btn:hover {
  background: var(--tt-danger-hover);
}

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 31, 51, 0.45);
  justify-content: center;
  align-items: center;
  padding: 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  animation: fadeIn 0.18s;
  box-sizing: border-box;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--tt-surface);
  padding: 24px 20px 20px;
  border-radius: var(--tt-radius);
  box-shadow: 0 16px 48px rgba(15, 60, 104, 0.18);
  min-width: 0;
  width: min(420px, 100%);
  max-width: 100%;
  max-height: min(90dvh, 720px);
  overflow-y: auto;
  animation: modalBounce 0.18s;
  position: relative;
  box-sizing: border-box;
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--tt-navy);
  text-transform: none;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding-right: 36px;
}

.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-content input,
.modal-content select {
  width: 100%;
  min-height: var(--tt-tap);
  padding: 10px 12px;
  font-size: 1rem;
  border: 1.5px solid #c9d7ea;
  border-radius: 12px;
  background: #f8fafc;
  outline: none;
  transition: border-color 0.13s, box-shadow 0.13s;
  box-sizing: border-box;
}

.modal-content input:focus,
.modal-content select:focus {
  border-color: var(--tt-blue);
  box-shadow: 0 0 0 3px rgba(36, 99, 235, 0.15);
}

.modal-content button[type="submit"] {
  margin-top: 4px;
  background: var(--tt-blue);
  color: #fff;
  border: none;
  padding: 12px 20px;
  min-height: var(--tt-tap);
  font-size: 1rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 650;
  text-transform: none;
  letter-spacing: 0;
}

.modal-content button[type="submit"]:hover {
  background: var(--tt-blue-hover);
  color: #fff;
}

.close-modal {
  position: absolute;
  right: 10px;
  top: 10px;
  width: var(--tt-tap);
  height: var(--tt-tap);
  background: none;
  border: none;
  font-size: 24px;
  color: var(--tt-muted);
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

#dues-table .action-cell button {
  width: 100%;
}

#dues-table td:nth-child(1) {
  text-align: center;
  vertical-align: middle;
}

#team-name-form {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

#team-name-form label {
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  white-space: normal;
}

#team-name-input {
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.2;
  border: 1.5px solid #c9d7ea;
  border-radius: 12px;
  background: #f8fafc;
  outline: none;
  height: var(--tt-tap);
  min-height: var(--tt-tap);
  max-height: var(--tt-tap);
  padding: 0 14px;
  box-sizing: border-box;
  flex: 0 0 auto;
  min-width: 0;
  width: 100%;
}

#team-name-input:focus {
  border-color: var(--tt-blue);
  box-shadow: 0 0 0 3px rgba(36, 99, 235, 0.15);
}

#team-name-form button {
  height: var(--tt-tap);
  min-height: var(--tt-tap);
  font-size: 0.95rem;
  border-radius: 12px;
  padding: 0 18px;
  margin: 0;
  flex: 0 0 auto;
}

#budget-totals,
#actuals-totals,
#dues-totals {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--tt-border);
  color: var(--tt-text);
}

#budget-totals p,
#actuals-totals p,
#dues-totals p {
  margin: 6px 0;
}

/* ---- DASHBOARD CARDS ---- */
.dashboard-cards-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: stretch;
}

.dashboard-card {
  background: var(--tt-surface);
  border-radius: var(--tt-radius);
  box-shadow: var(--tt-shadow);
  border: 1px solid var(--tt-border);
  padding: 16px 16px 14px;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  flex: 1 1 140px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  margin-bottom: 0;
  box-sizing: border-box;
  max-width: 100%;
}

.dashboard-card.large {
  min-width: 0;
  flex: 1 1 100%;
  min-height: 0;
}

.card-label {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--tt-muted);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-main {
  margin-bottom: 2px;
}

.card-value {
  font-family: inherit;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--tt-text);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.card-value.positive { color: #15803d; }
.card-value.negative { color: #dc2626; }

.card-sub {
  color: var(--tt-muted);
  font-size: 0.88rem;
  font-weight: 400;
  margin-top: 6px;
}

#overdue-dues-table {
  width: 100%;
  margin-top: 8px;
}

#overdue-dues-table th,
#overdue-dues-table td {
  padding: 10px 8px;
  font-size: 0.92rem;
  text-align: left;
}

#overdue-dues-table th {
  color: var(--tt-navy);
  background: #f4f7fb;
  font-weight: 650;
  border-bottom: 1px solid var(--tt-border);
}

#overdue-dues-table td:last-child {
  text-align: right;
}

.dues-badge {
  background: var(--tt-danger);
  color: #fff;
  border-radius: 999px;
  font-size: 0.85rem;
  padding: 4px 12px;
  font-weight: 600;
  display: inline-block;
}

#expensePieChart {
  margin-top: 12px;
  display: block;
  max-width: 100%;
}

.dashboard-empty-msg,
.no-expense-msg {
  margin-top: 16px;
  color: var(--tt-muted);
  text-align: left;
  font-size: 0.88rem;
  font-weight: 400;
}

.reports-title {
  font-size: 1.4rem;
  font-weight: 750;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.reports-cards-row {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 12px;
}

.report-card {
  background: var(--tt-surface);
  border-radius: var(--tt-radius);
  box-shadow: var(--tt-shadow);
  border: 1px solid var(--tt-border);
  padding: 18px 0 16px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  box-sizing: border-box;
}

.report-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.report-desc {
  color: var(--tt-muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-btn {
  background: #fff;
  color: var(--tt-navy);
  border: 1.5px solid var(--tt-border);
  padding: 10px 16px;
  min-height: var(--tt-tap);
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 1 140px;
}

.report-btn:hover,
.report-btn:focus {
  background: var(--tt-blue);
  color: #fff;
  border-color: var(--tt-blue);
}

.export-icon {
  font-size: 1.1em;
  margin-right: 2px;
}

.report-modal-content {
  max-width: min(820px, 100%);
  width: 100%;
  min-width: 0;
}

#report-dues-status-table th,
#report-dues-status-table td {
  padding: 10px 10px;
  vertical-align: middle;
  text-align: left;
}

#report-dues-status-table th {
  font-size: 0.82rem;
  font-weight: 650;
  border-bottom: 1px solid var(--tt-border);
}

#report-dues-status-table td {
  font-size: 0.94rem;
  border-bottom: 1px solid #f1f5f9;
}

#report-dues-status-table td:nth-child(3) {
  text-align: right;
}

#report-dues-status-table td:nth-child(5),
#report-dues-status-table th:nth-child(5) {
  text-align: center;
  min-width: 96px;
}

.status-badge {
  display: inline-block;
  min-width: 64px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  margin: 0;
}

.status-badge.overdue { background: #fecaca; color: #991b1b; }
.status-badge.unpaid { background: #fde68a; color: #92400e; }
.status-badge.paid { background: #bbf7d0; color: #166534; }

.export-modal-content {
  padding: 24px 20px 20px;
  border-radius: var(--tt-radius);
  min-width: 0;
  width: min(360px, 100%);
  background: #fff;
  text-align: center;
}

.export-choice-btn {
  padding: 12px 0;
  min-height: var(--tt-tap);
  font-size: 1rem;
  border-radius: 12px;
  border: 1.5px solid var(--tt-border);
  background: #fff;
  font-weight: 600;
  color: var(--tt-blue);
  cursor: pointer;
  width: 100%;
}

.export-choice-btn:hover,
.export-choice-btn:focus {
  background: var(--tt-blue);
  color: #fff;
  border-color: var(--tt-blue);
}

.export-choice-btn.cancel-btn {
  color: var(--tt-danger);
  border-color: #fecaca;
  margin-top: 2px;
}

.export-choice-btn.cancel-btn:hover,
.export-choice-btn.cancel-btn:focus {
  background: #fef2f2;
  color: var(--tt-danger);
}

th,
.table-section-row {
  text-transform: uppercase;
  font-weight: 650;
  background: #f4f7fb;
  color: var(--tt-blue);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--tt-border);
}

.table-section-row {
  background: #f8fafc !important;
  color: var(--tt-navy) !important;
}

@media (max-width: 800px) {
  .dashboard-cards-row,
  .reports-cards-row {
    flex-direction: column;
    gap: 12px;
  }

  .dashboard-card,
  .dashboard-card.large,
  .report-card {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
  }

  .dashboard-card,
  .report-card {
    padding: 14px 14px 12px;
  }

  .settings-card,
  .card,
  #budget-summary,
  #actuals-summary,
  #dues-summary {
    padding: 14px 0 12px;
    margin-bottom: 12px;
  }

  .card-content {
    padding: 0 14px;
  }

  .primary-btn,
  #add-budget-entry,
  #add-actual-entry,
  #add-due-entry {
    width: 100%;
    min-width: 0;
  }

  #team-name-form {
    flex-direction: column;
    align-items: stretch;
  }

  #team-name-form button {
    width: 100%;
  }

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

  .report-btn {
    width: 100%;
    flex: 1 1 auto;
  }

  #budget-table th,
  #budget-table td,
  #actuals-table th,
  #actuals-table td,
  #dues-table th,
  #dues-table td,
  #overdue-dues-table th,
  #overdue-dues-table td {
    padding: 10px 8px;
    font-size: 0.88rem;
    white-space: nowrap;
  }
}

@media (max-width: 500px) {
  .modal-content,
  .report-modal-content,
  .export-modal-content {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 20px 14px 16px !important;
    border-radius: 14px !important;
  }
}
