/* Edara for Dahua.

   Every colour, type size, radius, spacing step, state-layer opacity and shadow comes from the
   shared Edara Extensions tokens (styles/edara-tokens.css, a byte-identical copy of
   edara-extensions-infra/design/extension-shell/edara-tokens.css, linked before this file).
   Never define or change a colour, a font size or a radius here: change it in the shared file
   and run its sync.sh, so every extension moves together. backend/tests/test_design_system.py
   refuses a raw colour or font size in this file.

   The shell (header, rail, bottom bar), the components and the sign-in card follow the
   "Edara Extensions Design System" page, class for class. Only logical properties are used
   (inline / block, start / end), so Arabic mirrors without a second stylesheet. */
:root{
  /* The two values the shared file doesn't name. A scrim is black in both themes. */
  --scrim:rgb(0 0 0 / .45);
  --font-mono:ui-monospace,Menlo,Consolas,monospace;
  --rail-open:236px; --rail-folded:72px; --bar-height:64px;
}

/* ---------- base ---------- */
*,*::before,*::after{box-sizing:border-box}
html,body{margin:0}
body{background:var(--background);color:var(--on-surface);font-family:var(--font-family);font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh);letter-spacing:var(--typo-body-md-ls);-webkit-font-smoothing:antialiased}
h1,h2,h3,h4,p,dl,dd,ol,ul,fieldset{margin:0}
[hidden]{display:none!important}
button,input,select{font:inherit;letter-spacing:inherit;color:inherit}
button{cursor:pointer}
svg{flex-shrink:0}
a{color:var(--primary)}
b{font-weight:600}
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.sr-only{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.sprite{position:absolute;inline-size:0;block-size:0;overflow:hidden}
.icon{inline-size:20px;block-size:20px;flex:none;fill:currentColor}
.icon--outline{fill:none}
.muted{color:var(--on-surface-variant)}
.help{font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);letter-spacing:var(--typo-body-sm-ls);color:var(--on-surface-variant)}
.help.block,.radio .help{display:block}
.grow{flex:1 1 220px;min-inline-size:0}
.readable{max-inline-size:72ch}
.row{display:flex;gap:var(--space-3);flex-wrap:wrap;align-items:center}
.row--fields{align-items:flex-start}
.row--fields > .tf{flex:1 1 180px}
.row--fields > .btn{margin-block-start:var(--space-4)}
.stack{display:flex;flex-direction:column;gap:var(--space-4);min-inline-size:0}
.stack > *{min-inline-size:0}
/* A code or an id keeps its own left-to-right order inside an Arabic sentence. */
bdi.code{display:inline-block;max-inline-size:100%;font-family:var(--font-mono);unicode-bidi:isolate;overflow-wrap:anywhere;vertical-align:bottom}

/* ---------- shell: header ---------- */
.app{display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;grid-template-areas:"header header" "rail view" "rail foot";block-size:100vh;block-size:100dvh;background:var(--background);overflow:hidden}
.app-header{grid-area:header;display:flex;align-items:center;gap:var(--space-3);block-size:60px;padding-inline:var(--space-4);background:var(--surface);border-block-end:1px solid var(--outline-variant);min-inline-size:0}
.app-header > *{flex-shrink:0}
.header-lead{display:flex;align-items:center;gap:var(--space-4);min-inline-size:0;flex-shrink:1}
.header-lead > *{min-inline-size:0}
.header-lead .sub,.edara-lockup--login .sub{font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:600;color:var(--primary);white-space:nowrap}
.edara-lockup{display:inline-flex;align-items:center;flex:none;color:var(--on-surface)}
.brand-logo{display:block;flex:none}
/* A real element with flex-shrink, so a narrow header doesn't eat the hairline first. */
.header-divider{inline-size:1px;block-size:20px;background:var(--outline-variant);opacity:.5;flex-shrink:0}
.header-lead .org-slot:empty ~ .header-divider{display:none}
.header-spacer{flex:1 1 0;min-inline-size:0}
.header-signals{display:flex;align-items:center;gap:var(--space-2);flex-shrink:1;min-inline-size:0}
.org-slot{display:inline-flex;min-inline-size:0}
.org-pill{position:relative;display:inline-flex;align-items:center;gap:var(--space-2);max-inline-size:100%;min-block-size:28px;padding-block:3px;padding-inline:3px 10px;border:none;border-radius:var(--shape-xl);background:var(--surface-container);color:var(--on-surface-variant);font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:600}
.org-pill span{min-inline-size:0;max-inline-size:28ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.org-pill i{display:grid;place-items:center;flex:none;inline-size:22px;block-size:22px;border-radius:50%;background:var(--secondary-container);color:var(--on-secondary-container);font-style:normal;font-size:var(--typo-label-sm);line-height:1}
button.org-pill:hover{background:color-mix(in srgb,var(--on-surface) calc(var(--state-hover)*100%),var(--surface-container))}
/* The pill is 28px of ink; this gives it the shared 44px touch target without moving its neighbours. */
button.org-pill::after{content:"";position:absolute;inset-block:calc((var(--min-touch-target) - 28px) / -2);inset-inline:0}
.icon-btn{display:grid;place-items:center;flex:none;inline-size:38px;block-size:38px;padding:0;border:none;border-radius:50%;background:none;color:var(--on-surface-variant);transition:background var(--motion-base) var(--motion-ease)}
.icon-btn:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.icon-btn .icon{inline-size:22px;block-size:22px}
/* The language button reads the name of the language a click switches to, in that language's
   own font (set at the end of this file), as a text button the height of the icon buttons. */
.lang-btn{display:inline-flex;align-items:center;justify-content:center;flex:none;min-inline-size:38px;block-size:38px;padding:0 var(--space-3);border:none;border-radius:var(--shape-xl);background:none;color:var(--on-surface-variant);font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh);font-weight:600;white-space:nowrap;transition:background var(--motion-base) var(--motion-ease)}
.lang-btn:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
/* Production is in sight on every screen: the header carries its status colour. */
html.env-prod .app-header{box-shadow:inset 0 -2px 0 var(--st-error-fg)}
/* Embedded in the portal, the portal's bar supplies the brand, the organization and the account. Hide it whole, never piece by piece. */
html.ext-embedded .app-header,html.ext-embedded .edara-lockup{display:none}

/* ---------- shell: rail ---------- */
.side-nav{grid-area:rail;display:flex;flex-direction:column;gap:2px;inline-size:var(--rail-open);padding:var(--space-3) var(--space-2);overflow-y:auto;background:var(--surface);border-inline-end:1px solid var(--outline-variant);transition:inline-size var(--motion-base) var(--ease-nav)}
.side-nav-item{position:relative;display:flex;align-items:center;gap:var(--space-3);inline-size:100%;min-block-size:var(--min-touch-target);padding:var(--space-3) var(--space-4);border-radius:var(--shape-xl);color:var(--on-surface-variant);font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh);font-weight:500;text-align:start;text-decoration:none;transition:background var(--motion-base) var(--motion-ease)}
.side-nav-item:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.side-nav-item.active,.bottom-nav-item.active{background:var(--secondary-container);color:var(--on-secondary-container)}
.side-nav-item > span:last-child{min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* Help & guide sits at the foot of the rail, so it stays reachable when the header is hidden. */
.side-nav .rail-foot{margin-block-start:auto}
.rail-version{margin:0;padding:0 var(--space-4) var(--space-2);color:var(--on-surface-variant);font-size:var(--typo-label-sm);line-height:var(--typo-label-sm-lh);font-variant-numeric:tabular-nums}
.rail-version:empty,html.rail-collapsed .rail-version{display:none}
/* The fold toggle is at the top of the rail, never in the header (which is hidden when embedded). */
.rail-toggle{display:grid;place-items:center;flex:none;align-self:flex-start;inline-size:40px;block-size:40px;margin-block-end:var(--space-1);margin-inline-start:var(--space-1);padding:0;border:none;border-radius:50%;background:none;color:var(--on-surface-variant);transition:background var(--motion-base) var(--motion-ease)}
.rail-toggle:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.rail-toggle[aria-pressed="true"]{background:var(--secondary-container);color:var(--on-secondary-container)}
/* Folded: icons only. The label stays in the page for assistive tech (clip-path, never display:none) and shows as the tooltip. */
html.rail-collapsed .side-nav{inline-size:var(--rail-folded);overflow:visible;position:relative;z-index:30}
html.rail-collapsed .side-nav-item{justify-content:center;padding-inline:0;gap:0}
html.rail-collapsed .side-nav-item > span:last-child{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
html.rail-collapsed .rail-toggle{align-self:center;margin-inline-start:0}
/* The tooltip: on hover and on keyboard focus, a plain tooltip (inverse surface, 4px corners)
   just past the rail's inline end, so it sits to the right in English and to the left in Arabic.
   For a folded destination it is the label itself, unclipped; the toggle has its own. */
.rail-toggle{position:relative}
.rail-tip,html.rail-collapsed .side-nav-item:is(:hover,:focus-visible) > span:last-child{position:absolute;inset-inline-start:calc(100% + var(--space-3));inset-block-start:50%;translate:0 -50%;inline-size:auto;block-size:auto;overflow:visible;clip-path:none;padding:var(--space-1) var(--space-2);border-radius:var(--shape-xs);background:var(--inverse-surface);color:var(--inverse-on-surface);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);font-weight:500;white-space:nowrap;pointer-events:none;z-index:40;box-shadow:var(--elev-2)}
.rail-tip{display:none}
.rail-toggle:is(:hover,:focus-visible) .rail-tip{display:block;box-shadow:var(--elev-2)}

/* ---------- shell: bottom bar (under 600px, instead of the rail) ---------- */
.bottom-nav{display:none}
.bottom-nav-item{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-inline-size:0;border-radius:var(--shape-xl);color:var(--on-surface-variant);font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:500;text-decoration:none}
.bottom-nav-item > span:last-child{max-inline-size:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bottom-nav-item .icon{inline-size:22px;block-size:22px}

/* ---------- shell: content ---------- */
.view{position:relative;grid-area:view;min-inline-size:0;min-block-size:0;overflow:auto;padding:var(--space-5) var(--space-5) var(--space-8)}
.view:focus{outline:none}
/* Every screen starts next to the rail with the shell's gutter (the view's padding), as wide as
   the shell lets content be (1120px), instead of centred in the window. Logical properties, so
   it starts at the right in Arabic; on a phone the column is narrower than the cap anyway. */
.view-inner{display:flex;flex-direction:column;gap:var(--space-4);max-inline-size:1120px;margin-inline:0}
.view-inner > *,.view-body > *{min-inline-size:0}
.view-body,.notices{display:flex;flex-direction:column;gap:var(--space-4)}
.notices:empty{display:none}
/* Landing shape: the page title is worded exactly as the destination that leads to it, and the
   screen's one primary action sits at the end of the title row. */
.page-head{display:flex;align-items:center;gap:var(--space-3);flex-wrap:wrap;min-block-size:40px}
.page-title{margin-inline-end:auto;font-family:var(--font-headline);font-size:var(--typo-title-lg);line-height:var(--typo-title-lg-lh);letter-spacing:var(--typo-title-lg-ls);font-weight:700;color:var(--on-surface)}
.page-actions{display:flex;gap:var(--space-2);flex-wrap:wrap}
.page-actions:empty{display:none}
/* Why the title row's action is disabled, right under it at the end of the row. */
.action-notes:not(:has(> :not([hidden]))){display:none}
.action-note{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--space-1) var(--space-2);text-align:end}
.action-note a{font-weight:600}
/* Under a button inside a card, the reason starts where the button does. */
.action-note--inline{justify-content:flex-start;text-align:start}
/* A bar a screen docks under its content (Settings' save bar). It is a row of its own below the
   scrolling area, opaque, as wide as the content column: nothing scrolls underneath it, so it
   can't cover a field, and a focused field is always fully in view above it. */
.view-foot{grid-area:foot;min-inline-size:0;padding-inline:var(--space-5);overflow:hidden;scrollbar-gutter:stable;background:var(--surface);border-block-start:1px solid var(--outline-variant)}
.view-foot:not(:has(> :not([hidden]))){display:none}
.app:has(.view-foot > :not([hidden])) .view{scrollbar-gutter:stable}
.skip-link{position:absolute;inset-block-start:-100px;inset-inline-start:var(--space-2);z-index:300;padding:var(--space-2) var(--space-4);border-radius:var(--shape-sm);background:var(--primary);color:var(--on-primary)}
.skip-link:focus{inset-block-start:var(--space-2)}

/* ---------- cards ---------- */
/* Page --background, card --card (white in light, a step up the ladder in dark), then tiles and
   table headers on --surface-container. Resting elements paint no shadow. */
.card{display:flex;flex-direction:column;gap:var(--space-3);min-inline-size:0;padding:var(--space-4);border:1px solid var(--outline-variant);border-radius:var(--shape-lg);background:var(--card);color:var(--on-surface)}
.card > *{min-inline-size:0}
.card-title{font-family:var(--font-headline);font-size:var(--typo-title-md);line-height:var(--typo-title-md-lh);letter-spacing:var(--typo-title-md-ls);font-weight:600}
.card-label{font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:600;color:var(--on-surface-variant)}
.sub-title{margin-block-start:var(--space-2);font-size:var(--typo-title-sm);line-height:var(--typo-title-sm-lh);letter-spacing:var(--typo-title-sm-ls);font-weight:600}
.big{font-family:var(--font-headline);font-size:var(--typo-display-sm);line-height:var(--typo-display-sm-lh);font-weight:600;font-variant-numeric:tabular-nums}

/* ---------- buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-2);min-block-size:40px;padding:0 var(--space-4);border:none;border-radius:var(--shape-xl);background:none;font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh);letter-spacing:var(--typo-label-lg-ls);font-weight:500;text-decoration:none;white-space:nowrap;cursor:pointer;transition:background var(--motion-base) var(--motion-ease)}
.btn .icon{inline-size:18px;block-size:18px}
.btn-filled{background:var(--primary);color:var(--on-primary)}
.btn-filled:hover{background:color-mix(in srgb,var(--on-primary) calc(var(--state-hover)*100%),var(--primary))}
.btn-filled:active{background:color-mix(in srgb,var(--on-primary) calc(var(--state-press)*100%),var(--primary))}
.btn-tonal{background:var(--secondary-container);color:var(--on-secondary-container)}
.btn-tonal:hover{background:color-mix(in srgb,var(--on-secondary-container) calc(var(--state-hover)*100%),var(--secondary-container))}
.btn-text{color:var(--primary);padding:0 var(--space-3)}
.btn-text:hover,.btn-outlined:hover{background:color-mix(in srgb,var(--primary) calc(var(--state-hover)*100%),transparent)}
.btn-outlined{color:var(--primary);border:1px solid var(--outline);padding:0 calc(var(--space-4) - 1px)}
.btn-filled.danger{background:var(--error);color:var(--on-error)}
.btn-filled.danger:hover{background:color-mix(in srgb,var(--on-error) calc(var(--state-hover)*100%),var(--error))}
/* Disabled, by the state rules: the content is on-surface at 38%, a filled or tonal container
   on-surface at 12%, an outline on-surface at 12%, in every variant and both themes. Fading the
   variant's own colour read as a pale blue that still looked pressable. A busy button keeps its
   colours: it is working, not unavailable. */
.btn:disabled{cursor:not-allowed}
.btn.btn:disabled:not([aria-busy="true"]){background:none;color:color-mix(in srgb,var(--on-surface) 38%,transparent)}
.btn.btn-filled:disabled:not([aria-busy="true"]),.btn.btn-tonal:disabled:not([aria-busy="true"]){background:color-mix(in srgb,var(--on-surface) 12%,transparent)}
.btn.btn-outlined:disabled:not([aria-busy="true"]){border-color:color-mix(in srgb,var(--on-surface) 12%,transparent)}
.icon-btn:disabled{background:none;color:color-mix(in srgb,var(--on-surface) 38%,transparent);cursor:not-allowed}
/* Busy: the label stays (a button never carries an ellipsis) and a small ring turns beside it. */
.btn[aria-busy="true"]{cursor:progress}
.btn[aria-busy="true"]::after{content:"";inline-size:14px;block-size:14px;border:2px solid currentColor;border-block-start-color:transparent;border-radius:50%;animation:spin .9s linear infinite}

/* ---------- chips ---------- */
/* A status chip takes Edara 3's status pairs (--st-*). The word carries the status. */
.chip{display:inline-flex;align-items:center;gap:var(--space-1);padding:var(--space-1) var(--space-3);border:none;border-radius:var(--shape-sm);background:var(--st-neutral-bg);color:var(--st-neutral-fg);font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:500;white-space:nowrap}
.chip.ok{background:var(--st-success-bg);color:var(--st-success-fg)}
.chip.warn{background:var(--st-warning-bg);color:var(--st-warning-fg)}
.chip.err{background:var(--st-error-bg);color:var(--st-error-fg)}
.chip.info{background:var(--st-info-bg);color:var(--st-info-fg)}
/* The Dahua environment is outlined, so it reads as a setting next to the filled status chip.
   Production keeps the error status pair, in its outline. */
.chip.env-chip{padding-block:calc(var(--space-1) - 1px);padding-inline:calc(var(--space-3) - 1px);border:1px solid var(--outline);background:transparent;color:var(--on-surface-variant)}
.chip.env-chip--prod{border-color:var(--st-error-fg);background:var(--st-error-bg);color:var(--st-error-fg);font-weight:600}
.chip.filter{min-block-size:32px;padding:var(--space-1) var(--space-3);border:1px solid var(--outline-variant);background:transparent;color:var(--on-surface-variant);font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh);cursor:pointer}
.chip.filter:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.chip.filter[aria-pressed="true"]{border-color:transparent;font-weight:600;background:var(--secondary-container);color:var(--on-secondary-container)}
.chips{gap:var(--space-2)}

/* ---------- form fields (outlined, the label in a notch on the border) ---------- */
.tf{display:flex;flex-direction:column;inline-size:100%;max-inline-size:420px;min-inline-size:0}
.tf--wide{max-inline-size:560px}
.tf--narrow{max-inline-size:560px}
.tf--narrow > .tf-box{max-inline-size:240px}
.tf-req{margin-inline-start:var(--space-2);color:var(--st-warning-fg);font-weight:600}
.tf-suffix{flex:none;margin-inline-start:var(--space-2);color:var(--on-surface-variant)}
.tf-box{display:flex;align-items:center;min-block-size:56px;min-inline-size:0;margin:0;padding:0 var(--space-3) var(--space-2);border:1px solid var(--outline);border-radius:var(--shape-xs)}
.tf-box > legend{max-inline-size:100%;padding:0 var(--space-1);margin-inline-start:calc(var(--space-2) - var(--space-1));font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);color:var(--on-surface-variant)}
.tf-box > legend label{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tf input,.tf select{inline-size:100%;min-inline-size:0;min-block-size:28px;padding:0;border:none;outline:none;background:transparent;color:var(--on-surface);font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh)}
.tf select{cursor:pointer}
.tf select option{background:var(--surface-container);color:var(--on-surface)}
.tf-box:hover{border-color:var(--on-surface)}
.tf-box:focus-within{border-color:var(--primary);border-width:2px;padding:0 calc(var(--space-3) - 1px) calc(var(--space-2) - 1px)}
.tf-box:focus-within > legend{color:var(--primary)}
/* A disabled box fades like a disabled button: the label, the value and its icon at 38%, the
   outline at 12%, so it reads as unusable next to the buttons beside it. */
.tf-box:has(:disabled){border-color:color-mix(in srgb,var(--on-surface) 12%,transparent)}
.tf-box:has(:disabled) > legend,.tf :disabled{color:color-mix(in srgb,var(--on-surface) 38%,transparent);cursor:not-allowed}
/* An icon button at the end of a field (show the secret, open the calendar). */
/* The icon button overhangs the box's line, so a box with one is as tall as one without. */
.tf-box > .tf-icon{inline-size:40px;block-size:40px;margin-block:calc(-1.5 * var(--space-1));margin-inline:var(--space-1) calc(-1 * var(--space-2))}
.tf-hint,.tf-error{padding:var(--space-1) var(--space-4) 0;font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);letter-spacing:var(--typo-body-sm-ls);color:var(--on-surface-variant)}
.tf-error{color:var(--error);font-weight:600}
.tf--error .tf-box{border-color:var(--error)}
.tf--error .tf-box > legend{color:var(--error)}
/* File picker: the real input keeps the focus and the keyboard but isn't drawn; the labelled
   button beside it shows its focus ring, and the chosen file's name follows. */
.filepick{display:flex;flex-direction:column;max-inline-size:560px;min-inline-size:0}
.filepick__label{margin-block-end:var(--space-2);font-size:var(--typo-title-sm);line-height:var(--typo-title-sm-lh);font-weight:600}
.filepick__row{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2) var(--space-3);min-inline-size:0}
.filepick__input{position:absolute;inset-block-start:0;inset-inline-start:0;inline-size:1px;block-size:1px;margin:0;padding:0;opacity:0;overflow:hidden;clip-path:inset(50%)}
.filepick__input:focus-visible + .filepick__btn{outline:2px solid var(--primary);outline-offset:2px}
.filepick__name{flex:1 1 160px;min-inline-size:0;overflow-wrap:anywhere;font-weight:600}
.filepick__name--none{color:var(--on-surface-variant);font-weight:400}
.filepick .tf-hint,.filepick .tf-error{padding-inline:0;padding-block-start:var(--space-2)}
.filepick--error .filepick__btn{border-color:var(--error)}
/* Combobox: the box searches as you type and its options open right under it. An option is a
   48px row; the one the arrow keys are on takes the selected colours. */
.combo{position:relative}
.combo .tf-box{gap:var(--space-2)}
.combo__meta{flex:none;max-inline-size:45%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--on-surface-variant);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.combo__meta:empty,.combo:has([aria-expanded="true"]) .combo__meta{display:none}
.combo__anchor{position:relative}
.combo__pop{position:absolute;inset-block-start:var(--space-1);inset-inline:0;z-index:20;max-block-size:296px;overflow-y:auto;border:1px solid var(--outline-variant);border-radius:var(--shape-sm);background:var(--surface-container);color:var(--on-surface);box-shadow:var(--elev-2)}
.combo__list{list-style:none;margin:0;padding:var(--space-1) 0}
.combo__opt{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:0 var(--space-3);min-block-size:48px;padding:var(--space-2) var(--space-4);cursor:pointer}
.combo__opt:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.combo__opt[aria-selected="true"]{background:var(--secondary-container);color:var(--on-secondary-container)}
.combo__name{min-inline-size:0;overflow-wrap:anywhere;font-weight:500}
.combo__sub{color:var(--on-surface-variant);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.combo__opt[aria-selected="true"] .combo__sub{color:inherit}
.combo__more{justify-content:center;color:var(--primary);font-weight:600}
.combo__status{padding:var(--space-3) var(--space-4);color:var(--on-surface-variant)}
/* Date and month picker: the calendar opens under its field (centred on a phone), on the menu
   surface, with the dialog's shadow. Days are 40px circles: today is ringed, the chosen day
   filled with the primary colour; a day out of range is dimmed and can't be chosen. Logical
   properties throughout, so the grid and its arrows mirror in Arabic. */
dialog.dp{position:fixed;inset:auto;margin:0;padding:0;border:none;background:none;color:var(--on-surface);overflow:visible;max-inline-size:calc(100vw - 2 * var(--space-4))}
dialog.dp::backdrop{background:transparent}
.dp__box{display:flex;flex-direction:column;gap:var(--space-2);inline-size:328px;max-inline-size:100%;padding:var(--space-3);border-radius:var(--shape-lg);background:var(--surface-container-high);box-shadow:var(--elev-3)}
.dp__head{display:flex;flex-direction:column;gap:var(--space-2)}
.dp__nav .dp__title{flex:1;text-align:center}
.dp__title{padding-inline:var(--space-2);font-family:var(--font-headline);font-size:var(--typo-title-md);line-height:var(--typo-title-md-lh);font-weight:600}
.dp__nav{display:flex;align-items:center;gap:var(--space-1)}
.dp__nav .icon-btn{inline-size:40px;block-size:40px}
.dp__select{flex:1 1 0;min-inline-size:0;min-block-size:40px;padding-inline:var(--space-2);border:1px solid var(--outline-variant);border-radius:var(--shape-xs);background:var(--surface-container-high);color:var(--on-surface);font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh)}
.dp__select[data-part="year"]{flex:0 0 88px}
.dp__select option{background:var(--surface-container);color:var(--on-surface)}
.dp__grid{inline-size:100%;border-collapse:collapse;table-layout:fixed}
.dp__grid th{block-size:32px;color:var(--on-surface-variant);font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:600;text-align:center}
.dp__cell{block-size:44px;padding:2px;text-align:center;cursor:pointer;border-radius:50%}
.dp__cell > span{display:grid;place-items:center;inline-size:40px;block-size:40px;margin-inline:auto;border-radius:50%;font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh);font-variant-numeric:tabular-nums}
.dp__cell:hover > span{background:color-mix(in srgb,var(--on-surface) calc(var(--state-hover)*100%),transparent)}
.dp__cell[aria-current="date"] > span{box-shadow:inset 0 0 0 1px var(--primary);color:var(--primary)}
.dp__cell[aria-selected="true"] > span{background:var(--primary);color:var(--on-primary);box-shadow:none}
.dp__cell[aria-disabled="true"]{cursor:not-allowed}
.dp__cell[aria-disabled="true"] > span{background:none;color:color-mix(in srgb,var(--on-surface) 38%,transparent)}
.dp__cell:focus{outline:none}
.dp__cell:focus-visible > span{outline:2px solid var(--primary);outline-offset:1px;background:color-mix(in srgb,var(--on-surface) calc(var(--state-press)*100%),transparent)}
.dp__cell[aria-selected="true"]:focus-visible > span{background:var(--primary)}
.dp__grid--months .dp__cell{block-size:56px}
.dp__grid--months .dp__cell > span{inline-size:auto;min-inline-size:72px;block-size:40px;padding-inline:var(--space-3);border-radius:var(--shape-xl)}
.dp__foot{display:flex;align-items:center;gap:var(--space-1)}
.dp__spacer{flex:1}
/* Under a field: why it is a plain box for now, or what went wrong, with the way out. */
.field-note{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-2);padding:var(--space-1) var(--space-4) 0}
.field-note .btn-text{margin-inline-start:calc(-1 * var(--space-3))}
.field-note .help + .btn-text{margin-inline-start:0}
/* A field that waits for something else first (Edara connected): the info notice, as wide as a
   field, with its action at the end. */
.field-banner{max-inline-size:560px;align-items:center}
.field-banner .banner__text{display:flex;flex-direction:column;gap:var(--space-1)}
/* Its label sits on the title's line: the 40px button takes no more height than the line. */
.banner > .btn-text{flex:none;margin-block:calc((var(--typo-body-md-lh) - 40px) / 2);margin-inline-end:calc(-1 * var(--space-2));color:inherit;font-weight:600}
.fixed-row{padding-block-start:var(--space-3)}
.fixed-row .tf{max-inline-size:none}
/* A "comes from" field and its fixed value side by side; alone, the field takes the width. */
.source-pair{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0 var(--space-3);align-items:start;min-inline-size:0}
.source-pair > .tf{max-inline-size:none}
.source-pair:has(> .fixed-row[hidden]) > .tf{grid-column:1 / -1}
.source-pair > .fixed-row{padding-block-start:0}
.tf-switch{appearance:none;position:relative;flex:none;inline-size:52px;block-size:32px;margin:0;border:2px solid var(--outline);border-radius:var(--shape-lg);background:var(--surface-variant);cursor:pointer;transition:background var(--motion-base) var(--motion-ease)}
.tf-switch::after{content:"";position:absolute;inset-inline-start:var(--space-1);inset-block-start:50%;translate:0 -50%;inline-size:16px;block-size:16px;border-radius:50%;background:var(--outline);transition:all var(--motion-base) var(--motion-ease)}
.tf-switch:checked{background:var(--primary);border-color:var(--primary)}
.tf-switch:checked::after{inset-inline-start:22px;inline-size:24px;block-size:24px;background:var(--on-primary)}
.tf-switch:disabled{opacity:.38;cursor:not-allowed}
/* A checkbox row is a 48px touch target, however short its label. */
.check{display:inline-flex;align-items:center;gap:var(--space-3);min-block-size:calc(var(--min-touch-target) + var(--space-1));padding-block:var(--space-1);cursor:pointer;font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh)}
.check input{flex:none;inline-size:18px;block-size:18px;margin:0;accent-color:var(--primary)}
.checks{display:flex;flex-wrap:wrap;column-gap:var(--space-5);padding:0;border:none;min-inline-size:0}
.checks > legend,.checks > .help,.checks > .tf-error{flex-basis:100%;padding-inline:0}
legend{padding:0;font-size:var(--typo-title-sm);line-height:var(--typo-title-sm-lh);font-weight:600}

/* ---------- dialog ---------- */
dialog.modal{inline-size:min(560px,calc(100vw - 2 * var(--space-4)));max-block-size:calc(100dvh - 2 * var(--space-4));margin:auto;padding:0;overflow:auto;border:none;border-radius:var(--shape-xl);background:var(--surface-container-high);color:var(--on-surface);box-shadow:var(--elev-3)}
dialog.modal:not([open]){display:none}
dialog.modal::backdrop{background:var(--scrim)}
.modal-head{display:flex;align-items:center;gap:var(--space-2);padding:var(--space-5) var(--space-5) var(--space-3);border-block-end:1px solid var(--outline-variant)}
.modal-head .ttl{flex:1;font-family:var(--font-headline);font-size:var(--typo-title-lg);line-height:var(--typo-title-lg-lh);font-weight:600}
.modal-body{display:flex;flex-direction:column;gap:var(--space-3);padding:var(--space-4) var(--space-5);color:var(--on-surface-variant)}
.modal-body .tf{max-inline-size:none}
.modal-foot{display:flex;justify-content:flex-end;gap:var(--space-2);flex-wrap:wrap;padding:var(--space-3) var(--space-5) var(--space-5);border-block-start:1px solid var(--outline-variant)}
.callout{padding:var(--space-3);border-radius:var(--shape-sm);background:var(--st-info-bg);color:var(--st-info-fg)}
.callout--warn{background:var(--st-warning-bg);color:var(--st-warning-fg)}
.callout--prod{background:var(--st-error-bg);color:var(--st-error-fg);font-weight:600}

/* ---------- snackbar ---------- */
/* Inverse surface, 4px corners, 48px floor, at the bottom-START corner of the content, so it
   flips under right to left with no second rule. One at a time by construction. */
.toast-host{position:fixed;inset-block-end:var(--space-5);inset-inline-start:calc(var(--rail-open) + var(--space-5));z-index:200;max-inline-size:min(560px,calc(100vw - 2 * var(--space-4)));pointer-events:none}
html.rail-collapsed .toast-host{inset-inline-start:calc(var(--rail-folded) + var(--space-5))}
/* The settings screen keeps its save bar at the bottom: the snackbar sits above it, not on it. */
body:has(.savebar:not([hidden])) .toast-host{inset-block-end:calc(var(--space-8) + var(--space-7))}
.toast{pointer-events:auto;display:inline-flex;align-items:center;gap:var(--space-4);min-block-size:48px;padding:var(--space-2) var(--space-4);border-radius:var(--shape-xs);background:var(--inverse-surface);color:var(--inverse-on-surface);font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh);box-shadow:var(--elev-3)}
/* The shared file names no inverse primary; tone 90 reads on the inverse surface in both themes. */
.toast__action{flex:none;padding:var(--space-2);border:none;border-radius:var(--shape-xs);background:none;color:var(--primary-container);font-weight:600;text-decoration:none;white-space:nowrap}

/* ---------- empty, loading and error states ---------- */
.empty{padding:var(--space-6) var(--space-4);text-align:center;color:var(--on-surface-variant)}
.empty--inline{padding:var(--space-4)}
.empty-icon{display:grid;place-items:center;flex:none;inline-size:56px;block-size:56px;margin:0 auto var(--space-3);border-radius:50%;background:var(--surface-container-high);color:var(--on-surface-variant)}
.empty-icon .icon{inline-size:24px;block-size:24px}
.empty--inline .empty-icon{inline-size:40px;block-size:40px;margin-block-end:var(--space-2)}
.empty--inline h3{font-size:var(--typo-title-sm);line-height:var(--typo-title-sm-lh)}
.empty h3{margin-block-end:var(--space-1);font-family:var(--font-headline);font-size:var(--typo-title-md);line-height:var(--typo-title-md-lh);color:var(--on-surface)}
.empty p{max-inline-size:430px;margin-inline:auto}
.empty__action{margin-block-start:var(--space-4)}
.state-error{flex-direction:row;flex-wrap:wrap;align-items:center;gap:var(--space-4)}
.state-error .empty-icon{margin:0;background:var(--st-error-bg);color:var(--st-error-fg)}
.state-error__text{flex:1 1 240px}
.state-error h3{font-family:var(--font-headline);font-size:var(--typo-title-md);line-height:var(--typo-title-md-lh)}
.state-error p{color:var(--on-surface-variant)}
.skeleton{display:flex;flex-direction:column;gap:var(--space-4)}
.sk-row{display:flex;align-items:center;gap:var(--space-3)}
.sk{flex:1;block-size:12px;border-radius:var(--shape-xs);background:var(--surface-container-high);animation:sk-pulse 1.4s ease-in-out infinite}
.sk-av{flex:none;inline-size:var(--avatar-size);block-size:var(--avatar-size);border-radius:50%}
.sk-sm{max-inline-size:110px}
.sk-md{max-inline-size:220px}
@keyframes sk-pulse{0%,100%{opacity:1}50%{opacity:.45}}
.spinner{inline-size:40px;block-size:40px;border:4px solid var(--surface-container-highest);border-block-start-color:var(--primary);border-radius:50%;animation:spin .9s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.sk{animation:none}.spinner,.btn[aria-busy="true"]::after{animation-duration:2.4s}}

/* ---------- banners and results ---------- */
.banner{display:flex;gap:var(--space-3);align-items:flex-start;padding:var(--space-3) var(--space-4);border-radius:var(--shape-md);background:var(--st-info-bg);color:var(--st-info-fg)}
.banner__text{flex:1;min-inline-size:0}
.banner__title{font-weight:600}
.banner--warning{background:var(--st-warning-bg);color:var(--st-warning-fg)}
.banner--error{background:var(--st-error-bg);color:var(--st-error-fg)}
.banner--success{background:var(--st-success-bg);color:var(--st-success-fg)}
.result{display:flex;gap:var(--space-2);align-items:flex-start}
.result--ok{color:var(--st-success-fg)}
.result--bad{color:var(--st-error-fg)}

/* ---------- tables ---------- */
.table-wrap{overflow-x:auto;border:1px solid var(--outline-variant);border-radius:var(--shape-md);background:var(--card)}
.table{inline-size:100%;border-collapse:collapse}
/* Headers on a grey band, as Edara 3's grids and the portal's tables draw them. */
.table th{padding:var(--space-2) var(--space-4);border-block-end:1px solid var(--outline-variant);background:var(--surface-container);color:var(--on-surface-variant);font-size:var(--typo-label-sm);line-height:var(--typo-label-sm-lh);font-weight:600;text-align:start;white-space:nowrap}
.table td{padding:var(--space-3) var(--space-4);border-block-end:1px solid var(--outline-variant);vertical-align:top}
.table tr:last-child td{border-block-end:none}
.table .num{text-align:end;font-variant-numeric:tabular-nums}
.table--dense td{padding-block:var(--space-2)}
.table .nowrap{white-space:nowrap}
/* A code in a table cell stays whole: the column takes its width, and the table scrolls if it must. */
.table td bdi.code{white-space:nowrap}
.table td .help bdi.code{white-space:normal}
.cell-link{font-weight:600;white-space:nowrap}
.report-chips{display:flex;flex-wrap:wrap;gap:var(--space-2)}
.report-chip{display:inline-flex;align-items:center;gap:var(--space-1);white-space:nowrap}
.id-list{display:inline-flex;flex-direction:column;gap:var(--space-1)}
/* The API log (js/views/apilog.js): a row opens to what was asked and what came back. */
.call-filters{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--space-3) var(--space-6)}
.call-filters > .search-box{inline-size:min(100%,300px)}
.filter-group{display:flex;flex-direction:column;gap:var(--space-1)}
.filter-group__label{color:var(--on-surface-variant);font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:500}
.disclosure{display:inline-flex;align-items:center;gap:var(--space-1);padding:0;border:none;background:none;color:var(--primary);font:inherit;font-weight:600;white-space:nowrap;cursor:pointer}
.disclosure .icon{transition:transform var(--motion-base) var(--motion-ease)}
.disclosure[aria-expanded="true"] .icon{transform:rotate(180deg)}
.calls tr[hidden]{display:none}
.calls .call-path{min-inline-size:180px}
.calls bdi.path{white-space:normal;overflow-wrap:normal}
bdi.path .path__part{white-space:nowrap}
.banner__actions{gap:var(--space-2)}
.banner__actions .btn{color:inherit;font-weight:600}
.banner__actions .btn:first-child{margin-inline-start:calc(-1 * var(--space-3))}
.disclosure{align-items:flex-start}
.when{display:flex;flex-direction:column;align-items:flex-start;font-variant-numeric:tabular-nums}
.when__day{color:var(--on-surface-variant);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);font-weight:400}
.call-summary{overflow-wrap:anywhere}
.call-summary > span{display:inline-block;max-inline-size:100%}   /* each fact wraps as a whole, in either direction */
.call-summary bdi:not(.code){unicode-bidi:isolate}
.call-detail > td{background:var(--surface-container)}
.call-detail .codeblock{max-block-size:260px}
.call-detail a bdi.code{display:inline}

/* ---------- tabs ---------- */
.tabs{display:flex;border-block-end:1px solid var(--outline-variant);overflow-x:auto}
.tab{position:relative;flex:none;min-block-size:48px;padding-inline:var(--space-4);border:none;background:none;color:var(--on-surface-variant);font-size:var(--typo-title-sm);line-height:var(--typo-title-sm-lh);font-weight:500}
.tab:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.tab[aria-selected="true"]{color:var(--primary)}
/* Inside the tab: the tab bar scrolls sideways, which would cut a ring drawn outside it. */
.tab:focus-visible{outline-offset:-2px;border-radius:var(--shape-sm)}
.tab-panel:focus{outline:none}
.tab-panel:focus-visible{outline:2px solid var(--primary);outline-offset:var(--space-1)}
.tab[aria-selected="true"]::after{content:"";position:absolute;inset-inline:var(--space-4);inset-block-end:0;block-size:3px;border-start-start-radius:var(--shape-xs);border-start-end-radius:var(--shape-xs);background:var(--primary)}

/* ---------- overview ---------- */
/* The page opens with the one sentence the header's chips don't say, and the reports that are
   on. The status chip is repeated here only on a phone, where the header has no room for it. */
.overview__intro{display:flex;flex-direction:column;gap:var(--space-2)}
.status-strip{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-3);color:var(--on-surface-variant)}
.status-strip__text{max-inline-size:80ch}
.status-strip__chip{display:none}
@media (max-width:599px){
  .status-strip__chip{display:inline-flex}
}
.reports-line{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--space-1) var(--space-3);font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh)}
.reports-line__label{color:var(--on-surface-variant)}
.reports-line__items{display:inline-flex;flex-wrap:wrap;gap:var(--space-1) var(--space-2)}
.reports-line__item{color:var(--on-surface-variant)}
.reports-line__item--on{color:var(--on-surface);font-weight:600}
.reports-line__item + .reports-line__item::before{content:"·" / "";margin-inline-end:var(--space-2);color:var(--on-surface-variant);font-weight:400}
.overview{display:flex;flex-direction:column;gap:var(--space-4)}
.overview > .stack:empty{display:none}
/* "Everything is ready": one step up from a card title, Activate right under it with what it
   sends, then the done steps folded into one line. */
.card-title--lg{font-size:var(--typo-title-lg);line-height:var(--typo-title-lg-lh);letter-spacing:var(--typo-title-lg-ls)}
.ready__act{display:flex;flex-direction:column;align-items:flex-start;gap:var(--space-3)}
.ready__what{max-inline-size:70ch;color:var(--on-surface)}
.steps-summary{display:flex;flex-direction:column;gap:var(--space-2);padding-block-start:var(--space-3);border-block-start:1px solid var(--outline-variant)}
.steps-summary__line{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-3);color:var(--on-surface-variant);font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh)}
.steps-toggle{align-items:center;min-block-size:var(--min-touch-target);font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh)}
.ready-card > .checklist{border-block-start:1px solid var(--outline-variant)}
/* The last run: each report's period, chip, counts and what Dahua answered. */
.lastrun{gap:var(--space-3)}
.report-list .lastrun__report{display:flex;flex-direction:column;align-items:stretch;gap:var(--space-1)}
.lastrun__head{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-3)}
/* The report names and the counts take the same width on every line, so the numbers line up. */
.lastrun__name{min-inline-size:6.5em}
.lastrun__counts{min-inline-size:15em;font-variant-numeric:tabular-nums}
.lastrun__span{margin-block-start:var(--space-1)}
/* The data a report covers: a calendar, the range in bold, how many days. */
.data-span{display:inline-flex;align-items:center;gap:var(--space-2)}
.data-span > .icon{flex:none;inline-size:18px;block-size:18px;color:var(--on-surface-variant)}
.lastrun__answer{font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.lastrun__answer .icon{flex:none;inline-size:16px;block-size:16px}
.lastrun__next{color:var(--on-surface-variant)}
/* Active: one line with the schedule, the reports and Change, the next run under it. */
.status-strip--active{flex-direction:column;align-items:flex-start;gap:var(--space-1)}
.status-strip--active .status-strip__text{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--space-1) var(--space-2);color:var(--on-surface-variant)}
/* The next run: its own tinted block, so when the next send happens is seen at once. */
.next-run{display:flex;align-items:center;gap:var(--space-3);margin-block-start:var(--space-2);padding:var(--space-3) var(--space-4);border-radius:var(--shape-md);background:var(--primary-container, var(--secondary-container));color:var(--on-primary-container, var(--on-secondary-container))}
.next-run__icon{display:grid;place-items:center;flex:none;inline-size:40px;block-size:40px;border-radius:50%;background:color-mix(in srgb,currentColor 12%,transparent)}
.next-run__icon .icon{inline-size:22px;block-size:22px}
.next-run__text{display:flex;flex-direction:column;gap:2px}
.next-run__label{font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:500;opacity:.85}
.next-run__when{font-size:var(--typo-title-md);line-height:var(--typo-title-md-lh);font-weight:600}
.next-run__in{font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.quiet-link{text-decoration:none}
.quiet-link:hover{border-radius:var(--shape-xs);background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.lastrun__head .lastrun__answer{display:inline-flex;align-items:center;gap:var(--space-1)}
.trace{display:inline-flex;align-items:center;gap:0;margin-inline-start:var(--space-1)}
.trace bdi.code{font-size:var(--typo-body-sm)}
.copy-btn{inline-size:28px;block-size:28px}
.copy-btn .icon{inline-size:16px;block-size:16px}
/* Needs attention: one row per reason, its count, and where to fix it. */
.attention{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}
.attention__item{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:start;gap:var(--space-1) var(--space-4);padding-block:var(--space-3);border-block-start:1px solid var(--outline-variant)}
.attention__item:first-child{border-block-start:none}
.attention__why .causes p{margin:0}
.attention__why{display:flex;flex-direction:column;gap:var(--space-1)}
.attention__where{display:flex;flex-wrap:wrap;gap:var(--space-1) var(--space-3)}
.attention__item > .chip{justify-self:start}
/* A fix's list, folded under it, with its copy button. */
/* Recent runs: digits of one width, so the counts line up; held back in the warning colour. */
.recent__cell{font-variant-numeric:tabular-nums}
.recent__held{color:var(--st-warning-fg);font-weight:600}
.recent__foot{justify-content:space-between;margin-block-start:var(--space-2)}
.attention__list > summary{inline-size:fit-content;cursor:pointer;color:var(--primary);font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh);font-weight:500}
.attention__list ul{display:flex;flex-direction:column;gap:2px;margin:var(--space-2) 0;padding-inline-start:var(--space-5)}
.attention__list li{display:flex;flex-wrap:wrap;gap:var(--space-1) var(--space-3)}
/* A long list in columns on a wide screen, so it doesn't take over the page. */
.attention__list ul.attention__list--cols{display:block;columns:3 400px;column-gap:var(--space-6)}
/* A line stays whole: a part number and its model never break in the middle. */
.attention__list--cols li{break-inside:avoid;margin-block-end:2px;white-space:nowrap}
.attention__list > .btn-text{margin-inline-start:calc(-1 * var(--space-3))}
@media (max-width:599px){.attention__item{grid-template-columns:1fr auto}.attention__why{grid-column:1 / -1}}
/* The guided path: numbered steps, each saying what was done or what is still needed. */
.checklist{list-style:none;padding:0;display:flex;flex-direction:column}
.checklist > li{display:flex;align-items:flex-start;gap:var(--space-2) var(--space-3);min-block-size:56px;padding-block:var(--space-3);flex-wrap:wrap;border-block-start:1px solid var(--outline-variant)}
.checklist > li:first-child{border-block-start:none}
.checklist > li > .btn{margin-inline-start:auto}
/* A later step's action: a text link in the quiet colour, so only the next step's stands out. */
.btn-text.btn-quiet{color:var(--on-surface-variant);font-weight:400}
.btn-text.btn-quiet:hover{color:var(--on-surface);background:color-mix(in srgb,var(--on-surface) calc(var(--state-hover)*100%),transparent)}
/* Step marks, all 28px: a ringed number while to do (the next one ringed in the primary colour),
   a tick when done, the warning icon when done with a warning, a thin ring on a tint when optional. */
.checklist__mark{display:grid;place-items:center;flex:none;inline-size:28px;block-size:28px;border:2px solid var(--outline-variant);border-radius:50%;background:transparent;color:var(--on-surface-variant);font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:600;font-variant-numeric:tabular-nums}
.checklist__mark .icon{inline-size:16px;block-size:16px}
.checklist > li.next .checklist__mark{border-color:var(--primary);color:var(--primary)}
.checklist__label{font-size:var(--typo-title-sm);line-height:var(--typo-title-sm-lh);letter-spacing:var(--typo-title-sm-ls);font-weight:600}
.checklist > li.step--done .checklist__mark{border-color:transparent;background:var(--st-success-bg);color:var(--st-success-fg)}
.checklist > li.step--warn .checklist__mark{border-color:transparent;background:var(--st-warning-bg);color:var(--st-warning-fg)}
.checklist > li.step--optional.step--todo .checklist__mark{border-width:1px;background:var(--surface-container)}
.checklist__text{display:flex;flex-direction:column;gap:var(--space-1);flex:1;min-inline-size:200px;padding-block-start:2px}
.checklist__head{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-3)}
.checklist__head .chip{padding-block:0}
.step-link{font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);font-weight:600;text-underline-offset:2px}
.step-missing__list{margin-block-start:0;font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.step-missing__list.notice-links a{color:var(--primary)}
.checklist > li:not(.next) .step-missing__list.notice-links a{color:var(--on-surface-variant)}
.step-warn{font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);color:var(--st-warning-fg)}
.step-warn b{display:block}
.step-results{display:flex;flex-direction:column;gap:2px;padding:0;list-style:none}
/* Setting up: what to have at hand, under the card's heading. */
.setup__need{max-inline-size:90ch;color:var(--on-surface-variant)}
/* Progress spans the card's content, "N of 4 done" at its end (under it on a phone). */
.checklist__progress{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2) var(--space-3)}
.checklist__progress .help{flex:none;white-space:nowrap}
.checklist__bar{appearance:none;-webkit-appearance:none;flex:1 1 0;min-inline-size:120px;block-size:6px;border:none;border-radius:var(--shape-xs);background:var(--surface-container-highest);color:var(--primary);overflow:hidden}
@media (max-width:599px){
  .checklist__bar{flex-basis:100%}
}
.checklist__bar::-webkit-progress-bar{background:var(--surface-container-highest);border-radius:var(--shape-xs)}
.checklist__bar::-webkit-progress-value{background:var(--primary);border-radius:var(--shape-xs)}
.checklist__bar::-moz-progress-bar{background:var(--primary);border-radius:var(--shape-xs)}
/* What Settings still needs: one link per field. */
.notice-links{display:flex;flex-wrap:wrap;gap:var(--space-1) var(--space-4);margin-block-start:var(--space-1);padding:0;list-style:none}
.notice-links a{color:inherit;font-weight:600;text-decoration:none}
.notice-links a:hover{border-radius:var(--shape-xs);background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.banner__more{margin-block-start:var(--space-2);align-items:baseline}
.banner__more > span{font-weight:400}
.report-list{list-style:none;padding:0;display:flex;flex-direction:column;gap:var(--space-2)}
.report-list li{display:flex;gap:var(--space-3);align-items:center;flex-wrap:wrap}
.kv{display:grid;grid-template-columns:minmax(0,auto) minmax(0,1fr);gap:var(--space-2) var(--space-4)}
.kv dt{color:var(--on-surface-variant)}
.kv dd{overflow-wrap:anywhere}

/* ---------- connect ---------- */
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-4);align-items:start}
.grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--space-3)}
.env-choice{display:flex;flex-direction:column;gap:var(--space-2);max-inline-size:var(--creds-row);padding:0;border:none;min-inline-size:0}
.radio{display:flex;gap:var(--space-3);align-items:flex-start;padding:var(--space-3) var(--space-4);border:1px solid var(--outline-variant);border-radius:var(--shape-md);cursor:pointer}
.radio input{flex:none;inline-size:18px;block-size:18px;margin:1px 0 0;accent-color:var(--primary)}
.radio b{display:block}
.radio--on{border-color:var(--primary);box-shadow:inset 0 0 0 1px var(--primary);background:var(--st-info-bg)}
.radio--prod.radio--on{border-color:var(--st-error-fg);box-shadow:inset 0 0 0 1px var(--st-error-fg);background:var(--st-error-bg)}
.radio--prod input{accent-color:var(--error)}
.radio:has(input:disabled){cursor:not-allowed}
/* The Dahua card is three numbered steps, Overview's rows: test credentials, production
   credentials, Go live. Each step is set off by a rule, not a card of its own; its title sits
   over a quiet note, and a folded step's action (or a locked step's lock) at the row's end.
   A client ID or secret is short: each field
   stops at 384px, eight 48px steps, so the eye button sits near the text. Where the card has
   room the client ID and the secret share one row (the secret's note under it), and the "Go
   live" choice spans that row; narrower, they stack, and on a phone they take the whole width.
   The card is the container the row is decided on, so the rail being open or folded counts. */
.dahua{--field-width:calc(8 * var(--space-8));--creds-row:calc(2 * var(--field-width) + var(--space-4));container-type:inline-size}
/* Tighter than Overview's rows, so the whole screen fits a laptop window: the first step
   starts under the card's title, the last ends at the card's edge. */
.connect-steps > li{min-block-size:0;padding-block:var(--space-2)}
.connect-steps > li:first-child{padding-block-start:0}
.connect-steps > li:last-child{padding-block-end:0}
.connect-steps > li > .checklist__text{min-inline-size:0}
.connect-steps .creds-form{margin-block-start:var(--space-1)}
.connect-steps > li > .btn,.step-lock{align-self:center;margin-inline-start:auto}
.step-lock{display:grid;place-items:center;flex:none;color:var(--outline)}
.step-lock .icon{inline-size:18px;block-size:18px}
/* A small button: 32px to see, the shared touch target around it. */
.btn.btn-small{position:relative;min-block-size:32px;padding-inline:var(--space-3)}
.btn-small::before{content:"";position:absolute;inset-block:calc((var(--min-touch-target) - 32px) / -2);inset-inline:0}
/* The Edara card's explanation wraps into two lines that read comfortably. */
.edara-intro{max-inline-size:75ch}
/* Connect's cards sit one spacing step closer than the shell's (title to first card, card to
   card), as Overview's steps do: the whole screen fits a laptop window without scrolling. */
.view-body:has(> .dahua){gap:var(--space-3);margin-block-start:calc(var(--space-3) - var(--space-4))}
.creds-form{display:flex;flex-direction:column;gap:var(--space-3);max-inline-size:var(--creds-row)}
.creds-fields{display:grid;grid-template-columns:minmax(0,var(--field-width));gap:var(--space-3) var(--space-4);align-items:start}
@container (min-width:680px){
  .creds-fields{grid-template-columns:repeat(2,minmax(0,var(--field-width)))}
}
.creds-form .tf{max-inline-size:none}
.creds-form .row{gap:var(--space-2)}
/* Why Save waits: on the button's line, after it, wrapping under it when the line is full. */
.creds-actions{column-gap:var(--space-3)}
.creds-actions > .action-note{flex:0 1 auto;min-inline-size:0}
.connect-steps .env-choice{margin-block-start:var(--space-2)}
/* One line: a done Edara connection, or production credentials that aren't needed yet. */
.line{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-3);min-inline-size:0}
/* A text button in a line is lined up by its label: its padding goes into the gap on both sides. */
.line > .btn-text{margin-inline:calc(-1 * var(--space-2))}
.line__sep{color:var(--on-surface-variant)}
.card--line{padding-block:var(--space-2)}
.saved{display:flex;gap:var(--space-2);align-items:center;color:var(--on-surface-variant)}
.saved--yes{color:var(--st-success-fg);font-weight:600}
/* Under a step's title: what is saved, and Dahua's answer under it, in the note's size. */
.saved-line{display:flex;flex-direction:column;gap:var(--space-1);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);letter-spacing:var(--typo-body-sm-ls)}
.saved-line .icon{flex:none;inline-size:16px;block-size:16px}
.saved-line .result{align-items:center}
/* Saved credentials: Test again, Replace, Remove, lined up with the note above them. */
.creds-saved{gap:var(--space-1) var(--space-3)}
.creds-saved > .btn-text:first-child{margin-inline-start:calc(-1 * var(--space-3))}
.btn.btn-quiet{color:var(--on-surface-variant)}
/* Start over: an outlined button in the error colour, at the foot of Connect. */
.btn.btn-danger-outline:not(:disabled){border-color:var(--error);color:var(--error)}

/* ---------- mapping, settings ---------- */
.stat{gap:var(--space-1)}
.stat--success .big{color:var(--st-success-fg)}
.stat--warning .big{color:var(--st-warning-fg)}
/* The first upload: an outlined drop area inside the card. A file dragged over it shows the
   drag state layer and the primary outline (the design system has no dashed border). */
.drop{display:flex;flex-direction:column;align-items:center;gap:var(--space-2);padding:var(--space-5) var(--space-4);border:1px solid var(--outline-variant);border-radius:var(--shape-md);background:var(--surface-container-low);text-align:center}
.drop > .icon{inline-size:32px;block-size:32px;color:var(--primary)}
.drop__hint{font-size:var(--typo-title-sm);line-height:var(--typo-title-sm-lh);font-weight:600}
.drop .filepick{align-items:center;max-inline-size:none}
.drop .filepick__row{justify-content:center}
.drop .filepick__name{flex:0 1 auto}
.drop--over{border-color:var(--primary);background:color-mix(in srgb,var(--primary) calc(var(--state-drag)*100%),var(--surface-container-low))}
.drop-line > .line.drop--over{border-radius:var(--shape-sm);background:color-mix(in srgb,var(--primary) calc(var(--state-drag)*100%),transparent);outline:1px solid var(--primary);outline-offset:var(--space-1)}
.upload__status:empty{display:none}
.filepick__btn[aria-busy="true"]{pointer-events:none}
/* The sheet's columns, as the file spells them. */
code.colname{padding:0 var(--space-1);border-radius:var(--shape-xs);background:var(--surface-container-high);color:var(--on-surface);font-family:var(--font-mono);font-size:var(--typo-label-sm);line-height:var(--typo-label-sm-lh);white-space:nowrap}
/* Once there is a sheet the picker sits on the sheet's line: its button is the line's last
   item, and a problem with a file wraps under the line. */
.line > .filepick{display:contents}
.line .filepick__btn.btn-text{margin-inline:calc(-1 * var(--space-2))}
.line .filepick__row{flex-wrap:nowrap}
.line .filepick__name{flex:0 1 auto}
.line > .filepick .tf-error,.line > .upload__status{flex-basis:100%;padding:0}
/* After the sheet's actions, its own controls go to the end of the line: the shared-model filter,
   then a slim search. Removing the sheet is the quieter of its two actions. */
.line [data-action="remove-sheet"]{margin-inline-start:var(--space-1);color:var(--on-surface-variant)}
.line__tools{display:flex;flex:none;align-items:center;gap:var(--space-3);margin-inline-start:auto}
/* On the sheet's line the search box gives way first, so the line stays one row. */
.line__tools > .search-box{inline-size:auto;min-inline-size:180px;max-inline-size:260px;flex:1 1 180px}
.line__tools{flex:1 1 auto;justify-content:flex-end;min-inline-size:0}
.line__tools > .search-box input{inline-size:0}   /* its own width is the box's, not the browser's default */
.search-box{display:flex;align-items:center;gap:var(--space-2);inline-size:min(100%,260px);min-block-size:40px;padding-inline:var(--space-3);border:1px solid var(--outline);border-radius:var(--shape-xs);color:var(--on-surface-variant);cursor:text}
.search-box:hover{border-color:var(--on-surface)}
.search-box:focus-within{border-color:var(--primary);box-shadow:inset 0 0 0 1px var(--primary)}
.search-box > .icon{flex:none;inline-size:20px;block-size:20px}
.search-box input{flex:1;min-inline-size:0;padding:0;border:none;outline:none;background:none;color:var(--on-surface);font:inherit;font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh)}
.search-box input::placeholder{color:var(--on-surface-variant);opacity:1}
/* A part number whose model is on other rows too: the warning icon, and which rows. */
.shared{display:flex;align-items:flex-start;gap:var(--space-1)}
/* A model that repeats on other rows of the sheet: tinted with the warning colours. */
/* Preview: a column shown to check the rows by eye, not sent to Dahua. */
.table td.shown-only{color:var(--on-surface-variant)}
mark.dup{padding:1px var(--space-1);border-radius:var(--shape-xs);background:var(--st-warning-bg);color:var(--st-warning-fg)}
.shared > .icon{flex:none;inline-size:16px;block-size:16px;margin-block-start:2px;color:var(--st-warning-fg)}
/* Shared models only: each group under a heading row on the header's surface. */
.table .group__head th{padding:var(--space-2) var(--space-4);border-block:1px solid var(--outline-variant);background:var(--surface-container-low);color:var(--on-surface);font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh);font-weight:600;white-space:normal}
.table .group:first-of-type .group__head th{border-block-start:none}
.group__todo{display:inline-flex;align-items:center;gap:var(--space-1);color:var(--st-warning-fg);font-weight:600}
.group__todo > .icon{inline-size:16px;block-size:16px}
/* The sheet: a part number is short, so its column leaves the room to the models. */
.sheet-table th:first-child{inline-size:30%}
/* The last-read line: busy while Edara is read, then a tick with what the read found. */
/* How items are matched: a two-step flow, each step's outcomes as buttons with their counts. */
.match-flow > summary{cursor:pointer;font-weight:600;color:var(--on-surface)}
.match-flow[open] > summary{margin-block-end:var(--space-3)}
.flow{display:flex;flex-direction:column;gap:var(--space-2)}
.flow__start{display:inline-flex;align-self:flex-start;align-items:baseline;gap:var(--space-2);padding:var(--space-2) var(--space-3);border-radius:var(--shape-sm);background:var(--surface-container-high)}
.flow__steps{display:flex;flex-direction:column;gap:var(--space-2);margin:0;padding:0;list-style:none;border-inline-start:2px solid var(--outline-variant);margin-inline-start:var(--space-4);padding-inline-start:var(--space-4)}
.flow__step{display:flex;flex-direction:column;gap:var(--space-2);padding-block:var(--space-2)}
.flow__q{display:flex;align-items:center;gap:var(--space-2);font-weight:600}
.flow__n{display:grid;place-items:center;flex:none;inline-size:24px;block-size:24px;border-radius:50%;background:var(--primary);color:var(--on-primary);font-size:var(--typo-label-md)}
.flow__q .flow__change{font-weight:400;font-size:var(--typo-body-sm)}
/* Three equal boxes in a row, stacked when there's no room; each tinted with its own colour on
   hover, and filled while its list is the one shown below. */
.flow__outs{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));max-inline-size:760px;gap:var(--space-2);margin-inline-start:calc(24px + var(--space-2))}
.flow__out{--tone:var(--on-surface-variant);display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:var(--space-2) var(--space-3);border:1px solid var(--outline-variant);border-radius:var(--shape-sm);background:var(--card);color:var(--on-surface);text-align:start;cursor:pointer}
.flow__out:hover{background:color-mix(in srgb,var(--tone) calc(var(--state-hover)*100%),var(--card))}
.flow__out[aria-pressed="true"]{background:color-mix(in srgb,var(--tone) calc(var(--state-press)*100%),var(--card));box-shadow:inset 0 0 0 1px var(--tone)}
.flow__out-more{display:inline-flex;align-items:center;gap:2px;margin-block-start:auto;padding-block-start:var(--space-1);color:var(--primary);font-size:var(--typo-label-md)}
.flow__out-more .icon{inline-size:16px;block-size:16px}
.flow__looks{display:flex;align-items:center;gap:4px;color:var(--st-warning-fg)}
.flow__looks .icon{inline-size:16px;block-size:16px}
.flow__out-label{font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.flow__out-n{font-size:var(--typo-title-md);line-height:var(--typo-title-md-lh)}
.flow__out-note{font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);color:var(--on-surface-variant)}
.flow__out--ok{--tone:var(--st-success-fg);border-color:var(--st-success-fg)}
.flow__out--ok .flow__out-n{color:var(--st-success-fg)}
.flow__out--warn{--tone:var(--st-warning-fg);border-color:var(--st-warning-fg)}
.flow__out--warn .flow__out-n{color:var(--st-warning-fg)}
.flow__out--none .flow__out-n{color:var(--on-surface-variant)}
.flow__no{align-self:center;color:var(--on-surface-variant);font-size:var(--typo-body-sm)}
/* Picking an ambiguous item's part number: its rows as radios, then Use this part number. */
.chooser{display:flex;flex-direction:column;gap:var(--space-1);min-inline-size:0}
.chooser__legend{margin:0;font-weight:600}
.chooser__opts{display:flex;flex-direction:column;gap:var(--space-1);margin:0;padding:0;list-style:none}
.chooser__opt{display:flex;flex-direction:column;align-items:flex-start;gap:2px;inline-size:100%;padding:var(--space-1) var(--space-2);border:1px solid var(--outline-variant);border-radius:var(--shape-sm);background:var(--card);color:var(--on-surface);text-align:start}
button.chooser__opt{cursor:pointer}
button.chooser__opt:hover{background:color-mix(in srgb,var(--primary) calc(var(--state-hover)*100%),var(--card))}
.chooser__opt[aria-pressed="true"]{border-color:var(--primary);background:color-mix(in srgb,var(--primary) calc(var(--state-press)*100%),var(--card));cursor:default}
.chooser__model{font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.chooser__same{color:var(--on-surface-variant)}
.chooser__now{color:var(--primary);font-size:var(--typo-label-md)}
.sync-line--busy{color:var(--primary)}
.sync-line--busy::before{content:"";display:inline-block;inline-size:12px;block-size:12px;margin-inline-end:var(--space-2);vertical-align:-1px;border:2px solid currentColor;border-block-start-color:transparent;border-radius:50%;animation:spin .9s linear infinite}
.sync-line__done{display:inline-flex;align-items:center;gap:var(--space-1);color:var(--st-success-fg)}
.sync-line__done .icon{inline-size:16px;block-size:16px}
.line [data-action="remove-sheet-locked"]{color:var(--on-surface-variant)}
.line [data-action="remove-sheet-locked"] .icon{inline-size:16px;block-size:16px}
/* Edara items: steady column widths whatever the filter; a model kept whole. */
.catalog-table{table-layout:fixed}
.catalog-table th:nth-child(1){inline-size:38%}
.catalog-table th:nth-child(2){inline-size:22%}
/* An Edara item's named fields; the one compared with the sheet is tinted and tagged. */
.item-fields{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px var(--space-3);margin:0;align-items:baseline}
.item-field{display:contents}
.item-field dt{color:var(--on-surface-variant);font-size:var(--typo-label-md);white-space:nowrap}
.item-field dd{display:flex;align-items:center;gap:var(--space-2);margin:0;min-inline-size:0}
.item-field__val{min-inline-size:0;overflow-wrap:anywhere}
.item-field__one{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;overflow-wrap:normal}
.item-field__one bdi.code{white-space:nowrap}
.item-field--compared .item-field__val{padding:0 var(--space-1);border-radius:var(--shape-xs);background:var(--secondary-container);color:var(--on-secondary-container)}
.item-field__tag{flex:none;padding:0 4px;border-radius:var(--shape-xs);border:1px solid var(--outline-variant);font-size:var(--typo-label-sm);line-height:var(--typo-label-sm-lh)}
.catalog-tools{justify-content:space-between;align-items:center;gap:var(--space-3)}
.catalog-search .search-box{inline-size:min(100%,320px)}
.group__label{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--space-1) var(--space-3)}
.group__col{color:var(--on-surface-variant);font-size:var(--typo-label-sm);line-height:var(--typo-label-sm-lh);font-weight:500}
.group__head .muted{font-weight:400}
.table .group tr:last-child td{border-block-end:none}
/* Segmented button: the choices in one outlined pill; the chosen one filled, with a tick. */
.seg{display:flex;flex-direction:column;gap:var(--space-1)}
.seg__label{color:var(--on-surface-variant);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.seg__opts{display:inline-flex;border:1px solid var(--outline);border-radius:var(--shape-xl);overflow:hidden}
.seg__opt{position:relative;display:inline-flex;flex:1 1 auto;align-items:center;justify-content:center;gap:var(--space-2);min-block-size:40px;padding:0 var(--space-4);color:var(--on-surface);font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh);font-weight:500;white-space:nowrap;cursor:pointer}
.seg__opt + .seg__opt{border-inline-start:1px solid var(--outline)}
.seg__opt > input{position:absolute;inset:0;margin:0;opacity:0;cursor:inherit}
.seg__opt > .icon{display:none;inline-size:18px;block-size:18px}
.seg__opt:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.seg__opt:has(input:checked){background:var(--secondary-container);color:var(--on-secondary-container)}
.seg__opt:has(input:checked) > .icon{display:block}
.seg__opt:has(input:focus-visible){outline:2px solid var(--primary);outline-offset:-2px}
.seg__opt:has(input:disabled){color:color-mix(in srgb,var(--on-surface) 38%,transparent);cursor:default}
.seg__opt:has(input:disabled:checked){background:color-mix(in srgb,var(--on-surface) 12%,transparent)}
.seg__opts:has(input:disabled),.seg__opts:has(input:disabled) > .seg__opt + .seg__opt{border-color:color-mix(in srgb,var(--on-surface) 12%,transparent)}
/* Preview: the report, the month and the button on one line, along their bottom edge. */
.preview-form{gap:var(--space-2)}
.preview-form__fields{align-items:flex-end;gap:var(--space-3) var(--space-4)}
.preview-form__fields > .tf{flex:0 1 220px}
.preview-form__fields > .btn{margin-block-start:0}
.settings-fields{display:flex;flex-direction:column;gap:var(--space-4);margin-block-start:var(--space-2)}
.settings-fields > *{scroll-margin-block:var(--space-4)}
/* Settings: links to the sections; on a wide screen each section's title sits beside its fields. */
.settings-form{container-type:inline-size}
.settings-jump{display:flex;flex-wrap:wrap;gap:var(--space-2)}
.settings-jump a{display:inline-flex;align-items:center;min-block-size:32px;padding:0 var(--space-3);border:1px solid var(--outline-variant);border-radius:var(--shape-sm);color:var(--on-surface-variant);font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh);font-weight:500;text-decoration:none}
.settings-jump a:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.settings-jump a[aria-current="page"]{border-color:transparent;background:var(--secondary-container);color:var(--on-secondary-container)}
.settings-jump a{gap:var(--space-2)}
.settings-jump__dot{inline-size:8px;block-size:8px;border-radius:50%;background:var(--primary)}
.field-effect{margin:var(--space-1) 0 0;padding-inline:var(--space-4)}
.field-effect .field-effect{padding-inline:0}
.field-effect--warn{display:flex;align-items:flex-start;gap:var(--space-1);color:var(--st-warning-fg)}
.field-effect--warn .icon{flex:none;inline-size:16px;block-size:16px;margin-block-start:2px}
.settings-group__head{display:flex;flex-wrap:wrap;align-items:baseline;gap:0 var(--space-3)}
.settings-group__head > .muted{margin:0}
/* A field's help is two lines at most (the texts are written to fit); the whole of it shows on
   hover (title) and is read in full. */
.settings-fields .tf-hint{overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.settings-off{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-3)}
.settings-off > .btn-text{margin-inline-start:calc(-1 * var(--space-2))}
/* Wide enough: the section's title above, its fields in two columns, so a section fits the
   window without scrolling. */
@container (min-width:900px){
  .settings-group > .settings-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-4) var(--space-6);align-items:start}
  .settings-fields > .checks,.settings-fields > .setrow--note,.settings-fields > .field--row{grid-column:1 / -1}
  .settings-fields > .field--row{max-inline-size:760px}
  .settings-off > .btn-text{margin-inline-start:0}
}
.setrow{display:flex;justify-content:space-between;align-items:center;gap:var(--space-4);max-inline-size:560px;min-block-size:calc(var(--min-touch-target) + var(--space-1))}
.savebar{display:flex;flex-wrap:wrap;gap:var(--space-2) var(--space-3);align-items:center;justify-content:flex-end;max-inline-size:1120px;margin-inline:0;padding-block:var(--space-3)}
.savebar__note{flex:1;min-inline-size:140px;color:var(--on-surface-variant)}
.savebar__note--dirty{color:var(--on-surface);font-weight:600}

/* ---------- preview and run detail ---------- */
.groups{display:flex;flex-direction:column;gap:var(--space-2)}
.group{border:1px solid var(--outline-variant);border-radius:var(--shape-sm)}
.group > summary{display:flex;gap:var(--space-3);align-items:center;padding:var(--space-3) var(--space-4);cursor:pointer}
.group__reason{flex:1;min-inline-size:0;overflow-wrap:anywhere}
.group__rows{list-style:none;padding:0 var(--space-4) var(--space-3);display:flex;flex-direction:column;gap:var(--space-2)}
.group__rows li{padding-block-start:var(--space-2);border-block-start:1px solid var(--outline-variant)}
.causes{display:flex;flex-direction:column;gap:var(--space-1)}
.rowdata summary,.tech > summary{cursor:pointer;color:var(--primary);font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh);font-weight:500}
/* Opened in a table cell, a row's details take the room they need instead of one letter a line. */
td .rowdata[open]{min-inline-size:min(360px,70vw)}
.rowdata .kv{margin-block-start:var(--space-2);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
/* What the other systems said, in their own words: collapsed, labelled, and left to right. */
.tech{padding:var(--space-3);border-radius:var(--shape-sm);background:var(--surface-container)}
.tech[open]{display:flex;flex-direction:column;gap:var(--space-2)}
.tech__list{list-style:none;padding:0;display:flex;flex-direction:column;gap:var(--space-1);font-family:var(--font-mono);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.tech__list li{display:flex;gap:var(--space-3);overflow-wrap:anywhere}
.codeblock{margin:0;padding:var(--space-3);max-block-size:320px;overflow:auto;border-radius:var(--shape-sm);background:var(--surface-container-high);font-family:var(--font-mono);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);text-align:start;white-space:pre-wrap;overflow-wrap:anywhere}
/* What was sent to Dahua: one tile per submitted part, on the card's surface step. */
.sent{display:flex;flex-direction:column;gap:var(--space-2)}
.sent-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--space-3)}
.sent-item{display:flex;flex-direction:column;gap:var(--space-2);min-inline-size:0;padding:var(--space-3) var(--space-4);border:1px solid var(--outline-variant);border-radius:var(--shape-md);background:var(--surface-container-low)}
.sent-item > *{min-inline-size:0}
.sent-item__title{margin:0;font-size:var(--typo-title-sm);line-height:var(--typo-title-sm-lh);letter-spacing:var(--typo-title-sm-ls);font-weight:600}
.sent-item__actions{gap:var(--space-2)}
.sent-item__sha{font-family:var(--font-mono);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);overflow-wrap:anywhere;text-align:start}
.sent-zip{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2) var(--space-3)}

/* ---------- help, more ---------- */
.guide-steps{list-style:none;padding:0;display:flex;flex-direction:column}
.guide-steps li{display:flex;align-items:center;gap:var(--space-3);flex-wrap:wrap;padding-block:var(--space-3);border-block-start:1px solid var(--outline-variant)}
.guide-steps li:first-child{border-block-start:none}
.guide-steps__n{display:grid;place-items:center;flex:none;inline-size:28px;block-size:28px;border-radius:50%;background:var(--secondary-container);color:var(--on-secondary-container);font-size:var(--typo-label-lg);font-weight:600;font-variant-numeric:tabular-nums}
.guide-steps__text{flex:1;min-inline-size:200px;display:flex;flex-direction:column;align-items:flex-start;gap:var(--space-1)}
.guide-steps li{align-items:flex-start}
.guide-steps--done .guide-steps__n{background:var(--st-success-bg);color:var(--st-success-fg)}
.guide-steps__n .icon{inline-size:18px;block-size:18px}
.guide-steps__link{color:var(--primary);font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh);font-weight:500;text-decoration:none}
.guide-steps__link:hover{border-radius:var(--shape-xs);background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.help-page{max-inline-size:880px}
.help-tech > summary{cursor:pointer;color:var(--on-surface-variant);font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh);font-weight:500}
.help-tech[open] > summary{margin-block-end:var(--space-2)}
.guide-steps h3,.guide dt{font-size:var(--typo-title-sm);line-height:var(--typo-title-sm-lh);font-weight:600}
.guide-steps p,.guide dd{color:var(--on-surface-variant)}
.guide{display:flex;flex-direction:column;gap:var(--space-1)}
.guide dt{margin-block-start:var(--space-2)}
.more-list{padding:var(--space-2);gap:0}
.more-list__item{display:flex;align-items:center;gap:var(--space-3);min-block-size:56px;padding:var(--space-2) var(--space-3);border-radius:var(--shape-md);color:var(--on-surface);text-decoration:none}
.more-list__item:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.more-list__item > .icon{color:var(--on-surface-variant)}
.more-list__text{flex:1;display:flex;flex-direction:column;min-inline-size:0}

/* ---------- sign-in and the organization picker (one card) ---------- */
.center{display:grid;place-items:center;min-block-size:100vh;min-block-size:100dvh;padding:var(--space-6) var(--space-4);background:var(--background)}
.login-card{align-items:stretch;gap:0;inline-size:100%;max-inline-size:360px;padding:var(--space-5);text-align:center}
.edara-lockup--login{flex-direction:column;gap:var(--space-2);align-self:center}
.edara-lockup--login .sub{font-size:var(--typo-label-lg);line-height:var(--typo-label-lg-lh)}
.login-sub{margin-block:var(--space-2) var(--space-4);color:var(--on-surface-variant)}
/* The slot below the button, hidden until sign-in fails. App copy, never the raw message. */
.login-error{margin-block-start:var(--space-3);padding:var(--space-2) var(--space-3);border-radius:var(--shape-xs);background:var(--error-container);color:var(--on-error-container);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);text-align:start}
.login-foot{display:flex;align-items:center;gap:var(--space-2);margin-block-start:var(--space-5);padding-block-start:var(--space-3);border-block-start:1px solid var(--outline-variant);color:var(--on-surface-variant);font-size:var(--typo-label-sm);line-height:var(--typo-label-sm-lh)}
.login-foot--end{justify-content:flex-end;margin-block-start:var(--space-3)}
.login-social{display:flex;align-items:center;gap:var(--space-2);margin-inline-start:auto}
.login-social a{display:grid;place-items:center;inline-size:24px;block-size:24px;border-radius:50%;color:inherit}
.login-social .icon{inline-size:16px;block-size:16px}
.login-lang{padding:var(--space-1) var(--space-2);border:none;border-radius:var(--shape-xs);background:none;color:inherit;font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:600}
.login-lang:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.login-actions{display:flex;flex-direction:column;gap:var(--space-2);margin-block-start:var(--space-2)}
.login-card.orgs{max-inline-size:380px;max-block-size:calc(100dvh - 2 * var(--space-6));overflow:hidden}
.orgs__title{margin-block:var(--space-4) 2px;font-family:var(--font-headline);font-size:var(--typo-title-md);line-height:var(--typo-title-md-lh);font-weight:600}
.orgs .login-sub{margin-block-end:var(--space-3)}
.login-div{block-size:1px;margin-block:var(--space-3);background:var(--outline-variant)}
.login-search{display:flex;align-items:center;gap:var(--space-2);min-block-size:var(--min-touch-target);margin-block-end:var(--space-2);padding-inline:var(--space-3);border:1px solid var(--outline-variant);border-radius:var(--shape-sm);color:var(--on-surface-variant)}
.login-search:focus-within{border-color:var(--primary);box-shadow:inset 0 0 0 1px var(--primary)}
.login-search input{flex:1;min-inline-size:0;border:none;outline:none;background:none;color:var(--on-surface)}
.orgs__list{display:flex;flex-direction:column;flex:0 1 auto;min-block-size:88px;max-block-size:360px;overflow:auto}
.login-card.orgs > :not(.orgs__list){flex:none}
.orgs__none{padding:var(--space-3)}
.orgrow{display:flex;align-items:center;gap:var(--space-3);inline-size:100%;min-block-size:var(--min-touch-target);padding:var(--space-2) var(--space-3);border:none;border-radius:var(--shape-sm);background:none;color:var(--on-surface);text-align:start}
.orgrow:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.orgrow i{display:grid;place-items:center;flex:none;inline-size:26px;block-size:26px;border-radius:50%;background:var(--secondary-container);color:var(--on-secondary-container);font-style:normal;font-size:var(--typo-label-sm);font-weight:700}
.orgrow__name{flex:1;min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.orgrow--quiet{color:var(--on-surface-variant)}
.orgrow--current{background:var(--secondary-container);color:var(--on-secondary-container)}
.orgrow--current:hover{background:color-mix(in srgb,var(--on-secondary-container) calc(var(--state-hover)*100%),var(--secondary-container))}
.orgrow__current{display:inline-flex;align-items:center;gap:var(--space-1);flex:none;font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:600}
.orgrow__current .icon{inline-size:18px;block-size:18px}

/* ---------- window classes ---------- */
@media (max-width:839px){
  .grid2,.grid3{grid-template-columns:1fr}
  .stat{display:grid;grid-template-columns:1fr auto;align-items:center;column-gap:var(--space-3)}
  .stat .big{grid-row:1;grid-column:2;font-size:var(--typo-headline-sm);line-height:var(--typo-headline-sm-lh)}
}
/* Compact (under 600px): no rail, the bottom bar instead; 16px margins. The one breakpoint
   that changes the navigation, so the content offset, the mirror and the swap never disagree. */
@media (max-width:599px){
  .app{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto auto;grid-template-areas:"header" "view" "foot" "nav"}
  .side-nav{display:none}
  .bottom-nav{grid-area:nav;display:flex;gap:2px;block-size:calc(var(--bar-height) + env(safe-area-inset-bottom,0px));padding:var(--space-1) var(--space-1) calc(var(--space-1) + env(safe-area-inset-bottom,0px));background:var(--surface);border-block-start:1px solid var(--outline-variant)}
  .app-header{block-size:56px;gap:var(--space-1);padding-inline:var(--space-3)}
  .header-lead{gap:var(--space-2)}
  /* These move into the account menu on a phone, which shows a row for each hidden control. */
  .org-slot,.header-divider,#themeToggleBtn,#headerLangToggle,.header-status{display:none}
  .view{padding:var(--space-4) var(--space-4) var(--space-8)}
  .view-foot{padding-inline:var(--space-4)}
  .savebar .btn{flex:1 1 auto}
  .savebar__note{flex-basis:100%}
  .toast-host,html.rail-collapsed .toast-host{inset-inline-start:var(--space-4);inset-block-end:calc(var(--bar-height) + var(--space-3))}
  body:has(.savebar:not([hidden])) .toast-host{inset-block-end:calc(var(--bar-height) + 2 * var(--space-8) + var(--space-7))}
  .page-actions .btn{flex:1 1 auto}
  .action-note{justify-content:flex-start;text-align:start}
  .line__sep{display:none}   /* the parts of a one-line card wrap onto lines of their own */
  .line__tools{flex:1 1 100%;flex-wrap:wrap;margin-inline-start:0}
  .preview-form__fields > *{flex:1 1 100%}
  .preview-form__fields > .tf{flex:1 1 100%;max-inline-size:none}
  .line__tools > .search-box{inline-size:100%}
  .creds-actions > .action-note{flex-basis:100%}
  /* A step's action goes under its text, lined up with it. */
  .connect-steps > li:has(> .btn) > .checklist__text{flex-basis:calc(100% - 28px - var(--space-3))}
  .connect-steps > li > .btn{margin-inline-start:calc(28px + var(--space-3))}
  .modal-foot .btn{flex:1 1 auto}
  dialog.dp{inset:0;margin:auto}
  /* One card per row, each cell labelled from its own data-label, so nothing scrolls sideways. */
  .reflow thead{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%)}
  .reflow,.reflow tbody,.reflow tr,.reflow td{display:block;inline-size:auto}
  .reflow tr{padding:var(--space-3) var(--space-4);border-block-end:1px solid var(--outline-variant)}
  .reflow tr:last-child{border-block-end:none}
  .reflow td{display:flex;gap:var(--space-3);padding:var(--space-1) 0;border:none}
  .reflow td.num{text-align:start}
  .reflow td[data-label]::before{content:attr(data-label);flex:none;inline-size:38%;max-inline-size:140px;color:var(--on-surface-variant);font-size:var(--typo-body-sm);line-height:var(--typo-body-md-lh)}
  .reflow td > *{min-inline-size:0}
  /* An item's fields carry their own names, so its cell drops the column name and takes the width. */
  .reflow td.item-cell::before{display:none}
  .reflow td.item-cell > .item-fields{flex:1}
  .reflow td bdi.code{white-space:normal}
  .reflow .group__head th{display:block;margin-block-end:var(--space-2);border-radius:var(--shape-sm)}
}
/* Before the frame exists (sign-in, the picker) there is no rail to clear. */
body:not(:has(.app)) .toast-host{inset-inline-start:var(--space-5)}
@media (forced-colors:active){
  .chip,.banner,.callout{border:1px solid CanvasText}
}

/* ---------- Arabic and right to left ----------
   Layout mirrors by itself (logical properties), and the shared tokens switch the font to Cairo
   and zero the letter spacing under [dir=rtl]. These are the few things that need saying. */
[dir="rtl"] .flip-rtl{transform:scaleX(-1)}           /* icons that point, and the question mark */
[dir="rtl"] .rail-toggle svg{transform:scaleX(-1)}    /* the glyph's divider sits on the leading edge */
/* The language button is set in the font of the language it names. */
.lang-btn [lang="ar"],[lang="ar"].login-lang{font-family:'Cairo','Roboto',sans-serif;letter-spacing:0}
.lang-btn [lang="en"],[lang="en"].login-lang{font-family:'Inter','Roboto',sans-serif}

/* Preview: the run and its calls on the title's line; what it covers under it; the values every
   row shares said once; the reasons as one line; the latest previews before anything is run. */
.preview-head{align-items:center;gap:var(--space-3)}
.preview-head__links{font-size:var(--typo-body-sm);white-space:nowrap}
.preview-span,.preview-last{margin:0}
.preview-same{margin:0 0 var(--space-2)}
.preview-same__item{white-space:nowrap}
.preview-reason{max-inline-size:100%;gap:var(--space-1)}
.preview-reason__text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-inline-size:40ch}
.preview-latest{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}
.preview-latest__item{display:flex;align-items:center;gap:var(--space-3);padding-block:var(--space-2);border-block-start:1px solid var(--outline-variant)}
.preview-latest__item:first-child{border-block-start:none}
.preview-latest__item .muted{margin:var(--space-1) 0 0}
.preview-head + .preview-span{margin-block-start:calc(-1 * var(--space-2))}
.preview-latest__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-3)}
/* The held-back reasons: what fixes a group, then its records by order. */
.group__fix{display:flex;flex-direction:column;align-items:flex-start;gap:var(--space-1);margin:0;padding:0 var(--space-4) var(--space-2)}
.group__fix p{margin:0}
.group__customers{display:flex;flex-wrap:wrap;gap:var(--space-1) var(--space-4);margin:0;padding:0;list-style:none}
.group__order{margin:0;font-weight:500}
.group__line{margin-inline-start:var(--space-3)}
.preview-span{display:flex;flex-wrap:wrap;align-items:center;gap:0 var(--space-2)}
.preview-span__note{color:var(--on-surface-variant)}
.group__lines{margin-block-start:var(--space-2);overflow-x:auto}

/* ---------- Insider view ---------- */
.ins-week{display:flex;flex-wrap:wrap;gap:var(--space-2)}
.ins-week__day{display:flex;flex-direction:column;gap:2px;min-inline-size:110px;padding:var(--space-2) var(--space-3);border:1px solid var(--outline-variant);border-radius:var(--shape-sm);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.ins-week__day--bad{border-color:var(--st-error-fg);color:var(--st-error-fg)}
.ins-people{display:flex;flex-direction:column;gap:var(--space-1);margin:0;padding:0;list-style:none}
.ins-add{align-items:flex-start;gap:var(--space-3)}
.ins-env{display:inline-flex;align-items:center;gap:var(--space-1);margin-inline-end:var(--space-3)}
.ins-why{min-inline-size:220px}
.ins-week__day--none{color:var(--on-surface-variant);background:var(--surface-container)}
.ins-id{display:flex;align-items:center;gap:var(--space-1)}
.ins-copy{inline-size:28px;block-size:28px;min-inline-size:28px}
.ins-copy .icon{inline-size:16px;block-size:16px}
/* The Insider view's tables are wide: it takes the whole width the window gives. */
.view-inner:has(.ins-root),.view-inner:has(.runs-wide){max-inline-size:none}
.ins-said{min-inline-size:200px;max-inline-size:340px}
.ins-calls{display:grid;grid-template-columns:auto auto;justify-content:start;align-items:center;gap:var(--space-1) var(--space-2);white-space:nowrap}
.guide-checklist{margin:var(--space-1) 0 var(--space-2);padding-inline-start:var(--space-5)}
.guide-steps .guide-checklist li{display:list-item;margin:2px 0;padding:0;border:none}
.guide-steps__toggle{align-self:flex-start}
.app-version{display:flex;align-items:center;gap:var(--space-2)}
.help-copy{inline-size:28px;block-size:28px;min-inline-size:28px}
.help-copy .icon{inline-size:16px;block-size:16px}
/* Runs: a report's trace ID, short and copied with a click; held back compared with the run before. */
.trace-chip{display:inline-flex;align-items:center;gap:4px;padding:0 6px;min-block-size:24px;border:none;border-radius:var(--shape-xs);background:transparent;color:var(--on-surface-variant);font-size:var(--typo-label-md);cursor:pointer}
.trace-chip:hover{background:color-mix(in srgb,currentColor calc(var(--state-hover)*100%),transparent)}
.trace-chip .icon{inline-size:14px;block-size:14px}
.held-change{display:inline-flex;align-items:baseline;gap:var(--space-1)}
.held-change__by{font-size:var(--typo-label-md)}
.held-change__by--up{color:var(--st-warning-fg)}
.held-change__by--down{color:var(--st-success-fg)}
/* Runs: the search box beside Show previews; the ticked runs' export at the end of the line. */
.runs-tools{align-items:center;flex-wrap:wrap;gap:var(--space-2) var(--space-3)}
.runs-tools > .search-box{inline-size:min(100%,300px)}
.picked-bar{margin-inline-start:auto;align-items:center;gap:var(--space-2)}
.run-pick{inline-size:18px;block-size:18px;accent-color:var(--primary);cursor:pointer}
/* Insider view: why an organization needs a look, under its name; the commonest held-back reasons. */
.ins-why-line{display:flex;align-items:flex-start;gap:var(--space-1);color:var(--st-warning-fg)}
.ins-why-line > .icon{flex:none;inline-size:16px;block-size:16px;margin-block-start:2px}
.ins-reasons{margin:var(--space-1) 0 0;padding:0;list-style:none;font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh);color:var(--on-surface-variant)}
.ins-reasons > li + li{margin-block-start:2px}
/* Insider view: a reason's count stays on one line; a failed call that has worked since says so. */
.ins-reasons__n{white-space:nowrap}
.ins-fixed{color:var(--st-success-fg)}
/* Insider view: it covers every organization, so it says so under the title, and the organization
   in the header is set apart (outlined, no fill) while it's open. */
.ins-scope{display:flex;align-items:center;gap:var(--space-1)}
.ins-scope > .icon{flex:none;inline-size:16px;block-size:16px}
.in-insider .org-pill{background:transparent;box-shadow:inset 0 0 0 1px var(--outline-variant)}
.in-insider .org-pill i{background:var(--surface-container);color:var(--on-surface-variant)}
/* Runs: the tick boxes' column is as narrow as a box; a run's status or other environment sits
   under it rather than in a column of its own. */
th.pick-col,td.pick-col{inline-size:1%;padding-inline-end:0}
.run-cell{display:flex;flex-direction:column;align-items:flex-start;gap:var(--space-1)}
/* Runs list: one report per line, its name, result and batch ID in aligned columns. */
.report-grid{display:grid;grid-template-columns:max-content max-content max-content;align-items:center;gap:var(--space-1) var(--space-3)}
.report-grid > .report-chip{display:contents}
.report-grid > .report-chip > *{justify-self:start}
/* A call's request and answer, kept for it: a taller block, still scrolled inside itself. */
.call-bodies{display:flex;flex-direction:column;gap:var(--space-2)}
.codeblock--tall{max-block-size:420px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere}
.ins-open{display:flex;flex-direction:column;align-items:flex-start;gap:0}
.ins-open .btn-text{min-block-size:32px}
.ins-reasons__head{margin-block-start:var(--space-1)}
.ins-recording{display:flex;align-items:center;gap:var(--space-1);color:var(--st-error-fg)}
.ins-recording > .icon{inline-size:14px;block-size:14px}
.ins-org{min-inline-size:180px}
/* The Insider view's tables fit the window: the Last run reasons and the Setup list wrap first. */
.ins-reasons{min-inline-size:180px}
/* Insider view, Runs: the organization on one or two lines; why a run failed wraps in its column. */
.ins-org-sm{min-inline-size:150px}
td.ins-why{min-inline-size:200px;max-inline-size:280px;white-space:normal}
/* An empty value is a quiet dash; a held-back row's missing field is marked in the warning colour. */
.nothing{color:var(--on-surface-variant)}
.kv-gap{color:var(--st-warning-fg);font-weight:600}
/* A row's "Details" stays on one line, closed or open. */
.rowdata > summary{white-space:nowrap}
/* A run's page: its head on one line, a tab per report with what it holds back, each report's
   counts and IDs on two lines. */
.run-line{flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-2);margin:0}
.run-line__calls{margin-inline-start:var(--space-2)}
.report-tab{display:inline-flex;align-items:center;gap:var(--space-2)}
.report-tab__n{display:inline-grid;place-items:center;min-inline-size:22px;padding:0 6px;border-radius:999px;background:var(--st-warning-bg);color:var(--st-warning-fg);font-size:var(--typo-label-sm);line-height:20px;font-weight:600}
/* One line of one size: the period (with its icon) and the counts share a centre line. */
.report-line{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-2);margin:0;font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh)}
.report-line .data-span,.report-line .data-span b{font-size:inherit;line-height:inherit;font-weight:inherit}
/* The IDs start where the line above does: the first chip's own padding is pulled back. */
.report-ids{flex-wrap:wrap;gap:var(--space-1) var(--space-3);margin:0}
.report-ids > .trace-chip:first-child{margin-inline-start:-6px}
/* Held back: the items to pick a part number for; lines tables lead with the missing field. */
.group__fixline{margin:var(--space-2) 0 var(--space-1)}
.pick-items{margin:0;padding:0;list-style:none;display:grid;grid-template-columns:minmax(180px,1fr) auto minmax(150px,max-content);gap:var(--space-1) var(--space-4);align-items:baseline}
.pick-items > li{display:contents}
.pick-items__refs{font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.group__all{margin-block-start:var(--space-2)}
.lines-table__same{margin:0 0 var(--space-2)}
th.col-gap{color:var(--st-warning-fg)}
.group__customers{display:grid;grid-template-columns:max-content max-content;gap:2px var(--space-4);margin:var(--space-1) 0;padding:0;list-style:none}
.group__customers > li{display:contents}
.group__body{padding:0 var(--space-4) var(--space-3)}
/* A lines table: what every line shares as label/value pairs that wrap, room under its toggle. */
.lines-table{display:flex;flex-direction:column;gap:var(--space-2);margin-block-start:var(--space-2)}
.lines-table__same{display:flex;flex-wrap:wrap;gap:var(--space-1) var(--space-4);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.lines-table__pair{display:inline-flex;gap:var(--space-1);align-items:baseline}
.lines-table__pair b{font-weight:500}
/* One row's data in two columns of label/value pairs, so it's half as tall. */
@media (min-width:900px){
  .rowdata .kv{grid-template-columns:max-content minmax(0,1fr) max-content minmax(0,1fr);column-gap:var(--space-4)}
}
/* A part number picked from the held-back list: its choices as buttons, then what was picked. */
.pick-items__pns{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-2)}
.pick-pn{min-block-size:32px;font-family:var(--font-mono,monospace)}
.pick-items__done{display:inline-flex;align-items:center;gap:var(--space-1);color:var(--st-success-fg)}
.pick-items__done > .icon{inline-size:16px;block-size:16px}
/* Picking a part number: a heading row says what each column is; each choice says what its row on
   Dahua's sheet says, under it. */
.pick-items__head > span{color:var(--on-surface-variant);font-size:var(--typo-label-sm);line-height:var(--typo-label-sm-lh);font-weight:500}
.pick-items{align-items:start}
.pick-items__pns{flex-direction:column;align-items:flex-start}
.pick-choice{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-2)}
.pick-choice__said{font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
/* Picking a part number: one block per item (its name and what it holds back), then its part
   numbers in a column, each with its sheet row's internal model beside it, lined up. */
.pick-items{display:flex;flex-direction:column;gap:var(--space-3)}
.pick-items > li.pick-item{display:flex;flex-direction:column;gap:var(--space-2);padding-block-end:var(--space-3);border-block-end:1px solid var(--outline-variant)}
.pick-items > li.pick-item:last-child{border-block-end:0;padding-block-end:0}
.pick-item__head{display:flex;flex-wrap:wrap;justify-content:space-between;gap:var(--space-1) var(--space-4);align-items:baseline}
.pick-item__refs{font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
.pick-item__choices{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:var(--space-2) var(--space-3);align-items:center;padding-inline-start:var(--space-3)}
.pick-item__choices--done{display:block}
.pick-choice__pn{font-family:var(--font-mono,monospace)}
.pick-items{margin-block:var(--space-2) var(--space-3)}
/* Reports to send: a tile per report (its name, Dahua's number, what it holds), side by side. */
.checks:has(> .check--tile){display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:var(--space-2) var(--space-3)}
.checks:has(> .check--tile) > legend{margin-block-end:var(--space-1)}
.checks > legend,.checks > .help,.checks > .tf-error{grid-column:1 / -1}
.check--tile{align-items:flex-start;padding:var(--space-2) var(--space-3);border:1px solid var(--outline-variant);border-radius:var(--radius-md,12px)}
.check--tile:has(input:checked){border-color:var(--primary);background:color-mix(in srgb,var(--primary) 6%,transparent)}
.check--tile input{margin-block-start:3px}
.check__text{display:grid;grid-template-columns:1fr auto;gap:0 var(--space-2);align-items:baseline}
.check__name{font-weight:500}
.check__num{color:var(--on-surface-variant);font-size:var(--typo-label-sm);line-height:var(--typo-label-sm-lh);white-space:nowrap}
.check__about{grid-column:1 / -1;color:var(--on-surface-variant);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}
/* A line between settings, and tighter rows, so a section fits the window. */
.settings-group > .settings-fields{gap:var(--space-3) var(--space-6)}
.settings-group > .settings-fields > * + *{border-block-start:1px solid var(--outline-variant);padding-block-start:var(--space-3)}
.settings-group > .settings-fields .field-effect{padding-inline:var(--space-4) 0}
/* A preview's counts on one line (read, would be sent, held back), the last send under it. */
.preview-strip{display:flex;flex-direction:column;gap:var(--space-1)}
.preview-strip__counts{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--space-1) var(--space-5);margin:0}
.preview-strip__n{font-size:var(--typo-title-lg);line-height:var(--typo-title-lg-lh);font-weight:600}
.preview-strip__n--ok{color:var(--st-success-fg)}
.preview-strip__n--warn{color:var(--st-warning-fg)}
/* Held back for a customer code: a customer per line, its orders folded under it. */
.group__custs{list-style:none;margin:0 var(--space-4) var(--space-3);padding:0;display:flex;flex-direction:column}
.group__custs > li{border-block-start:1px solid var(--outline-variant)}
.group__cust > summary{display:list-item;padding-block:var(--space-2);cursor:pointer}
.group__cust > summary > .muted{margin-inline-start:var(--space-3)}
.group__cust > .group__rows{padding:0 0 var(--space-2);padding-inline-start:var(--space-5)}
.table td.col-name{min-inline-size:12ch;max-inline-size:28ch}
/* A call's request as one address, copied with a click; a long one wraps. */
.request-url{font-size:inherit;color:var(--on-surface);text-align:start;padding-inline:0 6px;max-inline-size:100%}
.request-url > bdi{overflow-wrap:anywhere}
/* The Dahua brands: the brands the Edara items have, to pick from; under them, a brand no item has. */
.brand-picks{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-2);margin-block-start:var(--space-1);padding-inline:var(--space-4) 0}
.brand-picks > .help{margin:0}
.brand-picks .chip{min-block-size:28px}
.field-effect--warn[hidden]{display:none}
/* An item not on Dahua's sheet: the nearest model, under its name. */
.pick-item__nearest{margin:0;padding-inline-start:var(--space-3);font-size:var(--typo-body-sm);line-height:var(--typo-body-sm-lh)}

/* The matching rule (Mapping → Edara items): the Edara field on one side, Dahua's sheet columns
   (in the order tried) on the other, an arrow between; side by side, stacked on a phone. */
.rule-card{display:flex;flex-direction:column;gap:var(--space-3)}
.rule__head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--space-3)}
.rule__head .help{margin:0}
.rule__title{margin:0 0 var(--space-1);font-size:var(--typo-title-sm);line-height:var(--typo-title-sm-lh)}
.rule{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1.4fr);align-items:stretch;gap:var(--space-3);max-inline-size:860px}
.rule__side{display:flex;flex-direction:column;gap:var(--space-2);padding:var(--space-3);border:1px solid var(--outline-variant);border-radius:var(--shape-sm);background:var(--surface-container)}
.rule__side-label{color:var(--on-surface-variant);font-size:var(--typo-label-md);line-height:var(--typo-label-md-lh);font-weight:600}
.rule__field{font-size:var(--typo-body-md);line-height:var(--typo-body-md-lh);color:var(--on-surface)}
.rule__arrow{display:grid;place-items:center;color:var(--primary)}
.rule__arrow .icon{inline-size:28px;block-size:28px}
.rule__cols{display:flex;flex-direction:column;gap:var(--space-1);margin:0;padding-inline-start:var(--space-5);font-weight:600;color:var(--on-surface)}
.rule__example{margin:0}
.rule__example .code{font-weight:600;color:var(--on-surface)}
.rule__pick{display:flex;flex-direction:column;gap:var(--space-1);margin:0;padding:0;list-style:none}
.rule__pick-row{display:flex;align-items:center;gap:var(--space-2);padding:2px var(--space-2);border-radius:var(--shape-xs);background:var(--card)}
.rule__pick-row label{flex:1;font-weight:600;color:var(--on-surface)}
.rule__pick-row--off label{font-weight:400;color:var(--on-surface-variant)}
.rule__pick-n{display:grid;place-items:center;flex:none;inline-size:22px;block-size:22px;border-radius:50%;background:var(--primary);color:var(--on-primary);font-size:var(--typo-label-sm)}
.rule__pick-row--off .rule__pick-n{background:none}
.rule__pick-move{display:flex}
.rule__result{display:flex;flex-direction:column;gap:var(--space-2)}
.rule__result-title{margin:0;font-weight:600}
.rule__stats{display:flex;flex-wrap:wrap;gap:var(--space-2)}
.rule__stat{display:flex;flex-direction:column;min-inline-size:120px;padding:var(--space-2) var(--space-3);border:1px solid var(--outline-variant);border-radius:var(--shape-sm)}
.rule__stat-label{color:var(--on-surface-variant);font-size:var(--typo-label-md)}
.rule__stat b{font-size:var(--typo-title-sm);line-height:var(--typo-title-sm-lh)}
.rule__stat-was{color:var(--on-surface-variant);font-size:var(--typo-label-sm)}
.rule__foot{justify-content:flex-end;gap:var(--space-2)}
button.flow__change{border:none;background:none;padding:0 2px;color:var(--primary);font:inherit;cursor:pointer}
@media (max-width:720px){
  .rule{grid-template-columns:minmax(0,1fr)}
  .rule__arrow .icon{transform:rotate(90deg)}
  .rule__head{flex-direction:column}
}
