/* ═══════════════════════════════════════════════════════════════════════════════
   TIME & BILLING — TLO Client Dashboard
   Uses --ed-* design tokens from editorial.css
   All selectors prefixed .billing-* to avoid conflicts
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── BILLING TAB CONTAINER ──────────────────────────────────────────────── */
#billingTab {
  padding: 0 1.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ─── HEADER ─────────────────────────────────────────────────────────────── */
.billing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 1rem;
  border-bottom: 1px solid var(--ed-border);
  margin-bottom: 1.25rem;
}

.billing-header-title {
  font-family: var(--ed-font-display);
  font-size: 1.75rem;
  color: var(--ed-ink-strong);
  margin: 0;
  letter-spacing: -0.01em;
}

.billing-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.billing-date-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  color: var(--ed-ink-muted);
}

.billing-date-range input[type="date"] {
  font-family: var(--ed-font-mono);
  font-size: 0.75rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-sm);
  background: var(--ed-surface);
  color: var(--ed-ink);
  outline: none;
  transition: border-color var(--ed-duration) var(--ed-ease);
}

.billing-date-range input[type="date"]:focus {
  border-color: var(--ed-accent);
}

.billing-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ed-ink-muted);
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-sm);
  cursor: pointer;
  transition: all var(--ed-duration) var(--ed-ease);
}

.billing-export-btn:hover {
  color: var(--ed-ink);
  border-color: var(--ed-border-strong);
  background: var(--ed-surface-alt);
}

/* ─── TIMER STRIP ────────────────────────────────────────────────────────── */
.billing-timer-strip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-md);
  margin-bottom: 1.25rem;
  box-shadow: var(--ed-shadow-sm);
}

.billing-timer-selects {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.billing-timer-select {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-sm);
  background: var(--ed-bg);
  color: var(--ed-ink);
  outline: none;
  transition: border-color var(--ed-duration) var(--ed-ease);
  text-overflow: ellipsis;
}

.billing-timer-select:focus {
  border-color: var(--ed-accent);
}

.billing-timer-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.billing-timer-display {
  font-family: var(--ed-font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--ed-ink-strong);
  min-width: 6rem;
  text-align: center;
  letter-spacing: 0.05em;
  padding: 0 0.5rem;
}

.billing-timer-display.running {
  color: var(--ed-status-active);
}

.billing-timer-controls {
  display: flex;
  gap: 0.4rem;
}

.billing-timer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--ed-radius-sm);
  border: 1px solid var(--ed-border);
  background: var(--ed-surface);
  color: var(--ed-ink-muted);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all var(--ed-duration) var(--ed-ease);
}

.billing-timer-btn:hover {
  border-color: var(--ed-border-strong);
  color: var(--ed-ink);
  background: var(--ed-surface-alt);
}

.billing-timer-btn.start {
  background: var(--ed-status-active);
  border-color: var(--ed-status-active);
  color: #fff;
}

.billing-timer-btn.start:hover {
  background: #12713a;
}

.billing-timer-btn.stop {
  background: var(--ed-status-danger);
  border-color: var(--ed-status-danger);
  color: #fff;
}

.billing-timer-btn.stop:hover {
  background: #991b1b;
}

.billing-timer-btn.discard {
  color: var(--ed-ink-faint);
}

.billing-timer-btn.discard:hover {
  color: var(--ed-status-danger);
  border-color: var(--ed-status-danger);
}

.billing-timer-warning {
  font-size: 0.7rem;
  color: var(--ed-status-hold);
  font-family: var(--ed-font-body);
  margin-left: 0.25rem;
  white-space: nowrap;
}

/* ─── STATS ROW ──────────────────────────────────────────────────────────── */
.billing-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.billing-stat-card {
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-md);
  padding: 0.875rem 1rem;
  box-shadow: var(--ed-shadow-sm);
}

.billing-stat-label {
  font-family: var(--ed-font-body);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ed-ink-muted);
  margin-bottom: 0.3rem;
}

.billing-stat-value {
  font-family: var(--ed-font-mono);
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--ed-ink-strong);
}

.billing-stat-value.currency::before {
  content: '$';
  font-size: 0.875rem;
  color: var(--ed-ink-muted);
  margin-right: 0.1rem;
}

/* ─── SUB-TABS (Time Entry / Expense Entry) ──────────────────────────────── */
.billing-sub-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--ed-border);
}

.billing-sub-tab {
  padding: 0.5rem 1.25rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ed-ink-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--ed-duration) var(--ed-ease);
}

.billing-sub-tab:hover {
  color: var(--ed-ink);
}

.billing-sub-tab.active {
  color: var(--ed-accent);
  border-bottom-color: var(--ed-accent);
}

/* ─── ENTRY FORM ─────────────────────────────────────────────────────────── */
.billing-entry-form {
  display: grid;
  grid-template-columns: 120px 1fr 1fr 90px 1fr 90px 100px auto;
  gap: 0.5rem;
  align-items: end;
  padding: 0.875rem 1rem;
  background: var(--ed-surface-alt);
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-md);
  margin-bottom: 1.25rem;
}

.billing-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.billing-form-group label {
  font-family: var(--ed-font-body);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ed-ink-muted);
}

.billing-form-group input,
.billing-form-group select,
.billing-form-group textarea {
  padding: 0.4rem 0.5rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-sm);
  background: var(--ed-surface);
  color: var(--ed-ink);
  outline: none;
  transition: border-color var(--ed-duration) var(--ed-ease);
}

.billing-form-group input:focus,
.billing-form-group select:focus,
.billing-form-group textarea:focus {
  border-color: var(--ed-accent);
}

.billing-form-group select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.billing-form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-bottom: 0.35rem;
}

.billing-form-checkbox input[type="checkbox"] {
  accent-color: var(--ed-accent);
  width: 1rem;
  height: 1rem;
}

.billing-form-checkbox label {
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  color: var(--ed-ink);
  cursor: pointer;
}

.billing-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--ed-accent);
  color: #fff;
  border: none;
  border-radius: var(--ed-radius-sm);
  cursor: pointer;
  transition: background var(--ed-duration) var(--ed-ease);
  align-self: end;
  white-space: nowrap;
}

.billing-save-btn:hover {
  background: var(--ed-accent-hover);
}

/* Expense-specific form adjustments */
.billing-entry-form.expense-form {
  grid-template-columns: 120px 1fr 1fr 110px 1fr 130px 90px auto;
}

/* ─── ENTRIES TABLE ──────────────────────────────────────────────────────── */
.billing-entries-wrapper {
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-md);
  overflow: hidden;
  box-shadow: var(--ed-shadow-sm);
}

.billing-entries-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--ed-border);
  background: var(--ed-surface-alt);
}

.billing-entries-count {
  font-family: var(--ed-font-body);
  font-size: 0.75rem;
  color: var(--ed-ink-muted);
}

.billing-filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.billing-filter-select {
  padding: 0.3rem 0.5rem;
  font-family: var(--ed-font-body);
  font-size: 0.75rem;
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-sm);
  background: var(--ed-surface);
  color: var(--ed-ink);
  outline: none;
}

.billing-entries-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
}

.billing-entries-table thead {
  background: var(--ed-surface-alt);
  border-bottom: 1px solid var(--ed-border);
}

.billing-entries-table th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ed-ink-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--ed-duration) var(--ed-ease);
}

.billing-entries-table th:hover {
  color: var(--ed-ink);
}

.billing-entries-table th .sort-icon {
  margin-left: 0.25rem;
  font-size: 0.6rem;
  opacity: 0.4;
}

.billing-entries-table th.sorted .sort-icon {
  opacity: 1;
  color: var(--ed-accent);
}

.billing-entries-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--ed-border);
  color: var(--ed-ink);
  vertical-align: middle;
}

.billing-entries-table tbody tr {
  transition: background var(--ed-duration) var(--ed-ease);
}

.billing-entries-table tbody tr:hover {
  background: var(--ed-accent-muted);
}

.billing-entries-table tbody tr:last-child td {
  border-bottom: none;
}

.billing-entry-type {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
}

.billing-entry-type.time {
  background: rgba(21, 128, 61, 0.08);
  color: var(--ed-status-active);
}

.billing-entry-type.expense {
  background: rgba(180, 83, 9, 0.08);
  color: var(--ed-status-hold);
}

.billing-billable-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
}

.billing-billable-badge.yes {
  background: var(--ed-status-active-bg);
  color: var(--ed-status-active);
}

.billing-billable-badge.no {
  background: var(--ed-status-closed-bg);
  color: var(--ed-status-closed);
}

.billing-entry-amount {
  font-family: var(--ed-font-mono);
  font-weight: 500;
  white-space: nowrap;
}

.billing-entry-actions {
  display: flex;
  gap: 0.3rem;
}

.billing-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--ed-radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ed-ink-faint);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all var(--ed-duration) var(--ed-ease);
}

.billing-action-btn:hover {
  border-color: var(--ed-border);
  background: var(--ed-surface-alt);
  color: var(--ed-ink);
}

.billing-action-btn.delete:hover {
  color: var(--ed-status-danger);
  border-color: var(--ed-status-danger);
}

/* ─── TABLE EMPTY STATE ──────────────────────────────────────────────────── */
.billing-table-empty {
  padding: 3rem 2rem;
  text-align: center;
}

.billing-table-empty i {
  font-size: 2rem;
  color: var(--ed-ink-ghost);
  margin-bottom: 0.75rem;
}

.billing-table-empty p {
  font-family: var(--ed-font-body);
  font-size: 0.875rem;
  color: var(--ed-ink-muted);
  margin: 0;
}

.billing-load-more {
  display: block;
  width: 100%;
  padding: 0.6rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ed-accent);
  background: transparent;
  border: none;
  border-top: 1px solid var(--ed-border);
  cursor: pointer;
  transition: background var(--ed-duration) var(--ed-ease);
}

.billing-load-more:hover {
  background: var(--ed-accent-muted);
}

/* ─── EDIT MODAL ─────────────────────────────────────────────────────────── */
.billing-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--ed-duration) var(--ed-ease),
              visibility var(--ed-duration) var(--ed-ease);
}

.billing-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.billing-modal {
  background: var(--ed-surface);
  border-radius: var(--ed-radius-lg);
  box-shadow: var(--ed-shadow-xl);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(10px);
  transition: transform var(--ed-duration) var(--ed-ease-out);
}

.billing-modal-overlay.active .billing-modal {
  transform: translateY(0);
}

.billing-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ed-border);
}

.billing-modal-header h3 {
  font-family: var(--ed-font-display);
  font-size: 1.25rem;
  color: var(--ed-ink-strong);
  margin: 0;
}

.billing-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: var(--ed-ink-muted);
  cursor: pointer;
  font-size: 1.25rem;
  border-radius: var(--ed-radius-sm);
  transition: all var(--ed-duration) var(--ed-ease);
}

.billing-modal-close:hover {
  background: var(--ed-surface-alt);
  color: var(--ed-ink);
}

.billing-modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.billing-modal-body .billing-form-group {
  gap: 0.3rem;
}

.billing-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--ed-border);
}

.billing-modal-cancel {
  padding: 0.45rem 0.85rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ed-ink-muted);
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-sm);
  cursor: pointer;
  transition: all var(--ed-duration) var(--ed-ease);
}

.billing-modal-cancel:hover {
  border-color: var(--ed-border-strong);
  color: var(--ed-ink);
}

.billing-modal-save {
  padding: 0.45rem 0.85rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--ed-accent);
  color: #fff;
  border: none;
  border-radius: var(--ed-radius-sm);
  cursor: pointer;
  transition: background var(--ed-duration) var(--ed-ease);
}

.billing-modal-save:hover {
  background: var(--ed-accent-hover);
}

/* ─── CONFIRM DIALOG ─────────────────────────────────────────────────────── */
.billing-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--ed-duration) var(--ed-ease),
              visibility var(--ed-duration) var(--ed-ease);
}

.billing-confirm-overlay.active {
  opacity: 1;
  visibility: visible;
}

.billing-confirm-box {
  background: var(--ed-surface);
  border-radius: var(--ed-radius-lg);
  box-shadow: var(--ed-shadow-xl);
  padding: 1.5rem;
  width: 90%;
  max-width: 360px;
  text-align: center;
}

.billing-confirm-box p {
  font-family: var(--ed-font-body);
  font-size: 0.875rem;
  color: var(--ed-ink);
  margin: 0 0 1.25rem;
}

.billing-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

/* ─── INVOICE SUB-TAB VIEW ──────────────────────────────────────────────── */
.billing-invoice-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.billing-invoice-stats .inv-stat .billing-stat-value.inv-overdue {
  color: var(--ed-status-danger);
}

.billing-invoice-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.billing-invoice-toolbar-left,
.billing-invoice-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.billing-inv-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ed-ink-muted);
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-sm);
  cursor: pointer;
  transition: all var(--ed-duration) var(--ed-ease);
}

.billing-inv-btn:hover {
  color: var(--ed-ink);
  border-color: var(--ed-border-strong);
  background: var(--ed-surface-alt);
}

.billing-inv-btn.primary {
  background: var(--ed-accent);
  color: #fff;
  border-color: var(--ed-accent);
}

.billing-inv-btn.primary:hover {
  background: var(--ed-accent-hover);
  border-color: var(--ed-accent-hover);
}

/* ─── INVOICE TABLE ─────────────────────────────────────────────────────── */
.billing-invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
}

.billing-invoice-table thead {
  background: var(--ed-surface-alt);
  border-bottom: 1px solid var(--ed-border);
}

.billing-invoice-table th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ed-ink-muted);
  white-space: nowrap;
}

.billing-invoice-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--ed-border);
  color: var(--ed-ink);
  vertical-align: middle;
}

.billing-invoice-table tbody tr {
  transition: background var(--ed-duration) var(--ed-ease);
}

.billing-invoice-table tbody tr:hover {
  background: var(--ed-accent-muted);
}

.billing-invoice-table tbody tr:last-child td {
  border-bottom: none;
}

.billing-inv-number {
  font-family: var(--ed-font-mono);
  font-weight: 600;
  color: var(--ed-accent);
  cursor: pointer;
}

.billing-inv-number:hover {
  text-decoration: underline;
}

.billing-inv-amount {
  font-family: var(--ed-font-mono);
  font-weight: 500;
  white-space: nowrap;
}

/* ─── INVOICE STATUS BADGES ─────────────────────────────────────────────── */
.billing-inv-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.billing-inv-status.draft {
  background: var(--ed-surface-alt);
  color: var(--ed-ink-muted);
}

.billing-inv-status.sent {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.billing-inv-status.partial {
  background: rgba(180, 83, 9, 0.1);
  color: var(--ed-status-hold);
}

.billing-inv-status.overdue {
  background: rgba(220, 38, 38, 0.1);
  color: var(--ed-status-danger);
}

.billing-inv-status.paid {
  background: var(--ed-status-active-bg);
  color: var(--ed-status-active);
}

/* ─── INVOICE ENTRY BADGE (in entries table) ────────────────────────────── */
.billing-invoiced-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 600;
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ─── WIZARD MODAL ──────────────────────────────────────────────────────── */
.billing-wizard-modal {
  max-width: 720px;
  max-height: 90vh;
}

.billing-wizard-steps {
  display: flex;
  border-bottom: 1px solid var(--ed-border);
  padding: 0 1.25rem;
}

.billing-wizard-step {
  flex: 1;
  text-align: center;
  padding: 0.75rem 0.5rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ed-ink-faint);
  border-bottom: 2px solid transparent;
  transition: all var(--ed-duration) var(--ed-ease);
}

.billing-wizard-step.active {
  color: var(--ed-accent);
  border-bottom-color: var(--ed-accent);
}

.billing-wizard-step.completed {
  color: var(--ed-status-active);
}

.billing-wizard-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--ed-surface-alt);
  font-size: 0.6875rem;
  font-weight: 700;
  margin-right: 0.35rem;
}

.billing-wizard-step.active span {
  background: var(--ed-accent);
  color: #fff;
}

.billing-wizard-step.completed span {
  background: var(--ed-status-active);
  color: #fff;
}

.billing-wizard-body {
  padding: 1.25rem;
  overflow-y: auto;
  max-height: 55vh;
}

/* Wizard form layout */
.billing-wizard-body .billing-form-group {
  margin-bottom: 0.875rem;
}

.billing-wizard-body label {
  display: block;
  font-family: var(--ed-font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ed-ink-muted);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.billing-wizard-body select,
.billing-wizard-body input[type="date"],
.billing-wizard-body input[type="text"],
.billing-wizard-body input[type="number"],
.billing-wizard-body textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  font-family: var(--ed-font-body);
  font-size: 0.8125rem;
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-sm);
  background: var(--ed-bg);
  color: var(--ed-ink);
  outline: none;
  transition: border-color var(--ed-duration) var(--ed-ease);
  box-sizing: border-box;
}

.billing-wizard-body select:focus,
.billing-wizard-body input:focus,
.billing-wizard-body textarea:focus {
  border-color: var(--ed-accent);
}

.billing-wizard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Wizard step 2 — entries list */
.billing-wizard-entries-group {
  margin-bottom: 1rem;
}

.billing-wizard-entries-group h4 {
  font-family: var(--ed-font-display);
  font-size: 0.875rem;
  color: var(--ed-ink-strong);
  margin: 0 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--ed-border);
}

.billing-wizard-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 0.8125rem;
  border-bottom: 1px dashed var(--ed-border);
}

.billing-wizard-entry:last-child {
  border-bottom: none;
}

.billing-wizard-entry input[type="checkbox"] {
  flex-shrink: 0;
}

.billing-wizard-entry-desc {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ed-ink);
}

.billing-wizard-entry-meta {
  font-family: var(--ed-font-mono);
  font-size: 0.75rem;
  color: var(--ed-ink-muted);
  white-space: nowrap;
}

.billing-wizard-running-total {
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem 0;
  font-family: var(--ed-font-body);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ed-ink-strong);
  border-top: 2px solid var(--ed-border);
  margin-top: 0.5rem;
}

/* Wizard step 3 — review/totals */
.billing-wizard-totals {
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-sm);
  padding: 1rem;
  margin-top: 0.75rem;
}

.billing-wizard-totals-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.8125rem;
  color: var(--ed-ink);
}

.billing-wizard-totals-row.grand {
  font-weight: 700;
  font-size: 1rem;
  padding-top: 0.5rem;
  margin-top: 0.3rem;
  border-top: 2px solid var(--ed-ink-strong);
  color: var(--ed-ink-strong);
}

.billing-wizard-totals-row .amount {
  font-family: var(--ed-font-mono);
  font-weight: 600;
}

/* ─── DETAIL MODAL ──────────────────────────────────────────────────────── */
.billing-detail-modal {
  max-width: 780px;
  max-height: 90vh;
}

.billing-detail-modal .billing-modal-body {
  overflow-y: auto;
  max-height: 65vh;
}

.billing-detail-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.billing-detail-header .bill-col {
  flex: 1;
}

.billing-detail-header .bill-col h5 {
  font-family: var(--ed-font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ed-ink-muted);
  margin: 0 0 0.25rem;
}

.billing-detail-header .bill-col p {
  font-size: 0.8125rem;
  color: var(--ed-ink);
  margin: 0;
  white-space: pre-line;
  line-height: 1.5;
}

.billing-detail-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

.billing-detail-items th {
  padding: 0.4rem 0.5rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ed-ink-muted);
  background: var(--ed-surface-alt);
  border-bottom: 1px solid var(--ed-border);
}

.billing-detail-items td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--ed-border);
  color: var(--ed-ink);
}

.billing-detail-items .matter-header td {
  font-weight: 600;
  background: rgba(0,0,0,0.02);
  color: var(--ed-ink-strong);
  padding-top: 0.6rem;
}

.billing-detail-payments {
  margin-top: 1rem;
}

.billing-detail-payments h4 {
  font-family: var(--ed-font-display);
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
  color: var(--ed-ink-strong);
}

.billing-detail-payment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.8125rem;
  border-bottom: 1px dashed var(--ed-border);
}

.billing-detail-payment-row:last-child {
  border-bottom: none;
}

.billing-detail-payment-row .pay-info {
  color: var(--ed-ink-muted);
}

.billing-detail-payment-row .pay-amount {
  font-family: var(--ed-font-mono);
  font-weight: 600;
  color: var(--ed-status-active);
}

.billing-detail-payment-row .pay-delete {
  background: none;
  border: none;
  color: var(--ed-ink-faint);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.2rem;
  border-radius: var(--ed-radius-sm);
  transition: color var(--ed-duration) var(--ed-ease);
}

.billing-detail-payment-row .pay-delete:hover {
  color: var(--ed-status-danger);
}

/* ─── SETTINGS MODAL ────────────────────────────────────────────────────── */
.billing-settings-modal {
  max-width: 560px;
}

.billing-settings-section {
  font-family: var(--ed-font-display);
  font-size: 0.8125rem;
  color: var(--ed-ink-strong);
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--ed-border);
}

.billing-settings-section:first-child {
  margin-top: 0;
}

.billing-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

/* ─── PAYMENT INFO BAR ──────────────────────────────────────────────────── */
.billing-payment-info {
  background: var(--ed-surface-alt);
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius-sm);
  padding: 0.6rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--ed-ink);
  margin-bottom: 0.75rem;
}

/* ─── MUTED TEXT ────────────────────────────────────────────────────────── */
.billing-muted-text {
  font-size: 0.8125rem;
  color: var(--ed-ink-muted);
  margin: 0.5rem 0 0;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .billing-entry-form,
  .billing-entry-form.expense-form {
    grid-template-columns: 1fr 1fr;
  }

  .billing-entry-form .billing-form-group:nth-child(5) {
    grid-column: 1 / -1;
  }

  .billing-save-btn {
    grid-column: 1 / -1;
  }

  .billing-stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .billing-invoice-stats {
    grid-template-columns: 1fr 1fr;
  }

  .billing-invoice-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .billing-wizard-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #billingTab {
    padding: 0 0.75rem 1.5rem;
  }

  .billing-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .billing-timer-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .billing-timer-selects {
    flex-direction: column;
  }

  .billing-timer-display {
    text-align: center;
    padding: 0.25rem 0;
  }

  .billing-timer-controls {
    justify-content: center;
  }

  .billing-entry-form,
  .billing-entry-form.expense-form {
    grid-template-columns: 1fr;
  }

  .billing-entries-table {
    font-size: 0.75rem;
  }

  .billing-entries-table th,
  .billing-entries-table td {
    padding: 0.4rem 0.5rem;
  }

  /* Hide less-important columns on mobile */
  .billing-entries-table .col-rate,
  .billing-entries-table .col-billable {
    display: none;
  }

  .billing-invoice-stats {
    grid-template-columns: 1fr 1fr;
  }

  .billing-invoice-toolbar-left,
  .billing-invoice-toolbar-right {
    flex-wrap: wrap;
  }

  .billing-wizard-modal,
  .billing-detail-modal,
  .billing-settings-modal {
    width: 95%;
    max-height: 92vh;
  }
}

/* ─── ANIMATIONS ─────────────────────────────────────────────────────────── */
@keyframes billingFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.billing-stat-card,
.billing-entries-wrapper {
  animation: billingFadeIn 0.3s var(--ed-ease-out) both;
}

.billing-stat-card:nth-child(2) { animation-delay: 0.05s; }
.billing-stat-card:nth-child(3) { animation-delay: 0.1s; }
.billing-stat-card:nth-child(4) { animation-delay: 0.15s; }
