/* History.css - Sub-tab layouts and booking/request result styles
 *
 * Each sub-tab is ONE panel: the filters and the Search button are its header, the
 * expandable result rows are its body. The sub-tab bar is a SIBLING section above it,
 * never a wrapper around both -- that is what the one-panel rule in Panel.css keys off,
 * and it is why the header, the sub-tabs and the filter bar stay put while only the
 * results scroll.
 *
 * There is deliberately no module container here. `.history-module` used to hand-roll
 * its own fill chain (height:100% + a flex child), which put the panel out of reach of
 * the platform rule and made the whole tab scroll instead of the list.
 */

/* ===================
   SUB-TAB NAVIGATION
   =================== */

/* Two rows (TLP-1105): the group, then that group's sub-tabs, stacked with a
   gap. No padding of its own: the VerticalStackTemplate that holds this bar
   already puts its gap between the bar and the panel (gap-only spacing). */
.history-sub-tabs {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* A wide row scrolls SIDEWAYS inside its own row and never wraps: the
   SegmentedControl's sliding highlight is sized to the whole control, so a
   wrapped row would paint the pill across every line. Same rule and same
   shape as the Set Up seat's selector rows, which carry seventeen outlets. */
.history-sub-tab-row {
    display: flex;
    align-items: center;
    min-width: 0;
    overflow-x: auto;
}

.history-sub-tab-row .segmented-control {
    flex: 0 0 auto;
}

/* ===================
   REQUEST FILTERS: 3-group grid layout (What | When | Where)
   =================== */

/* ===================
   BOOKING RESULT HEADERS
   Row layout + all chips come from the shared ExpandableRowHeader molecule.
   .hist-booking-name is kept (rendered as a raw slot) so the group-booking
   e2e can select guest names within a group.
   =================== */

.hist-booking-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

/* ===================
   BOOKING GROUP WRAPPER
   =================== */

.hist-booking-group {
    border: var(--border-width-2) solid var(--color-warning);
    border-radius: var(--border-radius-lg);
    padding: var(--space-2);
    background: var(--color-warning-light);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.hist-booking-group-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-warning-hover);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 var(--space-1);
}

/* ===================
   BOOKING EXPANDED DETAILS
   Field groups span the page via the shared FormGrid molecule (auto columns);
   wide content (special requests, dietary, notes, history) stacks full-width below.
   =================== */

/* Full-width content below the field groups (special requests, description, ...)
   renders as a labelled .hist-section block (spacing rule below) + body text. */

/* ===================
   NOTES SECTION
   =================== */

.hist-notes-section,
.hist-change-section,
.hist-tasks-section,
.hist-section {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: var(--border-width-1) solid var(--border-subtle);
}

.hist-section-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-2);
}

.hist-note-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-0_5);
    padding: var(--space-1) 0;
}

.hist-note-meta {
    font-size: var(--text-2xs);
    color: var(--text-muted);
}

.hist-note-text {
    font-size: var(--text-sm);
    color: var(--text-body);
}

.hist-empty-note {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-style: italic;
}

.hist-add-note {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    margin-top: var(--space-2);
}

.hist-add-note .input {
    flex: 1;
}

/* ===================
   CHANGE HISTORY SECTION
   =================== */

.hist-change-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-0_5);
    padding: var(--space-1) 0;
}

.hist-change-meta {
    font-size: var(--text-2xs);
    color: var(--text-muted);
}

.hist-change-detail {
    font-size: var(--text-xs);
    color: var(--text-body);
    font-family: var(--font-mono);
}

/* ===================
   REQUEST EXPANDED DETAILS
   (Request row headers render via the shared ExpandableRowHeader molecule.)
   =================== */

.hist-task-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) 0;
    font-size: var(--text-sm);
}

.hist-task-dept {
    font-size: var(--text-xs);
    color: var(--text-muted);
    min-width: 100px;
}

.hist-task-title {
    flex: 1;
    color: var(--text-body);
}



/* (Complaint row headers render via the shared ExpandableRowHeader molecule.) */

/* ===================
   PRINT TABLE (rendered in print popup)
   =================== */

.hist-print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-xs);
}

.hist-print-table th,
.hist-print-table td {
    border: var(--border-width-1) solid var(--border-default);
    padding: var(--space-1) var(--space-2);
    text-align: left;
}

.hist-print-table th {
    background: var(--bg-layer-2);
    font-weight: 600;
}

/* ===================
   TASK TRAIL (TLP-1089)
   The Activity and Comments blocks are the Inbox's own markup from the shared
   task-trail renderer (their rules live in Tasks.css); this frame only stacks
   the two under the description with the section spacing every other block has.
   =================== */

.hist-trail {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* ===================
   WORKFLOW CHAIN (TLP-1108)
   The expanded body of a run: every step the run INTENDED, in plan order. A step
   that was never minted is drawn in the same list as one that was -- muted, and
   saying so in words -- because leaving it out is what turns a short chain into
   a chain that looks whole.
   =================== */

.hist-workflow-chain {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.hist-workflow-step {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: var(--text-xs);
    padding: var(--space-1) 0;
    border-bottom: var(--border-width-1) solid var(--border-subtle);
}

.hist-workflow-step:last-child {
    border-bottom: none;
}

/* The step number, so the chain reads as an order rather than a list. */
.hist-workflow-step-index {
    flex: 0 0 auto;
    min-width: var(--space-4);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.hist-workflow-step-title {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text-body);
}

.hist-workflow-step-state {
    flex: 0 0 auto;
    color: var(--text-secondary);
}

.hist-workflow-step-meta {
    flex: 0 0 auto;
    color: var(--text-muted);
}

/* A step that has not happened, and one that never will. Muted rather than absent:
   the plan is what the run intended, and the difference between "still coming" and
   "can never happen now" is the whole answer on a dead run. */
.hist-workflow-step-pending .hist-workflow-step-title,
.hist-workflow-step-blocked .hist-workflow-step-title,
.hist-workflow-step-unrecorded .hist-workflow-step-title {
    color: var(--text-muted);
}

/* A step that DID happen but is not in the index (the run predates the workflow
   key). Warning, not error: nothing is broken, we simply cannot show it -- and the
   banner above the chain says why. */
.hist-workflow-step-unrecorded .hist-workflow-step-state {
    color: var(--color-warning);
}

.hist-workflow-step-blocked .hist-workflow-step-state {
    color: var(--color-error);
}

.hist-workflow-step-done .hist-workflow-step-title {
    color: var(--text-primary);
}

/* ---------------------------------------------------------------------------
   The Conversations sub-tab's open row (TLP-1165): the stay's facts, then what
   was said. Two subjects, so they need a gap between them -- without one the
   transcript's centred day pill reads as part of the detail grid above it. The
   Conversations tab gets this from its own `.gconv-body`; History's rows are
   ExpandableList items rather than ExpandablePanels, so it is said here, in the
   module that owns the `hist-` prefix. The thread's own `gconv-` rules apply
   unchanged -- every one of them is a flat selector.
   --------------------------------------------------------------------------- */
.hist-conversation-expanded {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
