/* =============================================================================
   Agent Meeko - HR > Settings (RM-168)
   Built on the CRM settings cards (crm-settings.css) and the bookings switch
   rows (bookings-settings.css); this file holds only what is HR's own: the
   department tree, the week of a working pattern, and the list tables.
   ============================================================================= */

/* ---- Page frame ------------------------------------------------------------------ */
.hr-settings .page-toolbar { padding: var(--content-gap-top, 20px) var(--gutter, 24px) 0; flex-wrap: wrap; }
.hr-settings .data-table-scroll { margin: 16px var(--gutter, 24px) 32px; }
.hr-settings .crm-settings__body { padding-top: 16px; }
.hr-settings__minutes { margin-top: 8px; max-width: 220px; height: var(--control-height-small); font-size: var(--font-size-small); }

/* ---- General: idle export and the statuses (RM-172) ------------------------------ */
.hr-settings__idle-export { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; align-self: flex-start; }
/* The Status page's card, sitting in the settings body rather than on its own page. */
.hr-settings .hr-settings__statuses { margin: 16px 0 0; max-width: none; overflow: visible; }
.hr-idle-export { display: flex; flex-direction: column; gap: 14px; padding: 4px 0; }
.hr-idle-export__intro { margin: 0; font-size: var(--font-size-base); color: var(--text-secondary); line-height: 1.5; }
/* The compact panel is too narrow for two date pickers side by side: they stack. */
.hr-idle-export__dates { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.hr-idle-export .form-field { margin: 0; min-width: 0; }
.hr-idle-export .form-field__control { width: 100%; box-sizing: border-box; }

/* ---- Department tree --------------------------------------------------------------- */
.hr-tree { display: flex; flex-direction: column; gap: 10px; }
.hr-tree__department {
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: var(--surface-panel);
    overflow: hidden;
}
.hr-tree__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    min-width: 0;
}
.hr-tree__row--department { background: var(--surface-panel); }
.hr-tree__department.is-open > .hr-tree__row--department { border-bottom: 1px solid var(--border-subtle); background: var(--surface-subtle); }
.hr-tree__toggle {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
.hr-tree__toggle:hover { background: var(--surface-subtle); color: var(--text-primary); }
.hr-tree__toggle:focus-visible { outline: none; box-shadow: var(--am-focus); }
.hr-tree__dot { flex: none; width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.hr-tree__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hr-tree__title {
    font-size: var(--font-size-base);
    font-weight: 650;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hr-tree__detail { font-size: var(--font-size-small); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-tree__edit { flex: none; }
.hr-tree__children { display: flex; flex-direction: column; padding: 4px 16px 14px 56px; gap: 4px; }
.hr-tree__team { border-left: 2px solid var(--border-subtle); padding-left: 14px; }
.hr-tree__row--team { padding: 10px 0 6px; }
.hr-tree__team-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent-tint);
    color: var(--accent);
}
.hr-tree__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hr-tree__chips--team { padding: 0 0 10px 40px; }
.hr-tree__people { display: flex; flex-direction: column; gap: 8px; padding: 10px 0 4px 16px; border-left: 2px solid var(--border-subtle); }
.hr-tree__label { font-size: var(--font-size-small); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.hr-tree__empty { margin: 10px 0 0; font-size: var(--font-size-small); color: var(--text-muted); }

/* ---- Department panel: teams with ticks --------------------------------------------- */
.hr-settings-panel { display: flex; flex-direction: column; gap: 16px; }
.hr-settings-panel__switches { border-top: var(--divider-width, 1px) solid var(--divider-colour, var(--border-subtle)); padding-top: 14px; }
.hr-check-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    max-height: 260px;
    overflow-y: auto;
}
.hr-check-list__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid var(--border-subtle);
    cursor: pointer;
    min-width: 0;
}
.hr-check-list__row:first-child { border-top: 0; }
.hr-check-list__row:hover { background: var(--surface-subtle); }
.hr-check-list__name { flex: 1 1 auto; min-width: 0; font-size: var(--font-size-base); color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-check-list__note { flex: none; font-size: var(--font-size-small); color: var(--text-muted); }
.hr-check-list__empty { margin: 0; padding: 12px; font-size: var(--font-size-small); color: var(--text-muted); }

/* ---- List tables ---------------------------------------------------------------------- */
.hr-settings-table tbody tr { cursor: pointer; }
.hr-settings-table__name { font-weight: 600; color: var(--text-primary); }
.hr-settings-table__detail { display: block; margin-top: 2px; font-size: var(--font-size-small); color: var(--text-secondary); }
.hr-chip { display: inline-flex; align-items: center; gap: 8px; }
.hr-yes { display: inline-flex; align-items: center; gap: 5px; color: var(--status-success); font-weight: 600; }

/* ---- A week of a working pattern ------------------------------------------------------- */
.hr-week { display: flex; gap: 4px; flex-wrap: wrap; }
.hr-week__day {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 62px;
    padding: 4px 6px;
    border-radius: 6px;
    background: var(--surface-subtle);
    color: var(--text-muted);
}
.hr-week__day.is-working { background: var(--accent-tint); color: var(--accent); }
.hr-week__name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.hr-week__hours { font-size: 11.5px; white-space: nowrap; }

.hr-pattern-field { display: flex; flex-direction: column; gap: 8px; }
.hr-pattern-days { display: flex; flex-direction: column; border: 1px solid var(--border-default); border-radius: 8px; }
.hr-pattern-day {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 10px 12px;
    border-top: 1px solid var(--border-subtle);
}
.hr-pattern-day:first-child { border-top: 0; }
.hr-pattern-day__name { display: inline-flex; align-items: center; gap: 10px; width: 130px; flex: none; font-weight: 600; font-size: var(--font-size-base); cursor: pointer; }
.hr-pattern-day__times { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 auto; flex-wrap: wrap; min-width: 0; }
.hr-pattern-day__times .form-field__control { width: auto; min-width: 0; height: var(--control-height-small); }
.hr-pattern-day__times input[type="time"] { width: 112px; }
.hr-pattern-day__off { display: none; font-size: var(--font-size-small); }
.hr-pattern-day.is-off .hr-pattern-day__times { display: none; }
.hr-pattern-day.is-off .hr-pattern-day__off { display: inline; }
.hr-pattern-day.is-off .hr-pattern-day__name { color: var(--text-muted); }

/* ---- Tablet and phone ------------------------------------------------------------------ */
@media (max-width: 900px) {
    .hr-tree__department .teams-faces { display: none; }
    .hr-settings-table__optional { display: none; }
}
@media (max-width: 560px) {
    .hr-settings .page-toolbar { padding-left: 16px; padding-right: 16px; }
    .hr-settings .data-table-scroll { margin-left: 16px; margin-right: 16px; }
    .hr-tree__row { padding: 10px 12px; gap: 8px; }
    .hr-tree__edit span { display: none; }
    .hr-tree__children { padding: 4px 12px 12px 22px; }
    .hr-tree__chips--team { padding-left: 0; }
    .hr-pattern-day__name { width: 100%; }
    .hr-pattern-day__times input[type="time"] { width: 104px; }
}
