/* Shared action hierarchy. Anchors still navigate; buttons submit or toggle. */
:root { --control-border:#bdc6d3; --control-hover:#f0f3f7; --button-height:36px; --button-padding-y:6px; --button-small-height:32px; --button-auth-height:42px; --field-padding-x:16px; }
a { text-underline-offset:3px; }
a:focus-visible, summary:focus-visible, textarea:focus-visible { outline:3px solid #54769f; outline-offset:3px; }
.skip-link { position:fixed; top:8px; left:8px; z-index:1000; padding:8px 14px; border-radius:8px; background:#fff; color:var(--primary); font-weight:700; text-decoration:none; box-shadow:0 4px 16px #162a4633; transform:translateY(-150%); }
.skip-link:focus { transform:translateY(0); }
.shell > div { min-width:0; }
.nav { text-decoration:none; color:#e5eaf2; font-weight:600; }
.nav:hover { background:#293e5c; }
.navlabel-tools { margin-top:24px; }
button, input[type=submit], input[type=button], .btn, .titlebar > a, .actions > a, a.edit, .source-field-link, .footer a, .review-targets a {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:var(--button-height); padding:var(--button-padding-y) 14px; border:1px solid var(--control-border);
  border-radius:9px; background:#fff; color:var(--primary); font-size:13px; font-weight:600;
  text-decoration:none; line-height:1.4; cursor:pointer;
  transition:background .15s, border-color .15s, box-shadow .15s;
}
button:hover, .btn:hover, .titlebar > a:hover, .actions > a:hover, a.edit:hover, .source-field-link:hover, .footer a:hover {
  background:var(--control-hover); border-color:#7f94ae; box-shadow:0 2px 5px #162a460a;
}
button.primary, a.primary, .actions > a.primary { background:var(--primary); border-color:var(--primary); color:white; }
button.primary:hover, a.primary:hover, .actions > a.primary:hover { background:#142b49; border-color:#142b49; }
.btn-subtle { background:transparent; border-color:transparent; }
.btn-small, a.edit, .source-field-link { min-height:var(--button-small-height); padding:5px 10px; font-size:13px; }
button:disabled { cursor:not-allowed; box-shadow:none; }
[hidden] { display:none !important; }
.titlebar { align-items:flex-start; margin-bottom:20px; }
.note:empty { display:none; }
/* Right-hand group of a title bar: a back link plus optional row navigation, wrapping as one unit. */
.titlebar-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:8px 10px; margin-left:auto; }
.review-row-nav { display:inline-flex; align-items:center; gap:8px; }
.review-row-position { white-space:nowrap; font-variant-numeric:tabular-nums; }
.titlebar .actions { justify-content:flex-end; }
.workflow { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-bottom:26px; }
.workflow > a, .workflow-pending { display:flex; align-items:center; gap:12px; padding:12px 16px; border:1px solid var(--line); border-radius:10px; text-decoration:none; background:#fff; color:var(--muted); font-weight:600; }
.workflow > a:hover { border-color:#7f94ae; background:#f4f5f7; }
.workflow [aria-current=step] { color:var(--primary); background:#f3eddf; border-color:#b89b5f; }
.step-number { display:grid; place-items:center; flex:none; width:27px; height:27px; border-radius:50%; border:1px solid #d5dbe4; background:white; font-size:13px; }
[aria-current=step] .step-number { background:var(--primary); border-color:var(--primary); color:white; }
.workflow small { display:block; font-size:12px; font-weight:400; margin-top:2px; }
.workflow-pending { background:transparent; }
.action-menu { position:relative; margin:0; font-size:13px; }
.action-menu > summary { display:flex; align-items:center; justify-content:space-between; gap:18px; list-style:none; padding:var(--button-padding-y) 14px; min-height:var(--button-height); border:1px solid var(--control-border); background:white; border-radius:9px; font-weight:600; color:var(--primary); }
.action-menu > summary::-webkit-details-marker { display:none; }
.action-menu > summary::after, .select-trigger::after { content:''; width:7px; height:7px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg) translateY(-2px); flex:none; }
.action-menu[open] > summary { background:var(--control-hover); border-color:#7f94ae; }
.action-menu-primary > summary, .action-menu-primary[open] > summary { background:var(--primary); color:white; border-color:var(--primary); }
.list-panel { overflow:visible; }
.list-panel .tablewrap { border-radius:0 0 10px 10px; }
.menu-panel { position:absolute; right:0; top:calc(100% + 7px); width:280px; max-width:calc(100vw - 48px); padding:8px; border:1px solid #cbd1da; border-radius:12px; background:#fff; box-shadow:0 12px 35px #162a4626; z-index:30; }
.menu-panel > a { display:block; padding:10px 12px; border-radius:7px; color:var(--ink); text-decoration:none; font-size:13px; }
.menu-panel > a:hover, .menu-panel > a[aria-current=page] { background:#f0f3f7; color:var(--primary); }
.menu-panel small { display:block; color:var(--muted); font-size:12px; font-weight:400; margin-top:3px; }
.menu-label { display:block; padding:5px 12px 8px; color:var(--muted); font-size:12px; letter-spacing:.8px; }
.mobile-menu { display:none; }
.header-actions { display:flex; align-items:center; justify-content:flex-end; gap:12px; }
/* The mode pill is a bordered oval; never render it empty (non-admins have no environment label). */
header .demo:empty { display:none; }
.header-org { max-width:280px; overflow:hidden; color:var(--primary); font-size:13px; font-weight:650; letter-spacing:.3px; text-overflow:ellipsis; white-space:nowrap; }
.header-batch-indicator { display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"title summary" "track track"; gap:2px 10px; width:min(360px,34vw); min-width:220px; padding:6px 10px; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:#faf9f6; text-decoration:none; }
.header-batch-indicator:hover { background:#f3f5f8; }
.header-batch-title { grid-area:title; overflow:hidden; color:var(--primary); font-size:12px; font-weight:650; text-overflow:ellipsis; white-space:nowrap; }
.header-batch-summary { grid-area:summary; color:var(--muted); font-size:12px; white-space:nowrap; }
.header-batch-track { grid-area:track; display:flex; height:4px; overflow:hidden; border-radius:999px; background:#e7e9ed; }
.header-batch-track > span { height:100%; transition:width .25s ease; }
.header-batch-completed { background:#387459; }
.header-batch-running { background:#54769f; }
.header-batch-stopped { background:#a64d4d; }
.header-batch-indicator.has-stopped { border-color:#d6ad6d; background:#fff9ed; }
.header-batch-indicator.is-stalled { box-shadow:inset 0 0 0 1px #b9822b; }
.profile-menu > summary { width:38px; height:38px; min-height:38px; padding:7px; justify-content:center; border-radius:50%; }
.profile-menu > summary::after { display:none; }
.profile-menu .menu-panel { width:230px; }
.profile-identity { padding:8px 12px 12px; border-bottom:1px solid var(--line); margin-bottom:5px; overflow-wrap:anywhere; }
.profile-identity strong, .profile-identity small { display:block; }
.profile-identity small { color:var(--muted); margin-top:2px; }
.profile-menu .menu-panel form { margin:0; }
.profile-menu .menu-panel form button { display:flex; justify-content:flex-start; width:100%; min-height:0; padding:10px 12px; border:0; border-radius:7px; color:var(--ink); background:#fff; font-weight:400; }
.profile-menu .menu-panel form button:hover { background:#f0f3f7; border:0; box-shadow:none; }
.account-security-dialog { width:min(620px,calc(100vw - 32px)); }
.account-security-dialog .security-setup { display:flex; align-items:center; gap:20px; flex-wrap:wrap; }
.account-security-dialog .security-setup img { max-width:220px; height:auto; background:#fff; }
.account-security-dialog .setup-key { overflow-wrap:anywhere; }
.account-security-dialog form p { margin:14px 0; }
.account-security-dialog form input { width:100%; }
.work-next { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:18px 20px; background:#f3eddf; border:1px solid #d6c6a1; border-radius:12px; margin:20px 0; }
.work-next h2 { font-size:17px; }
.work-next p { margin:5px 0 0; font-size:13px; color:#5e6570; }
.run-card { margin:12px 0; }
.run-card-top { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.run-incident-link { margin-left:8px; font-size:13px; white-space:nowrap; }
.run-card-note { margin-left:8px; color:var(--muted); font-size:13px; }
.page-links { display:flex; flex-wrap:wrap; gap:10px; padding:0; list-style:none; }
.page-links li { padding:8px; border:1px solid var(--line); border-radius:8px; }
.page-links a { display:inline-block; padding:5px 6px; text-decoration:none; font-weight:600; }
.page-links a:hover { background:var(--control-hover); }
.saved-roster { border:1px solid var(--line); border-radius:10px; padding:16px; margin:14px 0; }
.saved-roster .roster-name { display:block; font-size:16px; font-weight:650; text-decoration:none; margin-bottom:7px; }
.saved-roster .actions { margin-top:13px; }
/* Import state on a roster card: 停止 needs someone, 打ち切り is there so a
   closure is not invisible from the list. The title carries the detail.
   The head row keeps them at the top right; they wrap under a long title rather
   than overlapping it, which absolute positioning would do at narrow widths. */
.saved-roster-head { display:flex; align-items:baseline; justify-content:space-between;
  gap:10px; flex-wrap:wrap; margin-bottom:7px; }
.saved-roster-head .roster-name { margin-bottom:0; }
.saved-roster .roster-states { display:flex; gap:6px; flex-wrap:wrap; }
.saved-roster .roster-state { display:inline-block; padding:1px 9px; border-radius:999px;
  border:1px solid var(--line); font-size:12px; white-space:nowrap; cursor:help; }
.saved-roster .roster-state-stopped { border-color:#c7827e; background:#fff3f2; color:#7a2521; }
.saved-roster .roster-state-pending { border-color:#9fb4cd; background:#f2f6fb; color:#274769; }
.saved-roster .roster-state-resolved { color:var(--muted); }
.upload-steps { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin:18px 0; }
.upload-steps .menu-panel { right:auto; left:0; }

input[type=file]::file-selector-button { background:#f0f3f7; border:1px solid var(--control-border); color:var(--primary); border-radius:7px; padding:var(--button-padding-y) 12px; margin-right:12px; cursor:pointer; }
.filters { align-items:flex-start; background:#fcfbf8; }
.filter-main { display:flex; flex-wrap:wrap; gap:10px; align-items:center; width:100%; }
.filter-main input[name=q] { flex:1; min-width:190px; }
.filter-more { width:100%; margin:0; }
.filter-more > summary { display:inline-block; padding:7px 0; font-weight:600; }
.filter-fields { display:flex; gap:12px; flex-wrap:wrap; align-items:center; padding:12px 0 4px; border-top:1px solid var(--line); }
.review-save-actions { position:sticky; bottom:0; background:#fff; padding:14px 0; border-top:1px solid var(--line); z-index:2; }
/* Standalone forms must not clip their dropdown menus into a second scrollbar. */
.panel.form { max-height:none; overflow:visible; }
@media(max-width:1179px) { .mobile-menu { display:block; } header { flex-wrap:wrap; gap:10px; height:auto; min-height:75px; padding-top:12px; padding-bottom:12px; } .crumb { flex:1; } .header-batch-indicator { order:3; width:100%; } header .demo { display:none; } .header-actions { gap:8px; } }
@media(max-width:650px) { .header-org { display:none; } .workflow { gap:5px; } .workflow > a, .workflow-pending { padding:9px 6px; gap:5px; font-size:12px; } .workflow small { display:none; } .step-number { width:20px; height:20px; font-size:12px; } .work-next { align-items:stretch; flex-direction:column; } .work-next .primary { width:100%; } .titlebar .actions { justify-content:flex-start; } .menu-panel { width:260px; } .select-widget { min-width:120px; } .filter-main .select-widget { flex:1; } .filter-fields .select-widget { max-width:100%; } .run-card-top .action-menu { margin-left:auto; } }
@media(prefers-reduced-motion:reduce) { button, a { transition:none !important; } }

/* The confirmed PDF groups multiple values inside its name/address columns. */
.review-column { min-width: 0; margin: 24px 0; padding: 14px; border: 1px solid #d5dbe4; border-radius: 12px; }
.review-column legend { padding: 0 8px; font-weight: 700; color: #203b60; }
.format-preview { display: block; width: 100%; max-width: 960px; aspect-ratio: 595 / 841; background: white; }
.format-preview rect { fill: #236dcc08; stroke: #236dcc; stroke-width: 1.5; vector-effect: non-scaling-stroke; }

.format-panel { padding: 24px; margin-bottom: 20px; }
.format-panel h2 { margin-top: 0; }
.tool-instructions h2 { font-size:17px; margin-bottom:14px; }
.tool-steps { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px 28px; margin:0; padding-left:22px; }
.tool-steps li { padding-left:3px; }
.tool-steps li::marker { color:var(--primary); font-weight:700; }
.tool-steps strong, .tool-steps span { display:block; }
.tool-steps span { margin-top:5px; font-size:13px; line-height:1.7; }
.tool-form .helptext { display:block; margin-top:6px; font-size:13px; line-height:1.7; color:var(--muted); }
.tool-form input, .tool-form textarea { max-width:100%; }
@media(max-width:800px) { .tool-steps { grid-template-columns:1fr; } }

.review-common .select-widget, .review-field .select-widget { display:block; width:100%; margin-top:6px; }
/* In a field's control row the dropdown lines up with its button, like a text input. */
.review-field .review-field-control > .select-widget { margin-top:0; }
.review-common .select-list, .review-field .select-list { width:100%; min-width:0; max-width:100%; }

.comparison-notice { border-left:3px solid #a16d17; background:#fff8e6; padding:12px 16px; }
.comparison-table { table-layout:fixed; min-width:1000px; }
.comparison-table th:first-child { width:50px; }
.comparison-table td { vertical-align:top; overflow-wrap:anywhere; }
.comparison-token { display:inline-block; white-space:pre-wrap; background:#edf1f7; border-radius:4px; padding:2px 4px; margin:2px; }
.comparison-token-warning { background:#fff0c2; border-bottom:1px solid #a16d17; }
.comparison-reason { display:block; color:#734c0c; font-size:12px; }
.format-preview .comparison-token-box { stroke:#bf5700; fill:#ed960026; stroke-width:1; }
.guide-tabs { display:flex; flex-wrap:wrap; gap:6px 24px; margin:22px 0; padding:0; border:0; border-bottom:1px solid var(--line); border-radius:0; background:transparent; }
.guide-tabs a { flex:none; padding:12px 2px; border:0; border-bottom:3px solid transparent; border-radius:0; background:transparent; box-shadow:none; text-decoration:none; color:var(--muted); font-weight:500; }
.guide-tabs a span { display:none; }
.guide-tabs a[aria-selected=true], .guide-tabs a[aria-current=page] { color:var(--primary); border-bottom-color:var(--primary); font-weight:700; background:transparent; box-shadow:none; }
.guide-tabs a:focus-visible { outline:2px solid #b89b5f; outline-offset:3px; }
@media(max-width:650px) { .guide-tabs { gap:4px 18px; } .guide-tabs a { padding:11px 1px; font-size:13px; } }
.guide-section-title { margin:0 0 16px; }
.guide-sections { display:grid; gap:16px; margin-bottom:20px; }
[data-guide-panel][hidden] { display:none; }

/* Entry screen: ordered creation steps and bounded saved-roster navigation. */
.home-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:24px; align-items:start; }
.home-section { padding:24px; min-width:0; }
.home-section h2 { margin:0 0 12px; font-size:20px; }
.home-section h3 { margin-top:20px; font-size:15px; }
.creation-steps { counter-reset:creation; list-style:none; padding:0; margin:24px 0; }
.creation-steps li { counter-increment:creation; position:relative; padding:0 0 22px 44px; }
.creation-steps li::before { content:counter(creation); position:absolute; left:0; top:0; display:grid; place-items:center; width:30px; height:30px; border-radius:50%; background:#203b60; color:white; font-weight:700; border:1px solid #b69a60; }
.creation-steps li:not(:last-child)::after { content:''; position:absolute; left:15px; top:34px; bottom:4px; border-left:1px solid #d6c6a1; }
.creation-steps p { margin:6px 0 0; color:var(--muted); font-size:13px; }
.creation-start { width:100%; }
.automatic-upload-form { display:grid; gap:14px; margin-top:20px; }
.automatic-title-field { display:grid; gap:6px; }
.automatic-title-field > label, .automatic-consent label { font-weight:650; }
.automatic-title-field input { width:100%; box-sizing:border-box; }
.pdf-dropzone { display:grid; justify-items:center; gap:10px; padding:24px 18px; border:2px dashed #9dafc4; border-radius:10px; background:#f7f9fc; text-align:center; transition:border-color .15s,background .15s; }
.pdf-dropzone.is-dragging { border-color:#9a6a16; background:#fff8e9; }
.pdf-dropzone.is-disabled { opacity:.72; }
.pdf-dropzone input[type=file] { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; }
.pdf-selection-list { justify-self:stretch; max-height:110px; overflow:auto; margin:0; padding-left:24px; text-align:left; font-size:13px; }
.automatic-consent { display:flex; align-items:flex-start; gap:9px; padding:12px 14px; border-radius:8px; background:#f8f4ea; }
.automatic-consent input { flex:0 0 auto; margin-top:3px; }
.roster-archive { margin:24px 0 0; padding-top:18px; border-top:1px solid var(--line); }
.roster-archive > summary { padding:8px 0; font-weight:650; color:var(--primary); }
.catalog-filters input { max-width:100%; box-sizing:border-box; }
.catalog-filters label, .catalog-choice label { display:block; margin-bottom:6px; font-weight:600; }
.catalog-filters input { width:100%; min-height:var(--button-height); padding:var(--button-padding-y) 12px; border:1px solid var(--control-border); border-radius:9px; }
.catalog-filters .select-widget, .catalog-choice .select-widget { display:block; width:100%; }
.catalog-choice .select-list { width:100%; max-width:100%; }
.home-section .roster-name { overflow-wrap:anywhere; }
@media(max-width:1179px) { .home-grid { grid-template-columns:minmax(0,1fr); } }

/* Saved rereads stay beside the existing name inputs; no separate edit form. */
.name-reread-value-row { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 8px; }
.name-reread-value { font-size:clamp(20px, 1.8vw, 25px); line-height:1.35; letter-spacing:.04em; color:var(--primary); overflow-wrap:anywhere; }
.name-reread-model { color:var(--muted); font-size:13px; }
.name-reread-original { margin:12px 0; }
.name-reread-original figcaption { font-size:13px; margin-bottom:6px; color:var(--muted); }
.name-reread-image { max-width:100%; overflow:auto; border:1px solid var(--line); border-radius:6px; background:white; }
.name-reread-image img { display:block; width:100%; height:auto; }
.name-reread-image.is-enlarged img { width:850px; max-width:none; }
.name-reread-original button { margin-top:8px; }
.name-reread-original button[hidden] { display:none; }
.name-candidate-panel { margin:10px 0 12px; padding:10px; border:1px solid #c8cfda; border-radius:7px; background:#f7f9fc; }
.name-candidate-panel p { margin:0 0 8px; }
.name-candidate-panel p > .hint { margin-left:10px; }
.name-candidate-options { display:flex; flex-wrap:wrap; gap:8px; }
.name-candidate-options button { display:inline-flex; align-items:center; gap:8px; min-width:90px; justify-content:space-between; }
.name-candidate-options button small { color:var(--muted); font-size:12px; font-weight:400; }
.name-candidate-options button.is-selected { border-color:#1f5e4b; background:#e2f2e8; color:#1f5b3c; }
.name-candidate-options button.is-selected::before { content:'✓'; font-weight:800; }

/* Shared breathing room for actions and adjacent labels; do not style options. */
.actions { gap:12px; }
main p > :is(.btn, .source-field-link, a.edit) { margin-block:4px; margin-inline:4px; }
main p > :is(.btn, .source-field-link, a.edit):first-child { margin-inline-start:0; }
.badge, .review-badge, .pill { margin-inline-end:8px; margin-block:4px; vertical-align:middle; }
.review-field-heading { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:8px; }
.review-field-heading > :is(.badge, .review-badge) { margin:0; }
.review-field-control { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:start; gap:8px; max-width:760px; }
.review-field-control > :is(input, textarea, select, .select-widget) { width:100%; min-width:0; }
.review-field-control > :is(button, .btn) { white-space:nowrap; align-self:start; }
.review-field-control > :is(.review-action-confirm, .review-action-source) { min-height:var(--button-height); padding:var(--button-padding-y) 12px; font-size:13px; }
.review-action-confirm { border-color:#70937f; background:#e9f3ed; color:#174d39; }
.review-action-confirm:hover { border-color:#416f58; background:#dcebe2; }
.review-action-source { border-color:#b89b5f; background:#f5efe1; color:#654a16; }
.review-action-source:hover { border-color:#8f7135; background:#ece1c9; }
.review-field-confirmed { border:1px solid #9fbea9; border-left:4px solid #4f8b67; border-radius:7px; background:#f2f8f4; padding:12px; }
.review-field-confirmed [data-field-value] { border-color:#8fb29c; background:#fff; }
.review-reason-fold { margin:8px 0 12px; }
.review-reason-fold > summary { color:var(--muted); font-size:12px; }
.review-reason-fold[open] > summary { margin-bottom:6px; }
.toast-region { position:fixed; top:82px; right:20px; z-index:40; display:grid; gap:10px; width:min(420px,calc(100vw - 32px)); pointer-events:none; }
.app-toast { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:12px 14px; border:1px solid #b8c7d9; border-left:4px solid var(--primary); border-radius:8px; background:#fff; box-shadow:0 8px 26px #172b4730; transition:opacity .18s ease,transform .18s ease; pointer-events:auto; }
.app-toast.success { border-left-color:#277557; }
.app-toast.warning { border-left-color:#a16d17; }
.app-toast.error { border-left-color:#a43d3d; }
.app-toast.is-leaving { opacity:0; transform:translateY(-6px); }
.app-toast [data-toast-close] { min-width:28px; min-height:28px; padding:0; border:0; background:transparent; font-size:20px; line-height:1; }
.review-common label, .review-field details label { display:block; margin-bottom:8px; }
.review-mode-switch { margin:14px 0; }
.review-flow { color:var(--muted); }
.review-guide > strong { display:block; margin-bottom:6px; }
.mailing-review-bucket { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; padding-top:8px; }
.mailing-review-bucket + .mailing-review-bucket { margin-top:4px; border-top:1px solid var(--line); }
.mailing-review-bucket > strong { min-width:100px; font-size:12px; color:var(--muted); }
.mailing-review-bucket.mailing-review-bucket-complete { margin-top:8px; padding:9px 11px; border:1px solid #9fbea9; border-radius:7px; background:#f2f8f4; }
.mailing-review-bucket-complete > strong { color:#235b3e; }
.mailing-review-bucket-complete .review-targets a { border-color:#8fb29c; background:#e4f2e8; color:#235b3e; }
.mailing-review-bucket-complete .review-targets a::before { content:'✓'; margin-right:5px; font-weight:800; }
.review-section-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
.review-section-heading :is(h3, .badge) { margin:0; }
.review-postal-actions { margin:10px 0 14px; }
.review-status-complete { border-color:#9fbea9; background:#f2f8f4; }
.review-complete-badge { border-color:#8fb29c; background:#e4f2e8; color:#235b3e; }
.review-badge-neutral { background:#eef0f3; color:#5e6874; }
.review-save-bar { display:flex; flex-wrap:wrap; align-items:center; gap:10px 18px; position:sticky; bottom:0; z-index:3; background:#fff; box-shadow:0 -6px 14px #162a460d; }
.review-save-bar .review-save-status { display:flex; flex-wrap:wrap; gap:6px 14px; font-size:13px; color:var(--muted); }
.review-save-bar .review-save-actions { position:static; padding:0; border:0; background:transparent; margin-left:auto; }
.review-save-bar .review-save-secondary { flex-basis:100%; justify-content:flex-end; }
.review-save-bar .review-save-secondary button { min-height:var(--button-small-height); padding:5px 10px; font-size:13px; background:transparent; }
.review-status-line .review-section-heading { margin:0; }
.review-complete-message { color:#235b3e; }
.review-complete-message strong { margin-right:.5em; }
.review-status-complete .review-postal-actions { padding-top:10px; border-top:1px solid #cee0d4; }
.review-confirmation { margin-top:18px; }
.review-confirmation .review-save-actions { margin-top:10px; }
.review-resolved-check { display:grid; grid-template-columns:auto minmax(0,1fr); gap:8px 10px; align-items:start; }
.review-common > summary { font-size:13px; font-weight:700; }
.review-common[open] > summary { margin-bottom:12px; }
.note:empty { display:none; }
.review-source-details { margin:18px 0 0; padding:12px 14px; border:1px solid #d3d7dc; border-radius:8px; background:#f8f7f3; }
.review-source-details > summary { font-weight:700; }
.review-source-details[open] > summary { margin-bottom:12px; }
.review-source-details h2 { margin-top:18px; }
.review-source-details pre { max-width:100%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; }
.review-source-actions { flex-wrap:wrap; align-items:flex-start; }
.reason-guidance { margin:14px 0; }
.reason-guidance li + li { margin-top:8px; }
.address-postal { margin-bottom:6px; font-variant-numeric:tabular-nums; }
.address-text { line-height:1.7; }
.checkbox-control, label:has(> input[type="checkbox"]) {
  display:inline-flex; align-items:flex-start; gap:10px; max-width:100%;
}
.checkbox-control > input[type="checkbox"], label > input[type="checkbox"] {
  flex:0 0 auto; width:auto; min-height:0; margin:4px 0 0;
}
.checkbox-control > label { display:block; margin:0; min-width:0; }
p:has(> input[type="checkbox"]) { display:grid; grid-template-columns:auto minmax(0,1fr); gap:8px 10px; align-items:start; }
p:has(> input[type="checkbox"]) > input[type="checkbox"] { width:auto; margin:4px 0 0; }
p:has(> input[type="checkbox"]) > label { margin:0; }
p:has(> input[type="checkbox"]) > .errorlist { grid-column:2; }
/* Keep labels and adjacent fields legible in shared and hand-written forms. */
.form-field-row { display:flex; align-items:center; flex-wrap:wrap; column-gap:14px; row-gap:8px; }
.form-field-row > label { margin:0; }
.form-field-row > .helptext { flex:1 0 100%; }
label:has(> input:not([type=checkbox]):not([type=radio]):not([type=hidden])),
label:has(> select), label:has(> textarea) {
  display:inline-flex; align-items:center; flex-wrap:wrap; column-gap:14px; row-gap:8px;
}
.account-invite-dialog { width:min(640px,calc(100vw - 32px)); }
.account-invite-dialog .app-dialog-body { padding-bottom:10px; }
.account-invite-dialog .form-field-row { margin:0 0 18px; }
.account-invite-dialog .form-field-row > label { flex:0 0 180px; font-weight:600; }
.account-invite-dialog .form-field-row > input,
.account-invite-dialog .form-field-row > select,
.account-invite-dialog .form-field-row > .select-widget { flex:1 1 260px; min-width:0; }
@media(max-width:650px) {
.review-field-control { grid-template-columns:1fr auto; }
.review-field-control > :is(input, textarea, select, .select-widget) { grid-column:1 / -1; }
.review-field-control > :is(button, .btn) { justify-self:start; }
  .account-invite-dialog .form-field-row { align-items:stretch; }
  .account-invite-dialog .form-field-row > label { flex-basis:100%; }
}
.glyph-watch-table { min-width:540px; }
.glyph-watch-table th, .glyph-watch-table td { vertical-align:middle; }
.glyph-watch-table th[scope="row"] { font-size:18px; white-space:nowrap; }
.glyph-watch-table td .actions { margin:0; }
.glyph-watch-table td label { margin:0; }

/* Compact actions, preserving comfortable touch targets. */
@media(pointer:coarse) { :root { --button-height:40px; --button-padding-y:8px; --button-small-height:36px; --button-auth-height:44px; } }
.glyph-list-heading { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; }
.glyph-create-panel { margin-bottom:20px; }
.glyph-create-panel form { display:flex; flex-direction:column; min-height:0; }
.glyph-create-panel input[type=text] { width:100%; }
.glyph-create-dialog { width:min(620px,calc(100vw - 32px)); }
.glyph-create-dialog .glyph-create-panel { margin:0; border:0; border-radius:0; box-shadow:none; }

/* Single-line fields share action dimensions; multiline editors retain their rows. */
input:not([type]), input:is([type=text],[type=password],[type=search],[type=email],[type=url],[type=tel],[type=number],[type=date],[type=time],[type=datetime-local],[type=month],[type=week]) {
  box-sizing:border-box; height:var(--button-height); min-height:var(--button-height);
  padding:var(--button-padding-y) var(--field-padding-x); font-size:13px; line-height:1.4;
}
textarea { padding-inline:var(--field-padding-x); }
.stat-line { display:flex; align-items:baseline; justify-content:space-between; gap:16px; width:100%; min-width:0; }
.stat-line > :first-child { min-width:0; }
.stat-line > strong, .stat-line > .stat-number { flex:none; margin-left:auto; text-align:right; white-space:nowrap; }
.stat-line > strong { margin-top:0; margin-right:0; }
.stat-number strong { margin:0 4px 0 0; }
input[type=file] { box-sizing:border-box; min-height:var(--button-height); padding:0 8px 0 0; font-size:13px; line-height:1.4; }
input[type=file]::file-selector-button { min-height:calc(var(--button-height) - 2px); padding:var(--button-padding-y) 12px; margin-block:0; border-width:0 1px 0 0; border-radius:5px 0 0 5px; font:inherit; }

/* Role permission matrix: readable size, centred marks, colour plus text for screen readers. */
.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; }
.permission-table { min-width:640px; }
.permission-table th, .permission-table td { font-size:14px; padding:10px 12px; }
.permission-table thead th { font-size:13px; text-align:center; }
.permission-table thead th:first-child, .permission-table tbody th { text-align:left; font-weight:500; }
.permission-table td.perm { position:relative; text-align:center; font-size:18px; line-height:1; } /* contains the sr-only span so it never widens the page */
.permission-table .perm-yes { color:#2f6b4f; }
.permission-table .perm-no { color:#a64d4d; }

.account-row-actions { gap:6px; }
.account-row-actions form { margin:0; }

.review-history { margin:24px 0 0; padding:0 0 8px; border-top:1px solid var(--line); }
.review-history > summary { padding:14px 0 6px; font-weight:700; color:var(--primary); }

/* Postal dictionary update: step strip and the "what next" card. */
.postal-steps, .flow-steps { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 16px; padding:0; list-style:none; }
.postal-steps li, .flow-steps li { padding:6px 12px; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:13px; }
.postal-steps li.is-done, .flow-steps li.is-done { border-color:#2f6b4f; color:#2f6b4f; background:#eef5f1; }
.postal-steps li.is-current, .flow-steps li.is-current { border-color:var(--primary); color:var(--primary); background:#eef1f7; font-weight:700; }
.postal-next { border-left:4px solid var(--primary); }

.account-mode-switch { display:flex; gap:6px; margin:0 0 18px; padding:4px; border:1px solid var(--line); border-radius:10px; background:#f4f1eb; }
.account-mode-switch button { flex:1; min-height:38px; border:1px solid transparent; border-radius:7px; background:transparent; color:var(--muted); font-weight:600; }
.account-mode-switch button:hover { background:#fff; color:var(--primary); }
/* Selected mode: filled navy with a check mark, so the active choice is unmistakable. */
.account-mode-switch button[aria-selected="true"] { background:var(--primary); color:#fff; box-shadow:0 1px 2px #0003; }
.account-mode-switch button[aria-selected="true"]::before { content:"✓ "; }
.account-invite-dialog .app-dialog-actions { margin:16px 0 0; padding:16px 0 0; }

.role-summary { margin:0; padding-left:20px; line-height:1.8; }
.role-summary li { margin:4px 0; }
/* Guide tab panels are fragment targets; never draw a focus ring around a whole panel. */
[data-guide-panel]:focus, [data-guide-panel]:focus-visible { outline:none; }

.glyph-intro .titlebar { align-items:flex-start; }
.glyph-intro .subtitle { font-size:14px; color:var(--ink); }
.glyph-fine-print { margin:14px 0 0; }
.glyph-fine-print > summary { font-weight:600; }
.glyph-fine-print ul { margin:8px 0 0; padding-left:20px; line-height:1.8; }

/* Guide: numbered step cards with an ordered action list and an optional screenshot. */
.guide-steps { display:grid; gap:18px; margin-bottom:24px; }
.guide-step { padding:20px 22px 22px; }
.guide-step-head { display:flex; align-items:center; gap:12px; margin:0 0 12px; }
.guide-step-head h2 { margin:0; font-size:18px; }
.guide-step-number { display:inline-grid; place-items:center; flex:none; width:32px; height:32px; border-radius:50%; background:var(--primary); color:#fff; font-weight:700; }
.guide-step-body { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:16px 28px; align-items:start; }
/* Text and figures are grid items so wide screenshots span the card at their natural (1x) size. */
.guide-text { display:contents; }
.guide-step-body > .guide-text > .guide-actions, .guide-step-body > .guide-actions { grid-column:1; grid-row:1; min-width:0; }
/* Paragraphs stack down column 1; pinning them all to row 1 made a second one overlap the first. */
.guide-step-body > p { grid-column:1; min-width:0; }
.guide-step-body > .guide-figure:not(.guide-figure-wide), .guide-step-body > .guide-figures { grid-column:2; grid-row:1; }
.guide-figures { display:grid; gap:16px; max-width:560px; }
.guide-figure-wide { grid-column:1 / -1; }
.guide-actions { margin:0; padding-left:22px; line-height:1.8; }
.guide-actions li { margin:6px 0; }
.guide-actions b { color:var(--primary); }
.guide-figure { margin:0; max-width:560px; }
.guide-figure-wide { margin:4px 0 0; max-width:100%; }
/* No forced width: the width attribute (CSS px at 1x) applies, shrinking only when the card is narrower. */
.guide-figure img { display:block; max-width:100%; height:auto; border:1px solid var(--line); border-radius:8px; box-shadow:0 2px 8px #1a253515; background:#fff; }
.guide-figure figcaption { margin:8px 2px 0; color:var(--muted); font-size:12px; line-height:1.6; }
.guide-links { margin:12px 0 0; }
@media(max-width:900px) { .guide-step-body { grid-template-columns:minmax(0,1fr); } .guide-step-body > .guide-figure:not(.guide-figure-wide), .guide-step-body > .guide-figures { grid-column:1; grid-row:auto; } .guide-figure { max-width:100%; } }
/* 都道府県別の人数：47行を一画面で追えるよう、行を詰め、数値を右寄せにする。 */
.prefecture-counts { min-width:0; }
.prefecture-counts th, .prefecture-counts td { padding-top:7px; padding-bottom:7px; }
.prefecture-counts tbody th { font-size:13px; font-weight:600; color:var(--ink); background:none; border-top:0; white-space:normal; }
.prefecture-counts td, .prefecture-counts thead th:not(:first-child) { text-align:right; font-variant-numeric:tabular-nums; }
.prefecture-counts tfoot th, .prefecture-counts tfoot td { font-weight:700; border-top:2px solid var(--line); }
@media (max-width:650px) { .prefecture-counts th, .prefecture-counts td { padding-left:8px; padding-right:8px; } .prefecture-counts th:first-child, .prefecture-counts td:first-child { padding-left:12px; } }
/* 記入行の指定：原本画像を画面幅に収める。 */
.rows-confirm { margin:16px 0; }
.rows-confirm-source { margin-top:16px; }
.rows-confirm-source img { display:block; width:100%; max-width:900px; height:auto; margin:0 auto 16px; border:1px solid var(--line); }
.rows-confirm-source .hint { padding:0 20px; }
