@layer base, components, responsive;
@layer components {
  .test-banner { flex-shrink: 0; padding: 10px 28px; color: var(--warning); background: var(--warning-bg); border-bottom: 1px solid var(--line); font-size: 0.875rem; }
  .summary-strip { display: flex; flex-shrink: 0; flex-wrap: wrap; gap: 12px 32px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 0.875rem; color: var(--muted); }
  .summary-strip strong { color: var(--ink); font-variant-numeric: tabular-nums; }
  .test-attachment { border-top: 1px solid var(--line); padding-top: 24px; }
  .test-attachment .section-heading h3 { min-width: 0; overflow-wrap: anywhere; align-items: flex-start; }
  .test-attachment .section-heading { align-items: flex-start; }
  .document-chip { white-space: nowrap; background: var(--subtle); padding: 4px 8px; }
  .attachment-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 12px; font-size: 0.875rem; }
  .test-attachment.auto .attachment-status strong { color: var(--accent); }
  .test-attachment.review .attachment-status strong { color: var(--warning); }
  .reason-list { list-style: disc; padding-left: 20px; margin: 12px 0; color: var(--muted); font-size: 0.875rem; }
  .test-preview { color: var(--muted); font-size: 0.8rem; padding: 12px 0; }
  .test-path-editor > summary { cursor: pointer; font-size: 0.875rem; padding: 12px 0; }
  .test-path-editor .path-editor { grid-template-columns: 1.2fr 1fr 1.5fr 1fr .8fr; }
  .test-actions { flex-wrap: wrap; }
  .mismatch { color: var(--warning); background: var(--warning-bg); font-size: 0.8rem; padding: 4px 8px; display: inline-block; overflow-wrap: anywhere; }
  .number-warning, .decision-note { background: var(--warning-bg); color: var(--warning); padding: 16px; margin: 16px 0; font-size: 0.875rem; overflow-wrap: anywhere; }
  .local-desk .saved-path { overflow-wrap: anywhere; }
}
@layer responsive {
  @media (max-width: 1100px) { .test-path-editor .path-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 760px) {
    .test-banner { padding: 10px 16px; font-size: 0.8rem; }
    .summary-strip { padding: 12px 16px; gap: 8px 16px; font-size: 0.8rem; }
    .local-desk .tabs-bar [role="tablist"] { gap: 18px; }
    .test-path-editor .path-editor { grid-template-columns: minmax(0, 1fr); }
    .test-path-editor .path-segment:last-child { grid-column: auto; }
    .local-desk .test-actions { position: sticky; bottom: 0; padding: 12px 0; background: var(--surface); z-index: 2; }
    .local-desk .test-actions button { flex: 1; }
    .local-desk .detail-body { padding-bottom: 32px; }
  }
}
@layer base {
  :root {
    color-scheme: light;
    --canvas: oklch(97% .008 83); --surface: oklch(99% .004 83); --subtle: oklch(94.5% .01 83);
    --ink: oklch(27% .019 157); --muted: oklch(41% .014 135); --line: oklch(87% .014 100);
    --accent: oklch(39% .067 175); --accent-hover: oklch(33% .061 175); --selected: oklch(93% .023 167);
    --warning: oklch(42% .09 65); --warning-bg: oklch(96% .035 83);
    --danger: oklch(43% .13 30); --danger-bg: oklch(97% .014 30);
    --space-xs: 4px; --space-sm: 8px; --space-md: 12px; --space-lg: 16px; --space-xl: 24px; --space-2xl: 32px;
    --radius: 7px; --sticky: 20; --toast: 50;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 16px; line-height: 1.55; font-weight: 420; color: var(--ink); background: var(--canvas);
    font-synthesis: none; text-rendering: optimizeLegibility;
  }
  * { box-sizing: border-box; }
  body { margin: 0; }
  button, input, textarea { font: inherit; }
  button { color: inherit; cursor: pointer; }
  button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
  button:disabled { cursor: not-allowed; opacity: .48; }
  button, a, input, textarea, summary { transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out; }
  :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
  input, textarea { width: 100%; min-width: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
  input:hover, textarea:hover { border-color: var(--muted); }
  input[aria-invalid="true"] { border-color: var(--danger); }
  textarea { resize: vertical; min-height: 180px; line-height: 1.65; }
  button { min-height: 44px; border-radius: var(--radius); }
  button:active:not(:disabled) { filter: brightness(.96); }
  a { color: var(--accent); }
  h1, h2, h3, p { margin: 0; }
  h1 { font-size: 1.28rem; line-height: 1.35; letter-spacing: -.025em; font-weight: 700; }
  h2 { font-size: 1.7rem; line-height: 1.3; letter-spacing: -.03em; font-weight: 700; }
  h3 { font-size: 1rem; font-weight: 700; }
  ul { margin: 0; padding: 0; list-style: none; }
  svg { flex-shrink: 0; vertical-align: middle; }
  kbd { font: inherit; font-size: 12px; line-height: 1.5; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; opacity: .65; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  .skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; background: var(--surface); padding: 12px; }
  .skip-link:focus { top: 12px; }
  .muted, .field-hint { color: var(--muted); font-size: 0.875rem; }
  .error-text { color: var(--danger); }
  .eyebrow { font-size: 0.8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
}
@layer components {
  .app { height: 100dvh; display: flex; flex-direction: column; }
  .topbar { min-height: 64px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 28px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
  .brand strong { letter-spacing: .08em; font-size: 1.05rem; }
  .brand > span:last-child { color: var(--muted); }
  .brand-mark { width: 30px; height: 30px; display: grid; place-items: center; background: var(--accent); color: var(--surface); border-radius: 7px; font-size: 22px; font-weight: 700; line-height: 1; }
  .brand-divider { height: 20px; width: 1px; background: var(--line); margin: 0 4px; }
  .top-tools { display: flex; align-items: center; gap: 8px; }
  .demo-badge { border: 1px solid var(--line); color: var(--muted); padding: 3px 8px; border-radius: 5px; font-size: 0.8rem; white-space: nowrap; }
  .qa-mode-banner { flex-shrink: 0; padding: 8px 28px; color: var(--warning); background: var(--warning-bg); border-bottom: 1px solid var(--line); font-size: 0.875rem; font-weight: 700; letter-spacing: .06em; }
  .icon-button { display: inline-grid; place-items: center; width: 44px; padding: 0; background: transparent; border: 1px solid transparent; }
  .icon-button:hover:not(:disabled), .text-button:hover:not(:disabled) { background: var(--subtle); }
  .text-button { border: 0; background: transparent; padding: 8px; font-size: 0.875rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
  .primary, .secondary, .cancel-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
  .primary { background: var(--accent); color: var(--surface); }
  .primary:hover:not(:disabled) { background: var(--accent-hover); }
  .secondary { background: var(--surface); border-color: var(--line); font-size: 0.875rem; }
  .secondary:hover:not(:disabled) { background: var(--subtle); border-color: var(--muted); }
  .cancel-button { background: transparent; color: var(--danger); border-color: var(--line); }
  .cancel-button:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger); }
  .tabs-bar { display: flex; align-items: center; justify-content: space-between; min-height: 56px; border-bottom: 1px solid var(--line); padding: 0 28px; gap: 16px; flex-shrink: 0; background: var(--surface); }
  .tabs-bar [role="tablist"] { display: flex; align-self: stretch; gap: 24px; }
  .tabs-bar [role="tab"] { position: relative; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 8px 0; font-weight: 600; color: var(--muted); border-radius: 0; }
  .tabs-bar [role="tab"][aria-selected="true"] { color: var(--accent); }
  .tabs-bar [role="tab"][aria-selected="true"]::after { content: ''; position: absolute; height: 2px; bottom: -1px; left: 0; right: 0; background: var(--accent); }
  .tabs-bar [role="tab"]:hover { color: var(--ink); }
  .tab-count { border-radius: 4px; background: var(--subtle); padding: 0 6px; min-width: 20px; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
  [aria-selected="true"] .tab-count { background: var(--selected); }
  .review-note { color: var(--muted); font-size: 0.875rem; }
  .workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 348px minmax(0, 1fr); }
  .queue { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; background: var(--canvas); }
  .queue-heading { padding: 24px 24px 20px; display: flex; flex-direction: column; gap: 12px; }
  .queue-heading h1 { margin-top: 4px; }
  .queue-sort { font-size: 0.8rem; color: var(--muted); }
  .queue-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 12px 12px; }
  .queue-item { width: 100%; text-align: left; padding: 16px 12px; display: flex; flex-direction: column; gap: 5px; border: 1px solid transparent; background: transparent; border-radius: 7px; }
  .queue-list li + li { margin-top: 4px; }
  .queue-item:hover { background: var(--subtle); }
  .queue-item.selected { background: var(--selected); border-color: oklch(82% .034 167); }
  .queue-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 0.8rem; }
  .sender { font-weight: 600; }
  .queue-meta time { color: var(--muted); font-size: 0.8rem; }
  .queue-subject { font-size: 0.93rem; line-height: 1.45; font-weight: 600; }
  .hotel-guess { font-size: 0.8rem; color: var(--muted); }
  .queue-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 5px; font-size: 0.8rem; }
  .confidence { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
  .confidence-dot, .live-dot { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; flex-shrink: 0; }
  .confidence.low { color: var(--warning); }
  .confidence.low .confidence-dot { background: var(--warning); }
  .file-kind { font-size: 0.8rem; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
  .queue-footer { display: flex; align-items: center; gap: 6px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; flex-shrink: 0; }
  .queue-keys { margin-left: auto; white-space: nowrap; }
  .queue-keys kbd { margin-right: 3px; }
  .detail { min-height: 0; min-width: 0; overflow-y: auto; background: var(--surface); }
  .detail-toolbar { height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 40px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; }
  .detail-nav { display: flex; gap: 4px; }
  .detail-nav .icon-button { width: 44px; }
  .next-button svg { transform: rotate(180deg); }
  .back-button { display: none; }
  .detail-body { max-width: 1180px; margin: 0 auto; padding: 24px 40px 48px; }
  .email-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
  .email-topline time { color: var(--muted); font-size: 0.8rem; }
  .email-summary h2 { max-width: 34ch; margin-bottom: 16px; }
  .email-from { display: flex; gap: 12px; align-items: center; }
  .avatar { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--canvas); display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; border-radius: 50%; }
  .email-from strong { font-size: 0.875rem; display: block; font-weight: 600; }
  .email-from div > span { display: block; font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
  .summary-text { color: var(--muted); max-width: 72ch; line-height: 1.6; margin-top: 16px; }
  .attachment { border: 1px solid var(--line); border-radius: var(--radius); margin-top: 20px; overflow: hidden; }
  .attachment summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; cursor: pointer; list-style: none; background: var(--canvas); }
  .attachment summary::-webkit-details-marker { display: none; }
  .attachment-title { display: flex; gap: 8px; align-items: center; min-width: 0; }
  .attachment-title strong { font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
  .attachment-type { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.8rem; letter-spacing: .05em; }
  details[open] .attachment-type svg { transform: rotate(90deg); }
  .attachment-content { border-top: 1px solid var(--line); }
  .page-images { max-height: 180px; overflow-y: auto; background: var(--subtle); padding: 12px; }
  .page-image { max-width: 680px; margin: auto; background: var(--surface); }
  .page-image + .page-image { margin-top: 16px; }
  .page-image img { display: block; width: 100%; height: auto; }
  .page-image > p { padding: 16px; color: var(--muted); }
  .page-image.loading img { opacity: 0; }
  .sheet-scroll { overflow-x: auto; max-width: 100%; }
  table { border-collapse: collapse; width: 100%; text-align: left; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
  caption { padding: 8px 16px; color: var(--muted); text-align: left; font-size: 0.8rem; background: var(--canvas); }
  th { color: var(--muted); font-weight: 600; background: var(--canvas); }
  th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
  tbody tr:last-child td { border-bottom: 0; }
  .preview-fallback { padding: 32px 24px; color: var(--muted); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
  .attachment-none { display: flex; align-items: flex-start; gap: 12px; padding: 20px 0; margin-top: 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
  .attachment-none strong { color: var(--ink); font-size: 0.875rem; font-weight: 600; }
  .attachment-none p { font-size: 0.875rem; margin-top: 4px; }
  .filing-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
  .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
  .section-heading h3 { display: flex; align-items: center; gap: 8px; }
  .section-heading > .muted { font-size: 0.8rem; }
  .path-editor { display: grid; grid-template-columns: .7fr 1fr 1.15fr 1.4fr .95fr; gap: 8px; }
  .path-segment { min-width: 0; position: relative; }
  .path-separator { position: absolute; top: 32px; right: -7px; color: var(--muted); font-size: 14px; }
  .path-segment:last-child .path-separator { display: none; }
  .path-segment label { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 6px; }
  .path-segment input { padding: 10px 8px; font-size: 0.875rem; text-overflow: ellipsis; }
  .needs-check input { border-color: oklch(72% .09 75); background: var(--warning-bg); }
  .segment-hint { min-height: 29px; display: flex; gap: 4px; align-items: center; font-size: 0.8rem; color: var(--muted); }
  .segment-hint .text-button { min-height: 44px; padding: 4px 0; font-size: 0.8rem; text-decoration: underline; }
  .tag { padding: 0 5px; border-radius: 3px; font-size: 0.8rem; line-height: 1.6; }
  .check-tag { background: var(--warning-bg); color: var(--warning); }
  .new-tag { background: var(--selected); color: var(--accent); }
  .filing-hint { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
  .filing-hint.error-text { color: var(--danger); }
  .actions { display: flex; gap: 8px; margin-top: 20px; }
  .actions .primary { min-width: 188px; }
  .actions kbd { margin-left: 12px; }
  .undo-hint { margin-top: 8px; color: var(--muted); font-size: 0.8rem; }
  .saved-path { overflow-wrap: anywhere; line-height: 1.8; margin-bottom: 12px; }
  .external-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
  .reply-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
  .reply-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; }
  .reply-footer .muted { font-size: 0.8rem; }
  .reply-footer kbd { margin-left: 8px; }
  .contact-section { display: flex; align-items: flex-start; gap: 12px; padding-top: 24px; color: var(--muted); }
  .contact-section > svg { margin-top: 3px; }
  .contact-copy { flex: 1; min-width: 0; }
  .contact-copy strong { display: block; color: var(--ink); font-size: 0.875rem; font-weight: 600; }
  .contact-copy span { display: block; font-size: 0.8rem; overflow-wrap: anywhere; margin-top: 4px; }
  .contact-section .text-button { white-space: nowrap; margin-top: -8px; }
  .mobile-actions { display: none; }
  .empty { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; text-align: center; padding: 64px 24px; height: 100%; }
  .empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--subtle); color: var(--accent); margin-bottom: 8px; }
  .empty h2 { font-size: 1.4rem; }
  .empty p { color: var(--muted); max-width: 30ch; }
  .notice { flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 12px 24px; font-size: 0.875rem; border-bottom: 1px solid var(--line); }
  .notice span { flex: 1; }
  .warning { background: var(--warning-bg); color: var(--warning); }
  .error-notice { background: var(--danger-bg); color: var(--danger); }
  .detail-body > .notice { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 24px; padding: 12px; }
  .shortcut-help { display: flex; position: relative; gap: 24px; padding: 20px 28px; border-bottom: 1px solid var(--line); background: var(--canvas); flex-shrink: 0; }
  .shortcut-help h2 { font-size: 1rem; letter-spacing: 0; }
  .shortcut-help p { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
  .shortcut-help dl { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; flex: 1; }
  .shortcut-help dl > div { display: flex; gap: 8px; align-items: center; font-size: 0.8rem; min-width: 160px; }
  .shortcut-help dt { min-width: 36px; }
  .shortcut-help dd { margin: 0; }
  .shortcut-help > button { align-self: flex-start; }
  .toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: var(--toast); width: min(460px, calc(100% - 32px)); max-height: 55dvh; overflow-y: auto; }
  .toast { display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--surface); border: 1px solid oklch(42% .019 157); border-radius: 9px; padding: 12px 16px; box-shadow: 0 4px 12px oklch(27% .019 157 / .12); }
  .toast-symbol { flex-shrink: 0; }
  .toast > div { flex: 1; min-width: 0; }
  .toast strong { font-size: 0.875rem; font-weight: 600; display: block; }
  .toast div span { font-size: 0.8rem; display: block; color: oklch(85% .012 120); overflow-wrap: anywhere; }
  .undo-button { display: flex; gap: 8px; align-items: center; background: transparent; color: var(--surface); border: 1px solid oklch(63% .02 157); padding: 8px 12px; font-weight: 600; }
  .undo-button:hover { background: oklch(37% .019 157); }
  .undo-button span { font-size: 0.8rem; min-width: 16px; font-variant-numeric: tabular-nums; }
  .undo-button:focus-visible { outline-color: var(--surface); }
  .toast-working { font-size: 0.8rem; color: oklch(85% .012 120); }
  .login { width: min(480px, calc(100% - 40px)); margin: auto; padding: 64px 0; }
  .login h1 { font-size: 2.6rem; line-height: 1.15; font-weight: 600; margin-top: 16px; margin-bottom: 20px; letter-spacing: -.045em; }
  .login > p { color: var(--muted); max-width: 45ch; line-height: 1.7; }
  .login form { display: flex; flex-direction: column; margin-top: 32px; gap: 8px; }
  .login label { font-size: 0.875rem; font-weight: 600; }
  .login input { min-height: 48px; font-size: 16px; }
  .login form .primary { margin-top: 12px; }
  .login-foot { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 0.8rem; margin-top: 24px; }
  .queue-skeleton { padding: 20px; border-right: 1px solid var(--line); }
  .skeleton-row { display: flex; gap: 12px; flex-direction: column; padding: 20px 0; }
  .skeleton { background: var(--subtle); border-radius: 4px; animation: breathe 1.5s ease-out infinite alternate; }
  .line { display: block; height: 12px; width: 100%; }
  .line.short { width: 35%; }
  .line.medium { width: 70%; }
  .detail-skeleton { padding: 48px 40px; display: flex; flex-direction: column; gap: 24px; }
  .preview-skeleton { height: 320px; margin-top: 24px; }
  @keyframes breathe { to { opacity: .45; } }
}
@layer responsive {
  @media (min-width: 1680px) { .workspace { grid-template-columns: 380px minmax(0, 1fr); } }
  @media (min-width: 761px) and (max-width: 1100px) {
    .workspace { grid-template-columns: 300px minmax(0, 1fr); }
    .detail-toolbar { padding: 0 24px; }
    .detail-body { padding: 24px; }
    .path-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .path-segment:last-child { grid-column: span 2; }
    .path-separator { display: none; }
    .contact-section { flex-wrap: wrap; }
    .reply-footer { flex-wrap: wrap; }
    .shortcut-help { flex-direction: column; }
    .shortcut-help > button { position: absolute; top: 8px; right: 16px; }
  }
  @media (max-width: 760px) {
    :root { font-size: 16px; }
    .app { height: auto; min-height: 100dvh; }
    .topbar { min-height: 60px; padding: 8px 16px; gap: 8px; }
    .brand { gap: 8px; }
    .brand-mark { width: 28px; height: 28px; font-size: 20px; }
    .brand strong { font-size: 0.875rem; }
    .brand-divider, .brand > span:last-child { display: none; }
    .top-tools { gap: 0; }
    .demo-badge { font-size: 0.8rem; padding: 3px 6px; margin-right: 4px; }
    .passcode-button { font-size: 0.8rem; padding: 4px; }
    .top-tools .icon-button { width: 44px; }
    .tabs-bar { padding: 0 16px; min-height: 56px; }
    .tabs-bar [role="tablist"] { width: 100%; gap: 24px; }
    .tabs-bar [role="tab"] { font-size: 0.875rem; }
    .tab-count { font-size: 0.8rem; }
    .review-note { display: none; }
    .workspace { display: block; }
    .queue { border: 0; min-height: calc(100dvh - 116px); }
    .queue-heading { padding: 24px 20px 16px; gap: 8px; }
    .queue-heading h1 { font-size: 1.25rem; }
    .queue-list { overflow: visible; padding: 0 8px 16px; }
    .queue-item { padding: 16px 12px; }
    .queue-item.selected { background: transparent; border-color: transparent; }
    .queue-item:active { background: var(--selected); }
    .queue-list li + li { border-top: 1px solid var(--line); margin-top: 0; }
    .queue-subject { font-size: 0.93rem; }
    .queue-footer { margin-top: auto; font-size: 0.8rem; }
    .queue-keys { display: none; }
    .detail { display: none; overflow: visible; }
    .detail-open .queue { display: none; }
    .detail { display: none; }
    .detail-open .detail { display: block; }
    .detail-toolbar { height: 56px; padding: 0 12px; font-size: 0.8rem; }
    .back-button { display: inline-flex; font-size: 0.8rem; }
    .detail-nav { display: none; }
    .detail-body { padding: 24px 20px 116px; }
    .email-summary h2 { font-size: 1.5rem; margin-bottom: 20px; }
    .email-topline time { font-size: 0.8rem; }
    .email-from strong { font-size: 0.875rem; }
    .email-from div > span { font-size: 0.8rem; }
    .summary-text { font-size: 0.88rem; line-height: 1.65; margin-top: 16px; }
    .attachment summary { padding: 12px; }
    .attachment-title strong { font-size: 0.8rem; }
    .attachment-type { font-size: 0.8rem; gap: 4px; }
    .attachment-title { gap: 8px; }
    .page-images { max-height: 230px; padding: 8px; }
    table { font-size: 0.8rem; }
    th, td { padding: 12px; }
    caption { font-size: 0.8rem; }
    .section-heading { align-items: flex-start; gap: 8px; }
    .section-heading h3 { font-size: 0.88rem; }
    .section-heading > .muted { font-size: 0.8rem; margin-top: 2px; text-align: right; }
    .path-editor { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .path-separator { display: none; }
    .path-segment input { font-size: 16px; min-height: 46px; }
    .path-segment label { font-size: 0.8rem; margin-bottom: 4px; }
    .segment-hint { min-height: 28px; font-size: 0.8rem; }
    .tag { font-size: 0.8rem; }
    .filing-hint, .undo-hint { font-size: 0.8rem; }
    .desktop-actions { display: none; }
    .mobile-actions { display: block; position: fixed; bottom: 0; left: 0; right: 0; z-index: var(--sticky); padding: 12px 16px max(12px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
    .mobile-actions .actions { margin: 0; }
    .mobile-actions .primary { flex: 1; min-width: 0; }
    .mobile-actions button { min-height: 48px; font-size: 0.88rem; }
    .mobile-actions kbd { display: none; }
    .reply-section textarea { font-size: 16px; min-height: 240px; }
    .reply-footer { align-items: stretch; flex-direction: column; gap: 12px; }
    .reply-footer .secondary { font-size: 0.875rem; }
    .reply-footer kbd { display: none; }
    .contact-section { flex-wrap: wrap; gap: 8px; }
    .contact-copy { flex-basis: calc(100% - 32px); }
    .contact-copy span { font-size: 0.8rem; }
    .contact-section .text-button { margin-left: 24px; font-size: 0.8rem; }
    .notice { font-size: 0.8rem; gap: 8px; padding: 12px 16px; flex-wrap: wrap; }
    .notice .secondary { margin-left: 26px; }
    .shortcut-help { flex-direction: column; padding: 20px 16px; gap: 16px; }
    .shortcut-help h2 { padding-right: 32px; }
    .shortcut-help p { font-size: 0.8rem; }
    .shortcut-help dl { gap: 12px; }
    .shortcut-help dl > div { width: 100%; font-size: 0.8rem; }
    .shortcut-help > button { position: absolute; top: 8px; right: 8px; }
    .toasts { bottom: 88px; max-height: 45dvh; width: calc(100% - 24px); }
    .toast { padding: 8px 12px; gap: 8px; }
    .toast strong { font-size: 0.8rem; }
    .toast div span { font-size: 0.8rem; }
    .undo-button { font-size: 0.8rem; padding: 8px; }
    .queue-skeleton { border: 0; }
    .detail-skeleton { display: none; }
    .empty { min-height: 360px; padding: 48px 24px; }
    .empty h2 { font-size: 1.25rem; }
    .empty p { font-size: 0.88rem; }
    .login { margin: auto; padding: 56px 0; }
    .login h1 { font-size: 2.1rem; }
    .login > p { font-size: 0.88rem; }
    .login-foot { font-size: 0.8rem; }
  }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
}
@layer components {
  .file-name-editor { margin: 12px 0 18px; min-width: 0; }
  .name-change { overflow-wrap: anywhere; font-size: 0.875rem; line-height: 1.6; margin-bottom: 10px; }
  .file-name-editor label { display: block; font-size: 0.8rem; margin-bottom: 6px; }
  .file-name-editor input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--canvas); color: var(--ink); }
}

/* redesign 2026-11-11 */
@layer components {
  .workspace { grid-template-columns: 320px minmax(0, 1fr); }
  .detail { display: flex; flex-direction: column; overflow: hidden; background: var(--canvas); }
  .detail-toolbar { flex-shrink: 0; background: var(--surface); padding: 0 24px; font-size: .875rem; }
  .detail-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 460px); }
  .detail-grid > .decision-panel { max-width: none; margin: 0; padding: 24px 24px 48px; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 20px; }
  .decision-panel > .notice { margin: 0; }

  /* Viewer */
  .viewer { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 16px; gap: 12px; }
  .viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
  .viewer-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--subtle); border-radius: 10px; }
  .viewer-tabs [role="tab"] { min-height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; border: 0; border-radius: 7px; background: transparent; font-weight: 600; color: var(--muted); }
  .viewer-tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px oklch(27% .019 157 / .14); }
  .viewer-links { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .viewer-name { color: var(--muted); font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 32ch; }
  .secondary.small { min-height: 36px; padding: 6px 12px; font-size: .875rem; text-decoration: none; color: var(--ink); border-radius: var(--radius); }
  .viewer-body { flex: 1; min-height: 0; display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .viewer-body > * { flex: 1; min-width: 0; }
  .doc-frame { width: 100%; height: 100%; border: 0; display: block; background: var(--subtle); }
  .doc-scroll { overflow: auto; }
  .doc-center { display: flex; align-items: flex-start; justify-content: center; padding: 16px; background: var(--subtle); }
  .doc-image { max-width: 100%; height: auto; display: block; box-shadow: 0 2px 8px oklch(27% .019 157 / .12); }
  .viewer .page-images { max-height: none; }
  .doc-text-note { padding: 16px 20px 0; color: var(--muted); font-size: .875rem; font-weight: 600; }
  .doc-text { margin: 0; padding: 12px 20px 24px; white-space: pre-wrap; font: inherit; font-size: .95rem; line-height: 1.65; }
  .viewer .preview-fallback { justify-content: center; font-size: 1rem; }
  .viewer .preview-fallback a { text-decoration: none; color: var(--ink); }

  /* Email view */
  .email-view { padding: 24px 28px 32px; }
  .email-head { display: flex; align-items: center; gap: 12px; }
  .email-head .avatar { width: 42px; height: 42px; font-size: .875rem; background: var(--selected); color: var(--accent); border-color: transparent; }
  .email-head .email-from { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
  .email-head .email-from strong { font-size: 1rem; }
  .email-head .email-from span { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
  .email-head time { color: var(--muted); font-size: .875rem; white-space: nowrap; }
  .email-subject { font-size: 1.25rem; margin: 20px 0 16px; line-height: 1.35; }
  .email-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.7; max-width: 80ch; }
  .email-loading { display: flex; flex-direction: column; gap: 12px; }
  .email-error { margin-bottom: 16px; border-radius: var(--radius); border: 1px solid var(--line); }
  .email-earlier { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 12px; }
  .email-earlier summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 40px; display: flex; align-items: center; }
  .email-earlier .email-body { color: var(--muted); margin-top: 8px; }
  .email-attachments { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
  .email-attachments ul { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
  .email-attachments li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--canvas); border-radius: var(--radius); }
  .attachment-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
  .email-attachments .text-button { min-height: 36px; color: var(--accent); text-decoration: none; font-weight: 700; }

  /* Decision panel */
  .email-summary h2 { font-size: 1.35rem; line-height: 1.35; letter-spacing: -.015em; margin-bottom: 8px; max-width: none; overflow-wrap: anywhere; }
  .email-topline { justify-content: flex-start; flex-wrap: wrap; }
  .email-topline time { margin-left: auto; font-size: .875rem; }
  .from-line { font-size: .95rem; overflow-wrap: anywhere; }
  .from-line span { color: var(--muted); }
  .decision-panel .summary-text { margin-top: 10px; font-size: .95rem; color: var(--ink); }
  .kind-pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; line-height: 1.6; }
  .kind-filing { background: var(--selected); color: var(--accent); }
  .kind-reply { background: oklch(94% .04 255); color: oklch(40% .11 255); }
  .why-here { border-radius: 10px; padding: 16px 18px; background: var(--warning-bg); border: 1px solid oklch(86% .06 83); }
  .why-here.why-reply { background: oklch(96.5% .018 255); border-color: oklch(88% .04 255); }
  .why-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
  .why-badge { align-self: flex-start; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--warning); }
  .why-reply .why-badge { color: oklch(40% .11 255); }
  .why-here h3 { font-size: 1.05rem; }
  .why-here ul { list-style: disc; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: .95rem; line-height: 1.55; }
  .why-note { margin-top: 10px; font-size: .95rem; }
  .card { border: 1px solid var(--line); border-radius: 10px; padding: 18px; background: var(--surface); }
  .decision-panel .filing-section, .decision-panel .reply-section { padding: 18px; border-bottom: 1px solid var(--line); }
  .decision-panel .section-heading { margin-bottom: 12px; }
  .decision-panel .section-heading h3 { font-size: 1.05rem; }
  .path-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: .95rem; }
  .path-preview li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--subtle); border-radius: 6px; font-weight: 600; overflow-wrap: anywhere; }
  .path-preview li.path-root { background: transparent; padding-left: 0; color: var(--muted); }
  .path-preview li + li { position: relative; margin-left: 12px; }
  .path-preview li + li::after { content: '›'; position: absolute; left: -13px; color: var(--muted); font-weight: 400; }
  .path-missing { display: flex; align-items: center; gap: 8px; color: var(--warning); font-weight: 600; background: var(--warning-bg); padding: 10px 12px; border-radius: var(--radius); }
  .saved-as { margin-top: 12px; font-size: .95rem; overflow-wrap: anywhere; }
  .saved-as span { color: var(--muted); }
  .change-folder { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 6px; }
  .change-folder > summary { list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent); }
  .change-folder > summary::-webkit-details-marker { display: none; }
  .change-folder > summary svg { transition: transform 160ms ease-out; }
  .change-folder[open] > summary svg { transform: rotate(90deg); }
  .change-body { padding-top: 8px; }
  .decision-panel .path-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
  .decision-panel .path-segment:last-child { grid-column: span 2; }
  .decision-panel .path-separator { display: none; }
  .decision-panel .path-segment input { font-size: .95rem; padding: 10px; }
  .decision-panel fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0; padding: 12px; }
  .approve-blocker { margin-top: 12px; font-size: .9rem; font-weight: 600; }
  .decision-panel .actions { margin-top: 16px; }
  .decision-panel .actions .primary { flex: 1; min-width: 0; min-height: 52px; font-size: 1.05rem; }
  .decision-panel .actions .cancel-button { min-height: 52px; font-size: 1rem; }
  .reply-optional > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 700; min-height: 32px; }
  .reply-optional > summary::-webkit-details-marker { display: none; }
  .reply-optional[open] > summary { margin-bottom: 12px; }
  .decision-panel textarea { min-height: 200px; font-size: 1rem; }
  .no-reply { margin-top: 12px; color: var(--muted); }
  .decision-panel .contact-section { padding: 0 4px; }
  .decision-panel .reviewer-audit { color: var(--muted); font-size: .875rem; }
  .queue-bottom { justify-content: flex-start; flex-wrap: wrap; gap: 6px 10px; }
  .queue-bottom .file-kind { margin-left: auto; }
  .queue-item .kind-pill { font-size: .75rem; padding: 0 8px; }
}
@layer responsive {
  @media (max-width: 1100px) {
    .detail { overflow-y: auto; display: block; }
    .detail-grid { display: block; }
    .viewer { height: 62vh; min-height: 360px; }
    .detail-grid > .decision-panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  }
  @media (min-width: 761px) and (max-width: 1100px) { .workspace { grid-template-columns: 280px minmax(0, 1fr); } }
  @media (max-width: 760px) {
    .detail { display: none; }
    .detail-open .detail { display: block; }
    .viewer { height: 55vh; padding: 12px; }
    .viewer-links .viewer-name { display: none; }
    .email-view { padding: 16px; }
    .detail-grid > .decision-panel { padding: 20px 16px 120px; }
    .decision-panel .path-editor { grid-template-columns: minmax(0, 1fr); }
    .decision-panel .path-segment:last-child { grid-column: auto; }
  }
}
