/* Keep the portal compact with the walkthrough's sidebar, search choices and tables. */
:root {
  font-family: system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #667085;
  --border: #e4e7ec;
  --input-border: #cbd1dc;
  --link: #3b5bdb;
  --accent: #3b5bdb;
  --accent-soft: #edf2ff;
  --warn: #875a1b;
  --warn-bg: #fff4e6;
  --error: #a21d1d;
  --focus: #91a7ff;
  --on-accent: #ffffff;
  --page-width: 1600px; /* the one content width of every page, Administration and HR included */
  --success: #1b6b3a;
  --success-bg: #e8f6ee;
  --backdrop: rgba(0, 0, 0, 0.4);
  --approve-bg: #1b6b3a;
  --reject-bg: #b42318;
  /* One colour per status meaning, used by every badge, pill and stat: see "Status colours" below. */
  --st-draft-bg: #eef0f3; --st-draft-fg: #475467; --st-draft-line: #98a2b3;
  --st-progress-bg: #e0ecff; --st-progress-fg: #1849a9;
  --st-approved-bg: #d5f5f0; --st-approved-fg: #0b6157;
  --st-done-bg: #dcf3e4; --st-done-fg: #14602f;
  --st-warn-bg: #fdecc8; --st-warn-fg: #7a4a06;
  --st-failed-bg: #fde0de; --st-failed-fg: #a11a12;
  --st-attention-bg: #ece4fb; --st-attention-fg: #5a2ca0;
  --st-ended-bg: #e9eaee; --st-ended-fg: #5b6472;
}
/* Follow the system theme unless the user picked one with the header toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --bg: #0f1115; --surface: #171a21; --text: #e6e8ec; --muted: #9aa3b2; --border: #2a2f3a; --input-border: #3a4150; --link: #8ea2ff; --accent: #3b5bdb; --accent-soft: #232a45; --warn: #f0b667; --warn-bg: #3a2c14; --error: #ff8a8a; --focus: #5c7cfa; --success: #7fd6a0; --success-bg: #16301f; --backdrop: rgba(0, 0, 0, 0.65); --st-draft-bg: #272b34; --st-draft-fg: #aab2c0; --st-draft-line: #5b6472; --st-progress-bg: #1b2c52; --st-progress-fg: #9db9ff; --st-approved-bg: #12332f; --st-approved-fg: #6fd9c8; --st-done-bg: #16301f; --st-done-fg: #7fd6a0; --st-warn-bg: #3a2c14; --st-warn-fg: #f0b667; --st-failed-bg: #3e1a1a; --st-failed-fg: #ff9a94; --st-attention-bg: #2f2350; --st-attention-fg: #c6a9ff; --st-ended-bg: #22252d; --st-ended-fg: #8c95a5; }
}
:root[data-theme="dark"] { color-scheme: dark; --success: #7fd6a0; --success-bg: #16301f; --backdrop: rgba(0, 0, 0, 0.65); --bg: #0f1115; --surface: #171a21; --text: #e6e8ec; --muted: #9aa3b2; --border: #2a2f3a; --input-border: #3a4150; --link: #8ea2ff; --accent: #3b5bdb; --accent-soft: #232a45; --warn: #f0b667; --warn-bg: #3a2c14; --error: #ff8a8a; --focus: #5c7cfa; --st-draft-bg: #272b34; --st-draft-fg: #aab2c0; --st-draft-line: #5b6472; --st-progress-bg: #1b2c52; --st-progress-fg: #9db9ff; --st-approved-bg: #12332f; --st-approved-fg: #6fd9c8; --st-done-bg: #16301f; --st-done-fg: #7fd6a0; --st-warn-bg: #3a2c14; --st-warn-fg: #f0b667; --st-failed-bg: #3e1a1a; --st-failed-fg: #ff9a94; --st-attention-bg: #2f2350; --st-attention-fg: #c6a9ff; --st-ended-bg: #22252d; --st-ended-fg: #8c95a5; }
* { box-sizing: border-box; }
body { margin: 0; padding: 24px 16px; }
a { color: var(--link); text-underline-offset: 3px; }
.portal { max-width: var(--page-width); margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.brand { font-size: 17px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand span { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 10px; }
.workspace { display: flex; min-height: 480px; }
aside { width: 170px; flex-shrink: 0; border-right: 1px solid var(--border); padding: 16px 10px; }
aside nav { display: flex; flex-direction: column; gap: 8px; }
aside a { padding: 7px 10px; text-decoration: none; border-radius: 6px; }
aside a:hover { background: var(--accent-soft); }
.nav-label { text-transform: uppercase; font-size: 11px; color: var(--muted); margin: 0 10px 4px; }
main { flex: 1; min-width: 0; padding: 22px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 22px 0 8px; }
.intro { color: var(--muted); margin: 0 0 20px; }
.search-by { margin: 16px 0; }
.field-label, label, .plain-fieldset legend { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 5px; }
.search-by nav { display: flex; gap: 6px; }
.search { max-width: 540px; margin: 20px 0; }
.search div { display: flex; gap: 8px; }
/* Form controls: one look and one size for every input, select and textarea (tokens below). */
:root { --control-height: 38px; --control-radius: 6px; --control-pad: 0 10px; --control-bg: var(--surface); --comment-bg: var(--surface); --text-box-height: 96px; --text-box-tall: 168px; --comment-list-max: 320px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea { box-sizing: border-box; font: inherit; background: var(--control-bg); color: var(--text); border: 1px solid var(--input-border); border-radius: var(--control-radius); padding: var(--control-pad); width: 100%; min-width: 0; height: var(--control-height); }
/* A file field: the browser button fills the box from edge to edge (its -10px cancels the control padding), and its text and the file name sit on the middle line. */
input[type="file"] { line-height: calc(var(--control-height) - 2px); overflow: hidden; cursor: pointer; }
input[type="file"]::file-selector-button { font: inherit; box-sizing: border-box; height: calc(var(--control-height) - 2px); margin: 0 10px 0 -10px; padding: 0 14px; border: 0; border-right: 1px solid var(--input-border); border-radius: 0; background: var(--bg); color: var(--text); cursor: pointer; }
/* A date box with its picker button; the real date input is invisible but covers the whole field, so the browser opens its calendar at the field and not at the page corner. */
.date-field { position: relative; display: flex; gap: 6px; align-items: center; }
.date-field input.date-native[tabindex] { position: absolute; left: 0; top: 0; width: 100%; height: 100%; box-sizing: border-box; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.date-field .date-pick { flex: none; background: var(--control-bg); color: var(--text); border-color: var(--input-border); height: var(--control-height); padding: 0 10px; }
/* One text box everywhere: same width as its form, one height, no drag handle. `tall` is for the few long config texts. */
textarea { height: var(--text-box-height); padding: 8px 10px; resize: none; }
textarea.tall { height: var(--text-box-tall); resize: vertical; }
select[multiple] { height: auto; padding: 8px 10px; }
/* One chevron for every dropdown, drawn the same in both themes and kept inside the padding. */
select:not([multiple]) { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
button { font: inherit; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); border-radius: 6px; padding: 7px 14px; cursor: pointer; }
.quiet { color: var(--muted); background: transparent; border: 0; padding: 0; }
.panel { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin: 12px 0; }
.table { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
th { font-weight: 600; color: var(--muted); }
th, td { border-bottom: 1px solid var(--border); padding: 9px 7px; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
small { display: block; font-size: 11px; color: var(--warn); margin-top: 3px; }
.badge { width: fit-content; background: var(--accent-soft); color: var(--text); border-radius: 12px; padding: 2px 9px; font-size: 12px; }
.hint, .count { font-size: 12px; color: var(--muted); }
.helptext { font-size: 12px; color: var(--muted); }
dl { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 8px; margin: 0; }
dt { color: var(--muted); white-space: nowrap; }
dd { margin: 0; }
/* A person's own actions sit beside their details, and above them on a narrow screen. */
.details-panel { display: flex; flex-direction: row-reverse; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.details-panel > dl { flex: 1 1 320px; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; }
.panel-actions > span { display: inline-flex; align-items: center; gap: 4px; }
/* The actions sit at the right edge, so the tip opens leftwards and stays on screen. */
.panel-actions .help-tip { left: auto; right: 0; width: max-content; max-width: min(320px, 80vw); }
.pagination { display: flex; justify-content: center; gap: 20px; margin: 20px 0; }
.login { max-width: 400px; margin: 30px auto; }
.login button, .login a.button { width: 100%; box-sizing: border-box; }
.login a.button { display: block; text-align: center; margin-top: 10px; }
footer { max-width: var(--page-width); margin: 12px auto; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; }
.footer-links { display: flex; gap: 12px; }
.footer-links a { color: var(--link); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (max-width: 640px) {
  body { padding: 8px; }
  .workspace { flex-direction: column; }
  aside { width: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 10px; }
  aside nav { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav-label { display: none; }
  main { padding: 16px; }
}

/* Keep request inputs readable on desktop and small screens. */
.request-form { max-width: 540px; }
.request-form label { margin-bottom: 4px; }
.errorlist { color: var(--error); list-style: none; margin: 4px 0 0; padding: 0; font-size: 12px; }
/* One look for every "Not built yet" notice. */
.not-built { font-style: italic; }


/* Show the fixed requestor when a request is for me. */
.fixed-value { margin: 0 0 14px; }

/* Header tools: user menu, icon theme switch and bell share one look. */
.header-tools { display: flex; align-items: center; gap: 8px; }
.theme-toggle, .user-menu summary { display: flex; align-items: center; gap: 6px; color: var(--muted); background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; font-size: 13px; cursor: pointer; }
.theme-toggle:hover, .user-menu summary:hover { background: var(--accent-soft); }
.user-menu { position: relative; }
.user-menu summary { list-style: none; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-name { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 160px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px; box-shadow: 0 8px 24px var(--backdrop); display: flex; flex-direction: column; gap: 2px; }
.user-panel a, .user-panel button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; text-decoration: none; font: inherit; color: var(--text); }
.user-panel form { margin: 0; }
.user-panel a:hover, .user-panel button:hover { background: var(--accent-soft); }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-sun { display: inline-flex; }
:root[data-theme="dark"] .theme-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-sun { display: inline-flex; }
  :root:not([data-theme="light"]) .theme-moon { display: none; }
}
.icon { flex-shrink: 0; vertical-align: middle; }

/* Page title with its info icon: the description shows on hover and on keyboard focus only. */
.page-title { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; }
.page-title h1 { margin: 0; }
.label-row { display: flex; align-items: center; gap: 4px; margin: 0 0 5px; }
.label-row label { margin: 0; }
.help { position: relative; display: inline-flex; }
.help-icon { display: inline-flex; padding: 2px; background: transparent; border: 0; border-radius: 50%; color: var(--muted); cursor: help; }
.help-icon:hover, .help:focus-within .help-icon { color: var(--link); }
.help-tip { display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; width: max-content; max-width: min(420px, 80vw); padding: 10px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px var(--backdrop); font-size: 13px; font-weight: 400; }
.help:hover .help-tip, .help:focus-within .help-tip { display: block; }
.h-info { display: flex; align-items: center; gap: 6px; }
.h-info > h2, .h-info > h3 { margin: 0; }
.help-tip p { margin: 0 0 6px; }
.help-tip p:last-child { margin-bottom: 0; }
.help-tip .intro { color: var(--text); max-width: none; }

pre { margin: 0; white-space: pre-wrap; font-size: 12px; }

/* Show where a request is in its approval steps, and flag requests that wait too long. */
.stages { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 12px 0; padding: 0; }
.stages li { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; color: var(--muted); }
.stages li[data-state="done"] { color: var(--text); }
.stages li[data-state="done"]::before { content: "\2713\00a0"; }
.stages li[data-state="current"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 600; }
.stages li[data-state="stopped"] { border-color: var(--error); color: var(--error); font-weight: 600; }
.stages li[data-state="stopped"]::before { content: "\2715\00a0"; }
/* A request's progress as a vertical tracker: a dot and a line per step. */
.progress { list-style: none; margin: 12px 0 20px; padding: 0; }
.progress li { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 0 0 18px 28px; color: var(--muted); }
.progress li::before { content: ""; position: absolute; left: 0; top: 3px; width: 12px; height: 12px; box-sizing: border-box; border: 2px solid var(--border); border-radius: 50%; background: var(--surface); }
.progress li::after { content: ""; position: absolute; left: 5px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.progress li:last-child { padding-bottom: 0; }
.progress li:last-child::after { display: none; }
.progress li[data-state="done"] { color: var(--text); }
.progress li[data-state="done"]::before { border-color: var(--success); background: var(--success); }
.progress li[data-state="done"]::after { background: var(--success); }
.progress li[data-state="current"] { color: var(--text); }
.progress li[data-state="current"]::before { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--focus); }
.progress li[data-state="current"] .progress-title { font-weight: 600; }
.progress li[data-state="stopped"] { color: var(--error); }
.progress li[data-state="stopped"]::before { border-color: var(--error); background: var(--error); }
.progress li[data-state="stopped"] .progress-title { font-weight: 600; }
.progress-when, .progress-hint { font-size: 0.875em; color: var(--muted); }
.progress li[data-state="stopped"] .progress-hint { color: var(--error); }
.progress-people { display: block; font-size: 0.875em; }
tr.late td:first-child { border-left: 3px solid var(--error); }

/* Show the result of an action such as deciding several requests at once. */
.messages { list-style: none; margin: 0 0 12px; padding: 0; }
.messages li { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; }
.messages .error, .messages .warning { border-color: var(--error); }
.bulk-bar { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 12px 0; }
.bulk-bar .decision-actions { margin: 8px 0 0; }
.bulk-bar .hint { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }
/* Audit filters and the event drawer. */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 16px; align-items: end; margin: 16px 0; }
.filters .field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filters label { font-size: 13px; font-weight: 600; }
.filters-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.filters-actions button { height: var(--control-height); padding-block: 0; }
.filters-actions .quiet { padding-inline: 14px; background: var(--surface); color: var(--text); border: 1px solid var(--input-border); border-radius: 6px; }
.filters-wide { grid-column: 1 / -1; margin: 0; }
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(480px, 100vw); height: 100vh; max-height: 100vh; border: 0; border-left: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 18px; overflow: auto; }
.drawer::backdrop { background: var(--backdrop); }

/* Search, filter and sort a list the same way everywhere. */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; margin: 12px 0; }
.toolbar > div { min-width: 160px; }
.toolbar-actions { display: flex; gap: 12px; align-items: center; }
th a { color: inherit; text-decoration: none; white-space: nowrap; }
th a:hover, th a:focus-visible { text-decoration: underline; }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--text); }
.empty { color: var(--muted); padding: 18px 7px; }
.table[tabindex] { border-radius: 8px; }
.pagination [aria-current] { color: var(--muted); }

/* Let keyboard users skip the navigation. */
.skip-link { position: absolute; left: 8px; top: -48px; background: var(--surface); color: var(--text); border: 2px solid var(--focus); border-radius: 6px; padding: 8px 12px; z-index: 30; }
.skip-link:focus { top: 8px; }
main:focus { outline: none; }

/* Messages sit inline without script; with it they float as toasts that can be dismissed. */
.messages .success { border-color: var(--success); background: var(--success-bg); color: var(--text); }
.messages.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 20; width: min(380px, calc(100vw - 32px)); margin: 0; }
.messages.toasts li { display: flex; justify-content: space-between; gap: 10px; align-items: start; background: var(--surface); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }
.messages.toasts .success { background: var(--success-bg); }
.toast-close { background: transparent; border: 0; color: var(--muted); padding: 0 4px; font-size: 18px; line-height: 1; }

/* Confirm destructive steps in a native dialog. */
dialog.confirm { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); padding: 18px; max-width: min(440px, calc(100vw - 32px)); }
dialog.confirm::backdrop { background: var(--backdrop); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
button.secondary { background: transparent; color: var(--link); }
form.inline { display: inline; }
/* Row actions: the links and form buttons of one table row, on one line and centred on one axis. */
.row-actions { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.row-actions form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.row-actions input { width: 14em; height: auto; padding-block: 7px; }

/* Say what is wrong with a form in one place, and mark rows that are being sent. */
.error-summary { border: 2px solid var(--error); border-radius: 8px; padding: 10px 14px; margin: 0 0 16px; max-width: 540px; }
.error-summary h2 { margin: 0 0 6px; font-size: 15px; color: var(--error); }
.error-summary ul { margin: 0; padding-left: 18px; }
.error-summary:focus { outline: 3px solid var(--focus); }
[aria-invalid="true"] { border-color: var(--error); }
tr.sending { opacity: 0.55; }
tr.sending td:last-child::after { content: " Sending\2026"; color: var(--muted); }
button:disabled { opacity: 0.6; cursor: progress; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* Show how much waits on the user next to the nav link that opens it. */
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.nav-item a { flex: 1; display: flex; align-items: center; gap: 8px; }
.count-badge { min-width: 20px; text-align: center; border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 600; background: var(--accent); color: var(--on-accent); }
.count-badge.late { background: var(--error); color: var(--surface); }

/* Line up toolbar fields and their button on one baseline, and let them wrap instead of overlapping. */
.toolbar { align-items: flex-end; }
.toolbar > div { flex: 1 1 180px; max-width: 260px; min-width: 0; }
.toolbar > .toolbar-actions { flex: 0 0 auto; max-width: none; align-items: center; }
.toolbar button { height: var(--control-height); }
.toolbar button { padding-block: 0; }

/* Decide with two clear buttons: green to approve or grant, red to reject. */
.decision-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0; }
button.approve { background: var(--approve-bg); border-color: var(--approve-bg); color: #fff; }
button.reject { background: var(--reject-bg); border-color: var(--reject-bg); color: #fff; }
button.approve:hover, button.reject:hover { filter: brightness(1.12); }
.bulk-bar button { height: 38px; }
button:disabled { opacity: 0.6; cursor: progress; }

/* Show an uploaded logo at header height. */
.brand-logo { height: 28px; width: auto; vertical-align: middle; margin-right: 8px; }

/* An application's logo, or its initials when it has none, beside its name. */
.app-logo { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; vertical-align: middle; margin-right: 8px; }
.app-initials { display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--text); font-size: 12px; font-weight: 600; }

/* Keep a checkbox next to its label instead of stretched across the form. */
input[type="checkbox"], input[type="radio"] { width: auto; }

/* The one on/off control: a plain checkbox, its label, and one line of help. No switches, no radio buttons for yes or no. */
.check { margin: 0 0 16px; max-width: 640px; }
.check-label { display: flex; align-items: flex-start; gap: 10px; margin: 0; font-weight: 600; font-size: 15px; cursor: pointer; }
.check-label input[type="checkbox"] { width: 18px; height: 18px; margin: 2px 0 0; cursor: pointer; accent-color: var(--accent); flex: none; }
.check-help { margin: 4px 0 0 28px; color: var(--muted); font-size: 13px; }
.setting-group { border: 0; padding: 0; margin: 0 0 24px; }
.setting-group legend { font-size: 17px; font-weight: 700; padding: 0; margin: 0 0 12px; }
/* A tick box list inside a form, such as the actor roles: a small field label, one readable line per choice. */
.plain-fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.plain-fieldset legend { padding: 0; }
#id_roles label, #id_scopes label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; color: var(--text); margin: 0 0 6px; }

/* A button that cannot be used yet is plain grey, never green or red. */
button:disabled, button.approve:disabled, button.reject:disabled { background: var(--border); border-color: var(--border); color: var(--muted); cursor: not-allowed; opacity: 1; filter: none; }

/* The header bell: a details dropdown with the latest notifications, no script needed. */
.bell { position: relative; }
.bell summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 4px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); }
.bell summary::-webkit-details-marker { display: none; }
.bell summary:focus-visible { outline: 2px solid var(--focus); }
.bell-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(360px, 92vw); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px; box-shadow: 0 8px 24px var(--backdrop); }
.bell-panel form { margin: 0; }
.bell-shortcut { display: flex; justify-content: space-between; padding: 6px 8px; border-radius: 6px; font-weight: 600; }
.bell-item { display: block; width: 100%; text-align: left; background: transparent; color: var(--text); border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 8px; }
.bell-item small { display: block; color: var(--muted); }
.bell-item.unread span { font-weight: 600; }
.bell-item:hover, .bell-item:focus-visible { background: var(--accent-soft); }
.bell-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding: 8px 8px 0; }
button.link { background: transparent; border: 0; color: var(--link); padding: 0; text-align: left; text-decoration: underline; cursor: pointer; }
.error-page { padding: 22px; text-align: center; }
.unplugged { position: relative; display: flex; align-items: center; min-height: 340px; margin: 8px 0 20px; }
.unplugged .cable { flex: 1; height: 4px; background: var(--focus); }
.unplugged .plug { width: 70px; height: 50px; fill: var(--accent); flex: none; }
.unplugged .plug.flip { transform: scaleX(-1); }
.unplugged .orb { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 300px; height: 300px; border-radius: 50%; background: var(--accent-soft); border: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 36px; box-sizing: border-box; }
.unplugged .orb h1 { font-size: 22px; margin: 0 0 8px; }
.unplugged .orb p { font-size: 13px; color: var(--muted); margin: 0; }

/* Administration: a page header, a tab bar that wraps, cards and status pills. */
.admin main { font-size: 15px; }
.admin table { font-size: 14px; }
.admin h1 { font-size: 26px; }
.admin .intro { max-width: 80ch; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.page-head .intro { margin-bottom: 14px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* A link, or the summary of a details block, shown as a button. */
a.button, summary.button { display: inline-block; text-decoration: none; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); border-radius: 6px; padding: 7px 14px; }
a.button.secondary, summary.button.secondary, button.secondary { background: transparent; color: var(--link); border-color: var(--input-border); }
/* The green Add button: a link or button that adds a thing, built on the approve colour. */
a.button.add { background: var(--approve-bg); border-color: var(--approve-bg); color: #fff; }
a.button.add:hover, .tabs a.button.add:hover { background: var(--approve-bg); filter: brightness(1.12); }
.tabs a.button.add { padding: 6px 12px; }
.tabs-add { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.crumbs a + a::before, .crumbs a + span::before, .crumbs span + span::before { content: "\203A"; margin-right: 6px; color: var(--muted); }
.admin-sections, .admin-tabs, .tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.admin-sections { margin-bottom: 12px; padding-bottom: 0; border-bottom: 0; }
.admin-sections a { padding: 6px 10px; border-radius: 6px; text-decoration: none; font-weight: 600; border: 1px solid transparent; }
.admin-sections a:hover { background: var(--accent-soft); }
.admin-sections a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.admin-sections a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.admin-tabs a, .tabs a, .search-by a { border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; text-decoration: none; }
.admin-tabs a:hover, .tabs a:hover, .search-by a:hover { background: var(--accent-soft); }
.admin-tabs a[aria-current], .tabs a[aria-current], .search-by a[aria-current] { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; color: var(--text); }

/* Comments: one fixed-size section on every screen (templates/access_requests/_comments.html, the only copy). */
.comments { background: var(--comment-bg); }
.comment-list { max-height: var(--comment-list-max); overflow-y: auto; }
.group-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 24px 0 8px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: var(--surface); color: var(--text); min-width: 0; }
.card h2, .card h3 { margin: 0; font-size: 16px; }
.card p { margin: 0; color: var(--muted); }
.card .figure { color: var(--text); font-size: 28px; font-weight: 600; line-height: 1.1; }
.card-link { text-decoration: none; }
.card-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; }
.card-actions .quiet { border: 1px solid var(--input-border); border-radius: 6px; padding: 6px 12px; color: var(--link); }
.card-actions .quiet:disabled { color: var(--muted); }
.facts { grid-template-columns: minmax(90px, max-content) 1fr; font-size: 14px; row-gap: 2px; margin: 0; }
.stat { margin-top: auto; width: fit-content; max-width: 100%; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--text); }
.pill { display: inline-flex; align-items: center; gap: 6px; width: fit-content; border-radius: 12px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--text); }
.request-form.wide { max-width: none; }
.request-form.wide .panel { max-width: 640px; }
aside a[aria-current="page"] { background: var(--accent-soft); font-weight: 600; }
.admin-tabs a:focus-visible, .card-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 640px) {
  .card-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: minmax(80px, max-content) 1fr; }
}

/* Connectors: write-only credential rows (label and saved pill, full width field, sized remove option). */
.credential { display: flex; flex-direction: column; gap: 8px; margin: 0 0 20px; max-width: 640px; }
.credential-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.credential-head label { font-weight: 600; font-size: 15px; margin: 0; }
.credential-help { margin: 0; color: var(--muted); font-size: 13px; }

/* Connectors: settings rows like the credential rows, the same panel width, the Remove panel. */
.request-form.wide .panel { max-width: none; }
.setting { display: flex; flex-direction: column; gap: 8px; margin: 0 0 20px; max-width: 640px; }
.setting-label { font-weight: 600; font-size: 15px; margin: 0; }
.panel.danger { border-color: var(--error); }
.panel.danger h2 { color: var(--error); }
button.danger-button, a.button.danger-button { background: var(--error); border-color: var(--error); color: var(--on-accent); }

/* Status colours. Every status in the portal uses one of these eight tones, picked by the
   `status_tone` filter, so the same meaning always looks the same. Each tone has its own symbol,
   so the meaning never depends on colour alone. Put the tone class next to .badge, .pill or .stat. */
.st-draft, .st-progress, .st-approved, .st-done, .st-warn, .st-failed, .st-attention, .st-ended { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.st-draft::before, .st-progress::before, .st-approved::before, .st-done::before, .st-warn::before, .st-failed::before, .st-attention::before, .st-ended::before { content: var(--st-glyph); font-weight: 700; }
.st-draft { --st-glyph: "\25CB"; background: var(--st-draft-bg); color: var(--st-draft-fg); outline: 1px dashed var(--st-draft-line); outline-offset: -1px; }
.st-progress { --st-glyph: "\25D0"; background: var(--st-progress-bg); color: var(--st-progress-fg); }
.st-approved { --st-glyph: "\2713"; background: var(--st-approved-bg); color: var(--st-approved-fg); }
.st-done { --st-glyph: "\25CF"; background: var(--st-done-bg); color: var(--st-done-fg); }
.st-warn { --st-glyph: "!"; background: var(--st-warn-bg); color: var(--st-warn-fg); }
.st-failed { --st-glyph: "\2715"; background: var(--st-failed-bg); color: var(--st-failed-fg); }
.st-attention { --st-glyph: "?"; background: var(--st-attention-bg); color: var(--st-attention-fg); }
.st-ended { --st-glyph: "\2013"; background: var(--st-ended-bg); color: var(--st-ended-fg); }
.st-ended.struck { text-decoration: line-through; }

/* Ways to connect an unmapped SSO app or group: numbered cards, so they read as a choice. */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin: 12px 0; counter-reset: option; }
.choice { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; }
.choice .request-form { max-width: none; }
.choice h3 { margin: 4px 0 6px; }
.choice-tag { margin: 0; font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.choice-tag::before { counter-increment: option; content: "Option " counter(option); }
.choice-ignore { border-style: dashed; background: transparent; }
.checklist { padding-left: 1.4em; }
.checklist li { margin: 0 0 14px; }
.checklist li form { margin-top: 8px; max-width: 36em; }
.request-form ul[id$="permission_model"] { list-style: none; padding: 0; }
.request-form ul[id$="permission_model"] li { margin: 0 0 8px; }
.stages li small { display: block; font-weight: 400; color: var(--muted); }
.logo { width: auto; height: 28px; max-width: 120px; margin-right: 8px; object-fit: contain; vertical-align: middle; }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin-right: 8px; border-radius: 7px; background: transparent; color: var(--accent); font-size: 12px; font-weight: 700; vertical-align: middle; }

/* Link to a person is a button that opens the link choice, so the create form stays at the top. */
details.link-choice > summary { list-style: none; display: inline-block; cursor: pointer; margin: 8px 0; }
details.link-choice > summary::-webkit-details-marker { display: none; }
.bulk-create { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 16px; }
.bulk-create[hidden] { display: none; }

/* Org chart: nested lists with connector lines, no script (templates/people/org_chart.html). */
.org-tree, .org-tree ul { list-style: none; margin: 0; padding-left: 22px; }
.org-tree { padding-left: 0; }
.org-tree li { position: relative; padding: 4px 0 4px 18px; border-left: 1px solid var(--border); }
.org-tree li:last-child { border-left-color: transparent; }
.org-tree li::before { content: ""; position: absolute; left: 0; top: 18px; width: 14px; border-top: 1px solid var(--border); }
.org-tree li:last-child::after { content: ""; position: absolute; left: 0; top: 0; height: 18px; border-left: 1px solid var(--border); }
.org-tree summary, .org-leaf { display: inline-block; padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.org-tree summary { cursor: pointer; }
.org-tree .org-me { border-color: var(--accent, currentColor); background: var(--accent-soft, var(--surface)); font-weight: 600; }
.org-title { color: var(--muted); font-size: 12px; margin-left: 4px; }

.policy-timeline { display: grid; gap: 12px; list-style: none; margin: 12px 0; padding: 0; counter-reset: step; }
.policy-timeline > li { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; position: relative; }
.policy-timeline > li h3 { margin: 0 0 8px; font-size: 1rem; }
.policy-timeline > li h3::before { counter-increment: step; content: counter(step) ". "; color: var(--muted); }
.policy-timeline p { margin: 6px 0; }
.policy-timeline .fixed { color: var(--muted); }

/* Column and label tips hold long text: wrap it, and keep the tips of the last columns on screen. */
th .help-tip, dt .help-tip { white-space: normal; width: 300px; max-width: 80vw; text-align: left; }
th:nth-last-child(-n+3) .help-tip { left: auto; right: 0; }
@media (min-width: 900px) { .table:has(th .help) { overflow: visible; } }
