/*
 * AICoE Design System — components (the kit)
 *
 * Canonical component classes, extracted verbatim from aicoe-intranet
 * templates/base.html (commit 8e914c7) and hardened per the v1.2 review.
 * Tokens resolve from dist/tokens.css. Import tokens.css BEFORE this file.
 *
 * This file is the pure component kit. Application chrome (top bar, nav,
 * auth shell, stat cards) lives in aicoe-shell.css — vendor that only if you
 * need the intranet-style chrome.
 *
 * Use the classes with the markup in components/recipes.md. Do not re-author
 * components in new tokens — vendor this file with provenance.
 */

/* box-sizing: every width:100% element is border-box by default */
*, *::before, *::after { box-sizing: border-box; }

/* ── Content primitives ── */
.kicker { font-size: 11.5px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase;
          color: var(--teal-600); margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.kicker::after { content: ""; width: 26px; height: 2px; background: var(--teal-500);
                 border-radius: 1px; opacity: .6; }
.page-title { font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em;
              color: var(--ink-900); font-size: var(--text-2xl); line-height: 1.1; margin: 0 0 6px; }
.page-sub { font-size: var(--text-base); color: var(--textSecondary); line-height: 1.6; margin: 0 0 22px; max-width: 70ch; }
.lede { font-size: 17.5px; line-height: 1.6; color: var(--textSecondary); max-width: 62ch; margin: 0 0 30px; }

/* ── Breadcrumbs (APG pattern — nav[aria-label="Breadcrumb"] > ol.crumbs) ── */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; list-style: none;
  margin: 0 0 var(--space-3); padding: 0; font-size: var(--text-sm); font-weight: 650; }
.crumbs li { display: flex; align-items: center; gap: 8px; color: var(--textSecondary); }
.crumbs li + li::before { content: "/"; color: var(--ink-300); font-weight: 700; }
.crumbs a { color: var(--textSecondary); text-decoration: none; border-radius: 4px; }
.crumbs a:hover { color: var(--teal-800); text-decoration: underline; text-underline-offset: 2px; }
.crumbs a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.crumbs [aria-current="page"] { color: var(--ink-900); font-weight: 800; }

/* ── Command palette (behaviour: aicoe-palette.js) — a top-anchored .modal ── */
/* Keep palette spacing more specific than the generic modal reset below. */
dialog.modal.palette { display: flex; flex-direction: column; gap: var(--space-3);
  width: min(560px, calc(100vw - 24px)); max-height: min(70vh, 560px);
  margin: 12vh auto auto; padding: var(--space-4); }
dialog.palette[open] { display: flex; flex-direction: column; }
dialog.palette > :not(.palette-list) { flex-shrink: 0; }
dialog.palette > .kicker { margin-bottom: 0; }
.palette-list { overflow-y: auto; margin: 0; padding: 0 0 2px; min-height: 52px; }
.palette .menu-item[aria-selected="true"] { background: var(--ink-100); color: var(--ink-900); }
.palette .menu-item .item-hint { margin-left: auto; font-size: var(--text-xs); font-weight: 650; color: var(--textMuted); }
.palette-empty { padding: var(--space-4); text-align: center; font-size: var(--text-sm); color: var(--textMuted); }
.palette-hint { display: flex; justify-content: space-between; padding: 2px 6px 0;
  font-size: var(--text-xs); font-weight: 650; color: var(--textMuted); }
.menu-item[hidden] { display: none; }
kbd { font-family: var(--font-mono); font-size: .85em; font-weight: 700; color: var(--ink-600);
  background: var(--ink-050); border: 1px solid var(--ink-200); border-radius: 5px; padding: 1px 5px; }


/* ── Buttons ── */
.m-btn { border: none; border-radius: var(--radius-md); padding: var(--space-3) var(--space-5); font-size: var(--text-base); font-weight: 700;
         font-family: inherit; box-shadow: var(--shadow-sm); display: inline-flex; align-items: center;
         gap: var(--space-2); cursor: pointer; text-decoration: none; line-height: 1;
         transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out),
                     filter var(--dur-fast) var(--ease-out); }
.m-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.m-btn:active { transform: translateY(0) scale(.985); box-shadow: var(--shadow-sm); }
.m-btn.primary { background: var(--ink-900); color: var(--surface); }
.m-btn.primary:hover { background: var(--ink-800); }
.m-btn.accent  { background: var(--teal-500); color: var(--onAccent); }
.m-btn.accent:hover { background: var(--teal-400); }
.m-btn.ghost   { background: var(--surface); color: var(--ink-800); border: 1.5px solid var(--ink-200); }
.m-btn.sm { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.m-btn.danger-ghost { background: var(--surface); color: var(--danger); border: 1.5px solid var(--red-300); }
.m-btn.danger-ghost:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* disabled + loading states */
.m-btn:disabled, .m-btn[aria-disabled="true"], .btn[aria-disabled="true"] {
  background: var(--ink-100); color: var(--ink-300); box-shadow: none; transform: none;
  cursor: not-allowed; filter: none;
}
.m-btn:disabled:hover { transform: none; box-shadow: none; }
.m-btn.is-loading { color: transparent; position: relative; pointer-events: none; }
.m-btn.is-loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid var(--spinner, currentColor); border-right-color: transparent; border-radius: 50%;
  animation: spin var(--dur-normal) linear infinite;
}
.m-btn.primary.is-loading { --spinner: var(--surface); }
.m-btn.accent.is-loading  { --spinner: var(--onAccent); }
.m-btn.ghost.is-loading   { --spinner: var(--ink-800); }
.m-btn.danger-ghost.is-loading { --spinner: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards & tables ── */
.card { border: 1px solid var(--ink-150); border-radius: var(--radius-lg); background: var(--surface);
        padding: var(--space-6) 26px; box-shadow: var(--shadow-sm); margin-bottom: var(--space-4); }
.card-title { font-size: var(--text-base); font-weight: 800; color: var(--ink-900); margin-bottom: 4px; }
.card-sub { font-size: var(--text-sm); color: var(--textMuted); margin-bottom: 18px; }
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
           margin-bottom: var(--space-5); flex-wrap: wrap; }
.tbl-wrap { border: 1px solid var(--ink-150); border-radius: var(--radius-lg); background: var(--surface);
            box-shadow: var(--shadow-sm); margin-bottom: 18px; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
.tbl th { text-align: left; font-size: var(--text-xs); font-weight: 800; letter-spacing: .15em;
          text-transform: uppercase; color: var(--textMuted); padding: var(--space-3) var(--space-5);
          border-bottom: 1px solid var(--ink-150); background: var(--ink-050); }
.tbl td { padding: 14px var(--space-5); border-bottom: 1px solid var(--ink-100); color: var(--ink-800); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.tbl tbody tr:hover { background: var(--teal-50); }
.tbl .strong { font-weight: 800; color: var(--ink-900); }
.tbl .quiet { color: var(--textMuted); font-size: var(--text-sm); }
.row-actions { display: flex; gap: var(--space-2); justify-content: flex-end; align-items: center; }

/* ── Links ── */
.link { color: var(--teal-800); text-decoration: underline; text-underline-offset: 2px;
        font-weight: 650; border-radius: 4px; }
.link:hover { color: var(--accent); }
.link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Small accent TEXT needs the 800 step in light (700 is 3.3:1 on --surface);
   in dark the bright end takes over — the semantic role already equals it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .link { color: var(--accentStrong); }
}
:root[data-theme="dark"] .link { color: var(--accentStrong); }

/* ── Forms ── */
.m-label { display: block; font-size: var(--text-xs); font-weight: 800; letter-spacing: .14em;
           text-transform: uppercase; color: var(--textMuted); margin-bottom: var(--space-2); }
.m-field { width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3) 14px;
           font-size: var(--text-base); font-family: inherit; color: var(--text); background: var(--surface);
           transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.m-field::placeholder { color: var(--textMuted); }
.m-field:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal-500) 18%, transparent); }
.m-field:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
select.m-field { appearance: none; cursor: pointer; padding-right: 38px; color-scheme: light;
  background-image: linear-gradient(45deg, transparent 50%, var(--textMuted) 50%), linear-gradient(135deg, var(--textMuted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 13px) 52%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }
:root[data-theme="dark"] select.m-field { color-scheme: dark; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); gap: 15px; }
.form-row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: flex-end; }
.f-msg { font-size: var(--text-sm); font-weight: 700; margin: 7px 0 0; }
.f-msg.ok { color: var(--teal-800); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .f-msg.ok { color: var(--success); }
}
:root[data-theme="dark"] .f-msg.ok { color: var(--success); }
.f-msg.bad { color: var(--danger); }
.f-msg.warn { color: var(--warning); }
.m-field.bad { border-color: var(--red-300); }
.m-field.bad:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--red-500) 14%, transparent); }
.m-field.ok { border-color: var(--teal-300); }
.m-field:disabled { background: var(--ink-050); color: var(--textMuted); cursor: not-allowed; }

/* ── Pills & chips ── */
.pill { background: var(--teal-100); color: var(--teal-900); padding: 5px var(--space-3); border-radius: var(--radius-pill);
        font-size: var(--text-sm); font-weight: 700; white-space: nowrap; }
.pill.line { background: transparent; border: 1.5px solid var(--ink-200); color: var(--ink-600); }
.pill.dot { display: inline-flex; align-items: center; gap: 7px; }
.pill.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal-700); }
.s-chip { font-size: var(--text-xs); font-weight: 800; color: var(--teal-800); background: var(--teal-50);
          border: 1px solid var(--teal-300); border-radius: var(--radius-sm); padding: 3px 10px; white-space: nowrap; }
.s-chip.muted { color: var(--ink-600); background: var(--surface); border-color: var(--ink-200); }
.s-chip.amber { color: var(--amber-700); background: var(--amber-50); border-color: var(--amber-300); }

/* ── Notifications (50 · 100/300 · 700 family rule) ── */
.notif { display: flex; align-items: flex-start; gap: var(--space-3); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
         font-size: var(--text-base); font-weight: 600; margin-bottom: var(--space-3); border: 1px solid; }
.notif b { font-weight: 800; }
.notif .ic { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center;
             justify-content: center; font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0; margin-top: 1px; }
.notif.warn { background: var(--amber-50); border-color: var(--amber-300); color: var(--amber-700); }
.notif.warn .ic { background: var(--amber-700); }
.notif.ok { background: var(--teal-50); border-color: var(--teal-300); color: var(--teal-800); }
.notif.ok .ic { background: var(--teal-700); }
.notif.info { background: var(--azure-50); border-color: var(--azure-300); color: var(--azure-700); }
.notif.info .ic { background: var(--azure-700); }
.notif.danger { background: var(--red-50); border-color: var(--red-300); color: var(--red-700); }
.notif.danger .ic { background: var(--red-700); }

/* ── Empty & state cards ── */
.state-card { text-align: center; padding: 38px var(--space-5); }
.state-card .s-ic { width: 46px; height: 46px; border-radius: 50%; margin: 0 auto var(--space-3);
                    display: flex; align-items: center; justify-content: center; font-size: 17px;
                    font-weight: 800; background: var(--ink-050); border: 1.5px solid var(--ink-200);
                    color: var(--ink-500); }
.state-card h4 { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin: 0 0 5px;
                 color: var(--ink-900); }
.state-card p { font-size: var(--text-sm); color: var(--textSecondary); margin: 0 0 14px; line-height: 1.55; }

/* ── Home tiles ── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 15px; }
.tile { border: 1px solid var(--ink-150); border-radius: var(--radius-lg); background: var(--surface); padding: 22px;
        text-decoration: none; display: block; position: relative; overflow: hidden;
        box-shadow: var(--shadow-sm);
        transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out),
                    border-color var(--dur-fast) var(--ease-out); }
.tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px;
                background: linear-gradient(90deg, var(--teal-400), var(--teal-600));
                transform: scaleX(0); transform-origin: left;
                transition: transform var(--dur-normal) var(--ease-out); }
.tile:hover, .tile:active { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--teal-300); }
.tile:hover::before, .tile:active::before { transform: scaleX(1); }
.tile:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-lg); }
.tile .t-ic { width: 42px; height: 42px; border-radius: var(--radius-md); display: flex; align-items: center;
              justify-content: center; background: var(--teal-50); border: 1px solid var(--teal-200);
              color: var(--teal-700); margin-bottom: 14px; }
.tile .t-name { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600;
                color: var(--ink-900); }
.tile .t-sub { font-size: var(--text-sm); color: var(--textMuted); margin-top: 3px; }

/* ── Avatars ── */
.m-avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center;
            justify-content: center; font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0; }
.a-red { background: var(--red-500); } .a-teal { background: var(--teal-500); }
.a-amber { background: var(--amber-500); } .a-ink { background: var(--onAccent); }
.a-blue { background: var(--azure-500); } .a-purple { background: var(--violet-500); }
.role-Admin { background: var(--teal-500); }
.role-Manager { background: var(--amber-500); }
.role-Contractor { background: var(--azure-500); }
.role-Individual-Contributor { background: var(--onAccent); }

/* ── Icons ── */
/* The width/height attributes <aicoe-icon> sets are the size of record — CSS here
   must not defeat them (any rule beats a presentation attribute). Default only
   when an element carries no explicit size; context rules (.nav-link, .tab,
   .m-ic.sm, page micro-rules) still pin deliberately. */
.m-ic { flex-shrink: 0; color: currentColor; }
.m-ic:not([width]) { width: 16px; height: 16px; }
.m-ic.sm:not([width]) { width: 14px; height: 14px; }

/* ── Selection controls ── */
.m-check { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--ink-300); display: inline-flex;
           align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff;
           transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.m-check.on { background: var(--teal-700); border-color: var(--teal-700); }
.m-check.pop { animation: chk-pop var(--dur-fast) var(--ease-out); }
@keyframes chk-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* Canonical selection control: native input semantics plus a visible mark. */
.m-selection { display: inline-flex; align-items: flex-start; gap: var(--space-3); min-width: 0;
  color: var(--text); cursor: pointer; line-height: 1.45; }
.m-selection-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.m-selection .m-check { flex: 0 0 18px; margin-top: 2px; }
.m-selection-input:checked + .m-check { background: var(--accentStrong); border-color: var(--accentStrong); }
.m-selection-input:checked + .m-check::after { content: "✓"; }
.m-selection-input:focus-visible + .m-check { outline: 2px solid var(--focus); outline-offset: 3px; }
.m-selection-input:disabled + .m-check { opacity: .55; }
.m-selection[aria-invalid="true"] .m-check { border-color: var(--danger); }

/* Accessible field labels and visually-hidden utility. */
.m-label-required { color: var(--danger); margin-left: 3px; }
.sr-only, .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important; border: 0 !important; }

aicoe-accordion { display: block; border-block: 1px solid var(--border); }
aicoe-accordion [data-accordion-trigger] { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-4) 0; border: 0; background: none; color: var(--text); font: inherit; font-weight: 750; text-align: left; cursor: pointer; }
aicoe-accordion [data-accordion-trigger]:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
aicoe-accordion [data-accordion-panel] { padding: 0 0 var(--space-4); color: var(--textSecondary); line-height: 1.6; }
aicoe-tooltip { position: relative; display: inline-flex; align-items: center; }
aicoe-tooltip .m-tooltip-content { position: absolute; z-index: var(--z-toast); left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: min(280px, calc(100vw - 24px)); padding: 6px 9px; border-radius: var(--radius-sm); background: var(--ink-900); color: var(--surface); font-size: var(--text-xs); line-height: 1.35; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity var(--dur-fast) var(--ease-out); }
aicoe-tooltip:hover .m-tooltip-content, aicoe-tooltip:focus-visible .m-tooltip-content { opacity: 1; visibility: visible; }
.m-spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: spin var(--dur-normal) linear infinite; }
.m-spinner[aria-hidden="true"] { flex-shrink: 0; }
.m-avatar-img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--ink-100); }
.m-avatar-group { display: inline-flex; align-items: center; }
.m-avatar-group > * + * { margin-left: -7px; border: 2px solid var(--surface); }
.m-divider { height: 1px; width: 100%; border: 0; background: var(--border); margin-block: var(--space-4); }
aicoe-popover { position: relative; display: inline-block; }
aicoe-popover [data-popover-panel] { border: 1px solid var(--borderStrong); border-radius: var(--radius-md); background: var(--surface); color: var(--text); box-shadow: var(--shadow-md); padding: var(--space-4); max-width: min(320px, calc(100vw - 24px)); }
aicoe-combobox { display: block; min-width: 0; }
.m-switch { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; }
.m-switch input { position: absolute; opacity: 0; }
.m-switch-track { width: 38px; height: 22px; padding: 3px; border-radius: 999px; background: var(--ink-300); transition: background var(--dur-fast) var(--ease-out); }
.m-switch-track span { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform var(--dur-fast) var(--ease-out); }
.m-switch input:checked + .m-switch-track { background: var(--accentStrong); }
.m-switch input:checked + .m-switch-track span { transform: translateX(16px); }
.m-switch input:focus-visible + .m-switch-track { outline: 2px solid var(--focus); outline-offset: 3px; }
.m-pattern-input { accent-color: var(--accentStrong); }
aicoe-tabs { display: block; min-width: 0; }
aicoe-tabs [role=tablist] { display: flex; flex-wrap: wrap; gap: var(--space-2); border-bottom: 1px solid var(--border); }
aicoe-tabs [role=tab] { border: 0; border-bottom: 2px solid transparent; padding: var(--space-3); background: none; color: var(--textSecondary); font: inherit; cursor: pointer; }
aicoe-tabs [role=tab][aria-selected=true] { border-bottom-color: var(--accentStrong); color: var(--text); font-weight: 750; }
aicoe-tabs [role=tab]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
aicoe-tabs [role=tabpanel] { padding-block: var(--space-4); }
.m-progress { width: 100%; accent-color: var(--accentStrong); }
.m-file-status { display: block; margin-top: var(--space-2); color: var(--textSecondary); font-size: var(--text-sm); }
aicoe-stepper { display: block; min-width: 0; }
aicoe-stepper [data-step] { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--textMuted); }
aicoe-stepper [data-step] + [data-step]::before { content: "→"; margin-inline: var(--space-3); color: var(--borderStrong); }
aicoe-stepper [data-step].is-current { color: var(--text); font-weight: 750; }
aicoe-stepper [data-step].is-complete { color: var(--success); }

/* ── Skeleton / loading ── */
.skeleton { background: var(--ink-100); border-radius: var(--radius-sm); position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* ── Scroll reveal (motion) — behaviour lives in aicoe-motion.js ── */
.reveal { opacity: 0; transform: translateY(12px);
  animation: rise var(--dur-normal) var(--ease-out) forwards; }
.reveal.is-revealed { opacity: 1; transform: none; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ── Focus (unified, on-palette) ── */
.m-btn:focus-visible, .link:focus-visible, .m-label:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: inherit; }

/* ── Overlays — modal · drawer · menu (behaviour helpers: aicoe-overlay.js) ──
   Native <dialog> (modal/drawer) and the Popover API (menu) own focus, Escape
   and light dismiss; this section owns look and motion. Scrim is --scrim
   (semantic, ink-tinted, never black) under the topbar glass treatment. */
dialog.modal, dialog.drawer { border: none; padding: 0; background: var(--surface); color: var(--ink-800);
  border-radius: var(--overlay-radius); box-shadow: var(--shadow-lg); max-width: none; }
dialog.modal::backdrop, dialog.drawer::backdrop { background: var(--scrim);
  backdrop-filter: blur(var(--overlay-blur)) saturate(var(--overlay-saturate));
  -webkit-backdrop-filter: blur(var(--overlay-blur)) saturate(var(--overlay-saturate)); }

/* modal sizes */
dialog.modal { width: min(var(--modal-md), calc(100vw - 24px)); max-height: min(86dvh, 860px); }
dialog.modal.sm { width: min(var(--modal-sm), calc(100vw - 24px)); }
dialog.modal.lg { width: min(var(--modal-lg), calc(100vw - 24px)); }

/* drawer — full-height panel docked right */
dialog.drawer { position: fixed; inset: 0 0 0 auto; height: 100dvh; max-height: none; margin: 0;
  width: min(var(--drawer-w), 92vw); border-radius: var(--overlay-radius) 0 0 var(--overlay-radius); }
dialog.drawer.wide { width: min(var(--drawer-wide), 94vw); }

/* shared anatomy — drawer reuses the modal classes */
.modal-head, .drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-6) var(--space-6) var(--space-4); }
.modal-head h2, .drawer-head h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em;
  font-size: 22px; line-height: 1.2; color: var(--ink-900); margin: 0; }
.modal-head .kicker, .drawer-head .kicker { margin-bottom: 6px; }
.modal-body, .drawer-body { padding: 0 var(--space-6) var(--space-5); overflow-y: auto; }
.modal-foot, .drawer-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3);
  padding: var(--space-2) var(--space-6) var(--space-6); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex-shrink: 0;
  border: none; border-radius: var(--radius-sm); background: transparent; color: var(--textSecondary); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.icon-btn:hover { background: var(--ink-100); color: var(--ink-900); }
.icon-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* motion — enter via @starting-style, exit held by allow-discrete; token-driven */
dialog.modal, dialog.drawer { opacity: 0; transform: translateY(12px) scale(.98);
  transition: opacity var(--dur-normal) var(--ease-out), transform var(--dur-normal) var(--ease-out),
              overlay var(--dur-normal) allow-discrete, display var(--dur-normal) allow-discrete; }
dialog.drawer { transform: translateX(24px); }
dialog.modal[open], dialog.drawer[open] { opacity: 1; transform: none; }
dialog.modal::backdrop, dialog.drawer::backdrop { opacity: 0;
  transition: opacity var(--dur-normal) var(--ease-out), overlay var(--dur-normal) allow-discrete,
              display var(--dur-normal) allow-discrete; }
dialog.modal[open]::backdrop, dialog.drawer[open]::backdrop { opacity: 1; }
@starting-style {
  dialog.modal[open] { opacity: 0; transform: translateY(12px) scale(.98); }
  dialog.drawer[open] { opacity: 0; transform: translateX(24px); }
  dialog.modal[open]::backdrop, dialog.drawer[open]::backdrop { opacity: 0; }
}

/* menu — popover; light dismiss and Escape are native; never scrim a menu.
   Keyboard/hover selection is the fill, not a ring (APG menu convention). */
[popover].menu { inset: auto; border: 1px solid var(--ink-150); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink-800); box-shadow: var(--shadow-md);
  padding: 6px; min-width: 200px; max-width: 300px; font-size: var(--text-base); }
.menu::backdrop { background: transparent; }
.menu-item { display: flex; align-items: center; gap: var(--space-3); width: 100%; text-align: left;
  border: none; border-radius: var(--radius-sm); background: transparent; color: var(--ink-800); cursor: pointer;
  font: inherit; font-weight: 650; padding: var(--space-2) var(--space-3);
  transition: background var(--dur-fast) var(--ease-out); }
.menu-item:hover, .menu-item:focus-visible { background: var(--ink-100); color: var(--ink-900); outline: none; }
.menu-item:focus { outline: none; background: var(--ink-100); color: var(--ink-900); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: var(--red-50); color: var(--red-700); }
.menu-sep { border: none; border-top: 1px solid var(--ink-150); margin: 6px 4px; }
.menu-label { font-size: var(--text-xs); font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--textMuted); padding: var(--space-2) var(--space-3) 4px; }
.menu { opacity: 0; transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out),
              overlay var(--dur-fast) allow-discrete, display var(--dur-fast) allow-discrete; }
.menu:popover-open { opacity: 1; transform: none; }
@starting-style { .menu:popover-open { opacity: 0; transform: translateY(-4px); } }
/* menus are positioned by aicoe-overlay.js (below the trigger, flipping up
   near the viewport edge) — no anchor-positioning dependency */

/* compact — modal becomes a near-full sheet, drawer takes the full width */
@media (max-width: 700px) {
  dialog.modal, dialog.modal.sm, dialog.modal.lg { width: calc(100vw - 24px); max-height: calc(100dvh - 48px); }
  dialog.drawer, dialog.drawer.wide { width: 100vw; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  dialog.modal, dialog.drawer, dialog.modal::backdrop, dialog.drawer::backdrop, .menu { transition: none; }
}

/* ── Data table system — sort · search · filter · paginate · select
   (behaviour: aicoe-table.js; markup recipes in components/recipes.md) ── */
.tbl th.col-select, .tbl td.col-select { width: 40px; text-align: center; padding-right: 0; }
.tbl .col-select input { width: 15px; height: 15px; accent-color: var(--teal-600); cursor: pointer; }
.tbl tbody tr.is-selected, .tbl tbody tr.is-selected:hover { background: var(--teal-100); }
.tbl.compact th, .tbl.compact td { padding-top: 7px; padding-bottom: 7px; }
.tbl.compact td { font-size: var(--text-sm); }

/* sortable headers — one active column carries aria-sort; the icon rotates for descending */
.th-sort { display: inline-flex; align-items: center; gap: 5px; border: none; background: transparent;
  padding: 0; cursor: pointer; font: inherit; color: inherit; letter-spacing: inherit;
  text-transform: inherit; border-radius: 4px; }
.th-sort:hover { color: var(--ink-800); }
.th-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.th-sort .s-ic { opacity: .55; transition: transform var(--dur-fast) var(--ease-out); }
.th-sort[aria-sort="ascending"] .s-ic, .th-sort[aria-sort="descending"] .s-ic,
th[aria-sort="ascending"] .s-ic, th[aria-sort="descending"] .s-ic { opacity: 1; color: var(--teal-700); }
.th-sort[aria-sort="descending"] .s-ic { transform: rotate(180deg); }

/* filter chips — applied facets, dismissible; never-flip tint family */
.tbl-filters { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-3); }
.f-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--teal-200);
  background: var(--teal-50); color: var(--teal-800); border-radius: var(--radius-pill);
  padding: 3px 9px 3px 12px; font-size: var(--text-sm); font-weight: 700; white-space: nowrap; }
.f-chip .f-key { color: var(--teal-700); font-weight: 650; }
.f-chip button { border: none; background: transparent; color: inherit; font: inherit; font-weight: 800;
  cursor: pointer; padding: 0 3px; line-height: 1; border-radius: 50%; }
.f-chip button:hover { color: var(--teal-900); }
.f-chip button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* bulk bar — replaces the toolbar in place while a selection exists */
.tbl-bulk { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3);
  border: 1px solid var(--teal-200); background: var(--teal-50); border-radius: var(--radius-md);
  padding: 9px 14px; margin: 0 0 var(--space-3); font-size: var(--text-base); color: var(--teal-900); }
.tbl-bulk b { font-weight: 800; }
.tbl-bulk .spacer { flex: 1; }
.tbl-bulk[hidden] { display: none; }

/* pager */
.tbl-pager { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3);
  font-size: var(--text-sm); color: var(--textSecondary); margin: -6px 0 18px; }
.tbl-pager .pager-info { font-weight: 700; font-variant-numeric: tabular-nums; }
.tbl-pager .spacer { flex: 1; }
.tbl-pager select.m-field { width: auto; padding: 5px 10px; font-size: var(--text-sm); }
.tbl-pager .page-nos { display: flex; gap: 4px; }
.tbl-pager .page-nos button { border: none; background: transparent; min-width: 28px; height: 28px;
  border-radius: var(--radius-sm); font: inherit; font-size: var(--text-sm); font-weight: 700;
  color: var(--ink-800); cursor: pointer; }
.tbl-pager .page-nos button:hover { background: var(--ink-100); }
.tbl-pager .page-nos button[aria-current="page"] { background: var(--ink-900); color: var(--surface); }
.tbl-pager .icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.tbl-pager .icon-btn:disabled:hover { background: transparent; color: var(--textSecondary); }

/* skeleton loading rows */
.tbl tbody tr.tbl-loading td { padding: 12px var(--space-5); }
@media (max-width: 700px) {
  .tbl tbody tr.tbl-loading td { padding: 9px var(--space-4); }
}

/* ── Bottom tab bar (hidden on desktop; shown ≤880px) ── */
.tabbar { display: none; }

/* ══════════ RESPONSIVE LAYER — kit rules ══════════
   ≤700px: tables stack to cards, cards tighten, iOS focus zoom prevented,
   tiles go 2-up. Shell chrome (topbar/tabbar/auth) lives in aicoe-shell.css. */

@media (max-width: 700px) {
  .card { padding: 18px var(--space-4); }

  /* iOS: prevent focus zoom */
  .m-field, select.m-field { font-size: 16px; }

  /* toolbar: search becomes full-width */
  .toolbar .form-row { width: 100%; }
  .toolbar .m-field[style] { width: 100% !important; }

  /* tables → stacked cards (scope to .tbl, NOT .rt docs tables) */
  .tbl-wrap.tbl-stack { border: none; background: transparent; box-shadow: none; overflow: visible; }
  .tbl, .tbl.tbl-stack, .tbl-wrap.tbl-stack .tbl { display: block; }
  .tbl-wrap.tbl-stack .tbl tbody { display: block; }
  .tbl-wrap.tbl-stack .tbl thead { display: none; }
  .tbl-wrap.tbl-stack .tbl tr { display: block; background: var(--surface); border: 1px solid var(--ink-150);
            border-radius: 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
            padding: 4px 0 8px; }
  .tbl-wrap.tbl-stack .tbl td { display: flex; justify-content: space-between; align-items: center; gap: 14px;
            padding: 8px var(--space-4); border-bottom: none; text-align: right; overflow-wrap: anywhere; }
  .tbl-wrap.tbl-stack .tbl tbody tr:hover { background: var(--surface); }
  .tbl-wrap.tbl-stack .tbl td:first-child { display: block; text-align: left; padding-top: 13px; font-size: 15px; }
  .tbl-wrap.tbl-stack .tbl td[data-label]:not(:first-child)::before { content: attr(data-label); font-size: 9.5px;
            font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
            color: var(--ink-500); margin-right: auto; text-align: left; flex-shrink: 0; }
  .tbl-wrap.tbl-stack .tbl td[colspan] { display: block; text-align: center; padding: 0; }
  /* row action clusters + inline edit forms stack into a 2-col grid */
  .tbl-wrap.tbl-stack .tbl td div.row-actions, .tbl-wrap.tbl-stack .tbl td form.row-actions { display: grid; grid-template-columns: 1fr 1fr;
            gap: var(--space-2); width: 100%; }
  .tbl-wrap.tbl-stack .tbl .row-actions .m-field { width: auto !important; min-width: 0; }
  .tbl-wrap.tbl-stack .tbl .row-actions .m-btn { width: 100%; justify-content: center; }
  .tbl-wrap.tbl-stack .tbl td[style*="text-align:right"] { text-align: right; }

  /* home tiles: 2-up */
  .tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: var(--space-3); }
  .tile { padding: var(--space-4); }
  .tile .t-ic { width: 36px; height: 36px; margin-bottom: var(--space-3); }
  .tile .t-name { font-size: 15px; }
  .tile .t-sub { font-size: 11.5px; }
}

/* ── Motion guard ── */
/* Container-safe primitives: long content wraps; only data regions scroll. */
.card, .tile, .state-card, .notif, .toolbar, .form-grid, .form-row,
.tbl-wrap, .tbl-pager, .crumbs, .skeleton { min-width: 0; max-width: 100%; }
.card, .tile, .state-card, .notif, .page-title, .page-sub, .lede, .kicker { overflow-wrap: anywhere; }
.form-grid > *, .form-row > *, .toolbar > *, .notif > :not(.ic), .crumbs li { min-width: 0; max-width: 100%; }
.m-field { min-width: 0; max-width: 100%; }
.m-btn { max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; justify-content: center; }
.pill, .s-chip, .f-chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.f-chip button, .m-check, .kicker::after, aicoe-icon { flex-shrink: 0; }
.tbl-pager .page-nos, .row-actions { flex-wrap: wrap; }
.crumbs a, .crumbs [aria-current] { min-width: 0; overflow-wrap: anywhere; }
dialog.palette:not([open]) { display: none; }
dialog.palette[open] { overflow: hidden; margin-top: min(8dvh, 48px); max-height: min(560px, calc(100dvh - 64px)); }
.palette-list { min-height: 0; overscroll-behavior: contain; }
.palette-hint, .modal-foot, .drawer-foot { flex-wrap: wrap; gap: var(--space-2); }
.menu-item { min-width: 0; overflow-wrap: anywhere; }
.menu-item > span { min-width: 0; }
[popover].menu { min-width: min(200px, calc(100vw - 24px)); max-width: min(300px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
.modal-head > div, .drawer-head > div { min-width: 0; overflow-wrap: anywhere; }
.modal-head .icon-btn, .drawer-head .icon-btn { flex-shrink: 0; }
@media (max-width: 700px) {
  .modal-head, .drawer-head { padding: var(--space-4); }
  .modal-body, .drawer-body { padding: 0 var(--space-4) var(--space-4); }
  .modal-foot, .drawer-foot { padding: var(--space-4); }
  .tbl-wrap.tbl-stack .tbl td { flex-wrap: wrap; }
}
@media (pointer: coarse) {
  .m-btn, .m-btn.sm, .icon-btn, .menu-item, .tbl-pager .page-nos button { min-height: 44px; }
  .icon-btn, .tbl-pager .page-nos button { min-width: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ══════════ DARK TINT SURFACES (Sri review, v2.4.1) ══════════
   Light tint fills (teal-50/100, amber-50 …) wash out on dark surfaces.
   In dark mode they re-pin to dark brand tints — the brand colour at low
   opacity over the surface ("a lighter shade of black") with bright-end
   text. The light values earlier in this file remain the light-theme truth. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tint-teal-bg: color-mix(in srgb, var(--teal-500) 14%, var(--surface));
    --tint-teal-bg-strong: color-mix(in srgb, var(--teal-500) 20%, var(--surface));
    --tint-amber-bg: color-mix(in srgb, var(--amber-500) 14%, var(--surface));
    --tint-azure-bg: color-mix(in srgb, var(--azure-500) 14%, var(--surface));
    --tint-red-bg: color-mix(in srgb, var(--red-500) 12%, var(--surface));
    --tint-ink-hover: color-mix(in srgb, var(--teal-500) 7%, var(--surface));
  }
}
:root[data-theme="dark"] {
  --tint-teal-bg: color-mix(in srgb, var(--teal-500) 14%, var(--surface));
  --tint-teal-bg-strong: color-mix(in srgb, var(--teal-500) 20%, var(--surface));
  --tint-amber-bg: color-mix(in srgb, var(--amber-500) 14%, var(--surface));
  --tint-azure-bg: color-mix(in srgb, var(--azure-500) 14%, var(--surface));
  --tint-red-bg: color-mix(in srgb, var(--red-500) 12%, var(--surface));
  --tint-ink-hover: color-mix(in srgb, var(--teal-500) 7%, var(--surface));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    .pill { background: var(--tint-teal-bg); color: var(--success); }
    .pill.dot::before { background: var(--success); }
    .s-chip { background: var(--tint-teal-bg); color: var(--success); border-color: var(--teal-700); }
    .s-chip.amber { background: var(--tint-amber-bg); color: var(--warning); border-color: var(--amber-700); }
    .s-chip.muted { background: var(--surfaceHover); color: var(--textSecondary); border-color: var(--borderStrong); }
    .f-chip { background: var(--tint-teal-bg); color: var(--success); border-color: var(--teal-700); }
    .f-chip .f-key { color: var(--teal-400); }
    .f-chip button:hover { color: var(--teal-300); }
    .tbl-bulk { background: color-mix(in srgb, var(--teal-500) 10%, var(--surface)); border-color: var(--teal-700); color: var(--text); }
    .notif.warn { background: var(--tint-amber-bg); border-color: var(--amber-700); color: var(--warning); }
    .notif.ok { background: var(--tint-teal-bg); border-color: var(--teal-700); color: var(--success); }
    .notif.info { background: var(--tint-azure-bg); border-color: var(--azure-700); color: var(--info); }
    .notif.danger { background: var(--tint-red-bg); border-color: var(--red-700); color: var(--danger); }
    .tile .t-ic { background: var(--tint-teal-bg); border-color: var(--teal-700); color: var(--success); }
    .tbl tbody tr:hover { background: var(--tint-ink-hover); }
    .tbl tbody tr.is-selected, .tbl tbody tr.is-selected:hover { background: var(--tint-teal-bg-strong); }
    .m-btn.primary { background: var(--teal-900); color: #fff; }
    .m-btn.primary:hover { background: var(--teal-800); }
    .m-btn.primary.is-loading { --spinner: #fff; }
    .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }
  }
}
:root[data-theme="dark"] {
  .pill { background: var(--tint-teal-bg); color: var(--success); }
  .pill.dot::before { background: var(--success); }
  .s-chip { background: var(--tint-teal-bg); color: var(--success); border-color: var(--teal-700); }
  .s-chip.amber { background: var(--tint-amber-bg); color: var(--warning); border-color: var(--amber-700); }
  .s-chip.muted { background: var(--surfaceHover); color: var(--textSecondary); border-color: var(--borderStrong); }
  .f-chip { background: var(--tint-teal-bg); color: var(--success); border-color: var(--teal-700); }
  .f-chip .f-key { color: var(--teal-400); }
  .f-chip button:hover { color: var(--teal-300); }
  .tbl-bulk { background: color-mix(in srgb, var(--teal-500) 10%, var(--surface)); border-color: var(--teal-700); color: var(--text); }
  .notif.warn { background: var(--tint-amber-bg); border-color: var(--amber-700); color: var(--warning); }
  .notif.ok { background: var(--tint-teal-bg); border-color: var(--teal-700); color: var(--success); }
  .notif.info { background: var(--tint-azure-bg); border-color: var(--azure-700); color: var(--info); }
  .notif.danger { background: var(--tint-red-bg); border-color: var(--red-700); color: var(--danger); }
  .tile .t-ic { background: var(--tint-teal-bg); border-color: var(--teal-700); color: var(--success); }
  .tbl tbody tr:hover { background: var(--tint-ink-hover); }
  .tbl tbody tr.is-selected, .tbl tbody tr.is-selected:hover { background: var(--tint-teal-bg-strong); }
  .m-btn.primary { background: var(--teal-900); color: #fff; }
  .m-btn.primary:hover { background: var(--teal-800); }
  .m-btn.primary.is-loading { --spinner: #fff; }
  .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }
}

/* Shared application refinements; editorial and presentation typography stays separate. */
[hidden]:not([hidden="until-found"]) { display:none !important; }
.m-label { font-size:var(--text-label,13px); font-weight:600; letter-spacing:0; text-transform:none; line-height:1.5; margin-bottom:var(--space-2); }
.m-field, .m-btn { font-size:var(--text-body); }
.m-field { min-height:42px; }
.m-btn { min-height:40px; justify-content:center; }
.m-btn.sm { min-height:34px; }
.m-btn[aria-busy="true"] { position:relative; cursor:wait; }
.m-btn[aria-busy="true"]::after { content:''; width:14px; height:14px; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; animation:aicoe-spin 800ms linear infinite; }
@keyframes aicoe-spin { to { transform:rotate(360deg); } }
.icon-btn { min-width:40px; min-height:40px; border-radius:var(--radius-sm); }
.icon-btn.outlined { border:1px solid var(--borderStrong); background:var(--surface); }
.icon-btn[aria-pressed="true"] { color:var(--text); background:color-mix(in srgb,var(--accent) 20%,var(--surface)); }
.link, .link:hover { color:var(--linkText); text-decoration:underline; text-underline-offset:3px; }
.m-field-help { color:var(--textSecondary); font-size:var(--text-sm); margin-top:var(--space-2); }
.is-error { color:var(--danger); }
.m-field[aria-invalid="true"] { border-color:var(--danger); }
aicoe-field,aicoe-date-field,aicoe-file-upload,aicoe-progress { display:block; min-width:0; }
aicoe-radio-group { display:grid; gap:var(--space-3); }
aicoe-tabs [role=tablist] { display:flex; flex-wrap:wrap; gap:var(--space-1); border-bottom:1px solid var(--border); margin-bottom:var(--space-4); }
aicoe-tabs [role=tab] { border:0; border-bottom:2px solid transparent; background:transparent; color:var(--textSecondary); padding:12px 16px; font:inherit; cursor:pointer; }
aicoe-tabs [aria-selected="true"] { border-bottom-color:var(--accentStrong); color:var(--text); font-weight:600; }
aicoe-tabs [role=tab]:disabled { opacity:.5; cursor:not-allowed; }
aicoe-tabs [role=tablist][aria-orientation=vertical] { flex-direction:column; }
aicoe-tooltip:focus-within .m-tooltip-content { opacity:1; visibility:visible; }
aicoe-tooltip[data-dismissed] .m-tooltip-content { opacity:0 !important; visibility:hidden !important; }
.m-tooltip-content { max-width:min(240px,80vw); white-space:normal; }
[data-popover-panel] { max-width:calc(100vw - 16px); max-height:calc(100dvh - 16px); overflow:auto; }
.m-avatar { position:relative; flex-shrink:0; }
.m-avatar.a-teal { background:var(--teal-100); color:var(--teal-900); }
.m-avatar.a-amber { background:var(--amber-100); color:var(--amber-900); }
.m-avatar img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; border-radius:inherit; }
.m-avatar[data-presence]::after { content:''; position:absolute; right:-2px; bottom:-2px; width:9px; height:9px; border:2px solid var(--surface); border-radius:50%; background:var(--success); }
.m-avatar[data-presence=offline]::after { background:var(--textMuted); }
.avatar-group { display:flex; align-items:center; }
.avatar-group > * + * { margin-left:-8px; }
.avatar-group .m-avatar { outline:2px solid var(--surface); }
.s-chip { font-size:var(--text-sm); min-height:26px; color:var(--linkText); background:color-mix(in srgb,var(--accent) 12%,var(--surface)); }
.s-chip.neutral,.s-chip.muted { color:var(--textSecondary); background:var(--bg); }
.s-chip.danger { color:var(--danger); background:color-mix(in srgb,var(--danger) 9%,var(--surface)); }
.s-chip.info { color:var(--info); background:color-mix(in srgb,var(--info) 9%,var(--surface)); }
.s-chip.warning,.s-chip.amber { color:var(--warning); background:color-mix(in srgb,var(--warning) 9%,var(--surface)); }
.pill,.f-chip { max-width:100%; overflow-wrap:anywhere; }
.card-header,.card-body,.card-footer { padding:var(--space-4) 0; }
.card-header { padding-top:0; display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); }
.card-footer { border-top:1px solid var(--border); padding-bottom:0; }
.card-title,.app-title { font-family:var(--font-sans); letter-spacing:-.02em; }
.app-title { font-size:clamp(24px,3vw,32px); line-height:1.2; font-weight:650; }
.doc-intro { color:var(--textSecondary); font-size:var(--text-lg); line-height:1.65; max-width:68ch; }
.card[data-selectable] { cursor:pointer; }
.card[aria-pressed=true] { border-color:var(--accentStrong); outline:1px solid var(--accentStrong); }
.tile[aria-disabled=true] { opacity:.55; transform:none; cursor:not-allowed; }
.form-grid .span-full { grid-column:1/-1; }
.form-grid .field-short { max-width:180px; }
.tbl-wrap { max-width:100%; overflow:auto; }
.tbl caption { text-align:left; padding:var(--space-3) var(--space-4); color:var(--textSecondary); font-size:var(--text-body); }
.tbl th,.tbl td { font-size:var(--text-body); padding:14px 16px; }
.tbl th { font-weight:600; text-transform:none; letter-spacing:0; }
.tbl .numeric { text-align:right; font-variant-numeric:tabular-nums; }
[data-density=compact] .tbl th,[data-density=compact] .tbl td { padding:8px 12px; }
.tbl-pager { flex-wrap:wrap; gap:var(--space-2); }
.crumbs { flex-wrap:wrap; overflow-wrap:anywhere; }
.metric { display:grid; gap:var(--space-2); }
.metric-value { font-size:32px; font-weight:650; font-variant-numeric:tabular-nums; letter-spacing:-.03em; }
.metric-context { font-size:var(--text-sm); color:var(--textSecondary); }
.skeleton-text { height:14px; margin:12px 0; }
.skeleton-avatar { width:40px; height:40px; border-radius:50%; }
.skeleton-card { height:160px; }
.skeleton-table { height:42px; margin-bottom:8px; }
.save-bar { position:sticky; bottom:0; z-index:var(--z-sticky); display:flex; justify-content:space-between; gap:var(--space-3); padding:var(--space-4); border-top:1px solid var(--border); background:var(--surface); }
.selection-card { display:flex; gap:var(--space-3); padding:var(--space-4); border:1px solid var(--border); border-radius:var(--radius-sm); }
.selection-card:has(input:checked) { border-color:var(--accentStrong); background:color-mix(in srgb,var(--accent) 8%,var(--surface)); }
@media (max-width:700px) { .tbl-pager .spacer { display:none; } .form-grid { grid-template-columns:1fr; } .icon-btn { min-width:44px; min-height:44px; } }
@media (prefers-reduced-motion:reduce) { .m-btn[aria-busy=true]::after { animation:none; } }
.file-list { display:grid; gap:8px; padding:0; list-style:none; }
.file-list li { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 0; border-bottom:1px solid var(--border); }
.file-list span { overflow-wrap:anywhere; min-width:0; }
.m-selection-input:indeterminate + .m-check { background:var(--accentStrong); border-color:var(--accentStrong); }
.m-selection-input:indeterminate + .m-check::after { content:'−'; }
.m-selection:has(input:disabled) { cursor:not-allowed; color:var(--textSecondary); }
aicoe-stepper [data-step] { color:var(--textSecondary); padding:10px; }
aicoe-stepper .is-current { color:var(--text); font-weight:650; border-bottom:2px solid var(--accentStrong); }
aicoe-stepper .is-complete::after { content:' ✓'; }
@media(max-width:700px) { input.m-field,select.m-field,textarea.m-field { font-size:16px; } }
.m-btn { white-space:normal; overflow-wrap:anywhere; text-align:center; }

/* Enterprise primitives */
.m-date-range { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--space-3); margin:0; padding:var(--space-3); border:1px solid var(--border); border-radius:var(--radius-md); }
.m-date-range legend { grid-column:1/-1; padding:0; }
.m-editor { display:grid; gap:8px; border:1px solid var(--border); border-radius:var(--radius-md); padding:8px; background:var(--surface); }
.m-editor-tools { display:flex; gap:4px; padding-bottom:6px; border-bottom:1px solid var(--border); }
.m-editor-content { min-height:90px; padding:8px; outline:none; }
.m-editor-content:focus { box-shadow:inset 0 0 0 2px var(--focus); border-radius:4px; }
.m-billing-plan { display:block; min-width:0; }
@media(max-width:560px) { .m-date-range { grid-template-columns:1fr; } }
@media(forced-colors:active) { .m-editor,.m-date-range { border:2px solid CanvasText; } .m-btn { border:1px solid ButtonText; } }
[dir="rtl"] .m-editor-tools { flex-direction:row-reverse; }

/* Commerce and automotive additions */
.aicoe-quantity { display:inline-flex; align-items:center; gap:var(--space-2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:4px; background:var(--surface); }
.aicoe-quantity output { min-width:2.2rem; text-align:center; font-variant-numeric:tabular-nums; font-weight:650; }
.aicoe-search { display:grid; gap:6px; width:min(100%,360px); }
.aicoe-search-control { display:flex; align-items:center; gap:8px; padding-inline:10px; border:1px solid var(--border); border-radius:var(--radius-sm); }
.aicoe-search-control:focus-within { border-color:var(--focus); box-shadow:0 0 0 2px color-mix(in srgb,var(--focus) 25%,transparent); }
.aicoe-search-control .m-field { border:0; box-shadow:none; min-width:0; flex:1; padding-inline:0; }
.aicoe-search-control .icon-btn { border:0; min-width:28px; min-height:28px; }
.aicoe-filter-group { display:grid; gap:var(--space-2); }
.aicoe-filter-group > legend,.aicoe-filter-group > h3 { font-weight:700; }
.aicoe-filter-group label { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); padding:6px 0; }
.aicoe-filter-group label span:last-child { color:var(--textSecondary); font-size:var(--text-sm); }
.aicoe-selection-card { display:block; border:1px solid var(--border); border-radius:var(--radius-md); padding:var(--space-4); cursor:pointer; }
.aicoe-selection-card:has(input:checked) { border-color:var(--accentStrong); background:color-mix(in srgb,var(--accent) 8%,var(--surface)); }
.aicoe-selection-card:has(input:focus-visible) { outline:2px solid var(--focus); outline-offset:2px; }
.aicoe-order-summary { display:grid; gap:var(--space-4); border:1px solid var(--border); border-radius:var(--radius-md); padding:var(--space-5); background:var(--surface); }
.aicoe-order-summary h2 { margin:0; font-family:var(--font-display); }
.aicoe-order-summary dl { display:grid; gap:10px; margin:0; }
.aicoe-order-summary dl div { display:flex; justify-content:space-between; gap:var(--space-3); }
.aicoe-order-summary dt { color:var(--textSecondary); } .aicoe-order-summary dd { margin:0; font-variant-numeric:tabular-nums; }
.aicoe-summary-total { border-top:1px solid var(--border); padding-top:var(--space-3); font-weight:750; font-size:var(--text-lg); }
.aicoe-checkout-step { display:grid; gap:var(--space-4); }
.aicoe-star { color:var(--warning); font-size:1.3em; letter-spacing:1px; }
button.aicoe-star { border:0; background:none; cursor:pointer; padding:2px; }
.aicoe-media-card { display:grid; grid-template-columns:96px 1fr; gap:var(--space-4); padding:var(--space-4); border:1px solid var(--border); border-radius:var(--radius-md); }
.aicoe-media-card img { width:96px; aspect-ratio:1; object-fit:cover; border-radius:var(--radius-sm); background:var(--bg); }
.aicoe-confirmation { max-width:480px; }
.pattern-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:var(--space-4); }
.pattern-card { display:grid; gap:var(--space-2); border:1px solid var(--border); border-radius:var(--radius-md); padding:var(--space-4); background:var(--surface); }
.pattern-card h3,.pattern-card p { margin:0; } .pattern-card .pattern-meta { color:var(--textSecondary); font-size:var(--text-sm); }
.sticky-action-bar { position:sticky; bottom:0; z-index:var(--z-sticky); display:flex; justify-content:flex-end; gap:var(--space-3); padding:var(--space-3) var(--space-4); border-top:1px solid var(--border); background:color-mix(in srgb,var(--surface) 92%,transparent); backdrop-filter:blur(8px); }
.mobile-bottom-navigation { display:flex; justify-content:space-around; gap:4px; padding:8px; border:1px solid var(--border); border-radius:var(--radius-md); background:var(--surface); }
.mobile-bottom-navigation a { display:grid; justify-items:center; gap:2px; padding:8px; color:var(--textSecondary); font-size:var(--text-sm); text-decoration:none; }
.mobile-bottom-navigation a[aria-current="page"] { color:var(--accentStrong); font-weight:700; }
.responsive-data-list { width:100%; } .responsive-data-list .mobile-row { display:none; }
@media(max-width:700px) { .aicoe-media-card { grid-template-columns:72px 1fr; } .aicoe-media-card img { width:72px; } .responsive-data-list table { display:none; } .responsive-data-list .mobile-row { display:flex; justify-content:space-between; gap:12px; padding:12px 0; border-bottom:1px solid var(--border); } }

.m-btn:focus-visible,.icon-btn:focus-visible,.m-field:focus-visible,a:focus-visible,button:focus-visible,[role=tab]:focus-visible { outline:2px solid var(--text); outline-offset:3px; }
.m-selection-input:focus-visible + .m-check { outline:2px solid var(--text); outline-offset:3px; }
.m-btn.danger { background:var(--danger); color:var(--surface); }
.m-btn.danger:hover { filter:brightness(.96); }
.m-btn[aria-busy="true"] { color:transparent; }
.m-btn[aria-busy="true"]::after { position:absolute; left:50%; top:50%; margin:-7px 0 0 -7px; color:var(--text); }
.m-btn.primary[aria-busy="true"]::after,.m-btn.danger[aria-busy="true"]::after { color:var(--surface); }
.m-btn.accent[aria-busy="true"]::after { color:var(--onAccent); }
