/* Admin settings, Phase 1f (GitHub issue 203; docs/adr/0087): what the third interface review (2026-10-21) found on
   Admin settings' screens. Sizes are the tokens' (tokens.css); colors the page's own, so light and dark follow them.
   Loaded after the other settings sheets, so a rule here is the last word on what it names. */

/* ------------------------------------------------------------------------- Search results above the page */
/* The results drop down from the side menu's box over the page. The side menu had no layer of its own, so the page's
   own controls (a switch, a styled list: anything placed) were drawn over the results and took their clicks. While the
   results are open the menu sits above the page column, under the top bar and the outage banner. Below desktop width
   it is placed where it stays at the top of the screen as the page scrolls (settings-frame.css), so the layer counts
   there too and the box doesn't jump back into the page's flow as results open. */
#settingsView > .settings-side-menu:has(.settings-search-results:not([hidden])) { z-index:var(--z-banner); }
@media (max-width:1099px) {
  #settingsView > .settings-side-menu:has(.settings-search-results:not([hidden])) { position:sticky; }
}

/* ------------------------------------------------------------------------- The chosen top tab, in dark mode */
/* In dark mode the chosen tab was the card's dark on the track's dark: which half of Admin settings is open was hard
   to see. It is tinted and outlined in the accent there, as a chosen item of the side menu is. */
[data-theme="dark"] .settings-top-tab.active { background:var(--spruce-pale); color:var(--spruce-dark); box-shadow:inset 0 0 0 1px var(--spruce); }

/* ------------------------------------------------------------------------- One rule for a list's add and remove */
/* A list's Add is in its card's heading row, at its end: the filled button when the page has one list, an outline one
   on a page of several lists (Custom states' Tickets, Problems and Changes), so no two compete. A row's Delete or
   Remove is a quiet button at the row's end, after Edit, that turns red only when pointed at, and always asks first. */
#settingsView .settings-row-action.is-danger, body.settings-frame-open .modal .settings-row-action.is-danger { border-color:transparent; background:transparent; color:var(--ink-2); }
#settingsView .settings-row-action.is-danger:hover:not(:disabled), #settingsView .settings-row-action.is-danger:focus-visible { border-color:var(--bad); background:var(--terra-pale); color:var(--bad); }
#settingsView .settings-list-add { flex:none; margin-left:auto; }

/* ------------------------------------------------------------------------- What waits for a switch above it */
/* A feature switched on that waits for its parent (the AI assistant, the Teams or Slack app) is drawn on, with this
   beside its name; the card's notice says what it waits for. */
.settings-waiting-tag { display:inline-flex; align-items:center; margin-left:var(--space-75); padding:0 var(--space-75); border-radius:var(--radius-pill); background:var(--saffron-pale); color:var(--warn-ink); font-size:var(--text-xs); font-weight:var(--weight-semibold); line-height:1.6; vertical-align:middle; }

/* ------------------------------------------------------------------------- Setup steps (Teams, Slack) */
/* Each step its number in a small square, not an empty circle that read as a radio button and as done; a tick once
   FeatSuite knows the step is done. */
#settingsView .teams-steps li.to-do .teams-step-mark { border:var(--control-border-width) solid var(--line-strong, var(--line)); border-radius:var(--radius-sm); background:var(--surface-2); color:var(--ink); font-size:var(--text-xs); }

/* ------------------------------------------------------------------------- Custom states: one line a state */
/* Tickets' states across the page (they have the most to say), each row one line: the name, "Pauses SLA" in a column
   of its own, the color, then Edit and a quiet Delete; Problems and Changes beside each other under it. "Built in"
   says why there are no buttons, without a box of its own. */
#customStatesSettingsPanel .custom-states-grid > .custom-states-card:first-child { grid-column:1 / -1; }
#settingsView #customStatesSettingsPanel .custom-state-row { display:grid; grid-template-columns:minmax(0, 1fr) auto auto; align-items:center; gap:var(--space-100) var(--space-150); }
#settingsView #customStatesSettingsPanel .has-sla .custom-state-row { grid-template-columns:minmax(0, 1fr) 8.5rem auto auto; }
#settingsView #customStatesSettingsPanel .custom-state-row > .custom-state-name { overflow-wrap:anywhere; font-weight:var(--weight-semibold); }
#settingsView #customStatesSettingsPanel .custom-state-row > .custom-state-sla { display:flex; font-weight:var(--weight-regular); }
#settingsView #customStatesSettingsPanel .custom-state-color { margin-left:0; }
#settingsView #customStatesSettingsPanel .custom-state-actions { display:flex; justify-content:flex-end; gap:var(--space-50); min-width:9.5rem; min-height:2rem; align-items:center; font-weight:var(--weight-regular); }
#settingsView #customStatesSettingsPanel .state-sla-toggle { padding:0; background:none; color:var(--ink-2); font-size:var(--text-sm); font-weight:var(--weight-medium); }
#settingsView #customStatesSettingsPanel .state-sla-toggle input { width:auto; height:auto; accent-color:var(--spruce); }
#settingsView #customStatesSettingsPanel .state-sla-stops { font-size:var(--text-sm); }
#settingsView #customStatesSettingsPanel .custom-state-locked { padding:0; border:0; color:var(--muted); font-size:var(--text-sm); }
@media (max-width:700px) {
  #settingsView #customStatesSettingsPanel .has-sla .custom-state-row { grid-template-columns:minmax(0, 1fr) auto; }
  #settingsView #customStatesSettingsPanel .has-sla .custom-state-row > .custom-state-sla { grid-column:1; grid-row:2; }
  #settingsView #customStatesSettingsPanel .has-sla .custom-state-row > .custom-state-color { grid-column:2; grid-row:1; justify-self:end; }
  #settingsView #customStatesSettingsPanel .has-sla .custom-state-row > .custom-state-actions { grid-column:2; grid-row:2; min-width:0; }
  #settingsView #customStatesSettingsPanel .has-sla .custom-state-actions { min-width:0; }
}

/* ------------------------------------------------------------------------- Changes: why a chip is amber */
#settingsView .change-approver-stuck-note { margin:var(--space-50) 0 var(--space-100); color:var(--warn-ink); font-size:var(--text-xs); font-weight:var(--weight-semibold); }

/* ------------------------------------------------------------------------- Departments: a row's actions together */
/* Rename, Delete and the switch sit together at the row's end (GitHub issue 203, 1f: Rename and Delete were stacked
   under the name, the switch at the far right); Delete is the quiet one. On a phone the On chip and the actions share
   one line under the name. */
#settingsView .department-switch-row .department-switch-name { grid-template-columns:minmax(0, 1fr); }
#settingsView .department-row-actions button { min-height:var(--control-height-sm); padding:0 var(--space-150); font-size:var(--text-sm); }
#settingsView .department-row-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:var(--space-75); }
#settingsView .department-row-actions :is(.department-rename-open, .department-delete-open) { justify-self:auto; min-height:var(--control-height-sm); padding:0 var(--space-150); font-size:var(--text-sm); }
#settingsView .department-switch-row .department-delete-open { color:var(--ink-2); }
#settingsView .department-switch-row .department-delete-open:hover:not(:disabled), #settingsView .department-switch-row .department-delete-open:focus-visible { color:var(--bad); }
@media (max-width:700px) {
  #settingsView .department-switch-row:not(.department-mailbox-row) { grid-template-columns:auto minmax(0, 1fr); }
  #settingsView .department-switch-row:not(.department-mailbox-row) > .department-switch-name { grid-column:1 / -1; }
  #settingsView .department-row-actions { justify-content:flex-end; }
}

/* ------------------------------------------------------------------------- Users: Add user is the page's main action */
#settingsView #userAddMenuButton { display:inline-flex; align-items:center; gap:var(--space-50); }
#settingsView #userAddMenuButton span { padding:0; color:inherit; }

/* ------------------------------------------------------------------------- The setup checklists */
/* A step to do has the filled "Set up"; one done a quiet "Open" link, so the steps left stand out. */
.settings-checklist-steps .settings-checklist-open { min-height:var(--control-height-sm); padding:0 var(--space-100); color:var(--ink-2); font-size:var(--text-sm); font-weight:var(--weight-medium); }
.settings-checklist-steps .save-button { min-height:var(--control-height-sm); padding:0 var(--space-150); font-size:var(--text-sm); }
/* The bar is a track with its ends, so nothing done yet doesn't read as a divider. */
.settings-checklist-bar { background:var(--surface-2); box-shadow:inset 0 0 0 1px var(--line-strong, var(--line)); }
/* On a step's page, what is still missing, under the step's name. */
.settings-checklist-flow .settings-checklist-flow-detail { color:var(--ink-2); font-size:var(--text-xs); line-height:var(--leading-normal); }
.settings-checklist-flow .text-button.settings-row-action { color:var(--ink-2); }
/* On a phone "Hide this list" stays on the title's line, at its end, rather than a line of its own between the
   sentence and the bar; the IT Service Desk tab's "Open the checklist" lines up with the sentence above it. */
@media (max-width:700px) {
  .settings-checklist .settings-checklist-head { flex-direction:row; align-items:flex-start; gap:var(--space-100); }
  .settings-checklist .settings-checklist-head > div { flex:1 1 auto; min-width:0; }
  .settings-checklist-head .settings-checklist-hide { padding:0; }
  .settings-checklist-line .text-button { padding-left:0; padding-right:0; }
  .settings-checklist-steps li > :is(.save-button, .settings-checklist-open) { grid-column:2; justify-self:start; }
  .settings-checklist-steps li > .settings-checklist-open { padding-left:0; }
}

/* At a wide screen a rule's name has room: it squeezed to two lines and its line to three. Not below 1400 px: there
   the table is as wide as its card (at 1280 px the room for the name pushed Delete past the card's edge, cut off in a
   box that scrolled sideways). */
@media (min-width:1400px) {
  #settingsView .notification-rules-panel table.settings-compact-rows td:first-child { min-width:12rem; }
}
/* The Tickets, Problems and Changes tables stacked one under another share their columns, so Recipients, Sends and
   Active line up from card to card instead of each table sizing its own. */
@media (min-width:901px) {
  #settingsView .notification-rules-panel table.settings-compact-rows { table-layout:fixed; width:100%; }
  #settingsView .notification-rules-panel table.settings-compact-rows th:nth-child(1) { width:25%; }
  #settingsView .notification-rules-panel table.settings-compact-rows th:nth-child(2) { width:17%; }
  #settingsView .notification-rules-panel table.settings-compact-rows th:nth-child(3) { width:20%; }
  #settingsView .notification-rules-panel table.settings-compact-rows th:nth-child(4) { width:12%; }
  #settingsView .notification-rules-panel table.settings-compact-rows th:nth-child(5) { width:10%; }
  #settingsView .notification-rules-panel table.settings-compact-rows th:nth-child(6) { width:16%; }
  #settingsView .notification-rules-panel table.settings-compact-rows td { overflow-wrap:anywhere; }
}

/* ------------------------------------------------------------------------- Lists of rules on a phone */
/* Notification rules and escalation policies on a phone: a compact card a rule (its name; what starts it, who and
   what in a line each, the column's name before the value; its switch and Edit on the last line), not a stack of
   five labels over five values, one rule a screen. */
@media (max-width:700px) {
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table tr { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-50) var(--space-150); padding:var(--space-150) 0; }
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table td { width:auto; padding:0; }
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table td:first-child { flex:1 1 100%; }
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table td:first-child::before { content:none; }
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table td:first-child small { display:block; overflow:hidden; overflow-wrap:break-word; }
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table td:not(:first-child):not(:nth-last-child(-n+2)) { display:grid; flex:1 1 100%; grid-template-columns:6.5rem minmax(0, 1fr); gap:0 var(--space-100); color:var(--ink); font-size:var(--text-sm); }
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table td:not(:first-child):not(:nth-last-child(-n+2))[data-label]::before { grid-row:1; margin:0; font-size:var(--text-xs); letter-spacing:0; text-transform:none; }
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table td:not(:first-child):not(:nth-last-child(-n+2)) small { grid-column:2; margin-top:0; }
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table td:nth-last-child(2)::before { content:none; }
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table td:nth-last-child(2) { margin-top:var(--space-50); }
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table td:last-child { margin:var(--space-50) 0 0 auto; }
  #settingsView .settings-frame-panel table.settings-compact-rows.settings-stack-table td:last-child::before { content:none; }
}

/* ------------------------------------------------------------------------- Built-in emails' search box */
/* The box has the fields' own border and stays inside the page at any width (it had a heavy border joined to the
   Show list, and its right edge was cut on a phone). */
#settingsView .bie-filter .bie-find input[type="search"] { box-sizing:border-box; width:100%; min-height:var(--control-height); padding:0 var(--space-150); border:var(--control-border-width) solid var(--control-border); border-radius:var(--radius-md); background:var(--surface); box-shadow:none; }
#settingsView .bie-filter .bie-find input[type="search"]:focus-visible { border-color:var(--spruce); box-shadow:0 0 0 var(--focus-ring-width) var(--control-focus); outline:0; }
#settingsView .bie-filter { align-items:flex-end; }
#settingsView .bie-filter .bie-find { align-self:flex-end; }

/* ------------------------------------------------------------------------- One rhythm for a page's fields */
/* Limits and Files, the two tabs of one page, space their fields alike: a field, its line of help, its "Learn more"
   when it has one right under it, then one gap before the next field (Files' were 10 px apart, Limits' 30 px). */
#settingsView .limits-field { margin:0 0 var(--space-200); }
#settingsView .limits-field:has(+ .limits-more) { margin-bottom:var(--space-50); }
#settingsView .limits-field + .limits-more { margin:0 0 var(--space-200); }
/* FeatSuite's hosting size, read-only (GitHub issue 257). */
#settingsView .limits-hosting-note { margin:0 0 var(--space-150); color:var(--muted); font-size:var(--text-sm); line-height:1.45; }
#settingsView .limits-size-notice.limits-hosting-note { color:inherit; }

/* ------------------------------------------------------------------------- The page header stays put */
/* A tab with no Save (State rules, Built-in emails) drew the title 4 px higher than one with it: the title's row keeps
   the height of the controls either way. */
#settingsPageHeader .settings-page-title-row { min-height:var(--control-height); }

/* ------------------------------------------------------------------------- Field access */
/* One-word column headings that fit on a line, said whole in the line above; the choices' circles visible in dark mode
   (3:1 against the card). */
#rolesSettingsPanel .fa-table th:not(:first-child) { white-space:nowrap; }
.fa-legend { margin:0 0 var(--space-150); }
#settingsView .fa-table input[type="radio"] { display:inline-grid; place-content:center; width:16px; height:16px; margin:0; border:2px solid var(--ink-2); border-radius:var(--radius-round); background:var(--surface); -webkit-appearance:none; appearance:none; cursor:pointer; }
#settingsView .fa-table input[type="radio"]::before { content:""; width:8px; height:8px; border-radius:var(--radius-round); background:var(--spruce); transform:scale(0); }
#settingsView .fa-table input[type="radio"]:checked { border-color:var(--spruce); }
#settingsView .fa-table input[type="radio"]:checked::before { transform:scale(1); }
#settingsView .fa-table input[type="radio"]:focus-visible { outline:0; box-shadow:0 0 0 var(--focus-ring-width) var(--control-focus); }
#settingsView .fa-table input[type="radio"]:disabled { opacity:.6; cursor:not-allowed; }

/* ------------------------------------------------------------------------- A file to choose (Import data) */
#settingsView .settings-file-box { display:grid; gap:var(--space-50); margin:var(--space-200) 0 var(--space-50); }
#settingsView .settings-file-label { color:var(--ink); font-size:var(--text-sm); font-weight:var(--weight-semibold); }
#settingsView .settings-file-drop { position:relative; display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-100) var(--space-150); padding:var(--space-150); border:var(--control-border-width) dashed var(--control-border); border-radius:var(--radius-lg); background:var(--surface-2); color:var(--ink-2); font-size:var(--text-sm); }
#settingsView .settings-file-drop:hover { border-color:var(--control-hover); }
#settingsView .settings-file-drop:focus-within { border-color:var(--spruce); box-shadow:0 0 0 var(--focus-ring-width) var(--control-focus); }
#settingsView .settings-file-drop > input[type="file"]:not([hidden]) { position:absolute; inset:0; width:100%; height:100%; margin:0; padding:0; border:0; opacity:0; cursor:pointer; }
#settingsView .settings-file-button { min-height:var(--control-height-sm); padding:0 var(--space-150); font-size:var(--text-sm); pointer-events:none; }
#settingsView .settings-file-chosen { min-width:0; overflow-wrap:anywhere; }

