/* ui.css — small additions on top of the design layer (css/app.css + tokens). Everything here is
   implementation glue that the static prototypes did not need; it only uses design tokens. */

/* view enter transition: one short fade/slide, switched off for reduced motion */
.view__inner > #page.is-entering, #page.is-entering { animation: view-enter var(--dur-3, 200ms) var(--ease-out, ease-out) 1; }
@keyframes view-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#page.is-loading { opacity: .6; transition: opacity var(--dur-2, 120ms); }
@media (prefers-reduced-motion: reduce) { #page.is-entering { animation: none; } }

.noscript { padding: var(--space-6); text-align: center; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-5); background: var(--surface-page); color: var(--text-dark); }
.login__panel { width: min(100%, 28rem); display: grid; gap: var(--space-4); background: var(--surface-card); border: var(--border-hair, 1px solid var(--hair-dark)); border-radius: var(--radius-md); padding: var(--space-6); box-shadow: var(--elev-2); }
.login__brand { display: flex; align-items: center; gap: var(--space-2); color: var(--signal); }
.login .list { display: grid; gap: var(--space-2); }

/* self-service home tiles */
.grid-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: var(--gap-grid); }
.tile { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-5) var(--space-3); min-height: var(--tap-min); background: var(--surface-card); border: var(--border-hair, 1px solid var(--hair-dark)); border-radius: var(--radius-md); color: var(--text-dark); text-decoration: none; }
.tile:hover { background: var(--surface-card-hover); }
.tile .icon { width: 28px; height: 28px; color: var(--signal); }
.tile__label { font-weight: var(--fw-medium); }

/* roles: master/detail */
.split { display: grid; gap: var(--gap-grid); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 64rem) { .split { grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr); } }
.list--selectable [aria-selected="true"] { background: var(--signal-wash); box-shadow: inset 3px 0 0 var(--signal); }

/* location tree */
.tree { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.tree__item { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--hair-dark); }
.tree__item--none .tree__name { color: var(--muted-dark); }
.tree__indent { display: inline-block; width: 0; }
.tree__indent[data-depth="1"] { width: var(--space-5); } .tree__indent[data-depth="2"] { width: var(--space-8); } .tree__indent[data-depth="3"] { width: var(--space-10); }
.tree__name { flex: 1 1 auto; min-width: 0; }

/* small helpers the markup uses that the design layer does not define */
.mt-2 { margin-top: var(--space-2); }
.right { text-align: right; }
.select--inline { width: auto; min-width: 9rem; }
.segment--wrap { flex-wrap: wrap; }
.t-warn { color: var(--conn-stale); }
.stat__value--sm { font-size: var(--fs-h3); }
.is-disabled { opacity: .6; }
.install-hint { margin: var(--space-4) var(--pad-view); }
.view:focus { outline: none; }

/* Fixes where the design prototypes rely on rules that do not win in the cascade (found in browser checks):
   - .freshness__icon is declared before .icon, so .icon's 20px wins; the footer icon must be 12px.
   - .list-item__title / __sub are <span>s in the prototypes; without block display, title and hint run together. */
.freshness .freshness__icon { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; margin-right: var(--space-2); }
.list-item__title, .list-item__sub { display: block; }

/* Dynamic-page forms: fields keep their natural height and align to the top of their grid row, so a longer
   hint in one cell does not stretch (or bottom-align) its neighbour. */
.dp-grid { align-items: start; }
.field { align-content: start; }
/* data tables: numbers and phone numbers never wrap; the sort control is plain text (the arrow comes from aria-sort) */
.table td.num, .table th.num { white-space: nowrap; }
.th-sort { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; text-align: inherit; }
.th-sort:hover { color: var(--text-dark); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--signal); }
.dp-grid > .field { margin-top: 0; }               /* `.field + .field` stacking margin must not apply inside a grid */
.dp-grid .input, .dp-grid .select { width: 100%; box-sizing: border-box; }

/* Checkbox/radio controls that match the dark theme (the native white boxes are the loudest thing on the page otherwise).
   Switches (.switch) have their own design and are not touched. */
.table input[type="checkbox"], input[type="radio"].check {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto; margin: 0; cursor: pointer;
  width: 18px; height: 18px; display: inline-grid; place-content: center;
  background: var(--surface-input); border: 1.5px solid var(--border-control); border-radius: 4px;
}
input[type="radio"].check { border-radius: 50%; width: 20px; height: 20px; }
.table input[type="checkbox"]:hover, input[type="radio"].check:hover { border-color: var(--border-control-hover, var(--signal)); }
.table input[type="checkbox"]:checked, input[type="radio"].check:checked { background: var(--signal); border-color: var(--signal); }
.table input[type="checkbox"]:checked::after { content: ""; width: 5px; height: 9px; border: solid var(--signal-ink, #0A0F16); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
input[type="radio"].check:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--signal-ink, #0A0F16); }
.table input[type="checkbox"]:focus-visible, input[type="radio"].check:focus-visible { outline: var(--focus-width, 2px) solid var(--focus-dark, var(--signal)); outline-offset: var(--focus-offset, 2px); }
.table td.check-cell, .table th.check-cell { overflow: visible; text-overflow: clip; }

/* users table: give the system chips and the extension the room they need instead of ellipsis / two-line chips */
.table--users col.c-name { width: 23%; } .table--users col.c-upn { width: 22%; } .table--users col.c-dn { width: 9.5rem; }
.table--users col.c-loc { width: 15%; } .table--users col.c-sys { width: 17%; }
.table--users .syschips { flex-wrap: nowrap; }
.table--users { table-layout: auto; }
.table--users td.truncate { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table--users td.num, .table--users td .syschips { white-space: nowrap; overflow: visible; text-overflow: clip; }
/* radios inside list items keep their round shape (the design's .check is a flex row with a 44px minimum height) */
input[type="radio"].check { min-height: 0; min-width: 0; flex: 0 0 20px; align-self: center; aspect-ratio: 1; }

