/* ==========================================================================
   Rain V3 — one interface system for Rain Console and Rain ID.
   Source of truth: the approved "Rain V3 Design" sheet (Main.dc.html). Class names match the
   sheet, except the frame (.shell-*) which replaces the sheet's .side/.main/.sheet/.topbar.
   Dark is the default; every color token has a light pair under [data-theme="light"].
   Layers: tokens < base < layout < components < utilities (utilities win).
   ========================================================================== */
@layer tokens, base, layout, components, utilities;
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Roboto+Flex:opsz,wdth,wght@8..144,25..151,100..1000&display=swap");

/* ===== tokens ===== */
@layer tokens {
  :root, [data-theme="dark"] {
    color-scheme: dark;
    --bg-0:#0A0C0E; --bg-1:#101316; --bg-2:#161A1E; --bg-3:#1D2227; --bg-4:#262C32; --bg-hover:rgba(220,234,246,.035);
    --line-1:rgba(220,234,246,.07); --line-2:rgba(220,234,246,.11); --line-3:rgba(220,234,246,.18);
    --fg-1:#ECEFF2; --fg-2:#B3BCC5; --fg-3:#9099A2; --fg-4:#5E666E;
    --accent:#00ADEE; --accent-hover:#2BBDF3; --accent-ink:#00222D; --accent-text:#5CCBF6; --accent-soft:rgba(0,173,238,.13); --accent-line:rgba(0,173,238,.45);
    --ok:#3DD68C; --ok-soft:rgba(61,214,140,.12);
    --warn:#F0B429; --warn-soft:rgba(240,180,41,.12);
    --stop:#F7706E; --stop-soft:rgba(247,112,110,.12); --stop-solid:#C93338;
    --op:#E46BD6; --op-text:#F2A2EA; --op-soft:rgba(228,107,214,.12); --op-line:rgba(228,107,214,.5);
    --shadow-pop:0 0 0 1px rgba(220,234,246,.11),0 16px 40px -12px rgba(0,0,0,.72);
    --scrim:rgba(5,7,9,.6);
  }
  :root[data-theme="light"], [data-theme="light"] {
    color-scheme: light;
    --bg-0:#F2F4F6; --bg-1:#FFFFFF; --bg-2:#F9FAFB; --bg-3:#FFFFFF; --bg-4:#E7EBEE; --bg-hover:rgba(15,30,45,.03);
    --line-1:rgba(15,30,45,.08); --line-2:rgba(15,30,45,.12); --line-3:rgba(15,30,45,.22);
    --fg-1:#0E1418; --fg-2:#3F4A54; --fg-3:#5B6670; --fg-4:#9AA4AD;
    --accent:#00ADEE; --accent-hover:#009FDB; --accent-ink:#00222D; --accent-text:#00739F; --accent-soft:rgba(0,173,238,.12); --accent-line:rgba(0,140,200,.4);
    --ok:#0F7A4A; --ok-soft:rgba(15,160,95,.12);
    --warn:#8A5A00; --warn-soft:rgba(240,180,41,.2);
    --stop:#C0262D; --stop-soft:rgba(220,50,55,.1); --stop-solid:#C0262D;
    --op:#A3218F; --op-text:#A3218F; --op-soft:rgba(190,50,170,.1); --op-line:rgba(163,33,143,.45);
    --shadow-pop:0 0 0 1px rgba(15,30,45,.12),0 16px 40px -12px rgba(15,30,45,.22);
    --scrim:rgba(15,30,45,.35);
  }
  :root {
    --s-1:4px; --s-2:8px; --s-3:12px; --s-4:16px; --s-5:20px; --s-6:24px; --s-8:32px; --s-10:40px; --s-12:48px; --s-16:64px;
    --r-xs:4px; --r-sm:6px; --r-md:8px; --r-lg:12px; --r-xl:16px; --r-pill:999px;
    --font:"Roboto Flex",system-ui,-apple-system,"Segoe UI",sans-serif;
    --mono:"JetBrains Mono",ui-monospace,"SF Mono",Menlo,monospace;
    --ease:cubic-bezier(.2,.7,.2,1);
    --sidebar-w:240px;
    --band-h:0px;        /* operator band height; set on .shell.is-operator */
  }
}

/* ===== base ===== */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg-0); color: var(--fg-1); font-family: var(--font); font-size: 14px; line-height: 20px; font-optical-sizing: auto; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
  [data-theme] { color: var(--fg-1); }
  :where(h1,h2,h3,h4,h5,p,ul,ol,dl,dd,figure,blockquote) { margin: 0; padding: 0; }
  :where(ul,ol) { list-style: none; }
  :where(h1,h2,h3,h4,h5) { font-size: inherit; font-weight: 600; }
  :where(button,input,select,textarea) { font: inherit; color: inherit; letter-spacing: inherit; }
  :where(a) { color: var(--accent-text); text-decoration: none; }
  :where(a:hover) { color: var(--fg-1); }
  :where(a:not([class])) { text-underline-offset: 2px; }
  :where(a:not([class]):hover) { text-decoration: underline; }
  :where(img) { display: block; max-width: 100%; }
  :where(table) { border-collapse: separate; border-spacing: 0; }
  :where(b,strong) { font-weight: 600; }
  :where(a,button,input,select,textarea,summary,[tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  ::selection { background: var(--accent-soft); }
  [hidden] { display: none !important; }
  #main:focus { outline: none; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  }
}

/* ===== layout: app frame (sidebar + sheet), account frame, auth page ===== */
@layer layout {
  .skip { position: fixed; left: 12px; top: -48px; z-index: 100; padding: 8px 12px; border-radius: var(--r-md); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
  .skip:focus { top: 12px; color: var(--accent-ink); }

  .shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg-0); }
  .shell.is-operator { --band-h: 36px; }
  /* Operator frame: a fixed 2px magenta edge on the viewport, above everything, never clickable. */
  .shell.is-operator::after { content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none; box-shadow: inset 0 0 0 2px var(--op-line); }
  .shell-body { flex: 1 1 auto; display: flex; min-width: 0; }
  .shell-sidebar { position: sticky; top: var(--band-h); align-self: flex-start; flex: 0 0 var(--sidebar-w); width: var(--sidebar-w); height: calc(100dvh - var(--band-h)); min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 10px 10px 14px; overflow-y: auto; background: var(--bg-0); }
  .shell-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
  .shell-spacer { flex: 1 1 auto; min-height: 24px; }
  .shell-main { flex: 1 1 auto; min-width: 0; display: flex; padding: 8px 8px 8px 0; }
  .shell-sheet { flex: 1 1 auto; min-width: 0; min-height: calc(100dvh - var(--band-h) - 16px); display: flex; flex-direction: column; background: var(--bg-1); border: 1px solid var(--line-1); border-radius: var(--r-lg); }
  .shell-topbar { flex: none; display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line-1); }
  .shell-actions { display: inline-flex; align-items: center; gap: 8px; }
  .shell-actions:empty { display: none; }
  .shell-scrim { display: none; }

  .page { width: 100%; max-width: 1160px; margin: 0 auto; padding: 28px 32px 56px; }
  .page.is-wide { max-width: none; padding: 20px 24px 48px; }
  .page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
  .page-sub { margin-top: 4px; font-size: 14px; line-height: 20px; color: var(--fg-2); max-width: 64ch; }
  .page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .section { margin-top: 32px; }
  .section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

  /* Rain ID account frame */
  .shell.is-account { background: var(--bg-1); }
  .shell-header { flex: none; display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 16px 0 12px; border-bottom: 1px solid var(--line-1); }
  .shell-header .shell-grow { flex: 1 1 auto; }
  .shell-columns { flex: 1 1 auto; width: 100%; max-width: 1120px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: flex-start; align-content: flex-start; gap: 32px 56px; padding: 40px 32px 72px; }
  .shell-subnav { flex: 0 0 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .shell-who { display: flex; align-items: center; gap: 10px; padding: 0 10px 16px; min-width: 0; }
  .shell-content { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

  /* Auth: centered single column on the canvas */
  .auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 80px 16px 40px; background: var(--bg-0); }
  .auth > .lockup { margin-bottom: 32px; }
  .auth-card { width: 100%; max-width: 420px; padding: 32px; border: 1px solid var(--line-1); border-radius: var(--r-xl); background: var(--bg-1); }
  .auth-card.is-wide { max-width: 460px; }
  .auth-foot { margin-top: 28px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 20px; color: var(--fg-3); font-size: 12px; line-height: 16px; }
  .auth-foot a { color: var(--fg-3); }
  .auth-foot a:hover { color: var(--fg-1); }

  @media (max-width: 860px) {
    .shell-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(280px, 86vw); height: 100dvh; border-right: 1px solid var(--line-1); transform: translateX(-100%); transition: transform .22s var(--ease), visibility 0s linear .22s; visibility: hidden; }
    .shell.nav-open .shell-sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-pop); transition: transform .22s var(--ease); }
    .shell-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .2s; }
    .shell.nav-open .shell-scrim { opacity: 1; pointer-events: auto; }
    .shell-main { padding: 0; }
    .shell-sheet { border-width: 0; border-radius: 0; min-height: calc(100dvh - var(--band-h)); }
    .shell-topbar { padding: 0 8px 0 12px; }
    .page, .page.is-wide { padding: 20px 16px 48px; }
    .shell-columns { padding: 24px 16px 56px; gap: 20px; }
    .shell-subnav { flex: 1 1 100%; flex-direction: row; overflow-x: auto; padding-bottom: 4px; border-bottom: 1px solid var(--line-1); }
    .shell-subnav .shell-who { display: none; }
    .shell-subnav .nav-item { flex: none; }
    .auth { padding-top: 48px; }
    .auth-card { padding: 24px 20px; }
  }
}

/* ===== components ===== */
@layer components {
  /* --- type --- */
  .t-display { font-size: 32px; line-height: 40px; font-weight: 650; font-stretch: 118%; letter-spacing: -.012em; }
  .t-title { font-size: 24px; line-height: 32px; font-weight: 650; font-stretch: 118%; letter-spacing: -.008em; }
  .t-stat { font-size: 28px; line-height: 32px; font-weight: 560; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
  .t-h2 { font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: -.005em; }
  .t-h3 { font-size: 14px; line-height: 20px; font-weight: 600; }
  .t-lead { font-size: 15px; line-height: 24px; color: var(--fg-2); }
  .t-body { font-size: 14px; line-height: 20px; }
  .t-sm { font-size: 13px; line-height: 18px; }
  .t-xs { font-size: 12px; line-height: 16px; }
  .t-2xs { font-size: 11px; line-height: 14px; font-weight: 500; }

  /* --- icons --- */
  .i { display: block; width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .i-sm { width: 14px; height: 14px; }
  .i-lg { width: 20px; height: 20px; }
  .spin { animation: rv-spin .8s linear infinite; }
  @keyframes rv-spin { to { transform: rotate(360deg); } }

  /* --- brand lockup and product switcher --- */
  .lockup { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-1); line-height: 1; }
  .lockup img { width: 20px; height: 20px; object-fit: contain; }
  .wordmark { font-size: 14px; font-weight: 800; font-stretch: 125%; letter-spacing: .18em; margin-right: -.1em; color: var(--fg-1); }
  .product-name { font-size: 14px; font-weight: 500; color: var(--fg-2); }
  .lockup.is-lg img { width: 24px; height: 24px; }
  .lockup.is-lg .wordmark, .lockup.is-lg .product-name { font-size: 16px; }
  .lockup.is-sm { gap: 6px; }
  .lockup.is-sm img { width: 14px; height: 14px; }
  .lockup.is-sm .wordmark { font-size: 11px; }
  .lockup.is-sm .product-name { font-size: 12px; }
  .switcher { display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 0 8px 0 10px; border: 0; border-radius: var(--r-md); background: transparent; color: var(--fg-1); cursor: pointer; text-align: left; }
  .switcher:hover, .switcher[aria-expanded="true"] { background: var(--bg-2); }
  .switcher > .i { margin-left: auto; color: var(--fg-3); }
  .switcher > .lockup, .switcher > .tag { flex: none; }
  .switcher > .tag { padding: 0 5px; font-size: 11.5px; }
  .shell-sidebar .switcher { gap: 6px; padding: 0 6px 0 8px; }
  .shell-header .switcher { width: auto; }

  /* --- nav --- */
  .side-group { padding: 18px 10px 6px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--fg-3); }
  .nav-item { display: flex; align-items: center; gap: 10px; min-width: 0; height: 32px; padding: 0 10px; border-radius: var(--r-md); color: var(--fg-2); font-size: 13.5px; font-weight: 500; text-decoration: none; white-space: nowrap; }
  .nav-item .i { color: var(--fg-3); }
  .nav-item:hover { background: var(--bg-2); color: var(--fg-1); }
  .nav-item.is-active { background: var(--bg-3); color: var(--fg-1); box-shadow: inset 0 0 0 1px var(--line-1); }
  .nav-item.is-active .i { color: var(--accent); }
  .nav-item.is-disabled { color: var(--fg-3); cursor: default; background: transparent; }
  .nav-item.is-sub { height: 30px; padding-left: 36px; font-size: 13px; }
  .nav-item > .nav-ext { margin-left: auto; }
  .nav-parent { display: flex; align-items: center; gap: 2px; min-width: 0; }
  .nav-parent > .nav-item { flex: 1 1 auto; }
  .nav-toggle { flex: 0 0 auto; color: var(--fg-3); }
  .nav-caret { transition: transform .15s var(--ease); }
  .nav-toggle[aria-expanded="false"] .nav-caret { transform: rotate(-90deg); }
  .nav-children { display: flex; flex-direction: column; gap: 2px; }
  .nav-children.is-collapsed { display: none; }
  .nav-meta { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--fg-3); font-variant-numeric: tabular-nums; }
  .nav-meta.is-stop { color: var(--stop); }
  .nav-meta.is-warn { color: var(--warn); }
  .team-dot { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border-radius: 5px; background: var(--bg-4); color: var(--fg-1); font-size: 9.5px; font-weight: 700; }

  /* --- top bar pieces --- */
  .crumbs { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-3); white-space: nowrap; overflow: hidden; }
  .crumbs a { color: var(--fg-3); }
  .crumbs a:hover { color: var(--fg-1); }
  .crumbs .i { width: 14px; height: 14px; color: var(--fg-4); }
  .crumbs [aria-current="page"] { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--fg-1); font-weight: 500; }
  .search { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 300px; min-width: 0; height: 32px; padding: 0 6px 0 10px; border-radius: var(--r-md); border: 1px solid var(--line-1); background: var(--bg-2); color: var(--fg-3); font-size: 13px; cursor: pointer; text-align: left; }
  .search:hover { border-color: var(--line-2); color: var(--fg-2); }
  .search-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .search .kbds { margin-left: auto; display: inline-flex; gap: 3px; }
  .kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-xs); border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--bg-1); color: var(--fg-2); font: 500 11px/1 var(--font); }
  .userbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 2px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--fg-3); cursor: pointer; }
  .userbtn:hover, .userbtn[aria-expanded="true"] { background: var(--bg-2); }
  .btn.shell-menu-btn { display: none; }
  @media (max-width: 860px) {
    .btn.shell-menu-btn { display: inline-flex; margin-left: -6px; }
    .search { flex: none; width: auto; padding: 0 9px; }
    .search-text, .search .kbds { display: none; }
  }

  /* --- operator mode --- */
  .opband { position: sticky; top: 0; z-index: 50; flex: none; width: 100%; display: flex; align-items: center; gap: 6px 12px; height: var(--band-h); padding: 0 12px 0 16px; border-bottom: 1px solid var(--op-line); background: var(--bg-0); background-image: linear-gradient(var(--op-soft), var(--op-soft)); color: var(--op-text); font-size: 12.5px; line-height: 16px; }
  .opband-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .opband strong { font-weight: 650; }
  .opband .btn { flex: none; height: 24px; margin-left: auto; padding: 0 8px; border-color: color-mix(in srgb, var(--op) 40%, transparent); background: transparent; color: var(--op-text); font-size: 12px; }
  .opband .btn:hover { background: var(--op-soft); color: var(--fg-1); }
  @media (max-width: 860px) {
    .opband { position: static; height: auto; min-height: 36px; flex-wrap: wrap; padding: 6px 12px; }
    .opband-text { white-space: normal; }
    .shell.is-operator { --band-h: 0px; }
  }

  /* --- buttons --- */
  .btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid transparent; border-radius: var(--r-sm); font-size: 13px; font-weight: 550; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
  .btn-primary { background: var(--accent); color: var(--accent-ink); }
  .btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
  .btn-secondary { background: var(--bg-3); border-color: var(--line-2); color: var(--fg-1); }
  .btn-secondary:hover { background: var(--bg-4); color: var(--fg-1); }
  .btn-ghost { background: transparent; color: var(--fg-2); }
  .btn-ghost:hover { background: var(--bg-3); color: var(--fg-1); }
  .btn-danger { background: var(--stop-soft); border-color: color-mix(in srgb, var(--stop) 30%, transparent); color: var(--stop); }
  .btn-danger:hover { background: color-mix(in srgb, var(--stop) 20%, transparent); color: var(--stop); }
  .btn-danger-solid { background: var(--stop-solid); color: #FFFFFF; }
  .btn-danger-solid:hover { background: color-mix(in srgb, var(--stop-solid) 88%, #000); color: #FFFFFF; }
  .btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
  .btn-lg { height: 40px; padding: 0 16px; font-size: 14px; }
  .btn-block { width: 100%; }
  .btn-icon { width: 32px; padding: 0; }
  .btn-sm.btn-icon { width: 28px; }
  .btn-lg.btn-icon { width: 40px; }
  .btn[disabled], .btn.is-disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
  .btn.is-loading { cursor: progress; pointer-events: none; opacity: .8; }

  /* --- forms --- */
  .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
  .label { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--fg-1); }
  .label .opt { font-weight: 400; color: var(--fg-3); }
  .hint { font-size: 12px; line-height: 16px; color: var(--fg-3); }
  .err, .field-validation-error { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--stop); }
  .field-validation-valid { display: none; }
  .input { display: block; width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-0); color: var(--fg-1); font-size: 14px; outline: none; transition: border-color .12s, box-shadow .12s; }
  .input::placeholder { color: var(--fg-3); opacity: 1; }
  .input:hover { border-color: var(--line-3); }
  .input:focus, .input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
  .input.is-invalid, .input.input-validation-error { border-color: var(--stop); box-shadow: 0 0 0 3px var(--stop-soft); }
  .input[readonly] { background: var(--bg-2); color: var(--fg-2); }
  .input[disabled] { opacity: .55; cursor: not-allowed; }
  .input-sm { height: 32px; font-size: 13px; }
  .input.mono { font-family: var(--mono); font-size: 12.5px; }
  textarea.input { height: auto; min-height: 76px; padding: 8px 12px; line-height: 20px; resize: vertical; }
  .affix { position: relative; display: flex; align-items: center; min-width: 0; }
  .affix > .i { position: absolute; left: 10px; color: var(--fg-3); pointer-events: none; }
  .affix > .input { padding-left: 34px; }
  .affix > .kbds { position: absolute; right: 7px; display: inline-flex; gap: 3px; pointer-events: none; }
  .affix > .input[type="search"]::-webkit-search-cancel-button { display: none; }
  .affix.is-toolbar { width: min(260px, 100%); }
  .select { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer; }
  .select-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
  .select-wrap > .i { position: absolute; right: 10px; color: var(--fg-3); pointer-events: none; }
  .group { display: flex; min-width: 0; }
  .group > .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
  .group > .btn { height: 36px; margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
  .check { appearance: none; -webkit-appearance: none; position: relative; display: inline-block; width: 16px; height: 16px; margin: 0; flex: none; vertical-align: middle; border: 1px solid var(--line-3); border-radius: var(--r-xs); background: var(--bg-0); cursor: pointer; }
  .check:hover { border-color: var(--fg-3); }
  .check:checked, .check:indeterminate, .check.is-mixed { background: var(--accent); border-color: var(--accent); }
  .check:checked::after { content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 5px; height: 9px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
  .check:indeterminate::after, .check.is-mixed::after { content: ""; position: absolute; left: 3px; top: 6px; width: 8px; height: 2px; border-radius: 1px; background: var(--accent-ink); }
  .check[disabled], .switch[disabled] { opacity: .45; cursor: not-allowed; }
  .switch { appearance: none; -webkit-appearance: none; position: relative; width: 34px; height: 20px; margin: 0; flex: none; border: 1px solid var(--line-2); border-radius: var(--r-pill); background: var(--bg-4); cursor: pointer; transition: background .15s; }
  .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--fg-2); transition: transform .15s, background .15s; }
  .switch:checked { background: var(--accent); border-color: var(--accent); }
  .switch:checked::after { transform: translateX(14px); background: var(--accent-ink); }
  .choice { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 18px; cursor: pointer; }
  .choice > .check { margin-top: 1px; }
  .choice > .switch { margin-top: -1px; }
  .otp { display: flex; gap: 6px; }
  .otp .input { width: 40px; height: 44px; padding: 0; text-align: center; font-family: var(--mono); font-size: 18px; }
  .divider { display: flex; align-items: center; gap: 12px; color: var(--fg-3); font-size: 12px; }
  .divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

  /* --- segmented control, chips, tabs --- */
  .seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--bg-0); }
  .seg-item { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 26px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--fg-3); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
  .seg-item:hover { color: var(--fg-1); }
  .seg-item.is-active, .seg-item[aria-checked="true"], .seg-item[aria-current="page"] { background: var(--bg-3); color: var(--fg-1); box-shadow: 0 0 0 1px var(--line-2), 0 1px 2px rgba(0,0,0,.35); }
  .seg-count { font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
  .chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-pill); background: transparent; color: var(--fg-2); font-size: 12.5px; font-weight: 500; white-space: nowrap; cursor: pointer; text-decoration: none; }
  .chip:hover { background: var(--bg-2); color: var(--fg-1); }
  .chip.is-active, .chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--fg-1); }
  .chip.is-add { border-style: dashed; color: var(--fg-3); }
  .chip .k { color: var(--fg-3); }
  .chip .x { display: grid; place-items: center; width: 16px; height: 16px; margin-right: -4px; border-radius: 50%; color: var(--fg-3); }
  .tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-1); overflow-x: auto; scrollbar-width: none; }
  .tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; color: var(--fg-3); font-size: 13px; font-weight: 500; white-space: nowrap; }
  .tab:hover { color: var(--fg-1); }
  .tab.is-active, .tab[aria-current="page"], .tab[aria-selected="true"] { color: var(--fg-1); }
  .tab.is-active::after, .tab[aria-current="page"]::after, .tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; border-radius: 2px; background: var(--accent); }

  /* --- status: pills (condition, with dot), tags (names, no dot), meters, dots --- */
  .pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 7px; border-radius: var(--r-pill); background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--fg-2); font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; }
  .pill::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; }
  .pill-ok { background: var(--ok-soft); box-shadow: none; color: var(--ok); }
  .pill-warn { background: var(--warn-soft); box-shadow: none; color: var(--warn); }
  .pill-stop { background: var(--stop-soft); box-shadow: none; color: var(--stop); }
  .pill-accent { background: var(--accent-soft); box-shadow: none; color: var(--accent-text); }
  .pill-op { background: var(--op-soft); box-shadow: none; color: var(--op-text); }
  .tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: var(--r-xs); background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--fg-2); font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; vertical-align: middle; }
  .tag.mono { font-size: 11.5px; }
  .tag-accent { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent-text); }
  .tag-op { background: var(--op-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--op) 32%, transparent); color: var(--op-text); }
  .tag button { display: grid; place-items: center; width: 14px; height: 14px; margin-right: -2px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: var(--fg-3); cursor: pointer; }
  .tag button:hover { background: var(--bg-4); color: var(--fg-1); }
  .meter { flex: 1 1 auto; min-width: 48px; height: 4px; border-radius: var(--r-pill); background: var(--bg-4); overflow: hidden; }
  .meter > i { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: var(--accent); }
  .meter.is-warn > i { background: var(--warn); }
  .meter.is-stop > i { background: var(--stop); }
  .usage { display: flex; align-items: center; gap: 10px; min-width: 120px; }
  .usage .num { font-size: 12.5px; color: var(--fg-2); white-space: nowrap; }
  .dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--fg-3); }
  .dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-stop { background: var(--stop); } .dot-accent { background: var(--accent); }

  /* --- surfaces: panel, stats, list, tile, avatar, key-value, settings rows --- */
  .panel { min-width: 0; background: var(--bg-2); border: 1px solid var(--line-1); border-radius: var(--r-lg); }
  .panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-height: 52px; padding: 10px 16px; border-bottom: 1px solid var(--line-1); }
  .panel-body { padding: 16px; }
  .panel-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 44px; padding: 8px 16px; border-top: 1px solid var(--line-1); color: var(--fg-3); font-size: 12.5px; }
  .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--line-1); border: 1px solid var(--line-1); border-radius: var(--r-lg); overflow: hidden; }
  .stat { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 16px 20px 18px; background: var(--bg-2); color: inherit; }
  a.stat:hover { background: color-mix(in srgb, var(--bg-2) 94%, var(--fg-1)); color: inherit; }
  .stat-label { display: flex; align-items: center; gap: 6px; color: var(--fg-2); font-size: 13px; font-weight: 500; }
  .stat-label .i { color: var(--fg-3); }
  .stat-value { color: var(--fg-1); font-size: 28px; line-height: 32px; font-weight: 560; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
  .stat-value .of { color: var(--fg-3); font-size: 15px; font-weight: 450; letter-spacing: 0; }
  .stat-value.is-warn { color: var(--warn); } .stat-value.is-stop { color: var(--stop); }
  .stat-foot { color: var(--fg-3); font-size: 12px; line-height: 16px; }
  .list > li, .list-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 16px; border-top: 1px solid var(--line-1); }
  .list > li:first-child, .list-row:first-child { border-top: 0; }
  .list-main { flex: 1 1 auto; min-width: 0; }
  .tile { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: var(--r-md); background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--fg-2); }
  .tile-sm { width: 24px; height: 24px; border-radius: var(--r-sm); }
  .tile-lg { width: 48px; height: 48px; border-radius: var(--r-lg); }
  .tile img { width: 62%; height: 62%; object-fit: contain; }
  .tile.is-stop { color: var(--stop); } .tile.is-warn { color: var(--warn); } .tile.is-ok { color: var(--ok); }
  .avatar { width: 28px; height: 28px; flex: none; display: inline-grid; place-items: center; border-radius: 50%; background: var(--bg-4); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--fg-1); font-size: 11px; font-weight: 650; letter-spacing: .02em; }
  .avatar-sm { width: 20px; height: 20px; font-size: 9px; }
  .avatar-lg { width: 40px; height: 40px; font-size: 14px; }
  .dl { display: grid; grid-template-columns: minmax(110px, 150px) minmax(0, 1fr); gap: 10px 16px; font-size: 13px; line-height: 18px; }
  .dl dt { color: var(--fg-3); }
  .dl dd { margin: 0; min-width: 0; color: var(--fg-1); overflow-wrap: anywhere; }
  .setrow { display: flex; flex-wrap: wrap; gap: 12px 40px; padding: 24px 0; border-top: 1px solid var(--line-1); }
  .setrow-label { flex: 1 1 220px; max-width: 280px; }
  .setrow-label p { margin-top: 4px; color: var(--fg-3); font-size: 13px; line-height: 18px; }
  .setrow-body { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
  .panel > .setrow { padding: 20px; }
  .panel > .setrow:first-child { border-top: 0; }
  .qr { width: 136px; height: 136px; flex: none; display: grid; place-items: center; border: 1px dashed var(--line-3); border-radius: var(--r-md); background: var(--bg-0); color: var(--fg-3); font-size: 12px; }
  .code { margin: 0; padding: 12px 14px; overflow: auto; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--bg-0); color: var(--fg-2); font-family: var(--mono); font-size: 12px; line-height: 18px; white-space: pre; }
  .code .k { color: var(--fg-1); }
  .codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; padding: 14px 16px; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--bg-0); color: var(--fg-1); font-family: var(--mono); font-size: 13px; line-height: 20px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
  [data-copy] { cursor: copy; }

  /* --- table --- */
  .tbl-wrap { position: relative; min-width: 0; } /* contains .sr labels when th is static (mobile) */
  .table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; line-height: 18px; }
  .table th { position: sticky; top: var(--band-h); z-index: 1; height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg-3); font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; }
  .table td { height: 52px; padding: 0 12px; border-bottom: 1px solid var(--line-1); color: var(--fg-1); vertical-align: middle; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
  .table tbody tr:last-child td { border-bottom: 0; }
  .table .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .table .w-check { width: 44px; padding-right: 0; }
  .table tbody tr:hover td { background: var(--bg-hover); }
  .table tr[data-href] { cursor: pointer; }
  .table tr.is-selected td, .table tr:has(> .w-check .check:checked) td { background: var(--accent-soft); }
  .table tr.is-sub td { background: var(--bg-1); height: 44px; }
  .table.is-compact td, .is-operator .table:not(.is-comfortable) td { height: 38px; }
  .table.is-compact th, .is-operator .table:not(.is-comfortable) th { height: 32px; }
  .table td.is-empty { height: auto; padding: 0; }
  .cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .cell-sub { color: var(--fg-3); font-size: 12px; line-height: 16px; }
  .row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; opacity: 0; transition: opacity .12s; }
  .table tr:hover .row-actions, .table tr:focus-within .row-actions { opacity: 1; }
  .sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: none; cursor: pointer; }
  .sort:hover, th[aria-sort] .sort { color: var(--fg-1); }
  .sort-caret { opacity: 0; transition: opacity .12s, transform .15s var(--ease); }
  .sort:hover .sort-caret, .sort:focus-visible .sort-caret, th[aria-sort] .sort-caret { opacity: 1; }
  th[aria-sort="ascending"] .sort-caret { transform: rotate(180deg); }
  @media (hover: none) { .row-actions { opacity: 1; } }
  @media (max-width: 860px) {
    .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tbl-wrap .table td { white-space: nowrap; }
    .table th { position: static; }
  }

  /* --- overlays: menu (popover), command palette, confirm pop --- */
  .menu { min-width: 240px; padding: 6px; border-radius: var(--r-lg); background: var(--bg-3); box-shadow: var(--shadow-pop); color: var(--fg-1); }
  .menu[popover] { position: fixed; inset: auto; margin: 0; border: 0; max-width: calc(100vw - 24px); max-height: calc(100dvh - 80px); overflow: auto; }
  .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 0 8px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--fg-1); font-size: 13px; text-align: left; text-decoration: none; cursor: pointer; }
  .menu-item .i { color: var(--fg-3); }
  .menu-item:hover, .menu-item[aria-selected="true"] { background: var(--bg-4); color: var(--fg-1); }
  .menu-item .kbd, .menu-item .meta, .menu-item > .menu-end { margin-left: auto; }
  .menu-item .meta { color: var(--fg-3); font-size: 12px; white-space: nowrap; }
  .menu-item.is-danger, .menu-item.is-danger .i { color: var(--stop); }
  .menu-item.is-op .i { color: var(--op); }
  .menu-item.is-rich { padding: 8px; }
  .menu-item.is-rich > span:not(.tile) { min-width: 0; }
  .menu-title { display: block; font-weight: 600; }
  .menu-item .check-mark { margin-left: auto; color: var(--accent); }
  .menu-label { padding: 8px 8px 4px; color: var(--fg-3); font-size: 12px; line-height: 16px; font-weight: 500; }
  .menu-sep { height: 1px; margin: 6px -6px; background: var(--line-1); }
  .menu-head { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 8px 10px; }
  .menu form { margin: 0; }
  #rain-user-menu { top: calc(var(--band-h) + 58px); right: 16px; }
  #rain-product-menu { top: calc(var(--band-h) + 54px); left: 10px; width: 300px; }
  .is-account #rain-user-menu { top: 52px; }
  .is-account #rain-product-menu { top: 52px; left: 12px; }
  @supports (position-anchor: --a) {
    .userbtn { anchor-name: --rain-user; }
    .switcher { anchor-name: --rain-switcher; }
    #rain-user-menu, .is-account #rain-user-menu { position-anchor: --rain-user; top: anchor(bottom); right: anchor(right); margin-top: 6px; }
    #rain-product-menu, .is-account #rain-product-menu { position-anchor: --rain-switcher; top: anchor(bottom); left: anchor(left); margin-top: 6px; }
  }
  dialog { padding: 0; border: 0; color: var(--fg-1); }
  dialog::backdrop { background: var(--scrim); }
  .cmdk { width: 100%; max-width: 560px; overflow: hidden; border-radius: var(--r-xl); background: var(--bg-3); box-shadow: var(--shadow-pop); }
  dialog.cmdk { width: calc(100vw - 32px); max-height: min(520px, 76dvh); margin: 12dvh auto auto; }
  dialog.cmdk[open] { display: flex; flex-direction: column; }
  .cmdk-input { flex: none; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line-1); color: var(--fg-3); }
  .cmdk-input input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; color: var(--fg-1); font-size: 15px; }
  .cmdk-list { flex: 1 1 auto; overflow-y: auto; padding: 6px; }
  .cmdk-empty { padding: 28px 16px; text-align: center; color: var(--fg-3); font-size: 13px; }
  .cmdk-foot { flex: none; display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line-1); color: var(--fg-3); font-size: 12px; line-height: 16px; }
  .cmdk-foot > span { display: inline-flex; align-items: center; gap: 6px; }
  .pop { width: 100%; max-width: 340px; padding: 14px; border-radius: var(--r-lg); background: var(--bg-3); box-shadow: var(--shadow-pop); color: var(--fg-1); }
  .pop .input { background: var(--bg-1); }
  .pop-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
  dialog.pop { max-width: min(340px, calc(100vw - 32px)); }
  dialog.pop.is-anchored { margin: 0; }
  .drawer { min-width: 0; background: var(--bg-2); border: 1px solid var(--line-1); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); }
  .bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 5px 5px 5px 12px; border-radius: var(--r-lg); background: var(--bg-3); box-shadow: var(--shadow-pop); font-size: 13px; }
  .bulkbar .count { margin-right: 6px; padding-right: 12px; border-right: 1px solid var(--line-2); font-weight: 600; font-variant-numeric: tabular-nums; }

  /* --- feedback: toast, notice, flash, empty, skeleton --- */
  .toast { display: flex; align-items: flex-start; gap: 10px; width: 100%; max-width: 380px; padding: 12px 12px 12px 14px; border-radius: var(--r-lg); background: var(--bg-3); box-shadow: var(--shadow-pop); color: var(--fg-1); font-size: 13px; line-height: 18px; }
  .toast > .i { margin-top: 1px; color: var(--accent-text); }
  .toast.is-ok > .i { color: var(--ok); } .toast.is-warn > .i { color: var(--warn); } .toast.is-stop > .i { color: var(--stop); }
  .toast-body { flex: 1; min-width: 0; padding-top: 1px; overflow-wrap: anywhere; }
  .toast > .btn { margin: -4px -4px -4px 0; }
  .toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
  .toasts > .toast { pointer-events: auto; animation: rv-rise .18s var(--ease); }
  .toasts > .toast.is-leaving { opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
  @keyframes rv-rise { from { opacity: 0; transform: translateY(6px); } }
  .notice { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 12px 12px 14px; border: 1px solid var(--line-1); border-radius: var(--r-lg); background: var(--bg-2); }
  .notice-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-text); }
  .notice.is-ok .notice-icon { background: var(--ok-soft); color: var(--ok); }
  .notice.is-warn .notice-icon { background: var(--warn-soft); color: var(--warn); }
  .notice.is-stop .notice-icon { background: var(--stop-soft); color: var(--stop); }
  .notice-body { flex: 1 1 280px; min-width: 0; }
  .notice > .group { flex: 1 1 380px; }
  .notice-title { font-size: 13px; line-height: 18px; font-weight: 600; }
  .notice-text { font-size: 13px; line-height: 18px; color: var(--fg-3); }
  .flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
  .flash { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--bg-2); color: var(--fg-1); font-size: 13px; line-height: 18px; }
  .flash > .i { margin-top: 1px; color: var(--accent-text); }
  .flash-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .flash.is-ok { border-color: color-mix(in srgb, var(--ok) 32%, transparent); background: var(--ok-soft); }
  .flash.is-ok > .i { color: var(--ok); }
  .flash.is-warn { border-color: color-mix(in srgb, var(--warn) 32%, transparent); background: var(--warn-soft); }
  .flash.is-warn > .i { color: var(--warn); }
  .flash.is-stop { border-color: color-mix(in srgb, var(--stop) 32%, transparent); background: var(--stop-soft); }
  .flash.is-stop > .i { color: var(--stop); }
  .empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 24px; text-align: center; }
  .empty p { max-width: 40ch; color: var(--fg-3); font-size: 13px; line-height: 18px; }
  .empty-icon { width: 40px; height: 40px; margin-bottom: 8px; display: grid; place-items: center; border-radius: var(--r-lg); background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--fg-2); }
  .empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
  .sk { display: block; height: 10px; border-radius: var(--r-xs); background: var(--bg-4); animation: rv-pulse 1.6s ease-in-out infinite; }
  @keyframes rv-pulse { 50% { opacity: .5; } }

  /* --- timeline (activity, audit) and the single-series column chart --- */
  .tl > li { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
  .tl > li::before { content: ""; position: absolute; left: 4px; top: 16px; bottom: 2px; width: 1px; background: var(--line-2); }
  .tl > li:last-child { padding-bottom: 0; }
  .tl > li:last-child::before { display: none; }
  .tl-dot { width: 9px; height: 9px; margin-top: 5px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--fg-3); }
  .tl-dot.is-ok { box-shadow: inset 0 0 0 1.5px var(--ok); } .tl-dot.is-warn { box-shadow: inset 0 0 0 1.5px var(--warn); } .tl-dot.is-stop { box-shadow: inset 0 0 0 1.5px var(--stop); }
  .tl-dot.is-accent { box-shadow: inset 0 0 0 1.5px var(--accent); } .tl-dot.is-op { box-shadow: inset 0 0 0 1.5px var(--op); }
  .tl-body { flex: 1; min-width: 0; }
  .tl-meta { margin-top: 3px; color: var(--fg-3); font-size: 12px; line-height: 16px; }
  .tl-time { flex: none; color: var(--fg-3); font-size: 12px; line-height: 20px; font-variant-numeric: tabular-nums; }
  .bars { display: flex; align-items: flex-end; gap: 2px; height: 96px; border-bottom: 1px solid var(--line-2); }
  .bars > i { position: relative; flex: 1 1 0; min-width: 6px; border-radius: 4px 4px 0 0; background: var(--accent); }
  .bars > i:hover { background: var(--accent-hover); }
  .bars-axis { display: flex; gap: 2px; margin-top: 6px; color: var(--fg-3); font-size: 12px; line-height: 16px; }
  .bars-axis > span { flex: 1; text-align: center; }

  /* --- object pages: page head with a leading tile and a meta line (license, team) --- */
  .page-ident { display: flex; align-items: center; gap: 16px; min-width: 0; }
  .page-ident > .tile { color: var(--fg-1); }
  .page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 6px; color: var(--fg-3); font-size: 13px; line-height: 18px; }
  .vr { width: 1px; height: 14px; flex: none; background: var(--line-2); }
  .btn-xs { height: 22px; padding: 0 6px; font-size: 12px; }
  .btn-xs.btn-icon { width: 22px; padding: 0; }

  /* --- meter as a native <progress>: value/max draw the fill, so no inline width --- */
  progress.meter { -webkit-appearance: none; appearance: none; display: block; width: 100%; border: 0; color: var(--accent); background: var(--bg-4); }
  progress.meter::-webkit-progress-bar { background: var(--bg-4); border-radius: var(--r-pill); }
  progress.meter::-webkit-progress-value { background: currentColor; border-radius: var(--r-pill); }
  progress.meter::-moz-progress-bar { background: currentColor; border-radius: var(--r-pill); }
  progress.meter.is-warn { color: var(--warn); }
  progress.meter.is-stop { color: var(--stop); }
  .stat > .meter { flex: none; }
  .notice .usage, .panel-head .usage, .usage.is-fixed { flex: 0 1 180px; }
  .select-wrap.is-toolbar { width: min(180px, 100%); }
  .panel-body + .list { border-top: 1px solid var(--line-1); }
  .auth-card .notice-body { flex-basis: 200px; }
  .table .w-meter { width: 200px; }
  .table .w-actions { width: 1%; white-space: nowrap; }

  /* --- panel body split in two panes (activation link | pairing code); the 1px gap draws the
         divider whether the panes sit side by side or stack --- */
  .panel-split { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line-1); }
  .panel-split > * { flex: 3 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; padding: 20px; background: var(--bg-2); }
  .panel-split > * + * { flex: 2 1 300px; }

  /* --- a real QR image: scanners need the white quiet zone, so the well turns white --- */
  .qr.is-code { padding: 8px; border: 0; background: #FFFFFF; }
  .qr > img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
  .qr.is-sm { width: 112px; height: 112px; }

  /* --- pairing-code input, radio, choice cards, quantity stepper (Activate, Buy) --- */
  .input.is-narrow { width: 80px; }
  .input.is-code { height: 44px; font-family: var(--mono); font-size: 18px; letter-spacing: .3em; text-align: center; }
  .radio { -webkit-appearance: none; appearance: none; position: relative; display: inline-block; width: 16px; height: 16px; margin: 0; flex: none; border: 1px solid var(--line-3); border-radius: 50%; background: var(--bg-0); cursor: pointer; }
  .radio:hover { border-color: var(--fg-3); }
  .radio:checked { border-color: var(--accent); }
  .radio:checked::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
  .picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
  .pick { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--bg-1); cursor: pointer; transition: border-color .12s, background .12s; }
  .pick:hover { border-color: var(--line-3); }
  .pick:has(> .radio:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
  .pick:has(> .radio:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
  .pick > .radio:focus-visible { outline: none; }
  .pick-main { flex: 1 1 auto; min-width: 0; font-size: 13.5px; font-weight: 500; }
  .pick-price { flex: none; color: var(--fg-2); font-size: 13px; font-variant-numeric: tabular-nums; }
  .stepper { display: inline-flex; align-items: stretch; }
  .stepper > .btn { width: 36px; height: 36px; padding: 0; }
  .stepper > .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
  .stepper > .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; }
  .stepper > .input { position: relative; z-index: 1; width: 72px; margin: 0 -1px; border-radius: 0; text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
  .stepper > .input::-webkit-inner-spin-button, .stepper > .input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

  /* --- main column + sticky summary aside (Buy) --- */
  .with-aside { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
  .with-aside > .is-sticky { position: sticky; top: 16px; }
  @media (max-width: 1000px) {
    .with-aside { grid-template-columns: minmax(0, 1fr); }
    .with-aside > .is-sticky { position: static; }
  }

  /* Touch: the approved desktop density is 28/32px. Coarse pointers get ≥44px targets
     (≥36px inside dense tables), the hover-only affordances are always shown. */
  @media (pointer: coarse) {
    .btn, .nav-item, .menu-item, .switcher, .userbtn, .search, .chip, .tab, .seg-item, .input, .select { min-height: 44px; }
    .btn-icon { min-width: 44px; }
    .table .btn, .table .chip, .table .seg-item { min-height: 36px; }
    .table .btn-icon { min-width: 36px; }
    .tag button { width: 24px; height: 24px; }
    .check { width: 20px; height: 20px; }
    .check:checked::after { left: 6px; top: 2.5px; width: 6px; height: 11px; }
    .check:indeterminate::after, .check.is-mixed::after { left: 4px; top: 8px; width: 10px; }
  }
}

/* ===== utilities: the small set pages use instead of inline styles ===== */
@layer utilities {
  .stack { display: flex; flex-direction: column; gap: 16px; }
  .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .row.nowrap { flex-wrap: nowrap; }
  .grid-2, .grid-3, .grid-4 { display: grid; gap: 16px; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  @media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 860px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
  .grid-3-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
  @media (max-width: 1100px) { .grid-3-2 { grid-template-columns: minmax(0, 1fr); } }
  .narrow { width: 100%; max-width: 560px; margin-inline: auto; }
  .items-end { align-items: flex-end; }
  .fw-400 { font-weight: 400; }
  .gap-0 { gap: 0; } .gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); } .gap-4 { gap: var(--s-4); } .gap-6 { gap: var(--s-6); } .gap-8 { gap: var(--s-8); }
  .mt-0 { margin-top: 0; } .mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); } .mt-8 { margin-top: var(--s-8); }
  .mb-0 { margin-bottom: 0; } .mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }
  .ml-auto { margin-left: auto; }
  .flex-1 { flex: 1 1 0; min-width: 0; }
  .min-w-0 { min-width: 0; }
  .w-full { width: 100%; }
  .items-start { align-items: flex-start; }
  .items-center { align-items: center; }
  .justify-between { justify-content: space-between; }
  .justify-center { justify-content: center; }
  .justify-end { justify-content: flex-end; }
  .text-center { text-align: center; }
  .text-left { text-align: left; }
  .text-right { text-align: right; }
  .text-muted, .c3 { color: var(--fg-3); }
  .text-secondary, .c2 { color: var(--fg-2); }
  .c1 { color: var(--fg-1); }
  .t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-stop { color: var(--stop); } .t-accent { color: var(--accent-text); }
  .fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; }
  .mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
  .tabular, .num { font-variant-numeric: tabular-nums; }
  .truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .break { overflow-wrap: anywhere; }
  .sr, .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  @media (max-width: 860px) { .hide-mobile { display: none !important; } }
}

/* ===== Rain ID ===== components the Rain ID pages needed that the system didn't have yet
   (consent, security, admin user/application/audit). Appended; nothing above is changed. */
@layer components {
  /* Consent: the app and Rain side by side, joined by dots */
  .connect { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 24px; }
  .connect-dots { display: inline-flex; gap: 5px; }

  /* A tile that holds initials instead of an icon or a logo */
  .tile-text { color: var(--fg-1); font-size: 11px; font-weight: 700; font-stretch: 118%; }
  .tile-lg.tile-text { font-size: 18px; }
  .tile-sm.tile-text { font-size: 9.5px; }

  /* Something drawn now but not built yet ("Coming soon" rows) */
  .is-dim { opacity: .6; }

  /* A list row's expansion (a setup form under a factor), indented past the row's tile */
  .list-detail { display: flex; flex-direction: column; gap: 12px; padding: 0 16px 16px 60px; }
  .panel-head + .list-row { border-top: 0; }
  @media (max-width: 860px) { .list-detail { padding-left: 16px; } }

  /* Danger zone */
  .panel.is-danger { border-color: color-mix(in srgb, var(--stop) 30%, transparent); }
  .panel.is-danger > .panel-head { border-color: color-mix(in srgb, var(--stop) 20%, transparent); }

  /* Six-tile stat strip: three across, then two, then one */
  .stats.is-3col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  @media (max-width: 1100px) { .stats.is-3col { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 600px) { .stats.is-3col { grid-template-columns: minmax(0, 1fr); } }

  /* Segmented control as a native radio group (no JS): the checked option is the active segment */
  .field > .seg { align-self: flex-start; }
  .seg-item:has(> input[type="radio"]) { position: relative; }
  .seg-item > input[type="radio"] { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
  .seg-item:has(> input:checked) { background: var(--bg-3); color: var(--fg-1); box-shadow: 0 0 0 1px var(--line-2), 0 1px 2px rgba(0,0,0,.35); }
  .seg-item:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
  .seg-item:has(> input:disabled) { cursor: not-allowed; opacity: .55; }

  /* Choice cards with a checkbox (the application's scope grid) */
  .pick:has(> .check:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
  .pick:has(> .check:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
  .pick > .check:focus-visible { outline: none; }
  .pick:has(> .check:disabled) { cursor: default; }

  /* A small "add" chip inside a table cell */
  .chip.chip-xs { height: 22px; padding: 0 8px; gap: 4px; font-size: 12px; }

  /* A list row whose fields edit in place (the scope catalog) */
  .edit-row { flex-wrap: wrap; }
  .edit-row-label { flex: 0 0 200px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
  .edit-row-form { flex: 1 1 520px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
  .edit-row-spacer { flex: none; width: 64px; }
  @media (max-width: 860px) { .edit-row-form { grid-template-columns: minmax(0, 1fr); } .edit-row-spacer { display: none; } }
}
@layer utilities {
  .t-balance { text-wrap: balance; }
}

/* ===== Console admin ===== the operator area (/Admin: dashboard, licenses, devices, orders,
   catalog, customers, audit, system). Appended; nothing above is changed. */
@layer components {
  /* Customer lookup: in the dashboard head, and as the bar on top of the Customers page */
  .lookup { flex: 0 1 420px; min-width: min(260px, 100%); display: flex; flex-direction: column; gap: 6px; }
  .lookup-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; }
  .lookup-bar > .affix { flex: 0 1 560px; }
  .input.is-lg { height: 40px; }

  /* Activations chart: value over each bar, room above for it */
  .panel-body.chart { padding: 28px 20px 16px; }
  .bars .bar-n { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 3px; color: var(--fg-3); font-size: 11px; font-style: normal; line-height: 14px; text-align: center; font-variant-numeric: tabular-nums; }

  .tile-xs { width: 20px; height: 20px; border-radius: var(--r-xs); }

  /* "Needs an operator": on a phone the actions drop under the text */
  @media (max-width: 860px) {
    .attn > li { flex-wrap: wrap; }
    .attn > li > .row { flex: 1 1 100%; padding-left: 44px; }
  }
  .team-dot.is-lg { width: 28px; height: 28px; border-radius: var(--r-md); font-size: 11px; }

  /* Operator table toolbars: a GET filter form and/or the bulk bar in the panel head */
  .panel-head.is-toolbar { padding: 10px 12px; }
  .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
  .select-wrap.is-compact > .input { width: auto; }
  .filters > .select-wrap.is-toolbar { width: min(160px, 100%); }
  .panel-head > .filters { flex: 0 0 auto; max-width: 100%; }
  .panel-head > .filters.w-full { flex: 1 1 100%; }
  /* A filter form that takes the rest of the panel head, its controls right-aligned (Rain ID users) */
  .filters.is-end { flex: 1 1 auto; justify-content: flex-end; gap: 8px; }
  .table.is-compact .w-meter, .is-operator .table .w-meter { width: 160px; }
  /* A table in a narrow column (customer lookup) scrolls sideways instead of overflowing its panel */
  .tbl-wrap.is-scroll { overflow-x: auto; }
  .tbl-wrap.is-scroll .table th { position: static; }
  /* The sale switch is a submit button (confirm with reason), so it carries aria-checked, not :checked */
  button.switch { padding: 0; }
  .switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
  .switch[aria-checked="true"]::after { transform: translateX(14px); background: var(--accent-ink); }
  .affix.is-toolbar.is-wide { width: min(300px, 100%); }
  .input.is-day { width: 148px; }
  .panel-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line-1); }
  .bulkbar [data-select-count] { font-variant-numeric: tabular-nums; }

  /* Collapsible sub-rows (catalog groups under their product), toggled by rain.js */
  .toggle-row > .i { transition: transform .12s; }
  .toggle-row[aria-expanded="true"] > .i { transform: rotate(90deg); }
  .toggle-space { width: 22px; flex: none; }
  .table tr.is-collapsed { display: none; }
  .table td.is-indent { padding-left: 52px; }
  .table .w-toggle { width: 36px; padding-right: 0; }
  .table td.nowrap, .nowrap { white-space: nowrap; }

  /* Rows that expand without JS (audit events): a visually hidden checkbox and its label as the
     button; the detail row right after shows while it is checked */
  .row-expander { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
  .row-expander-btn > .i { transition: transform .12s; }
  .row-expander:checked + .row-expander-btn > .i { transform: rotate(90deg); }
  .row-expander:focus-visible + .row-expander-btn { outline: 2px solid var(--accent); outline-offset: 2px; }
  .table tr.row-detail { display: none; }
  .table tr:has(.row-expander:checked) + tr.row-detail { display: table-row; }
  .table tbody tr:has(+ tr.row-detail:last-child):not(:has(.row-expander:checked)) td { border-bottom: 0; }
  .table tr.row-detail td { height: auto; padding: 4px 16px 16px 48px; white-space: normal; }
  .detail { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
  .detail > .code { flex: 2 1 420px; min-width: 0; max-height: 360px; white-space: pre-wrap; overflow-wrap: anywhere; }
  .detail > .stack { flex: 1 1 260px; min-width: 0; }
  .code.is-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
  .dl.is-tight { grid-template-columns: 88px minmax(0, 1fr); gap: 6px 12px; font-size: 12.5px; }
  .clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 60ch; white-space: normal; }
  @media (max-width: 860px) { .table tr.row-detail td { padding-left: 16px; } }

  /* Entitlement editor rows: identifier | value | remove */
  .ent-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
  @media (max-width: 600px) { .ent-row { grid-template-columns: minmax(0, 1fr) auto; } .ent-row > .field:first-of-type { grid-column: 1 / -1; } }
}

@layer utilities {
  .flex-3 { flex: 3 1 460px; min-width: 0; }
  .flex-2 { flex: 2 1 320px; min-width: 0; }
  .measure { width: 100%; max-width: 640px; }
  .measure-wide { width: 100%; max-width: 920px; }
  .mb-3 { margin-bottom: var(--s-3); }
}

/* Notifications */
/* ===== Notifications ===== the operator bell in the top bar (a .btn-icon with an unread badge and a
   popover of the latest entries), the inbox rows and the settings matrix (/Admin/Notifications*).
   Appended; nothing above is changed. */
@layer components {
  /* The bell: the badge sits on the icon's corner, ringed in the sheet colour so it reads on hover too */
  .bell { position: relative; }
  .bell[aria-expanded="true"] { background: var(--bg-3); color: var(--fg-1); }
  .bell-badge { position: absolute; top: 1px; right: -1px; min-width: 16px; height: 16px; padding: 0 4px; display: grid; place-items: center; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 2px var(--bg-1); font-size: 10px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; pointer-events: none; }

  /* The popover: under the bell where anchor positioning exists, top right otherwise; full width on a phone */
  .bell-pop { width: min(380px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
  .bell-pop:popover-open { display: flex; flex-direction: column; }
  #rain-bell { top: calc(var(--band-h) + 58px); right: 60px; }
  @supports (position-anchor: --a) {
    .bell { anchor-name: --rain-bell; }
    #rain-bell { position-anchor: --rain-bell; top: anchor(bottom); right: anchor(right); margin-top: 6px; }
  }
  @media (max-width: 600px) {
    #rain-bell { top: calc(var(--band-h) + 58px); left: 12px; right: 12px; width: auto; margin-top: 0; }
  }
  .bell-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 10px 10px 14px; border-bottom: 1px solid var(--line-1); }
  .bell-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
  .bell-actions > form { margin: 0; }
  .bell-list { flex: 1 1 auto; min-height: 0; max-height: min(420px, calc(100dvh - 220px)); overflow-y: auto; padding: 4px; }
  .bell-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--fg-2); text-decoration: none; }
  .bell-item:hover, .bell-item:focus-visible { background: var(--bg-4); color: var(--fg-1); }
  .bell-dot { width: 7px; height: 7px; margin-top: 6px; flex: none; border-radius: 50%; }
  .bell-item.is-unread .bell-dot { background: var(--accent); }
  .bell-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .bell-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: 13px; line-height: 18px; }
  .bell-item.is-unread .bell-title { color: var(--fg-1); font-weight: 550; }
  .bell-meta { color: var(--fg-3); font-size: 12px; line-height: 16px; }
  .bell-empty { padding: 28px 18px; color: var(--fg-3); font-size: 13px; line-height: 18px; text-align: center; }
  .bell-foot { flex: none; display: block; padding: 10px 14px; border-top: 1px solid var(--line-1); color: var(--accent-text); font-size: 13px; font-weight: 500; text-align: center; }
  .bell-foot:hover { background: var(--bg-4); color: var(--fg-1); }

  /* Inbox rows: an unread one has a faint accent wash, a brighter title and a dot by its Mark read */
  .notif-list > li.is-unread { background: color-mix(in srgb, var(--accent) 4%, transparent); }
  .notif-title { color: var(--fg-2); font-size: 13.5px; line-height: 20px; font-weight: 500; overflow-wrap: anywhere; }
  .notif-title:hover { color: var(--fg-1); text-decoration: underline; text-underline-offset: 2px; }
  .notif.is-unread .notif-title { color: var(--fg-1); font-weight: 600; }
  .notif-body { max-width: 90ch; overflow-wrap: anywhere; }
  .notif-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); }
  @media (max-width: 860px) {
    .notif-list > li { flex-wrap: wrap; }
    .notif-list > li > .row { flex: 1 1 100%; justify-content: flex-end; }
  }

  /* Settings matrix: two centred switch columns; the category text may wrap */
  .table th.c, .table td.c { width: 96px; text-align: center; }
  .notif-desc { max-width: 64ch; white-space: normal; }
  @media (max-width: 860px) { .table th.c, .table td.c { width: 68px; } }

  @media (pointer: coarse) { .bell-item { min-height: 44px; } }
}

/* Passkeys (Rain ID: Security, Login, admin user detail; passkeys.js drives them) */
@layer components {
  .pk-signin { display: flex; flex-direction: column; gap: 20px; }
  .panel-head > .pk-head { flex: 1 1 260px; }
  .pk-rename[popover] { inset: 0; margin: auto; height: fit-content; border: 0; }
  .pk-rename[popover]::backdrop { background: rgb(0 0 0 / .45); }
  .pk-rename .field + .pop-actions { margin-top: 14px; }
  .pk-admin-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
  .pk-admin-list > li { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 6px 10px; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--bg-1); }
  .pk-admin-list > li > div { flex: 1; }
}

/* Operator record pages (Rain Console /Admin): a small anchored form, opened with popovertarget (device rename) */
@layer components {
  .pop-form[popover] { inset: 0; margin: auto; height: fit-content; border: 0; }
  .pop-form[popover]::backdrop { background: rgb(0 0 0 / .45); }
  .pop-form .field + .pop-actions { margin-top: 14px; }
  /* A stored email rendered in a sandboxed frame: mail HTML expects a white page */
  .mail-frame { display: block; width: 100%; min-height: 520px; border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); background: #fff; }
  .pre-wrap { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
}
