/* projects_settings_timesheet_budget.css
   Extends the pst-* design tokens from projects_settings_timesheet.css
   (same colors/spacing) with the extra elements the budget tab needs:
   a data table, a progress bar, and status badges. */

.ptb-table-wrap { padding: 4px 20px 16px; }

/* Bounds how tall the Category Budgets / History tables can grow — once a
   project accumulates many categories or a long change history, the table
   scrolls internally instead of pushing the rest of the settings page (and
   the other tabs' content sitting hidden below it) further and further down. */
.ptb-scroll {
  max-height: 320px;
  overflow: auto;
}

.ptb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ptb-table th, .ptb-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}
.ptb-table thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
  background: #f9fafb;
  position: sticky;
  top: 0;
  z-index: 1;
}
.ptb-table tbody tr:last-child td { border-bottom: none; }
.ptb-table tbody tr:hover td { background: #fafafa; }
.ptb-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── History table: date/time + approver cell ──────────────────────────
   Matches the Audit Logs table's date-stack and user-cell pattern used
   elsewhere in this plugin, so a change-history row reads the same way
   an audit-log row does. */
.ptb-history-table th, .ptb-history-table td { padding: 10px 14px; }
.ptb-td-datetime { line-height: 1.35; }
.ptb-date { display: block; font-weight: 500; color: #111827; }
.ptb-time { display: block; font-size: 11px; color: #9ca3af; margin-top: 1px; }

.ptb-user-cell { display: flex; align-items: center; gap: 8px; }
.ptb-user-cell img { border-radius: 50%; }
.ptb-user-link { color: #0094ff; text-decoration: none; font-weight: 500; }
.ptb-user-link:hover { text-decoration: underline; }
.ptb-user-email { font-size: 11px; color: #9ca3af; margin-top: 1px; }
.ptb-subtle { color: #9ca3af; font-style: italic; }

/* Explicit opt-in (rather than a blanket first/last-child rule) since the
   two tables on this tab don't share the same column order — the flexible,
   wrap-if-needed column is Category on one table and Comment on the other. */
.ptb-nowrap { white-space: nowrap; width: 1%; }

.ptb-section-title-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ptb-add-btn { padding: 6px 14px !important; font-size: 12px !important; }

/* Full override (not just padding-bottom) so the description block gets
   consistent breathing room on every side under the section's header bar,
   instead of sitting flush against its bottom border. */
.ptb-standalone-desc {
  padding: 16px 20px 20px;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #6b7280;
}

/* ── Project Overview sidebar widget ──────────────────────────────────
   Core Redmine's .box already applies 10px padding, so the table wrap
   here drops its own horizontal padding to sit flush with the box's
   heading instead of double-indenting. */
.ptb-overview-box .ptb-table-wrap { padding: 8px 0 0; }
.ptb-overview-scroll { max-height: 260px; }
.ptb-overview-empty { color: #9ca3af; font-size: 13px; margin: 8px 0 0; }

.ptb-pagination { padding: 12px 20px 16px; font-size: 13px; }
.ptb-pagination .pagination { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.ptb-status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.ptb-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.ptb-badge-ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.ptb-badge-warn { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

.ptb-bar-track {
  height: 6px;
  width: 96px;
  border-radius: 3px;
  background: #e5e7eb;
  overflow: hidden;
}
.ptb-bar-fill { height: 100%; }
.ptb-bar-ok { background: #3b82f6; }
.ptb-bar-warn { background: #dc2626; }

/* Add / Adjust Budget form */
.ptb-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.ptb-field { display: flex; flex-direction: column; gap: 5px; }
.ptb-field-wide { grid-column: 1 / -1; }
.ptb-field-label { font-size: 12px; font-weight: 500; color: #374151; }
.ptb-select, .ptb-input {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  /* padding: 7px 10px; */
  font-size: 13px;
  color: #111827;
  background: #fff;
  height: 40px;
}
.ptb-select:focus, .ptb-input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

@media (max-width: 640px) {
  .ptb-form-grid { grid-template-columns: 1fr; }
}

/* ── Add / Adjust Budget modal ──────────────────────────────────────────
   Same overlay/dialog structure as the .as-modal pattern already used by
   this plugin's Approval Schemas page (same z-index, backdrop tint, and
   dialog chrome), under a ptb- prefix so its narrower, single-purpose
   sizing doesn't leak onto that other page. */
.ptb-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ptb-modal[hidden] { display: none !important; }
.ptb-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.56);
}
.ptb-modal-dialog {
  position: relative;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}
.ptb-modal-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.ptb-modal-close-btn:hover { background: #f3f4f6; color: #111827; }
.ptb-modal-content { padding: 22px; box-sizing: border-box; }
.ptb-modal-header { margin-bottom: 16px; padding-right: 20px; }
.ptb-modal-title { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: #111827; }
.ptb-modal-subtitle { margin: 0; font-size: 13px; color: #6b7280; line-height: 1.5; }

.ptb-form-grid-modal { grid-template-columns: 1fr; }

.ptb-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}
.ptb-cancel-btn { align-self: auto; }
