/* reports.css — Summary Report styling (TK-64..TK-71) */

#page-reports-summary .page-body {
  padding: 20px 24px;
}

/* toolbar row (date picker + action buttons) */
.rp-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.rp-toolbar .rp-spacer { flex: 1; }
.rp-drp-group {
  display: inline-flex;
  align-items: stretch;
  gap: 4px;
}
.rp-drp-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #cbd5e1;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.rp-drp-nav:hover { background: #334155; border-color: #475569; color: #f1f5f9; }
.rp-toolbar button.rp-action {
  padding: 7px 14px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.rp-toolbar button.rp-action:hover:not(:disabled) { background: #334155; }
.rp-toolbar button.rp-action:disabled { opacity: .5; cursor: not-allowed; }
.rp-toolbar button.rp-action.primary { background: #10b981; border-color: #10b981; color: #fff; }
.rp-toolbar button.rp-action.primary:hover:not(:disabled) { background: #059669; }

/* filter bar */
#rpFilterBar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid #1e293b;
}
.rp-flt-wrap { position: relative; }
.rp-flt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  cursor: pointer;
  font-family: inherit;
}
.rp-flt-btn:hover { background: #1e293b; }
.rp-flt-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 260px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  z-index: 700;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.rp-flt-panel.open { display: block; }
.rp-flt-search input {
  width: 100%;
  padding: 6px 10px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 12px;
  margin-bottom: 6px;
}
.rp-flt-body { max-height: 220px; overflow-y: auto; }
.rp-flt-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  font-size: 12px;
  color: #e2e8f0;
  cursor: pointer;
  border-radius: 4px;
}
.rp-flt-row:hover { background: #1e293b; }
.rp-flt-sep { height: 1px; background: #1e293b; margin: 4px 0; }
.rp-flt-empty { padding: 10px; color: #64748b; font-size: 12px; text-align: center; }
.rp-flt-footer {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  margin-top: 6px;
  border-top: 1px solid #1e293b;
}
.rp-flt-footer button {
  flex: 1;
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  cursor: pointer;
  font-family: inherit;
}
.rp-flt-footer button:hover { background: #334155; }
.rp-flt-clear {
  padding: 6px 12px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-family: inherit;
  margin-left: auto;
}
.rp-flt-clear:hover { color: #ef4444; border-color: #ef4444; }

/* group-by bar — sits directly above the table */
#rpGroupBar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #1e293b;
  border: 1px solid #334155;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}
#rpGroupBar + .rp-table-wrap { border-radius: 0 0 8px 8px; border-top: none; }
.rp-groupby-sel {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding: 6px 28px 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #334155;
  background-color: #0f172a;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: #e2e8f0;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}
.rp-groupby-sel:hover { border-color: #475569; }
.rp-groupby-sel:focus { border-color: #60a5fa; }
.rp-groupby-sel option:disabled { color: #475569; }
.rp-groupby-sel::-ms-expand { display: none; }

/* totals + charts */
#rpStats { margin-bottom: 20px; }

#rpChartsRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  #rpChartsRow { grid-template-columns: 1fr; }
}
.rp-chart-card {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 16px;
}
.rp-chart-title {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.rp-chart-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 8px;
  font-size: 11px;
  color: #94a3b8;
}
.rp-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.rp-donut-wrap {
  display: flex;
  gap: 12px;
  align-items: center;
}
.rp-donut-legend {
  flex: 1;
  max-height: 240px;
  overflow-y: auto;
  font-size: 11px;
}
.rp-legend-row {
  display: flex;
  align-items: center;
  padding: 3px 0;
  color: #cbd5e1;
}
.rp-chart-empty {
  padding: 40px;
  text-align: center;
  color: #475569;
  font-size: 12px;
}

/* Hard-stop card */
.rp-hardstop-wrap, .rp-hardstop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 16px;
  border-radius: 8px;
  transition: background 0.15s, box-shadow 0.15s;
}
.rp-hardstop-wrap:hover {
  background: rgba(245, 158, 11, 0.06);
}
.rp-hardstop-wrap.is-active {
  background: rgba(245, 158, 11, 0.10);
  box-shadow: inset 0 0 0 2px #f59e0b;
}
.rp-hardstop-num {
  font-size: 38px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f59e0b;
  letter-spacing: -0.02em;
}
.rp-hardstop-empty .rp-hardstop-num { color: #475569; }
.rp-hardstop-sub {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 6px;
}
.rp-hardstop-bd {
  color: #64748b;
  font-size: 11px;
}
.rp-hardstop-cta {
  font-size: 11px;
  color: #f59e0b;
  margin-top: 14px;
  letter-spacing: .03em;
  text-transform: uppercase;
  font-weight: 600;
}
.rp-hardstop-cta.is-active { color: #fbbf24; }

/* Inline reason badge inside table rows */
.rp-hs-reason {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: .03em;
  vertical-align: middle;
  white-space: nowrap;
}
.rp-hs-reason-cap {
  background: #f59e0b22;
  color: #f59e0b;
  border: 1px solid #f59e0b55;
}
.rp-hs-reason-mid {
  background: #60a5fa22;
  color: #60a5fa;
  border: 1px solid #60a5fa55;
}
.rp-row-hs td:first-child {
  border-left: 2px solid #f59e0b;
}

/* table */
.rp-table-wrap {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  overflow-x: auto;
}
#rpTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}
#rpTable thead th {
  text-align: left;
  padding: 10px 14px;
  background: #1e293b;
  color: #94a3b8;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid #334155;
  position: sticky;
  top: 0;
  white-space: nowrap;
}
#rpTable thead th.rp-col-num { text-align: right; width: 120px; }
#rpTable thead th.rp-sortable { cursor: pointer; user-select: none; }
#rpTable thead th.rp-sortable:hover { color: #e2e8f0; background: #273449; }

/* Long text in the Group / Description columns is clipped with a
   browser-native tooltip (title attribute) showing the full value. */
#rpTable tbody td.rp-group-cell,
#rpTable tbody td.rp-desc-cell {
  max-width: 520px;
  overflow: hidden;
}
.rp-group-label,
.rp-desc-label {
  display: inline-block;
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
/* When a hard-stop badge is prepended, give the label less room so the
   pill + ellipsised text stay inside the cell's max-width. */
.rp-row-hs .rp-desc-label {
  max-width: 340px;
}
.rp-group-label[title]:hover,
.rp-desc-label[title]:hover { cursor: help; }
#rpTable tbody td {
  padding: 7px 14px;
  color: #e2e8f0;
  border-bottom: 1px solid #1e293b;
  vertical-align: middle;
}
#rpTable tbody td.rp-col-num {
  text-align: right;
  white-space: nowrap;
  width: 120px;
}
#rpTable tfoot td {
  padding: 10px 14px;
  background: #1e293b;
  color: #f1f5f9;
  border-top: 2px solid #334155;
}
#rpTable tfoot td.rp-col-num { text-align: right; }
.rp-row:hover { background: #0b1220; }
.rp-group-row { background: rgba(30, 41, 59, 0.2); }
.rp-group-row:hover { background: rgba(30, 41, 59, 0.4); }
.rp-depth-0 { background: rgba(30, 41, 59, 0.45); font-weight: 600; color: #f1f5f9; }
.rp-depth-0:hover { background: rgba(30, 41, 59, 0.6); }
.rp-depth-1 { background: rgba(30, 41, 59, 0.25); }
.rp-depth-2 { background: rgba(30, 41, 59, 0.1); }
.rp-tree-toggle {
  display: inline-block;
  width: 18px;
  text-align: center;
  cursor: pointer;
  color: #94a3b8;
  margin-right: 6px;
  user-select: none;
}
.rp-tree-toggle:hover { color: #f1f5f9; }
.rp-tree-bullet {
  display: inline-block;
  width: 18px;
  text-align: center;
  color: #475569;
  margin-right: 6px;
  user-select: none;
}

/* schedule modal */
#rpSchedModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}
#rpSchedModal.open { display: flex; }
.rp-sched-dialog {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 24px;
  width: 560px;
  max-width: calc(100vw - 32px);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.rp-sched-dialog h2 {
  margin: 0 0 14px 0;
  font-size: 16px;
  color: #f1f5f9;
}
.rp-sched-dialog label {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin: 10px 0 4px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.rp-sched-dialog input[type="text"],
.rp-sched-dialog select,
.rp-sched-dialog textarea {
  width: 100%;
  padding: 8px 12px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  font-family: inherit;
  font-size: 13px;
  box-sizing: border-box;
}
.rp-sched-dialog textarea { min-height: 80px; resize: vertical; }
.rp-sched-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  justify-content: flex-end;
}
.rp-sched-actions button {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}
.rp-sched-actions button.primary {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
  font-weight: 600;
}
.rp-sched-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #1e293b;
  border-radius: 6px;
  margin-bottom: 6px;
  background: #0b1220;
}
.rp-sched-del {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid #7f1d1d;
  background: transparent;
  color: #fca5a5;
  cursor: pointer;
  font-family: inherit;
}
.rp-sched-del:hover { background: #7f1d1d; color: #fff; }

/* print layout (Stage 5) */
@media print {
  body > *:not(#page-reports-summary):not(#page-reports-summary *) { display: none !important; }
  .sidebar, .app-header, .page-header,
  #rpFilterBar, #rpGroupBar,
  .rp-toolbar { display: none !important; }
  #page-reports-summary.page { display: block !important; }
  #page-reports-summary {
    background: #fff !important;
    color: #000 !important;
  }
  #page-reports-summary * {
    color: #000 !important;
    background: transparent !important;
    border-color: #ccc !important;
  }
  #rpTable thead th { background: #f5f5f5 !important; }
  .rp-chart-card { page-break-inside: avoid; }
}

/* Build 1006 Phase B — reports mobile rules.
   #rpChartsRow already collapses to 1 col at 900px. Reports also has
   a fixed-width filter rail (260px) and rp-col-num cells at 120px.
   Allow horizontal scroll for the data table; collapse filter rail
   to top-stack on mobile. */
@media (max-width: 640px) {
  #rpFilterRail { width: 100%; max-width: 100%; }
  .rp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #rpTable thead th.rp-col-num { width: auto; }
  .rp-export-row { flex-wrap: wrap; gap: 6px; }
}
