@layer components {
  .btn {
    --b-bg: var(--surface-2);
    --b-bd: var(--border);
    --b-fg: var(--text);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: var(--ctl-h); min-width: var(--ctl-h); padding: 0 var(--s-3);
    border-radius: var(--r-md); border: 1px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg);
    font-size: var(--fs-sm); font-weight: 500; letter-spacing: -0.005em; white-space: nowrap; user-select: none;
    box-shadow: 0 1px 0 oklch(1 0 0 / 0.03) inset, 0 1px 2px oklch(0 0 0 / 0.25);
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
    touch-action: manipulation;
  }
  .btn:hover:not(:disabled) { --b-bg: var(--surface-3); --b-bd: var(--border-strong); }
  .btn:active:not(:disabled) { transform: translateY(0.5px) scale(0.985); }
  .btn:disabled, .btn[aria-disabled='true'] { opacity: 0.4; }
  .btn .icon { width: 15px; height: 15px; color: var(--text-2); }
  .btn:hover .icon { color: currentColor; }
  .btn-primary { --b-bg: var(--primary); --b-bd: var(--primary); --b-fg: var(--on-primary); box-shadow: 0 1px 2px oklch(0 0 0 / 0.3); }
  .btn-primary .icon { color: var(--on-primary); }
  .btn-primary:hover:not(:disabled) { --b-bg: var(--primary-hover); --b-bd: var(--primary-hover); }
  .btn-primary:active:not(:disabled) { --b-bg: var(--primary-press); }
  .btn-danger { --b-bg: transparent; --b-bd: var(--danger-line); --b-fg: var(--danger); box-shadow: none; }
  .btn-danger .icon { color: var(--danger); }
  .btn-danger:hover:not(:disabled) { --b-bg: var(--danger-soft); --b-bd: var(--danger); }
  .btn-solid-danger { --b-bg: var(--danger); --b-bd: var(--danger); --b-fg: oklch(0.99 0 0); }
  .btn-solid-danger .icon { color: currentColor; }
  .btn-solid-danger:hover:not(:disabled) { --b-bg: var(--danger-hover); --b-bd: var(--danger-hover); }
  .btn-ghost { --b-bg: transparent; --b-bd: transparent; --b-fg: var(--text-2); box-shadow: none; }
  .btn-ghost:hover:not(:disabled) { --b-bg: var(--surface-hover); --b-bd: transparent; --b-fg: var(--text); }
  .btn-sm { height: var(--ctl-h-sm); min-width: var(--ctl-h-sm); padding: 0 10px; font-size: var(--fs-xs); gap: 5px; border-radius: var(--r-sm); }
  .btn-sm .icon { width: 14px; height: 14px; }
  .btn-icon { padding: 0; width: var(--ctl-h); }
  .btn-sm.btn-icon { width: var(--ctl-h-sm); }
  .btn-block { width: 100%; }
  .btn[aria-pressed='true'] { --b-bg: var(--surface-active); --b-bd: var(--border-strong); --b-fg: var(--text); }
  .btn[aria-pressed='true'] .icon { color: var(--text); }
  .btn .spin { animation: spin 0.8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  .input, .select, .textarea {
    width: 100%; min-width: 0; height: var(--ctl-h); padding: 0 10px;
    background: oklch(0.13 0 0); border: 1px solid var(--border); border-radius: var(--r-md);
    color: var(--text); font-size: var(--ctl-fs);
    box-shadow: 0 1px 2px oklch(0 0 0 / 0.2) inset;
    transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  }
  .input::placeholder, .textarea::placeholder { color: var(--text-4); }
  .input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
  .input:focus, .select:focus, .textarea:focus { border-color: var(--gray-8); box-shadow: 0 0 0 3px oklch(1 0 0 / 0.07); }
  .input[aria-invalid='true'] { border-color: var(--danger); }
  .input.mono, .textarea.mono { font-family: var(--font-mono); font-size: max(var(--ctl-fs), 12.5px); }
  .select { appearance: none; padding-right: 30px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E"); background-position: right 8px center; background-size: 14px; background-repeat: no-repeat; }
  .select option, .select optgroup { background: var(--surface-2); color: var(--text); }
  .textarea { height: auto; min-height: 96px; padding: 8px 10px; line-height: 1.5; resize: vertical; }
  .input-sm, .select.input-sm { height: var(--ctl-h-sm); font-size: var(--fs-sm); border-radius: var(--r-sm); }
  @media (pointer: coarse) { .input-sm, .select.input-sm { font-size: 16px; } }

  .field { display: grid; gap: 6px; min-width: 0; }
  .field > label, .label { font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); }
  .hint { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.5; }
  .field-row { display: flex; gap: var(--s-2); align-items: flex-end; flex-wrap: wrap; }
  .field-row > .field { flex: 1 1 160px; }
  .form-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
  .input-group { display: flex; gap: 6px; align-items: center; min-width: 0; }
  .input-group > .input, .input-group > .select { flex: 1; }

  .check { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; min-height: 28px; user-select: none; }
  .check input { appearance: none; width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--border-strong); background: oklch(0.13 0 0); display: grid; place-content: center; transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); flex: none; cursor: pointer; margin: 0; }
  .check input::after { content: ''; width: 9px; height: 5px; border: 2px solid var(--on-primary); border-top: 0; border-right: 0; transform: rotate(-45deg) scale(0); transition: transform var(--dur-fast) var(--ease); margin-top: -2px; }
  .check input:checked, .check input:indeterminate { background: var(--primary); border-color: var(--primary); }
  .check input:checked::after { transform: rotate(-45deg) scale(1); }
  .check input:indeterminate::after { width: 8px; height: 0; border-left: 0; transform: none; margin: 0; }
  .switch { appearance: none; width: 32px; height: 18px; border-radius: 18px; background: var(--gray-6); position: relative; cursor: pointer; transition: background-color var(--dur) var(--ease); flex: none; margin: 0; }
  .switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--gray-11); box-shadow: 0 1px 2px oklch(0 0 0 / 0.4); transition: transform var(--dur) var(--ease); }
  .switch:checked { background: var(--primary); }
  .switch:checked::after { transform: translateX(14px); background: var(--on-primary); }

  .card { background: var(--surface-1); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); min-width: 0; box-shadow: 0 1px 2px oklch(0 0 0 / 0.2); }
  .card-head { display: flex; align-items: center; gap: var(--s-2); padding: 14px var(--s-4) 0; flex-wrap: wrap; min-height: 44px; }
  .card-head h2, .card-head h3 { font-size: var(--fs-sm); font-weight: 600; margin-right: auto; display: flex; align-items: center; gap: var(--s-2); color: var(--text); letter-spacing: -0.005em; }
  .card-head h3 > .icon { color: var(--text-3); width: 15px; height: 15px; }
  .card-head .sub { color: var(--text-3); font-size: var(--fs-xs); font-weight: 400; }
  .card-head + .list, .card-head + .card-body.flush, .card-head + .list-tight { margin-top: 10px; border-top: 1px solid var(--border-subtle); }
  .card-body { padding: 12px var(--s-4) var(--s-4); }
  .card-body.flush { padding: 0; }
  .card > .card-body:first-child { padding-top: var(--s-4); }
  .card-foot { padding: 8px var(--s-4); border-top: 1px solid var(--border-subtle); display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; color: var(--text-3); font-size: var(--fs-xs); }
  .card.collapsed > :not(.card-head) { display: none; }

  .badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 11.5px; font-weight: 500; line-height: 1; background: var(--surface-3); color: var(--text-2); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; border: 0; }
  .badge.ok { background: oklch(0.76 0.14 155 / 0.12); color: var(--ok); }
  .badge.warn { background: oklch(0.83 0.13 85 / 0.12); color: var(--warn); }
  .badge.danger { background: oklch(0.68 0.18 25 / 0.14); color: var(--danger); }
  .badge.accent { background: var(--surface-active); color: var(--text); }
  .badge.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
  .badge.mono { font-family: var(--font-mono); font-size: 11px; }
  .badge:empty { display: none; }
  .status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; }
  .status .dot { width: 6px; height: 6px; }
  .count { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 10.5px; font-weight: 600; background: var(--danger); color: oklch(0.99 0 0); font-variant-numeric: tabular-nums; }

  .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-7); flex: none; display: inline-block; }
  .dot.ok { background: var(--ok); }
  .dot.warn { background: var(--warn); }
  .dot.danger { background: var(--danger); }
  .dot.live { box-shadow: 0 0 0 3px oklch(0.76 0.14 155 / 0.16); }

  .kbd, kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); font-family: var(--font-ui); font-size: 11px; font-weight: 500; line-height: 1; }
  @media not ((hover: hover) and (pointer: fine)) { .kbd-hint { display: none !important; } }

  .muted { color: var(--text-3); }
  .dim { color: var(--text-4); }
  .ok-text { color: var(--ok); }
  .warn-text { color: var(--warn); }
  .danger-text { color: var(--danger); }
  .num { font-variant-numeric: tabular-nums; }
  .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .wrap-any { overflow-wrap: anywhere; }

  .stack { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
  .stack-sm { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
  .row { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
  .row-wrap { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
  .spacer { flex: 1; }
  .grid-auto { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 280px)), 1fr)); }
  .divider { height: 1px; background: var(--border-subtle); border: 0; }

  .output {
    font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; color: var(--text-2);
    background: oklch(0.13 0 0); border: 1px solid var(--border-subtle); border-radius: var(--r-md);
    padding: 10px 12px; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word;
    -webkit-user-select: text; user-select: text;
  }
  .output:empty { display: none; }
  .output.tall { max-height: 60dvh; }

  .table-wrap { overflow: auto; min-width: 0; }
  .table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
  .table th { position: sticky; top: 0; z-index: 1; background: var(--surface-1); text-align: left; font-weight: 500; font-size: var(--fs-xs); color: var(--text-3); padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
  .table td { padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; color: var(--text-2); }
  .table tbody tr { transition: background-color var(--dur-fast) var(--ease); }
  .table tbody tr:hover { background: var(--surface-hover); }
  .table tr:last-child td { border-bottom: 0; }

  .list { display: flex; flex-direction: column; }
  .list-row { display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-4); min-height: 44px; border-bottom: 1px solid var(--border-subtle); min-width: 0; }
  .list-row:last-child { border-bottom: 0; }
  .list-row > .icon { color: var(--text-3); }
  .list-row .main { flex: 1; min-width: 0; display: grid; gap: 2px; }
  .list-row .title { color: var(--text); font-size: var(--fs-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; min-width: 0; }
  .list-row .meta { color: var(--text-3); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  button.list-row, a.list-row { text-align: left; width: 100%; color: inherit; text-decoration: none; transition: background-color var(--dur-fast) var(--ease); }
  button.list-row:hover, a.list-row:hover { background: var(--surface-hover); text-decoration: none; }

  .seg, .tabs { display: inline-flex; align-items: center; padding: 3px; gap: 2px; background: oklch(0.13 0 0); border: 1px solid var(--border-subtle); border-radius: 9px; max-width: 100%; overflow-x: auto; scrollbar-width: none; align-self: flex-start; }
  .seg::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .seg button, .tabs button { position: relative; height: calc(var(--ctl-h-sm) - 2px); padding: 0 10px; border-radius: 6px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
  .seg button:hover, .tabs button:hover { color: var(--text); }
  .seg button[aria-selected='true'], .tabs button[aria-selected='true'] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px oklch(0 0 0 / 0.35), inset 0 0 0 1px oklch(1 0 0 / 0.05); }
  .tabs button .dim, .seg button .dim { font-weight: 400; color: var(--text-4); }

  .stat { display: grid; gap: 4px; padding: 12px 14px; background: var(--surface-1); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); min-width: 0; }
  .stat .k { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat .v { font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat .v small { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }
  .stat.danger .v { color: var(--danger); }
  .stat.warn .v { color: var(--warn); }
  .stats { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }
  .stats.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  @media (max-width: 640px) { .stats, .stats.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat { padding: 10px 12px; } .stat .v { font-size: var(--fs-md); } }

  .meter { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
  .meter > i { display: block; height: 100%; width: var(--p, 0%); background: var(--gray-9); border-radius: inherit; transition: width var(--dur-slow) var(--ease); }
  .meter.ok > i { background: var(--ok); }
  .meter.warn > i { background: var(--warn); }
  .meter.danger > i { background: var(--danger); }
  .progress { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
  .progress > i { display: block; height: 100%; width: var(--p, 0%); background: var(--gray-10); transition: width var(--dur) var(--ease); }
  .progress.indet > i { width: 35%; animation: indet 1.2s var(--ease) infinite; }
  @keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

  .skeleton { display: block; border-radius: var(--r-sm); background: var(--surface-2); animation: pulse 1.4s ease-in-out infinite; }
  .skeleton.line { height: 10px; margin: 8px 0; }
  .skeleton.row { height: 40px; margin-bottom: 6px; border-radius: var(--r-md); }
  .skeleton.block { height: 88px; border-radius: var(--r-lg); }
  @keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

  .empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: var(--s-8) var(--s-4); color: var(--text-3); font-size: var(--fs-sm); }
  .empty > .icon { width: 22px; height: 22px; color: var(--text-4); stroke-width: 1.6; margin-bottom: 4px; }
  .empty strong { color: var(--text); font-weight: 500; }
  .empty .row, .empty .row-wrap { margin-top: 6px; }
  .error-box { display: flex; gap: var(--s-2); align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger); font-size: var(--fs-sm); overflow-wrap: anywhere; }
  .note { display: flex; gap: var(--s-2); align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); }
  .note.warn { background: var(--warn-soft); color: var(--warn); }
  .note .icon { margin-top: 2px; flex: none; }

  .chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: var(--fs-xs); font-weight: 500; max-width: 220px; transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }
  .chip:hover { color: var(--text); background: var(--surface-3); }
  .chip > .icon { width: 13px; height: 13px; color: var(--text-3); }
  .chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chip .x { display: grid; place-items: center; width: 18px; height: 18px; margin-right: -5px; border-radius: 4px; color: var(--text-3); }
  .chip .x:hover { background: var(--surface-active); color: var(--text); }
  @media (pointer: coarse) { .chip { height: 32px; } }

  .dialog {
    border: 1px solid var(--border); padding: 0; background: var(--surface-1); color: var(--text);
    border-radius: 14px; box-shadow: 0 24px 48px oklch(0 0 0 / 0.5);
    width: min(500px, calc(100vw - 32px)); max-height: min(86dvh, 900px);
    display: flex; flex-direction: column; overflow: hidden;
  }
  .dialog:not([open]) { display: none; }
  .dialog.wide { width: min(920px, calc(100vw - 32px)); }
  .dialog.full { width: min(1280px, calc(100vw - 32px)); height: min(88dvh, 1000px); }
  .dialog::backdrop { background: oklch(0 0 0 / 0.6); backdrop-filter: blur(2px); }
  .dialog-head { display: flex; align-items: center; gap: var(--s-2); padding: 12px 12px 4px 20px; min-height: 52px; }
  .dialog-head h2 { font-size: var(--fs-md); font-weight: 600; margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dialog-body { padding: 8px 20px 20px; overflow: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--s-3); overscroll-behavior: contain; }
  .dialog-body.flush { padding: 0; border-top: 1px solid var(--border-subtle); }
  .dialog-foot { display: flex; gap: var(--s-2); justify-content: flex-end; padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--border-subtle); flex-wrap: wrap; background: oklch(0.16 0 0); }
  .dialog-msg { color: var(--text-2); line-height: 1.6; overflow-wrap: anywhere; white-space: pre-line; font-size: var(--fs-sm); }
  .sheet-grip { display: none; }

  @media (prefers-reduced-motion: no-preference) {
    .dialog[open] { animation: dialog-in var(--dur) var(--ease); }
    .dialog[open]::backdrop { animation: fade-in var(--dur) var(--ease); }
    .dialog.closing { animation: dialog-out var(--dur-fast) var(--ease-in) forwards; }
    .dialog.closing::backdrop { animation: fade-out var(--dur-fast) var(--ease-in) forwards; }
  }
  @keyframes dialog-in { from { opacity: 0; transform: translateY(4px) scale(0.985); } }
  @keyframes dialog-out { to { opacity: 0; transform: translateY(2px) scale(0.99); } }
  @keyframes fade-in { from { opacity: 0; } }
  @keyframes fade-out { to { opacity: 0; } }

  @media (max-width: 640px) {
    .dialog, .dialog.wide, .dialog.full {
      width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; border-width: 1px 0 0;
      max-height: calc(100dvh - var(--safe-t) - 24px);
    }
    .dialog.full { height: calc(100dvh - var(--safe-t) - 24px); }
    .dialog .sheet-grip { display: block; width: 32px; height: 4px; border-radius: 4px; background: var(--gray-6); margin: 8px auto 0; flex: none; touch-action: none; }
    .dialog-head { padding-left: 16px; min-height: 44px; }
    .dialog-body { padding: 8px 16px 16px; }
    .dialog-foot { padding: 10px 16px calc(10px + var(--safe-b)); }
    .dialog-foot .btn { flex: 1; }
    @media (prefers-reduced-motion: no-preference) {
      .dialog[open] { animation: sheet-in var(--dur-slow) var(--ease); }
      .dialog.closing { animation: sheet-out var(--dur) var(--ease-in) forwards; }
    }
  }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  @keyframes sheet-out { to { transform: translateY(100%); } }

  .menu {
    position: fixed; inset: auto; margin: 0; padding: 4px; min-width: 200px; max-width: min(300px, calc(100vw - 16px));
    max-height: min(70dvh, 520px); overflow: auto;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px oklch(0 0 0 / 0.5);
  }
  .menu:popover-open { display: flex; flex-direction: column; }
  @media (prefers-reduced-motion: no-preference) { .menu:popover-open { animation: dialog-in var(--dur-fast) var(--ease); } }
  .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 0 10px; border-radius: 6px; color: var(--text-2); font-size: var(--fs-sm); text-align: left; transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
  .menu-item:hover, .menu-item:focus-visible { background: var(--surface-active); color: var(--text); outline: none; }
  .menu-item:disabled { opacity: 0.4; }
  .menu-item.danger { color: var(--danger); }
  .menu-item .icon { color: var(--text-3); width: 15px; height: 15px; }
  .menu-item.danger .icon { color: var(--danger); }
  .menu-item .kbd-hint { margin-left: auto; }
  .menu-sep { height: 1px; background: var(--border-subtle); margin: 4px -4px; }
  .menu-label { padding: 6px 10px 4px; font-size: 11px; color: var(--text-4); font-weight: 500; }
  .action-list { display: flex; flex-direction: column; padding: 6px 8px calc(8px + var(--safe-b)); }
  .action-list .menu-item { min-height: 46px; font-size: var(--fs-md); padding: 0 10px; gap: 12px; border-radius: 8px; }
  .action-list .menu-sep { margin: 4px 0; }

  .toasts {
    position: fixed; inset: auto var(--s-4) calc(var(--s-4) + var(--safe-b)) auto; margin: 0; padding: 0; border: 0; background: transparent;
    display: flex; flex-direction: column; gap: var(--s-2); width: min(360px, calc(100vw - 32px)); overflow: visible; pointer-events: none;
  }
  .toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px oklch(0 0 0 / 0.45);
    font-size: var(--fs-sm); line-height: 1.45; touch-action: pan-y; overflow-wrap: anywhere;
    transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  }
  .toast .icon { margin-top: 1px; width: 16px; height: 16px; }
  .toast.ok .icon { color: var(--ok); }
  .toast.error .icon { color: var(--danger); }
  .toast.warn .icon { color: var(--warn); }
  .toast.info .icon { color: var(--text-2); }
  .toast .msg { flex: 1; min-width: 0; }
  .toast .x { color: var(--text-3); margin: -4px -4px -4px 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; }
  .toast .x:hover { background: var(--surface-active); color: var(--text); }
  .toast.leaving { opacity: 0; transform: translateX(16px); }
  @media (prefers-reduced-motion: no-preference) { .toast { animation: toast-in var(--dur) var(--ease); } }
  @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

  .topprog { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 200; pointer-events: none; overflow: hidden; }
  .topprog > i { display: block; height: 100%; width: 0; background: var(--gray-10); opacity: 0; transition: width 8s cubic-bezier(0.1, 0.7, 0.1, 1), opacity var(--dur) var(--ease); }
  .topprog.run > i { width: 88%; opacity: 1; }
  .topprog.done > i { width: 100%; opacity: 0; transition: width var(--dur) var(--ease), opacity 0.4s var(--ease) 0.1s; }

  .kv { display: grid; grid-template-columns: minmax(90px, max-content) 1fr; gap: 8px var(--s-4); font-size: var(--fs-sm); }
  .kv dt { color: var(--text-3); }
  .kv dd { color: var(--text); min-width: 0; overflow-wrap: anywhere; margin: 0; }

  .bars { display: flex; gap: 2px; align-items: flex-end; height: 16px; }
  .bars i { flex: 1; min-width: 3px; max-width: 6px; height: 100%; border-radius: 1.5px; background: var(--ok); opacity: 0.7; }
  .bars i.bad { background: var(--danger); opacity: 1; }

  .code-inline { font-family: var(--font-mono); font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); overflow-wrap: anywhere; }

  .secret-box { display: flex; gap: var(--s-2); align-items: center; padding: 6px 6px 6px 12px; background: oklch(0.13 0 0); border: 1px solid var(--border-strong); border-radius: var(--r-md); font-family: var(--font-mono); font-size: 13px; }
  .secret-box code { flex: 1; min-width: 0; overflow-wrap: anywhere; -webkit-user-select: all; user-select: all; }

  .tray { position: fixed; left: calc(var(--s-4) + var(--safe-l)); bottom: calc(var(--s-4) + var(--safe-b)); z-index: 50; width: min(340px, calc(100vw - 32px)); padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); box-shadow: 0 12px 32px oklch(0 0 0 / 0.45); display: grid; gap: 8px; }
  .tray-head { display: flex; align-items: center; gap: var(--s-2); }
  .tray-title { flex: 1; font-size: var(--fs-sm); font-weight: 500; }
  .tray-pct { font-size: var(--fs-sm); color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
  .tray-file { font-size: var(--fs-xs); color: var(--text-3); }
  .tray-stats { display: flex; justify-content: space-between; gap: var(--s-2); font-size: var(--fs-xs); color: var(--text-3); }
  @media (max-width: 899px) { .tray { left: var(--s-3); right: var(--s-3); width: auto; bottom: calc(var(--nav-h) + var(--safe-b) + var(--s-3)); } }
  @media (prefers-reduced-motion: no-preference) { .tray:not([hidden]) { animation: toast-in var(--dur) var(--ease); } }
}

@layer components {
  @media (pointer: coarse) {
    .btn, .tk, .chip, .seg button, .tabs button, .tt-main, .crumb-btn { position: relative; }
    .btn::after, .seg button::after, .tabs button::after, .chip::after { content: ''; position: absolute; inset: -4px -2px; }
    .btn-sm::after, .chip::after { inset: -6px -2px; }
  }
}

@layer components {
  .card.collapsible > .card-head { cursor: pointer; user-select: none; -webkit-user-select: none; }
  .card.collapsible > .card-head:hover h3 { color: var(--text); }
  .card.collapsible > .card-head:focus-visible { outline-offset: -2px; border-radius: var(--r-lg); }
  .card.collapsible.collapsed > .card-head { padding-bottom: 14px; }
  .card-head .chev { color: var(--text-4); transition: transform var(--dur) var(--ease); margin-left: 2px; }
  .card.collapsed .chev { transform: rotate(-90deg); }
}
