:root {
    --blue: #1e5aa8;
    --blue-dark: #123e78;
    --blue-soft: #eaf2ff;
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #d9e2ec;
    --shadow: 0 20px 45px rgba(22, 55, 100, .12);
    --radius: 18px;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }
body {
    margin: 0;
    font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    background: radial-gradient(circle at top left, #ffffff 0, var(--bg) 42%, #edf3fb 100%);
    color: var(--text);
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }

.app-body { min-height: 100vh; }
.app-shell { min-height: 100vh; display: flex; }
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px 14px;
    background: rgba(255, 255, 255, .94);
    border-right: 1px solid var(--border);
    box-shadow: 12px 0 32px rgba(28, 57, 96, .08);
    backdrop-filter: blur(16px);
    transition: width .2s ease, transform .2s ease;
}
.app-workspace {
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding-bottom: 64px;
    overflow-x: hidden;
    transition: margin-left .2s ease;
}
.sidebar-backdrop { display: none; }
.app-shell.sidebar-collapsed .app-sidebar { width: var(--sidebar-collapsed-width); }
.app-shell.sidebar-collapsed .app-workspace { width: calc(100% - var(--sidebar-collapsed-width)); margin-left: var(--sidebar-collapsed-width); }
.app-shell.sidebar-collapsed .sidebar-brand-text,
.app-shell.sidebar-collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 8px 8px 14px; min-height: 62px; }
.sidebar-brand-text, .nav-label { transition: opacity .16s ease, width .16s ease; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--blue), #4da1ff);
    color: #fff;
    font-weight: 800;
    font-size: 20px;
    box-shadow: 0 10px 25px rgba(30, 90, 168, .25);
}
.brand-title { font-weight: 800; letter-spacing: .02em; }
.brand-subtitle { font-size: 12px; color: var(--muted); }
.global-nav { display: grid; gap: 8px; overflow-y: auto; padding-right: 2px; }
.global-nav a, .logout-form button, .sidebar-group-toggle {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 12px;
    padding: 10px 12px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    text-align: left;
}
.global-nav a:hover, .logout-form button:hover, .sidebar-group-toggle:hover { background: var(--blue-soft); color: var(--blue-dark); }
.global-nav a.is-active {
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-weight: 800;
}
.global-nav a.is-active .sidebar-link-marker { background: var(--blue); }
.sidebar-group { display: grid; gap: 4px; }
.sidebar-group-toggle { font-weight: 800; }
.sidebar-group-toggle::after {
    content: "⌄";
    margin-left: auto;
    color: var(--muted);
    transition: transform .18s ease;
}
.sidebar-group.is-open .sidebar-group-toggle::after { transform: rotate(180deg); }
.sidebar-group-items {
    display: grid;
    gap: 4px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding-left: 10px;
    transition: max-height .24s ease, opacity .2s ease;
}
.sidebar-group.is-open .sidebar-group-items {
    max-height: 840px;
    opacity: 1;
}
.sidebar-link-marker {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #bfdbfe;
}
.global-nav a:hover .sidebar-link-marker,
.logout-form button:hover .sidebar-link-marker,
.sidebar-group-toggle:hover .sidebar-link-marker { background: var(--blue); }
.unread-badge {
    min-width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    margin-left: auto;
    padding: 0 6px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}
.logout-form { margin: auto 0 0; }
.sidebar-group .logout-form { margin: 0; }
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 72px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 14px clamp(18px, 3vw, 42px);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.menu-toggle {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}
.menu-toggle span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--blue-dark);
}
.topbar-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.topbar-title { margin: 2px 0 0; font-size: 22px; line-height: 1.25; }
.app-main { width: min(1180px, calc(100% - 32px)); margin: 24px auto 56px; padding-bottom: 24px; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
    width: min(440px, 100%);
    padding: 34px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}
.login-brand { margin-bottom: 22px; }

.hero, .page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 22px;
}
.hero {
    min-height: 210px;
    padding: clamp(26px, 5vw, 52px);
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(30, 90, 168, .95), rgba(22, 119, 255, .84)), url("data:image/svg+xml,%3Csvg width='160' height='160' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.12'%3E%3Cpath d='M0 80h160M80 0v160'/%3E%3Ccircle cx='80' cy='80' r='52'/%3E%3C/g%3E%3C/svg%3E");
    color: #fff;
    box-shadow: var(--shadow);
}
.hero p { color: rgba(255,255,255,.86); max-width: 680px; }
.hero h1, .page-heading h1 { margin: 0; font-size: clamp(26px, 4vw, 42px); }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; }
.hero .eyebrow { color: rgba(255,255,255,.76); }

.page-card, .stat-card, .menu-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(28, 57, 96, .08);
}
.page-card { padding: clamp(18px, 3vw, 28px); margin-bottom: 24px; }
.page-card h2 { margin-top: 0; }
.narrow { width: min(720px, 100%); margin-inline: auto; }

.stats-grid, .menu-grid, .summary-grid, .split-grid {
    display: grid;
    gap: 18px;
}
.stats-grid { grid-template-columns: repeat(3, 1fr); margin: 24px 0; }
.menu-grid, .split-grid { grid-template-columns: repeat(3, 1fr); }
.split-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.summary-grid + .summary-grid { margin-top: 18px; }
.stat-card, .menu-card { padding: 22px; transition: transform .18s ease, box-shadow .18s ease; }
.stat-card:hover, .menu-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card span, .summary-grid span { display: block; color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; font-size: 38px; color: var(--blue); margin: 8px 0; }
.stat-card small { display: block; color: var(--muted); }
.stat-unread { margin-top: 6px; font-weight: 800; color: #dc2626; }
.summary-grid > div { padding: 16px; background: var(--blue-soft); border-radius: 14px; }
.summary-grid strong { display: block; margin-top: 8px; color: var(--blue-dark); overflow-wrap: anywhere; word-break: break-word; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    min-width: 0;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--blue-dark);
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.2;
}
.button:hover { background: var(--blue-soft); }
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.primary:hover { background: var(--blue-dark); }
.button.small { min-height: 34px; padding: 7px 12px; font-size: 13px; }
.button.button-fixed:not(.wide) { width: 124px; padding-inline: 12px; }
.button.button-fixed.button-compact-text:not(.wide) { font-size: 14px; letter-spacing: -.01em; }
.button.small.button-fixed:not(.wide) { width: 86px; padding-inline: 8px; }
.button.small.button-fixed.button-compact-text:not(.wide) { font-size: 12px; }
.action-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.page-card > .action-row,
.page-card > form > .action-row,
.table-card .bulk-actions { margin-top: 18px; margin-bottom: 24px; }
.table-card .responsive-table { margin-top: 20px; }
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.section-title-row h2 { margin: 0; }
.estimate-detail-table textarea {
    min-width: 220px;
    min-height: 54px;
}
.estimate-detail-table input {
    min-width: 96px;
}
.readonly-total {
    display: grid;
    gap: 6px;
    align-content: center;
    min-height: 68px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}
.readonly-total span {
    color: var(--muted);
    font-size: 12px;
}
.readonly-total strong {
    color: var(--blue-dark);
    font-size: 18px;
}
.estimate-document-history {
    align-items: stretch;
}
.estimate-document-history > .page-card {
    height: 100%;
}
.estimate-document-history .responsive-table {
    height: 100%;
}
.document-history-table {
    table-layout: fixed;
    min-width: 900px;
}
.document-history-table col:nth-child(1) { width: 110px; }
.document-history-table col:nth-child(2) { width: 130px; }
.document-history-table col:nth-child(3) { width: 110px; }
.document-history-table col:nth-child(4) { width: 190px; }
.document-history-table col:nth-child(5) { width: 100px; }
.document-history-table col:nth-child(6) { width: 150px; }
.document-history-table col:nth-child(7) { width: 190px; }
.document-history-table td {
    word-break: break-word;
}
.document-history-table .action-row {
    align-items: flex-start;
}
.document-history-date-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
}
.document-history-date-form input[type="date"] {
    min-width: 0;
}
.document-mapping-note {
    margin-top: 8px;
}
.bulk-actions + .responsive-table,
.table-actions + .table-wrap,
.action-row + .responsive-table,
.form-stack + .responsive-table,
form > .bulk-actions + .responsive-table { margin-top: 22px; }
.page-card form + .responsive-table,
.page-card .drop-zone + .action-row { margin-top: 18px; }
.holiday-import-actions { margin-top: 18px; }
.menu-grid + .page-card,
.stats-grid + .page-card,
.summary-grid + .page-card,
.summary-grid + .table-card,
.page-card + .table-card { margin-top: 26px; }

.form-stack, .upload-form, .search-form, .detail-form { display: grid; gap: 16px; }
.search-form { grid-template-columns: 1fr auto; align-items: end; }
.ledger-search-form {
    grid-template-columns: minmax(180px, 280px) minmax(180px, 280px) auto;
    justify-content: start;
    margin-top: 18px;
}
.ledger-search-form input[type="date"] {
    min-width: 180px;
}
.detail-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: block; font-weight: 700; color: var(--text); }
label > input,
label > textarea,
label > select,
label > .inline-fields,
label > .drop-zone {
    display: block;
    margin-top: 8px;
}
.checkbox-line {
    display: flex;
    gap: 8px;
    align-items: center;
}
.checkbox-line input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex: 0 0 auto;
}
input, textarea, select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 13px;
    font: inherit;
    background: #fff;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 3px solid rgba(30,90,168,.14); border-color: var(--blue); }
input.required-missing,
textarea.required-missing,
select.required-missing {
    background: #fff1f2;
    border-color: #fecdd3;
}
.drop-zone.required-missing-wrap {
    background: #fff1f2;
    border-color: #fecdd3;
}
.span-2 { grid-column: span 2; }

.drop-zone {
    min-height: 190px;
    border: 2px dashed #8fb3df;
    border-radius: 20px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 26px;
    background: linear-gradient(180deg, #fff, var(--blue-soft));
    cursor: pointer;
}
.drop-zone input { display: none; }
.drop-title { font-size: 22px; color: var(--blue-dark); font-weight: 800; }
.drop-subtitle, .drop-filename { color: var(--muted); font-size: 13px; }
.drop-zone.is-dragover, .drop-zone.dragover { background: #dcebff; border-color: var(--blue); }

.responsive-table,
.table-wrap { overflow-x: auto; }
.holiday-master-table-scroll { max-height: 520px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
.holiday-master-table-scroll table { margin: 0; }
.holiday-master-table-scroll thead th { position: sticky; top: 0; z-index: 1; }
.table-wrap { margin-top: 20px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--blue); color: #fff; font-weight: 800; white-space: nowrap; }
th.sortable-header {
    cursor: pointer;
    user-select: none;
}
th.sortable-header .sort-indicator {
    display: inline-block;
    margin-left: 6px;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    letter-spacing: -2px;
    opacity: .9;
    vertical-align: middle;
}
th.sortable-header.is-sort-asc .sort-indicator,
th.sortable-header.is-sort-desc .sort-indicator {
    opacity: 1;
}
tr:hover td { background: #fbfdff; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.nowrap { white-space: nowrap; }
.error-message { padding: 16px; border-radius: 12px; background: #fff1f2; color: #991b1b; border: 1px solid #fecdd3; }
.table-pager {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin: 14px 0;
}
.table-pager[hidden] { display: none; }
.table-pager-top { margin-bottom: 12px; }
.table-pager-bottom { margin-top: 14px; }
.table-pager-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin-right: 4px;
}
.table-pager button:disabled {
    opacity: .55;
    cursor: default;
}
.attendance-confirm-table table {
    min-width: 980px;
}
.attendance-confirm-table th,
.attendance-confirm-table td {
    text-align: center;
    white-space: nowrap;
    padding: 10px 9px;
}
.attendance-confirm-table th:first-child,
.attendance-confirm-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    text-align: left;
}
.attendance-confirm-table th:first-child {
    z-index: 2;
}
.attendance-confirm-table td:first-child {
    background: #fff;
    font-weight: 800;
}
.attendance-confirm-table .holiday-cell {
    color: #dc2626;
}
.attendance-confirm-table .worked-cell {
    color: var(--blue-dark);
    font-weight: 800;
}
.attendance-confirm-table .off-cell {
    color: var(--muted);
}

@media (max-width: 860px) {
    .hero, .page-heading { align-items: flex-start; flex-direction: column; }
    .stats-grid, .menu-grid, .split-grid, .summary-grid, .detail-form, .search-form { grid-template-columns: 1fr; }
    .project-allocation-row { grid-template-columns: 1fr; }
    .section-head { flex-direction: column; }
    .span-2 { grid-column: auto; }
    .hero { min-height: auto; }
}

.user-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.alert {
    padding: 14px 16px;
    border-radius: 14px;
    font-weight: 700;
    margin-bottom: 16px;
}
.alert + .button,
.alert + .action-row,
.alert + form,
.alert + .bulk-actions { margin-top: 16px; }
.alert.danger {
    background: #fff1f2;
    color: #991b1b;
    border: 1px solid #fecdd3;
}
.required { color: #dc2626; font-size: 18px; line-height: 1; font-weight: 900; }
.field-error { color: #dc2626; font-weight: 700; }
.hint { color: var(--muted); font-size: 13px; }
.error-text { color: var(--danger); }
.tax-mapping-button-group { margin-top: 8px; justify-content: flex-end; }
.tax-mapping-modal[hidden] { display: none; }
.tax-mapping-modal { position: fixed; inset: 0; z-index: 1300; display: grid; place-items: center; padding: 18px; }
.tax-mapping-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .66); backdrop-filter: blur(2px); }
.tax-mapping-dialog { position: relative; width: min(1220px, calc(100vw - 28px)); max-height: calc(100vh - 28px); background: #fff; border: 1px solid #d7e3f8; border-radius: 16px; box-shadow: 0 28px 90px rgba(15,23,42,.36); display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.tax-mapping-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid #e5edf8; background: #f8fbff; }
.tax-mapping-header h2 { margin: 0 0 4px; }
.tax-mapping-header p { margin: 0; color: var(--muted); font-size: 13px; }
.tax-mapping-body { min-height: 0; overflow: auto; padding: 16px; display: grid; grid-template-columns: minmax(420px, 520px) minmax(0, 1fr); gap: 16px; }
.tax-mapping-canvas { background: #eef4fb; border: 1px solid #d7e3f8; border-radius: 12px; padding: 12px; overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; max-height: calc(100vh - 180px); }
.tax-mapping-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tax-mapping-pages { display: grid; gap: 16px; overflow: auto; padding: 2px 8px 10px 2px; min-height: 0; }
.tax-mapping-page-wrap { display: grid; gap: 6px; justify-items: center; }
.tax-mapping-page-label { justify-self: start; color: var(--muted); font-size: 12px; font-weight: 700; }
.tax-mapping-page-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; text-align: left; }
.tax-mapping-page { position: relative; width: min(440px, 100%); aspect-ratio: var(--tax-page-width, 595) / var(--tax-page-height, 842); background: #fff; border: 1px solid #c8d7ee; box-shadow: 0 10px 28px rgba(15,23,42,.14); overflow: hidden; }
.tax-mapping-page-image { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: fill; }
.tax-mapping-page-placeholder { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; padding: 18px; color: var(--muted); font-size: 13px; text-align: center; background: repeating-linear-gradient(135deg, #fff, #fff 10px, #f8fafc 10px, #f8fafc 20px); }
.tax-mapping-box { position: absolute; z-index: 2; min-height: 8px; border: 1.5px solid #2563eb; background: rgba(37,99,235,.16); color: #1d4ed8; font-size: 9px; font-weight: 700; line-height: 1.1; overflow: hidden; white-space: nowrap; box-shadow: 0 0 0 1px rgba(255,255,255,.8); cursor: move; user-select: none; touch-action: none; }
.tax-mapping-box.is-dragging { border-color: #1d4ed8; background: rgba(37,99,235,.28); box-shadow: 0 0 0 2px rgba(37,99,235,.24); }
.tax-mapping-box.disabled { border-style: dashed; border-color: #94a3b8; background: rgba(148,163,184,.12); color: #64748b; }
.tax-mapping-form { min-width: 0; }
.tax-mapping-table-wrap { overflow: auto; max-height: calc(100vh - 260px); border: 1px solid #e5edf8; border-radius: 10px; }
.tax-mapping-table input,
.tax-mapping-table select { width: 100%; min-width: 68px; }
.tax-mapping-table td:nth-child(2) input { min-width: 150px; }
.tax-mapping-table td:nth-child(3) select { min-width: 180px; }
.tax-mapping-table td:nth-last-child(2) input { min-width: 220px; }
.tax-mapping-table code { white-space: nowrap; }
.tax-mapping-form-head { margin: 0 0 10px; }
.tax-mapping-zoom-modal[hidden] { display: none; }
.tax-mapping-zoom-modal { position: fixed; inset: 0; z-index: 1400; display: grid; place-items: center; padding: 18px; }
.tax-mapping-zoom-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .76); backdrop-filter: blur(2px); }
.tax-mapping-zoom-dialog { position: relative; width: min(1040px, calc(100vw - 28px)); max-height: calc(100vh - 28px); background: #fff; border: 1px solid #d7e3f8; border-radius: 16px; box-shadow: 0 28px 90px rgba(15,23,42,.42); display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.tax-mapping-zoom-scroll { min-height: 0; overflow: auto; padding: 18px; display: grid; gap: 22px; justify-items: center; background: #eef4fb; }
.tax-mapping-zoom-page-wrap { width: min(860px, 100%); }
.tax-mapping-zoom-page { width: 100%; }
.tax-mapping-zoom-page .tax-mapping-box { font-size: 12px; border-width: 2px; }
@media (max-width: 900px) {
  .tax-mapping-body { grid-template-columns: 1fr; }
  .tax-mapping-canvas { max-height: 60vh; }
}
.tax-html-toolbar { margin-bottom: 18px; }
.tax-html-report { display: grid; gap: 24px; justify-items: center; }
.tax-html-page-wrap { display: grid; gap: 8px; justify-items: center; width: 100%; }
.tax-html-page-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.tax-html-page { position: relative; width: min(var(--tax-page-width-pt, 595pt), 100%); aspect-ratio: var(--tax-page-width, 595) / var(--tax-page-height, 842); background: #fff; border: 1px solid #c8d7ee; box-shadow: 0 18px 42px rgba(15,23,42,.14); overflow: hidden; }
.tax-html-page-image { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: fill; }
.tax-html-page-placeholder { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; padding: 18px; color: var(--muted); font-size: 13px; text-align: center; background: repeating-linear-gradient(135deg, #fff, #fff 10px, #f8fafc 10px, #f8fafc 20px); }
.tax-html-value { position: absolute; z-index: 2; display: flex; align-items: center; min-height: 2px; color: #111827; font-family: "Yu Gothic", "YuGothic", "Meiryo", sans-serif; font-weight: 700; line-height: 1; white-space: nowrap; overflow: visible; font-variant-numeric: tabular-nums; }
.tax-html-align-left { justify-content: flex-start; text-align: left; }
.tax-html-align-center { justify-content: center; text-align: center; }
.tax-html-align-right { justify-content: flex-end; text-align: right; }
@media print {
  @page { margin: 0; }
  body { background: #fff !important; }
  .app-sidebar,
  .sidebar-backdrop,
  .app-topbar,
  .page-back-row,
  .tax-html-toolbar,
  .loading-overlay { display: none !important; }
  .app-shell,
  .app-workspace,
  .app-main { display: block !important; margin: 0 !important; padding: 0 !important; width: auto !important; min-height: 0 !important; background: #fff !important; }
  .tax-html-report { display: block; }
  .tax-html-page-wrap { display: block; break-after: page; page-break-after: always; }
  .tax-html-page-wrap:last-child { break-after: auto; page-break-after: auto; }
  .tax-html-page-label { display: none; }
  .tax-html-page { width: var(--tax-page-width-pt, 595pt); max-width: none; border: 0; box-shadow: none; margin: 0 auto; }
  .tax-html-value { color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head h3 { margin: 0 0 4px; }
.project-allocation-card { display: block; }
.project-allocation-list { display: grid; gap: 10px; }
.project-allocation-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(120px, 180px) auto;
    gap: 10px;
    align-items: end;
}
.allocation-message { margin: 10px 0 0; color: var(--muted); font-weight: 700; }
.allocation-message.is-error { color: #dc2626; }
.wide { width: 100%; }
.span-full { grid-column: 1 / -1; }
small { color: var(--muted); }

/* 日本語コメント：一覧画面の一括操作ボタンを横並びで表示します。 */
.bulk-actions,
.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 18px 0 28px;
    align-items: center;
}

/* 日本語コメント：資料グループの複数ファイル登録欄をカード状に表示します。 */
.file-list,
.existing-documents {
    border: 1px solid #d7e3f8;
    border-radius: 14px;
    padding: 16px;
    background: #f8fbff;
}

.document-file-row {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr auto;
    gap: 12px;
    align-items: end;
    margin-top: 12px;
}

.document-existing-row,
.work-item-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid #dbe7f7;
}
.document-existing-row:first-of-type,
.work-item-row:first-of-type {
    border-top: 0;
}
.document-existing-row {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    align-items: start;
}
.document-existing-row strong,
.document-existing-row span,
.document-existing-row small {
    display: block;
}
.document-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(96px, 1fr));
    gap: 8px;
    align-items: stretch;
    min-width: 240px;
}
.document-action-grid .button {
    width: 100%;
    min-width: 0;
    white-space: normal;
    line-height: 1.25;
    text-align: center;
}
.document-mapping-editor {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fbff;
}
.document-mapping-editor summary {
    cursor: pointer;
    font-weight: 800;
    color: var(--blue-dark);
}
.mapping-grid,
.mapping-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.mapping-grid label,
.mapping-detail-grid label {
    font-size: 12px;
    color: var(--muted);
}
.mapping-grid input,
.mapping-detail-grid input {
    margin-top: 4px;
    text-transform: uppercase;
}
.mapping-preview-modal[hidden] { display: none; }
.mapping-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: grid;
    place-items: center;
    padding: 24px;
}
.mapping-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .58);
}
.mapping-preview-dialog {
    position: relative;
    width: min(1180px, 96vw);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .34);
}
.mapping-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.mapping-preview-header h3 { margin: 0; }
.mapping-preview-header p { margin: 4px 0 0; color: var(--muted); }
.mapping-preview-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.mapping-preview-dialog > .muted,
.mapping-preview-dialog > .empty { margin: 14px 20px; }
.mapping-custom-editor {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.mapping-custom-editor:empty { display: none; }
.mapping-custom-editor label {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
}
.mapping-custom-editor span {
    font-size: 12px;
    color: var(--muted);
}
.mapping-selection-panel {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(170px, .7fr) minmax(180px, .8fr) auto;
    gap: 12px;
    align-items: end;
    margin: 14px 20px;
    padding: 12px;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
}
.mapping-selection-panel[hidden] { display: none; }
.mapping-selection-panel strong {
    display: block;
    color: var(--blue-dark);
}
.mapping-selection-panel small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}
.mapping-selection-panel label {
    font-size: 12px;
    color: var(--muted);
}
.mapping-selection-panel select,
.mapping-selection-panel input {
    margin-top: 4px;
}
.mapping-selection-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}
.mapping-preview-scroll {
    overflow: auto;
    padding: 0 20px 20px;
}
.mapping-preview-table {
    width: max-content;
    min-width: 720px;
    table-layout: fixed;
    border-collapse: collapse;
    background: #fff;
}
.mapping-preview-table th,
.mapping-preview-table td {
    border: 1px solid #d9e2ef;
    padding: 4px 6px;
    vertical-align: top;
    background: #fff;
    color: #0f172a;
    overflow: hidden;
    box-sizing: border-box;
    user-select: none;
}
.mapping-preview-table thead th,
.mapping-preview-row-header,
.mapping-preview-corner {
    position: sticky;
    background: #eef5ff;
    color: #0f172a;
    z-index: 2;
    text-align: center;
}
.mapping-preview-table thead th { top: 0; }
.mapping-preview-row-header {
    left: 0;
    width: 54px;
    min-width: 54px;
    z-index: 1;
}
.mapping-preview-corner {
    left: 0;
    z-index: 3;
    width: 54px;
    min-width: 54px;
}
.mapping-preview-cell.mapped {
    background: #ff4d4f;
    color: #000;
    white-space: normal !important;
}
.mapping-preview-cell.selected {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
    box-shadow: inset 0 0 0 9999px rgba(37, 99, 235, .16);
}
.mapping-preview-cell strong {
    display: block;
    color: #000;
    font-weight: 900;
    line-height: 1.35;
}
.mapping-preview-cell small {
    display: block;
    margin-top: 4px;
    color: inherit;
    opacity: .78;
    overflow-wrap: anywhere;
}
@media (max-width: 900px) {
    .mapping-selection-panel {
        grid-template-columns: 1fr;
    }
    .mapping-selection-actions {
        justify-content: flex-start;
    }
}
.work-item-row {
    grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1.4fr) minmax(130px, .6fr) auto;
    align-items: start;
}
.work-item-row > .button {
    align-self: end;
    margin-bottom: 2px;
}
.contact-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(140px, .9fr) minmax(180px, 1.1fr) auto;
    gap: 12px;
    align-items: end;
    padding: 12px 0;
    border-top: 1px solid #dbe7f7;
}
.contact-row:first-of-type { border-top: 0; }

.drop-zone.compact {
    min-height: 92px;
    padding: 16px;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.button.danger {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

@media (max-width: 720px) {
    .document-file-row {
        grid-template-columns: 1fr;
    }
}

/* 日本語コメント：勤怠・案件・お知らせ追加画面の横並び入力を整えます。 */
.recipient-row,
.document-file-row {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 12px;
}
.notice-board ul {
    margin: 8px 0 0 20px;
}
.notice-item {
    border-top: 1px solid #dbe7f7;
    padding: 14px 0;
}
.notice-item h3 {
    margin: 4px 0 8px;
    color: #0f4c9a;
}
.notice-date {
    color: #64748b;
    font-size: 0.85rem;
}
@media (max-width: 760px) {
    .recipient-row,
    .document-file-row {
        grid-template-columns: 1fr;
    }
}

/* 日本語コメント：タスク・Wikiの補助表示をカード状に整えます。 */
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-weight: 800;
    font-size: 12px;
}
.badge.info { background: #e0f2fe; color: #075985; }
.badge.warning { background: #fff7ed; color: #9a3412; }
.badge.danger { background: #fff1f2; color: #991b1b; }
.meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
    background: #f8fbff;
    border: 1px solid var(--border);
}
.comment-list, .attachment-list { display: grid; gap: 10px; }
.comment-item {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fbfdff;
}
.comment-item small { display: block; margin-top: 4px; }
.comment-form label,
[data-mention-textarea] {
    position: relative;
}
.chat-composer,
.chat-drop-editor,
.detail-form label:has([data-mention-textarea]) {
    position: relative;
}
.mention-popup {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: 100%;
    display: grid;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(28, 57, 96, .14);
}
.mention-option {
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: transparent;
    padding: 8px 10px;
    text-align: left;
    color: var(--text);
    cursor: pointer;
}
.mention-option:hover { background: var(--blue-soft); color: var(--blue-dark); }
.mention-option.is-active { background: var(--blue); color: #fff; }
.wiki-body {
    min-height: 120px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
    line-height: 1.8;
}
.wiki-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 10px;
}
.toolbar-color {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}
.wiki-color-palette {
    position: absolute;
    z-index: 25;
    top: calc(100% + 6px);
    left: 0;
    width: 260px;
    display: grid;
    grid-template-columns: repeat(10, 20px);
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(28, 57, 96, .18);
}
.wiki-color-swatch {
    width: 20px;
    height: 20px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
}
.wiki-color-swatch:hover,
.wiki-color-swatch:focus {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}
.wiki-live-preview {
    margin-top: 12px;
}
.category-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f8fbff;
}
.task-search-form {
    grid-template-columns: 1.5fr .8fr .9fr auto;
}
@media (max-width: 860px) {
    .meta-grid, .task-search-form, .ledger-search-form { grid-template-columns: 1fr; }
    .work-item-row,
    .document-existing-row,
    .contact-row,
    .identity-document-upload-row { grid-template-columns: 1fr; }
}

/* 日本語コメント：領収書プレビューは画面幅に収まるよう調整します。 */
.receipt-preview{max-width:100%;max-height:420px;border:1px solid #dbe7f6;border-radius:12px;background:#fff;object-fit:contain;display:block;margin:12px 0;cursor:zoom-in;}
.page-card.soft{background:#f8fbff;border-style:dashed;}

/* 日本語コメント：PDF画像化プレビューを含む帳票画像の共通拡大モーダルです。 */
.image-preview-open{overflow:hidden;}
.image-preview-modal[hidden]{display:none;}
.image-preview-modal{position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:24px;}
.image-preview-modal__backdrop{position:absolute;inset:0;background:rgba(15,23,42,.68);backdrop-filter:blur(2px);}
.image-preview-modal__dialog{position:relative;width:min(1100px,calc(100vw - 32px));max-height:calc(100vh - 32px);display:grid;grid-template-rows:auto minmax(0,1fr);background:#fff;border:1px solid #d7e3f8;border-radius:16px;box-shadow:0 28px 90px rgba(15,23,42,.38);overflow:hidden;}
.image-preview-modal__head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border-bottom:1px solid #e5edf8;background:#f8fbff;}
.image-preview-modal__body{overflow:auto;padding:16px;display:grid;place-items:center;background:#eef4fb;}
.image-preview-modal__body img{max-width:100%;height:auto;max-height:none;border-radius:10px;background:#fff;box-shadow:0 12px 38px rgba(15,23,42,.18);}
@media (max-width: 720px){
    .image-preview-modal{padding:10px;}
    .image-preview-modal__dialog{width:calc(100vw - 20px);max-height:calc(100vh - 20px);}
    .image-preview-modal__head{align-items:flex-start;flex-direction:column;}
}

/* 日本語コメント：スタッフ身分証とチャット添付のプレビューを一覧内で見やすく整えます。 */
.embedded-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    background: #f8fbff;
}
.embedded-section h2 {
    margin-top: 0;
}
.identity-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.identity-document-upload-list {
    display: grid;
    gap: 18px;
    margin-top: 14px;
}
.identity-document-upload-row {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) 88px;
    gap: 18px;
    align-items: end;
}
.identity-document-upload-row > label {
    min-width: 0;
}
.identity-document-upload-row .drop-zone {
    width: 100%;
    min-height: 132px;
    box-sizing: border-box;
}
.identity-document-upload-row [data-remove-identity-document-row] {
    width: 88px;
    min-width: 88px;
}
.identity-add-row {
    margin-top: 16px;
}
.identity-preview-grid img,
.identity-thumb,
.chat-attachment-preview {
    max-width: 100%;
    max-height: 150px;
    border: 1px solid var(--border);
    border-radius: 10px;
    object-fit: contain;
    background: #fff;
}
.identity-thumb {
    width: 96px;
    height: 64px;
}
.preview-item small {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
}
@media (max-width: 860px) {
    .identity-document-upload-row {
        grid-template-columns: 1fr;
    }
}
.unread-badge {
    display: inline-flex;
    min-width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #d92525;
    color: #fff;
    font-weight: 800;
    font-size: 13px;
}
.sidebar-unread {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    font-size: 11px;
}
.chat-panel {
    display: grid;
    gap: 18px;
}
.chat-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 18px;
    align-items: start;
}
.chat-message-list {
    display: grid;
    gap: 14px;
    max-height: 62vh;
    overflow: auto;
    padding-right: 4px;
}
.chat-message {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}
.chat-message:hover .chat-message-toolbar,
.chat-message:focus-within .chat-message-toolbar {
    opacity: 1;
    pointer-events: auto;
}
.chat-message-toolbar {
    position: absolute;
    top: 8px;
    right: 10px;
    display: inline-flex;
    gap: 2px;
    align-items: center;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(28, 57, 96, .12);
    opacity: 0;
    pointer-events: none;
    transition: opacity .14s ease;
}
.chat-message-toolbar form {
    display: inline-flex;
    margin: 0;
}
.chat-message-toolbar button {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 26px;
    min-width: 30px;
    min-height: 26px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--blue-dark);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}
.chat-message-toolbar button:hover { background: var(--blue-soft); }
.chat-message-toolbar button.is-active { background: #dbeafe; color: var(--blue); }
.chat-message header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}
[hidden] { display: none !important; }
.chat-edit-form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}
.chat-post-form {
    border-top: 1px solid var(--border);
    padding-top: 18px;
}
.chat-composer {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 10px;
}
.chat-composer.dragover,
.chat-drop-editor.dragover {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}
.chat-drop-editor {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 10px;
    background: #fff;
}
.chat-drop-hint {
    color: var(--muted);
    font-size: 12px;
}
.chat-composer textarea {
    border: 0;
    box-shadow: none;
    resize: vertical;
    min-height: 88px;
}
.chat-composer-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}
.chat-composer-toolbar [data-file-name] {
    flex: 1;
    min-width: 160px;
    overflow-wrap: anywhere;
}
.chat-composer-preview {
    margin-top: 10px;
}
.chat-attachment-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}
.chat-attachment-card {
    display: grid;
    grid-template-columns: auto minmax(0, 120px) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    background: #f8fbff;
}
.chat-attachment-card a {
    overflow-wrap: anywhere;
}
.chat-thread {
    margin-top: 12px;
    padding-left: 16px;
    border-left: 3px solid #dbeafe;
}
.chat-thread-summary {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.chat-thread-message {
    box-shadow: none;
    margin-top: 10px;
}
.chat-thread-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}
.chat-inline-attach {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    width: fit-content;
    font-size: 13px;
}
.chat-inline-attach input { width: auto; }
.file-icon {
    width: 46px;
    height: 54px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #eef4ff;
    color: var(--blue-dark);
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
}
.file-icon-pdf { background: #fff1f2; color: #b91c1c; border-color: #fecdd3; }
.file-icon-excel { background: #ecfdf5; color: #047857; border-color: #bbf7d0; }
.file-icon-word { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.file-icon-powerpoint { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.file-icon-image { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.file-icon-archive { background: #fefce8; color: #a16207; border-color: #fde68a; }
.file-icon-text { background: #f8fafc; color: #334155; border-color: #cbd5e1; }
.attachment-name { overflow-wrap: anywhere; }
.wiki-attachment-list {
    display: grid;
    gap: 10px;
    padding-left: 0;
    list-style: none;
}
.wiki-attachment-list li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    background: #f8fbff;
}
.row-action-menu { position: relative; }
.row-action-menu[open] { z-index: 5; }
.row-action-menu > form,
.row-action-menu > .compact-form {
    display: grid;
    gap: 8px;
    min-width: 260px;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(28, 57, 96, .14);
}
.chat-side-list {
    position: sticky;
    top: 90px;
    display: grid;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    max-height: calc(100vh - 120px);
    overflow: auto;
}
.chat-side-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.chat-side-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
}
.chat-side-item small {
    grid-column: 1 / -1;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-side-item.is-active,
.chat-side-item:hover {
    border-color: #b9d7ff;
    background: #f1f7ff;
}
.chat-side-section-title {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.chat-favorite-open {
    width: 100%;
    text-align: left;
    background: transparent;
    cursor: pointer;
}
.compact-text { margin: 0; font-size: 12px; }
.chat-favorite-list {
    display: grid;
    gap: 10px;
}
.chat-favorite-card {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    text-align: left;
    color: inherit;
    cursor: pointer;
}
.chat-favorite-card:hover {
    border-color: #b9d7ff;
    background: #f8fbff;
}
.chat-favorite-card span,
.chat-favorite-body,
.chat-favorite-thread {
    overflow-wrap: anywhere;
}
.chat-favorite-dialog {
    width: min(760px, calc(100vw - 32px));
}
.dialog-close-form {
    float: right;
    margin: 0 0 8px 12px;
}
.chat-favorite-body {
    clear: both;
    display: grid;
    gap: 10px;
    max-height: 45vh;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fbff;
}
.chat-favorite-body + .action-row {
    margin-top: 16px;
}
.chat-favorite-thread {
    padding: 10px;
    border-left: 3px solid #bfdbfe;
    background: #fff;
    border-radius: 10px;
}
.chat-favorite-edit-form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}
@media (max-width: 1100px) {
    .chat-workspace {
        grid-template-columns: 1fr;
    }
    .chat-side-list {
        position: static;
        max-height: 280px;
    }
}
@media (max-width: 760px) {
    .chat-attachment-card {
        grid-template-columns: 1fr;
    }
    .wiki-attachment-list li {
        grid-template-columns: 1fr;
    }
}

/* 日本語コメント：OAuth連携の状態表示と補助フォームを整えます。 */
.info-box,
.success-box {
    border: 1px solid #b9d7ff;
    background: #f1f7ff;
    color: #173b6d;
    border-radius: 14px;
    padding: 14px 16px;
    line-height: 1.8;
}
.success-box {
    border-color: #99d6b3;
    background: #f0fff6;
    color: #14532d;
}
.hidden-form {
    display: none;
}
.plain-list {
    margin: 8px 0 16px 20px;
    line-height: 1.8;
}

/* 日本語コメント：共通の戻る導線と二度押し防止用ローディング表示です。 */
.page-back-row { display:flex; gap:10px; justify-content:flex-end; margin:0 0 24px; flex-wrap:wrap; }
.loading-overlay { position:fixed; inset:0; display:none; align-items:center; justify-content:center; background:rgba(15,23,42,.45); z-index:9999; }
.loading-overlay.active { display:flex; }
.loading-box { background:#fff; color:#0f172a; border-radius:16px; padding:22px 28px; box-shadow:0 20px 60px rgba(15,23,42,.28); font-weight:700; }
.action-row.compact { gap:6px; flex-wrap:wrap; }
.client-error-dialog {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, .28);
}
.client-error-dialog[hidden] { display: none; }
.client-error-dialog > div {
    width: min(520px, calc(100% - 32px));
    padding: 20px;
    border: 1px solid #fecdd3;
    border-radius: 16px;
    background: #fff1f2;
    color: #991b1b;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
}
.client-error-dialog p { margin: 10px 0 16px; }

/* 日本語コメント：タスク定期通知など、横並びの補助入力欄を崩れにくくします。 */
.inline-fields {
    display: flex;
    gap: 8px;
    align-items: center;
}
.inline-fields input,
.inline-fields select {
    width: auto;
    min-width: 120px;
}
.alert.warning {
    border-left: 4px solid #f59e0b;
    background: #fff7ed;
}
.approval-card form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.modal-dialog {
    width: min(560px, calc(100vw - 32px));
    border: 1px solid #d7e3f8;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}
.modal-dialog::backdrop {
    background: rgba(15, 23, 42, .38);
}
.modal-dialog h3 {
    margin-top: 0;
}
.bulk-ocr-list {
    display: grid;
    gap: 18px;
}
.bulk-ocr-item-head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}
.bulk-ocr-grid {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 18px;
    align-items: start;
}
@media (max-width: 900px) {
    .bulk-ocr-grid {
        grid-template-columns: 1fr;
    }
}

/* 日本語コメント：マスター設定のJSON編集欄はコードマスタの視認性を優先します。 */
.code-textarea {
    width: 100%;
    min-height: 480px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}
.compact-form {
    margin-top: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
}
.inline-check {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

/* 日本語コメント：突合候補のまとまりを既存カード内で見やすく表示します。 */
.sub-card {
    border: 1px solid #d8e6f7;
    border-radius: 14px;
    padding: 16px;
    margin: 16px 0;
    background: #f8fbff;
}
.badge.success {
    background: #e7f7ef;
    color: #166534;
    border-color: #bbf7d0;
}
.badge.muted {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

@media (max-width: 960px) {
    .app-sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
    .app-workspace,
    .app-shell.sidebar-collapsed .app-workspace { width: 100%; margin-left: 0; }
    .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }
    .app-shell.sidebar-collapsed .app-sidebar { width: var(--sidebar-width); }
    .app-shell.sidebar-collapsed .sidebar-brand-text,
    .app-shell.sidebar-collapsed .nav-label { opacity: 1; width: auto; }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 35;
        display: none;
        background: rgba(15, 23, 42, .34);
    }
    .app-shell.sidebar-open .sidebar-backdrop { display: block; }
    .app-topbar { grid-template-columns: auto minmax(0, 1fr); }
    .app-topbar .user-badge { grid-column: 2; justify-self: start; }
}

@media (max-width: 640px) {
    .app-main { width: min(100% - 24px, 1180px); margin-top: 18px; }
    .app-topbar { padding-inline: 12px; }
    .topbar-title { font-size: 19px; }
    .page-back-row { justify-content: flex-start; }
}

/* 日本語コメント：操作ログ詳細画面で変更前後のJSONを読みやすく表示します。 */
.audit-pre,
.audit-json {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 420px;
    overflow: auto;
    background: #f8fafc;
    border: 1px solid #dbe5f0;
    border-radius: 10px;
    padding: 12px;
    font-size: 12px;
    line-height: 1.6;
}
.audit-pre {
    max-height: 180px;
    min-width: 240px;
}


/* 日本語コメント：操作ログは監査用途の参照専用画面であることを明示します。 */
.read-only-note {
    border-left: 4px solid #2563eb;
    background: #eff6ff;
}
.read-only-note p {
    margin: 6px 0 0;
    color: #475569;
}

.todo-summary-card {
    display: grid;
    gap: 18px;
}
.todo-summary-total {
    color: var(--blue-dark);
    white-space: nowrap;
}
.todo-summary-table th,
.todo-summary-table td {
    text-align: right;
}
.todo-summary-table th:first-child,
.todo-summary-table td:first-child {
    text-align: left;
}
.todo-chart {
    display: grid;
    gap: 10px;
}
.todo-chart-row {
    display: grid;
    grid-template-columns: minmax(130px, 180px) minmax(180px, 1fr) 64px;
    gap: 12px;
    align-items: center;
}
.todo-chart-label {
    font-weight: 800;
    color: var(--text);
}
.todo-chart-track {
    position: relative;
    height: 16px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5eef9;
}
.todo-chart-bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
}
@media (max-width: 760px) {
    .todo-chart-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/* 日本語コメント：ToDoサマリは件数の有無だけでなく、期限区分と状態の割合を認識できる円グラフで表示します。 */
.todo-pie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}
.todo-pie-panel {
    border: 1px solid #dbe5f0;
    border-radius: 16px;
    padding: 16px;
    background: #ffffff;
}

.todo-pie-empty {
    min-height: 156px;
    border: 1px dashed #dbe5f0;
    border-radius: 16px;
    background: #f8fbff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 24px 16px;
}
.todo-pie-empty strong {
    font-size: 16px;
    color: var(--text);
}
.todo-pie-empty span {
    font-size: 13px;
    color: var(--muted);
}
.todo-pie-panel h3 {
    margin: 0 0 12px;
    font-size: 15px;
    color: var(--text);
}
.todo-pie-layout {
    display: grid;
    grid-template-columns: 156px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
}
.todo-pie {
    width: 156px;
    height: 156px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.todo-pie span {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: var(--text);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}
.todo-pie small {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    margin-top: -18px;
}
.todo-pie-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}
.todo-pie-legend li {
    display: grid;
    grid-template-columns: 12px minmax(92px, 1fr) auto;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.todo-pie-legend strong {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}
.todo-pie-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}
@media (max-width: 760px) {
    .todo-pie-layout {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    .todo-pie-legend {
        width: 100%;
    }
}

/* 日本語コメント：SMTP設定の保存結果とテスト送信モーダルを見やすく整えます。 */
.alert.success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}
.smtp-settings-card .section-title-row {
    margin-bottom: 16px;
}
.smtp-test-dialog .modal-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.smtp-test-dialog .modal-head-row h3 {
    margin: 0;
}
.grid-form.single-column {
    grid-template-columns: 1fr;
}
.grid-form .full-width,
.full-width {
    grid-column: 1 / -1;
}

/* 日本語コメント：情報ブロックのヘッダをクリックして開閉できる共通アコーディオンです。 */
[data-accordion-header] {
    position: relative;
    cursor: pointer;
    user-select: none;
    padding-right: 64px;
}
[data-accordion-header]:focus-visible {
    outline: 3px solid rgba(30, 90, 168, .28);
    outline-offset: 4px;
    border-radius: 12px;
}
.accordion-indicator {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--blue-dark);
    font-size: 12px;
    font-weight: 800;
}
.accordion-indicator::before { content: "閉じる"; }
[data-accordion-card].is-collapsed > :not([data-accordion-header]) { display: none !important; }
[data-accordion-card].is-collapsed > [data-accordion-header] .accordion-indicator::before { content: "開く"; }
.accordion-block {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    background: #fff;
}
.accordion-block .section-head { margin-bottom: 12px; }
.accordion-block.is-collapsed .section-head { margin-bottom: 0; }

/* 日本語コメント：見積一覧の操作列を通常のtable-cellに戻し、行罫線の位置ずれを防ぎます。 */
.estimate-list-table .estimate-actions-cell {
    vertical-align: top;
    white-space: nowrap;
}
.estimate-list-table .estimate-actions-cell .action-row.compact {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}
.estimate-list-table .estimate-actions-cell .button {
    width: 86px;
}

/* 日本語コメント：SMTPポート手動入力は、手動入力が有効な場合だけ表示します。 */
.smtp-port-manual-field input {
    min-height: 42px;
}
.smtp-port-manual-field[hidden] {
    display: none !important;
}
.smtp-port-manual-field.is-disabled input {
    background: #f8fafc;
}
.master-section-highlight {
    outline: 3px solid rgba(37, 99, 235, .24);
    outline-offset: 4px;
}
.modal-dialog.is-open {
    display: block;
}
.section-title-row[data-accordion-header] {
    padding-right: 0;
}
.section-title-row[data-accordion-header] .accordion-indicator {
    position: static;
    transform: none;
    margin-left: auto;
    flex: 0 0 auto;
}

/* 日本語コメント：削除ボタンの幅を揃え、行追加後も既存行と見た目が変わらないようにします。 */
.button.small.danger,
table .button.small.danger {
    min-width: 64px;
    justify-content: center;
}

/* 日本語コメント：複数ボタンは近い位置にまとまるよう、操作行の過剰な余白を抑えます。 */
.action-row.compact,
td.action-row.compact,
.document-history-table .action-row.compact {
    gap: 8px;
    align-items: center;
}

/* 日本語コメント：テーブル内の操作フォームはボタン群として扱い、余白で離れすぎないようにします。 */
td.action-row form,
.action-row.compact form {
    margin: 0;
}

/* 日本語コメント：SMTPパスワードの保存状態を表示し、変更時だけ入力できることを明確にします。 */
.smtp-password-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 700;
}
.smtp-password-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.smtp-password-control input[type="password"]:disabled {
    background: #f8fafc;
    color: var(--muted);
    cursor: not-allowed;
}
.smtp-password-control small {
    color: var(--muted);
    font-weight: 500;
    line-height: 1.6;
}
.badge.success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

/* 日本語コメント：初回パスワード変更・二段階認証画面をログイン画面と同じ幅で見やすくします。 */
.auth-flow-card {
    width: min(520px, 100%);
}

/* 日本語コメント：二段階認証のメール未設定など、ログイン後に確認すべき警告を目立たせます。 */
.warning-box {
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #9a3412;
    font-weight: 700;
}


/* 日本語コメント：マスタ設定のチェック項目を列単位でそろえ、ラベルと入力部品の縦崩れを防ぎます。 */
.security-settings-form {
    display: grid;
    gap: 16px;
}
.setting-row {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}
.setting-label {
    font-weight: 700;
    color: #0f2742;
}
.setting-control {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
}
.setting-control .muted {
    flex-basis: 100%;
    margin: 0;
}
.compact-number-control input[type="number"] {
    max-width: 120px;
}
.auth-remember-check {
    justify-content: flex-start;
    margin-top: 14px;
}
@media (max-width: 720px) {
    .setting-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* 日本語コメント：一括登録ボタンとテンプレートボタンを新規登録導線と同じ行にそろえます。 */
.bulk-import-actions {
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.inline-upload-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}
.visually-hidden-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.bulk-import-result h2 {
    margin-top: 0;
}
.bulk-import-result .responsive-table {
    margin-top: 12px;
}

/* 日本語コメント：顧客の部署・担当者行に担当者FAXを追加したため、列単位で部品が揃うようにします。 */
.contact-row {
    grid-template-columns: minmax(130px, .9fr) minmax(130px, .9fr) minmax(130px, .85fr) minmax(170px, 1.1fr) minmax(130px, .85fr) auto;
}

/* 日本語コメント：ユーザ別メール認証情報は認証方式ごとの入力欄を列単位で整理します。 */
.user-mail-settings .mail-auth-section {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid #dbe7f7;
    border-radius: 14px;
    background: #f8fbff;
}
.user-mail-settings .mail-auth-section[hidden] {
    display: none !important;
}
.user-mail-settings .mail-auth-section h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    color: #12335f;
}
.user-mail-settings .mail-auth-grid {
    margin: 0;
}
.user-mail-settings .mail-auth-grid label {
    min-width: 0;
}

@media (max-width: 980px) {
    .contact-row {
        grid-template-columns: 1fr;
    }
}

/* 日本語コメント：マスタ設定のチェック項目をラベル列・入力列で揃え、列ずれを防ぎます。 */
.settings-row-form {
    display: grid;
    gap: 14px;
}
.settings-row-grid {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}
.settings-row-label {
    font-weight: 700;
    color: #0f2744;
}
.settings-row-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
}
.aligned-check {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* 日本語コメント：SMTPパスワード状態表示が上段入力欄へかぶらないよう余白と行配置を固定します。 */
.smtp-password-control {
    display: grid;
    gap: 10px;
    align-content: start;
    padding-top: 8px;
}
.smtp-password-title-row,
.smtp-password-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
}
.smtp-password-state {
    margin-left: 4px;
}

/* 日本語コメント：銀行接続先登録フォームと検索ヘッダーの重なりを避けるため、フォーム下余白を確保します。 */
#master-section-bank-connections .grid-form {
    margin-bottom: 24px;
}
#master-section-bank-connections .form-actions {
    align-self: end;
    padding-top: 10px;
}

/* 日本語コメント：JSON直接編集をやめた各種マスター表は横スクロール前提で、入力列が潰れないようにします。 */
.master-wide-table {
    overflow-x: auto;
}
.master-wide-table table {
    min-width: 1320px;
}
.master-wide-table input,
.master-wide-table select,
.master-wide-table textarea {
    width: 100%;
    min-width: 120px;
}
.master-wide-table textarea {
    resize: vertical;
}

/* 日本語コメント：定期タスク設定は通常タスクの入力に影響しないよう、選択時だけまとまって表示します。 */
.recurring-task-panel {
    border: 1px solid #d9e7f7;
    border-radius: 14px;
    padding: 16px;
    background: #f8fbff;
}
.recurring-task-panel[hidden] {
    display: none !important;
}
.recurring-choice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}
.recurring-choice-grid label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #dbe7f7;
    border-radius: 999px;
    background: #fff;
}
.recurring-detail-block[hidden] {
    display: none !important;
}

@media (max-width: 720px) {
    .settings-row-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/* 日本語コメント：チャット一覧のリアルタイム検索表示を整えます。 */
.chat-list-search {
  margin: 0 0 14px;
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.chat-list-search label {
  flex: 1 1 360px;
}

.chat-list-search small {
  color: var(--muted);
  padding-bottom: 10px;
}

.chat-list-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

tr.is-chat-filter-hidden {
  display: none !important;
}

/* 日本語コメント：Windowsエクスプローラ風のデータ管理画面です。 */
.explorer-shell {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr) minmax(220px, 300px);
  gap: 16px;
  min-height: 70vh;
}
.explorer-tree,
.explorer-main,
.explorer-detail {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #d9dee7);
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}
.explorer-pane-title {
  font-weight: 700;
  margin-bottom: 10px;
}
.explorer-tree-item,
.explorer-crumb {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: inherit;
}
.explorer-tree-item:hover,
.explorer-tree-item.is-active,
.explorer-crumb:hover {
  background: rgba(69, 108, 255, 0.10);
}
.explorer-toolbar,
.explorer-address-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.explorer-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  flex: 1 1 auto;
  min-width: 220px;
}
.explorer-search {
  min-width: 220px;
}
.explorer-drop-zone {
  border: 2px dashed var(--border-color, #ccd3df);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  color: var(--muted-color, #6b7280);
  margin-bottom: 10px;
}
.explorer-drop-zone.is-dragover {
  background: rgba(69, 108, 255, 0.08);
  border-color: #456cff;
}
.explorer-status {
  min-height: 1.6em;
  color: var(--muted-color, #6b7280);
  margin-bottom: 8px;
}
.explorer-status.is-error {
  color: #b42318;
  font-weight: 700;
}
.explorer-table-wrap {
  overflow: auto;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
}
.explorer-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
.explorer-table th,
.explorer-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  vertical-align: middle;
}
.explorer-table th {
  background: #f8fafc;
  text-align: left;
  user-select: none;
}
.explorer-table th[data-explorer-sort] {
  cursor: pointer;
}
.explorer-table tr.is-selected {
  background: rgba(69, 108, 255, 0.12);
}
.explorer-name-cell {
  font-weight: 600;
}
.explorer-detail-list {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
}
.explorer-detail-list dt {
  color: var(--muted-color, #6b7280);
}
.explorer-detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.checkbox-grid.compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
@media (max-width: 1100px) {
  .explorer-shell {
    grid-template-columns: 1fr;
  }
  .explorer-tree,
  .explorer-detail {
    min-height: auto;
  }
}

/* 日本語コメント：メニューのホバー中ドロップダウンをクリックなしで操作できるようにします。 */
.sidebar-group { position: relative; }
.sidebar-group.is-hover-open > .sidebar-group-toggle { background: var(--blue-soft); color: var(--blue-dark); }
.sidebar-group.is-hover-open > .sidebar-group-toggle .sidebar-link-marker { background: var(--blue); }
.sidebar-group.is-hover-open > .sidebar-group-items { max-height: 840px; opacity: 1; }
.app-shell.sidebar-collapsed .sidebar-group-items {
  position: absolute;
  left: 100%;
  top: 0;
  z-index: 80;
  width: 260px;
  max-height: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 18px 38px rgba(22, 55, 100, .18);
  backdrop-filter: blur(12px);
  overflow: hidden;
}
.app-shell.sidebar-collapsed .sidebar-group.is-open > .sidebar-group-items,
.app-shell.sidebar-collapsed .sidebar-group.is-hover-open > .sidebar-group-items {
  max-height: min(72vh, 720px);
  opacity: 1;
  overflow-y: auto;
}
.app-shell.sidebar-collapsed .sidebar-group-items .nav-label {
  opacity: 1;
  width: auto;
  overflow: visible;
}
.app-shell.sidebar-collapsed .sidebar-group-items .sidebar-link-marker { flex: 0 0 8px; }
.app-shell.sidebar-collapsed .sidebar-group-items .unread-badge { margin-left: auto; }
@media (max-width: 960px) {
  .app-shell.sidebar-collapsed .sidebar-group-items { position: static; width: auto; box-shadow: none; border: 0; padding-left: 10px; }
}

/* 日本語コメント：データ画面をWindowsエクスプローラに近い操作感へ寄せます。 */
.explorer-shell {
  grid-template-columns: minmax(210px, 280px) minmax(0, 1fr) minmax(240px, 320px);
  align-items: stretch;
}
.explorer-tree,
.explorer-main,
.explorer-detail {
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.explorer-toolbar {
  padding: 8px;
  border: 1px solid var(--border, #d9dee7);
  border-radius: 8px;
  background: linear-gradient(#ffffff, #f8fafc);
}
.explorer-address-row {
  padding: 6px 8px;
  border: 1px solid var(--border, #d9dee7);
  border-radius: 8px;
  background: #fff;
}
.explorer-address {
  flex: 1 1 340px;
  min-width: 240px;
  border: 1px solid var(--border, #d9dee7);
  border-radius: 6px;
  padding: 8px 10px;
  background: #f9fafb;
  color: var(--text);
  font: inherit;
}
.explorer-table th,
.explorer-table td {
  padding: 7px 9px;
  white-space: nowrap;
}
.explorer-table tbody tr { cursor: default; }
.explorer-name-cell span { user-select: none; }
.explorer-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.explorer-detail-list code {
  display: block;
  max-height: 72px;
  overflow: auto;
  white-space: normal;
  word-break: break-all;
  padding: 6px;
  border-radius: 6px;
  background: #f8fafc;
  color: #1f2937;
}
.explorer-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 230px;
  padding: 6px;
  border: 1px solid var(--border, #d9dee7);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, .22);
}
.explorer-context-menu button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 7px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.explorer-context-menu button:hover { background: var(--blue-soft); color: var(--blue-dark); }
.explorer-context-menu button.danger { color: #b42318; }
.explorer-context-menu button.danger:hover { background: #fee2e2; color: #991b1b; }

/* 日本語コメント：チャットとデータのように横幅が必要な画面は中央固定幅を緩めます。 */
.app-main,
.page-content,
.main-content {
  max-width: min(1760px, calc(100vw - 56px));
  margin-left: 24px;
  margin-right: 24px;
}
.chat-layout,
.explorer-shell {
  width: 100%;
  max-width: none;
}
.chat-message.is-pending {
  opacity: .72;
}
.chat-message.is-failed {
  border-color: #fda29b;
  background: #fff7f7;
}
.chat-send-error {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  color: #b42318;
  font-weight: 700;
}
.explorer-tree-item {
  padding-left: calc(8px + var(--level, 0) * 16px);
  white-space: nowrap;
}
.explorer-separator {
  color: var(--muted-color, #6b7280);
  padding: 0 2px;
}
.explorer-context-menu button:disabled,
.explorer-toolbar button:disabled {
  opacity: .42;
  cursor: not-allowed;
  pointer-events: none;
}
.explorer-properties-body {
  max-height: 60vh;
  overflow: auto;
}

/* 日本語コメント：v89 データ画面の専用ドロップ領域を廃止し、一覧・ツリー全体で直接ドロップできるようにします。 */
.explorer-breadcrumb.is-hidden,
.explorer-drop-zone {
  display: none !important;
}
.explorer-shell.is-dragover .explorer-main,
.explorer-shell.is-dragover .explorer-tree {
  outline: 2px dashed #456cff;
  outline-offset: -4px;
  background: rgba(69, 108, 255, 0.03);
}
.explorer-table tr.is-pending {
  opacity: .72;
}
.explorer-table tr.is-failed {
  background: #fff7f7;
}
.explorer-inline-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: 10px;
  vertical-align: middle;
}
.portal-dialog .modal-card.wide {
  width: min(1100px, 94vw);
  max-width: 94vw;
}
.explorer-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}
.explorer-preview-body {
  min-height: 360px;
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--border, #d9dee7);
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}
.explorer-preview-frame {
  width: 100%;
  height: 68vh;
  border: 0;
  background: #fff;
}
.explorer-preview-image {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  margin: 0 auto;
  object-fit: contain;
}

/* 日本語コメント：v91では詳細ペインを常時表示せず、一覧を右端まで広げてプロパティはモーダルで表示します。 */
.explorer-shell {
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) !important;
  min-height: calc(100vh - 190px);
}
.explorer-detail {
  display: none !important;
}
.explorer-main {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 190px);
}
.explorer-toolbar {
  align-items: flex-start;
}
.explorer-toolbar-fields {
  margin-left: auto;
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(240px, 380px);
  gap: 8px;
  align-items: center;
  flex: 1 1 560px;
  max-width: 820px;
}
.explorer-toolbar-fields .explorer-address,
.explorer-toolbar-fields .explorer-search {
  width: 100%;
  min-width: 0;
  margin: 0;
}
.explorer-address-row {
  display: none !important;
}
.explorer-table-wrap {
  flex: 1 1 auto;
  min-height: 520px;
  height: calc(100vh - 360px);
}
.explorer-table {
  min-width: 980px;
}
.portal-dialog.explorer-preview-dialog .modal-card.wide {
  width: min(1500px, 96vw);
  max-width: 96vw;
  height: min(920px, 92vh);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.portal-dialog.explorer-preview-dialog .explorer-preview-body {
  flex: 1 1 auto;
  min-height: 620px;
  max-height: none;
  overflow: auto;
}
.portal-dialog.explorer-preview-dialog .explorer-preview-frame {
  height: 78vh;
  min-height: 620px;
}
.portal-dialog.explorer-preview-dialog .explorer-preview-image {
  max-height: 78vh;
}
.explorer-table tr.is-pending td {
  color: #64748b;
}
.explorer-table tr.is-failed td {
  color: #991b1b;
}
@media (max-width: 1180px) {
  .explorer-shell {
    grid-template-columns: 1fr !important;
  }
  .explorer-toolbar-fields {
    grid-template-columns: 1fr;
    max-width: none;
    margin-left: 0;
  }
  .explorer-table-wrap {
    height: 58vh;
  }
}


/* 日本語コメント：v92 データモーダルのボタン間隔とZIPプレビュー表示を調整します。 */
.portal-dialog .modal-card .form-actions,
.portal-dialog.explorer-preview-dialog .explorer-preview-header .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.portal-dialog.explorer-preview-dialog .explorer-preview-header .form-actions .button {
  margin-left: 0;
}
.explorer-name-cell .explorer-file-icon {
  display: inline-block;
  width: 2em;
  text-align: center;
}
.explorer-table th[data-explorer-sort]::after {
  content: " ⇅";
  color: var(--muted-color, #6b7280);
  font-size: .85em;
}


/* v93 日本語コメント：モーダル内の入力欄とボタン群の余白を共通化し、押し間違いと詰まりを防ぎます。 */
.portal-dialog .modal-card label,
.portal-dialog .modal-card input,
.portal-dialog .modal-card select,
.portal-dialog .modal-card textarea {
    margin-bottom: 10px;
}
.portal-dialog .modal-card .form-actions {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 14px !important;
    flex-wrap: wrap;
    margin-top: 18px !important;
}
.portal-dialog .modal-card .form-actions .button,
.portal-dialog .modal-card .form-actions button,
.portal-dialog .modal-card .form-actions a.button {
    margin: 0 !important;
    flex: 0 0 auto;
}

/* v93 日本語コメント：長いプレビュー名で操作ボタンが画面右へ逃げないよう、タイトル側を省略可能にします。 */
.explorer-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.explorer-preview-header h2,
.explorer-preview-header [data-explorer-preview-title] {
    min-width: 0;
    max-width: min(100%, 720px);
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}
.explorer-preview-header .form-actions {
    flex: 0 0 auto;
    white-space: nowrap;
}
@media (max-width: 720px) {
    .explorer-preview-header .form-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* v93 日本語コメント：サイドバー大区分の文字化け対策として、文字アイコンではなくCSSだけの矢印にします。 */
.sidebar-group-toggle {
    position: relative;
    min-width: 0;
    padding-right: 36px;
}
.sidebar-group-toggle::after {
    content: "" !important;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    position: absolute;
    right: 14px;
    top: 50%;
    margin-top: -6px;
    margin-left: 0;
    transition: transform .18s ease;
}
.sidebar-group.is-open .sidebar-group-toggle::after,
.sidebar-group.is-hover-open .sidebar-group-toggle::after {
    transform: rotate(225deg);
    margin-top: -2px;
}
.global-nav a,
.logout-form button,
.sidebar-group-toggle {
    min-width: 0;
}
.nav-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.unread-badge,
.sidebar-unread {
    flex: 0 0 auto;
    min-width: 24px;
    height: 22px;
    padding: 0 7px;
    margin-left: auto;
    margin-right: 2px;
    box-shadow: 0 0 0 2px #fff;
}
.sidebar-group-toggle .unread-badge {
    margin-right: 18px;
}
.global-nav {
    padding-right: 10px;
}

/* v93 日本語コメント：ホバー式プルダウンの隙間を透明ブリッジで埋め、カーソル移動中に閉じないようにします。 */
.nav-dropdown,
.dropdown,
.dropdown-menu,
.header-dropdown,
.action-dropdown,
[data-dropdown-menu] {
    margin-top: 0 !important;
}
.nav-dropdown::before,
.dropdown-menu::before,
.header-dropdown::before,
.action-dropdown::before,
[data-dropdown-menu]::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -12px;
    height: 12px;
}

/* v93 日本語コメント：一覧系テーブルの本文幅を確保し、文字が縦に落ちる状態を防ぎます。 */
.responsive-table table,
.table-wrap table,
.table-card table {
    table-layout: auto;
    min-width: 1040px;
}
.responsive-table th,
.responsive-table td,
.table-wrap th,
.table-wrap td,
.table-card th,
.table-card td {
    min-width: 96px;
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: normal;
}
.responsive-table th:nth-child(1),
.table-wrap th:nth-child(1),
.table-card th:nth-child(1),
.responsive-table td:nth-child(1),
.table-wrap td:nth-child(1),
.table-card td:nth-child(1) { min-width: 84px; }
.responsive-table th:nth-child(2),
.table-wrap th:nth-child(2),
.table-card th:nth-child(2),
.responsive-table td:nth-child(2),
.table-wrap td:nth-child(2),
.table-card td:nth-child(2),
.responsive-table th:nth-child(3),
.table-wrap th:nth-child(3),
.table-card th:nth-child(3),
.responsive-table td:nth-child(3),
.table-wrap td:nth-child(3),
.table-card td:nth-child(3) { min-width: 150px; }
.responsive-table td,
.table-wrap td,
.table-card td {
    line-height: 1.65;
}
.responsive-table .button,
.table-wrap .button,
.table-card .button {
    white-space: nowrap;
}

/* v93 日本語コメント：マスタ設定などのチェックボックス行を横崩れしない共通レイアウトへ統一します。 */
.checkbox-line,
.checkbox-grid label,
.master-setting-row label,
.settings-card label:has(input[type="checkbox"]),
.user-mail-settings label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    white-space: normal;
}
.checkbox-line input[type="checkbox"],
.checkbox-grid input[type="checkbox"],
.master-setting-row input[type="checkbox"],
.settings-card input[type="checkbox"],
.user-mail-settings input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

/* v93 日本語コメント：動的行と初期行の削除ボタンサイズを統一します。 */
.button-delete-inline,
.contact-row > .button.danger,
.work-item-row > .button.danger,
[data-project-assignee-row] > .button.danger,
[data-remove-contact],
[data-remove-project-assignee],
[data-remove-work-item],
[data-remove-identity-document-row] {
    min-width: 92px;
    width: 92px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding-inline: 12px;
}

/* v93 日本語コメント：フォーム下部の固定操作群を近い場所へまとめて表示します。 */
.form-bottom-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* v93 日本語コメント：交通費入力画面の明細フォームを読みやすくします。 */
.transportation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 760px) {
    .transportation-grid { grid-template-columns: 1fr; }
}

/* v95 日本語コメント：マスタ設定とユーザ個別設定から切替できるダーク/ライトテーマをCSS変数で統一します。 */
.theme-light {
    --blue: #1e5aa8;
    --blue-dark: #123e78;
    --blue-soft: #eaf2ff;
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #d9e2ec;
    --shadow: 0 20px 45px rgba(22, 55, 100, .12);
}
.theme-dark {
    --blue: #60a5fa;
    --blue-dark: #93c5fd;
    --blue-soft: rgba(96, 165, 250, .16);
    --bg: #111827;
    --card: #1f2937;
    --text: #f9fafb;
    --muted: #cbd5e1;
    --border: #374151;
    --shadow: 0 20px 45px rgba(0, 0, 0, .32);
}
body.theme-dark {
    background: radial-gradient(circle at top left, #1f2937 0, #111827 46%, #0b1120 100%);
    color: var(--text);
}
.theme-dark .app-sidebar,
.theme-dark .app-topbar,
.theme-dark .page-card,
.theme-dark .modal-card,
.theme-dark .chat-message,
.theme-dark .chat-composer,
.theme-dark .explorer-shell,
.theme-dark .explorer-main,
.theme-dark .explorer-tree,
.theme-dark .explorer-context-menu,
.theme-dark .data-bulk-progress-panel,
.theme-dark .profile-avatar-card,
.theme-dark .table-card,
.theme-dark .card,
.theme-dark .alert,
.theme-dark .sidebar-group-items {
    background: rgba(31, 41, 55, .96);
    color: var(--text);
    border-color: var(--border);
}
.theme-dark input,
.theme-dark select,
.theme-dark textarea,
.theme-dark .explorer-address,
.theme-dark .explorer-search {
    background: #111827;
    color: var(--text);
    border-color: var(--border);
}
.theme-dark input::placeholder,
.theme-dark textarea::placeholder { color: #94a3b8; }
.theme-dark .muted,
.theme-dark small,
.theme-dark .brand-subtitle { color: var(--muted); }
.theme-dark .global-nav a.is-active,
.theme-dark .sidebar-link.is-active,
.theme-dark .sidebar-group-toggle:hover,
.theme-dark .global-nav a:hover,
.theme-dark .logout-form button:hover {
    background: rgba(96, 165, 250, .18);
    color: #dbeafe;
}
.theme-dark .responsive-table table,
.theme-dark .table-wrap table,
.theme-dark .table-card table,
.theme-dark .explorer-table {
    background: #111827;
    color: var(--text);
}
.theme-dark th {
    background: #1d4ed8;
    color: #fff;
}
.theme-dark td,
.theme-dark tr,
.theme-dark .explorer-table td {
    border-color: var(--border);
}
.theme-dark .button:not(.primary):not(.danger) {
    background: #111827;
    color: var(--text);
    border-color: var(--border);
}
.theme-dark .chat-message-toolbar {
    background: #111827;
    border-color: var(--border);
}
.theme-dark .chat-message-toolbar button { color: var(--text); }
.theme-dark .client-error-dialog > div { background: var(--card); color: var(--text); }

/* v95 日本語コメント：チャットをSlack風の日付区切り・ユーザアバター付きレイアウトへ整えます。 */
.chat-message-list {
    gap: 4px;
    padding: 8px 8px 14px;
}
.chat-date-divider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 18px 0 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.chat-date-divider::before,
.chat-date-divider::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--border);
}
.chat-date-divider span {
    flex: 0 0 auto;
    max-width: min(260px, 70vw);
    margin: 0 12px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
}
.chat-message {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    border: 0;
    border-radius: 8px;
    padding: 8px 10px;
    background: transparent;
}
.chat-message:hover,
.chat-message:focus-within {
    background: var(--blue-soft);
}
.chat-avatar,
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--blue-soft);
    flex: 0 0 auto;
}
.user-avatar.large,
.profile-avatar-current .user-avatar {
    width: 96px;
    height: 96px;
    border-radius: 22px;
}
.chat-message-main {
    min-width: 0;
}
.chat-message header {
    justify-content: flex-start;
    gap: 8px;
    align-items: baseline;
    min-width: 0;
}
.chat-message header strong {
    overflow-wrap: anywhere;
}
.chat-message header .muted {
    white-space: nowrap;
    font-size: 12px;
}
.chat-message-body,
.chat-message-main p {
    overflow-wrap: anywhere;
}

/* v95 日本語コメント：データ全DL/全UPの非同期進捗を画面下部で確認できるようにします。 */
.data-bulk-transfer-card {
    margin-bottom: 16px;
}
.data-bulk-action-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.data-bulk-progress-panel {
    position: sticky;
    bottom: 12px;
    z-index: 25;
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow);
}
.data-bulk-progress-panel.is-empty {
    box-shadow: none;
    opacity: .76;
}
.data-bulk-job {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
}
.data-bulk-job + .data-bulk-job { margin-top: 8px; }
.data-bulk-job.is-failed { border-color: #ef4444; }
.data-bulk-job-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.data-bulk-progress {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--border);
}
.data-bulk-progress span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--blue);
    transition: width .2s ease;
}
.data-bulk-job-meta,
.data-bulk-job-message {
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

/* v95 日本語コメント：トップバーにプロフィール・テーマ切替を追加しても崩れないようにします。 */
.topbar-user-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.theme-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.theme-switcher select {
    min-width: 112px;
    height: 34px;
    padding: 4px 10px;
}
.user-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.profile-avatar-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
}
@media (max-width: 760px) {
    .chat-message { grid-template-columns: 34px minmax(0, 1fr); }
    .chat-avatar { width: 30px; height: 30px; border-radius: 8px; }
    .topbar-user-actions { width: 100%; justify-content: flex-start; }
}


/* v96 日本語コメント：データ画面のダークテーマを操作バー・入力・一覧・進捗まで統一します。 */
.theme-dark .data-bulk-transfer-card,
.theme-dark .explorer-toolbar,
.theme-dark .explorer-table-wrap,
.theme-dark .explorer-preview-body,
.theme-dark .data-bulk-job,
.theme-dark .data-history-row,
.theme-dark .data-bulk-detail-body,
.theme-dark .data-history-body,
.theme-dark .data-version-body {
    background: #111827;
    color: var(--text);
    border-color: var(--border);
}
.theme-dark .explorer-toolbar { border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.theme-dark .data-bulk-progress-panel { background: rgba(17, 24, 39, .97); color: var(--text); }
.theme-dark .explorer-table tbody tr:hover,
.theme-dark .explorer-table tbody tr.is-selected,
.theme-dark .explorer-tree-item.is-active { background: rgba(96, 165, 250, .20); color: #dbeafe; }
.theme-dark .button:disabled { background: #374151 !important; color: #cbd5e1 !important; opacity: .75; }
.data-bulk-job-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.data-bulk-job.is-stalled { border-color: #f59e0b; }
.data-bulk-detail-dialog.is-maximized .modal-card,
.data-history-dialog.is-maximized .modal-card,
.data-version-dialog.is-maximized .modal-card { width: min(96vw, 1600px); height: min(92vh, 1000px); }
.data-bulk-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 12px; }
.data-bulk-detail-grid > div { border: 1px solid var(--border); border-radius: 10px; padding: 8px; display: grid; gap: 4px; }
.data-bulk-detail-log { width: 100%; min-height: 260px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.data-history-filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0 14px; }
.data-history-filter-row input { min-width: min(520px, 100%); }
.data-history-list { display: grid; gap: 8px; max-height: 58vh; overflow: auto; padding-right: 4px; }
.data-history-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--card); }
.data-history-row strong,
.data-history-row span,
.data-history-row small { display: block; overflow-wrap: anywhere; }
.data-history-row small { color: var(--muted); }
@media (max-width: 720px) { .data-history-row { grid-template-columns: 1fr; } }

/* v97 日本語コメント：プライベートチャット/DMの種別表示と一覧タブを追加します。 */
.chat-list-header-row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.chat-list-tabs {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.chat-type-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.3;
    white-space: nowrap;
    vertical-align: middle;
}
.chat-type-private {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fed7aa;
}
.chat-type-direct {
    background: #f5f3ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}
.chat-type-group {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}
.chat-heading .chat-type-badge {
    margin-left: 8px;
    transform: translateY(-2px);
}
.theme-dark .chat-type-badge {
    border-color: rgba(148, 163, 184, .38);
    background: rgba(96, 165, 250, .16);
    color: #bfdbfe;
}
.theme-dark .chat-type-private {
    background: rgba(251, 146, 60, .16);
    color: #fed7aa;
}
.theme-dark .chat-type-direct {
    background: rgba(167, 139, 250, .18);
    color: #ddd6fe;
}
.theme-dark .chat-list-tabs .button.primary {
    background: #2563eb;
    color: #fff;
}

/* v98 日本語コメント：ブランド名変更と猫ロゴ差し替えに合わせた共通表示です。 */
.brand-mark.brand-mark-image {
    padding: 0;
    overflow: hidden;
    background: transparent;
    border-color: rgba(96, 165, 250, .55);
}
.brand-mark.brand-mark-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* v98 日本語コメント：全UP確認モーダルの白い余白を消し、他モーダルと同じテーマ背景へ統一します。 */
.portal-dialog.data-bulk-confirm-dialog,
.theme-dark .portal-dialog.data-bulk-confirm-dialog {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.portal-dialog.data-bulk-confirm-dialog::backdrop {
    background: rgba(2, 6, 23, .72);
    backdrop-filter: blur(2px);
}
.portal-dialog.data-bulk-confirm-dialog .modal-card {
    margin: 0;
    width: min(94vw, 520px);
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.theme-dark .portal-dialog .modal-card {
    background: #111827;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, .28);
}
.theme-dark .portal-dialog .modal-card input,
.theme-dark .portal-dialog .modal-card select,
.theme-dark .portal-dialog .modal-card textarea {
    background: #0f172a;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, .35);
}

/* v98 日本語コメント：データ画面の操作ボタン色をダークテーマへ統一し、新規フォルダだけ青く浮かないようにします。 */
.theme-dark .explorer-toolbar .button,
.theme-dark .data-bulk-transfer-card .button,
.theme-dark .data-bulk-job .button,
.theme-dark .data-bulk-detail-dialog .button {
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, .35);
}
.theme-dark .explorer-toolbar .button:hover,
.theme-dark .data-bulk-transfer-card .button:hover,
.theme-dark .data-bulk-job .button:hover,
.theme-dark .data-bulk-detail-dialog .button:hover {
    background: #1f2937;
}
.theme-dark .explorer-toolbar .button.primary,
.theme-dark .data-bulk-transfer-card .button.primary {
    background: #1f2937;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, .45);
}
.theme-dark .data-bulk-transfer-card .button.is-emphasis,
.theme-dark .data-bulk-job .button.is-emphasis {
    background: #2563eb;
    border-color: #60a5fa;
}
.theme-dark .button.danger,
.theme-dark .data-bulk-job .button.danger {
    background: #dc2626;
    border-color: #ef4444;
    color: #fff;
}

/* v98 日本語コメント：バックグラウンド処理カードは1ジョブ1カードで最後まで見えるよう視認性を強化します。 */
.data-bulk-job-head span {
    white-space: nowrap;
}
.data-bulk-job-current-path {
    color: var(--text);
    font-weight: 700;
    overflow-wrap: anywhere;
}
.data-bulk-job.is-running,
.data-bulk-job.is-receiving,
.data-bulk-job.is-uploaded {
    border-color: rgba(96, 165, 250, .5);
}
.data-bulk-detail-log {
    background: #0b1220;
    color: #dbeafe;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 12px;
    padding: 12px;
    line-height: 1.5;
}

/* v99 日本語コメント：全UP確認モーダルを詳細モーダルと同じ白枠つきカードに戻します。 */
.portal-dialog.data-bulk-confirm-dialog .modal-card {
    border: 2px solid rgba(248, 250, 252, .82);
    box-shadow: 0 26px 80px rgba(2, 6, 23, .52), 0 0 0 1px rgba(15, 23, 42, .55) inset;
    padding: 24px 28px;
}
.theme-dark .portal-dialog.data-bulk-confirm-dialog .modal-card {
    background: #111827;
    border-color: rgba(248, 250, 252, .86);
}
.portal-dialog.data-bulk-confirm-dialog .form-actions {
    justify-content: flex-end;
    gap: 14px;
    margin-top: 18px;
}

/* v99 日本語コメント：バックグラウンド詳細の長いジョブIDを折り返し、コピーしやすい視認性を保ちます。 */
.data-bulk-detail-grid > div {
    min-width: 0;
}
.data-bulk-detail-grid span,
.data-bulk-detail-id {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* v99 日本語コメント：最大化時は詳細モーダル全体を使い、ログ欄を広く表示します。 */
.portal-dialog.data-bulk-detail-dialog.is-maximized {
    width: min(98vw, 1600px);
    height: 94vh;
    max-width: 98vw;
    max-height: 94vh;
}
.portal-dialog.data-bulk-detail-dialog.is-maximized .modal-card {
    width: 100%;
    height: 100%;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
}
.portal-dialog.data-bulk-detail-dialog.is-maximized .data-bulk-detail-body {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.portal-dialog.data-bulk-detail-dialog.is-maximized .data-bulk-detail-grid {
    flex: 0 0 auto;
}
.portal-dialog.data-bulk-detail-dialog.is-maximized .data-bulk-detail-log {
    flex: 1;
    min-height: 48vh;
    height: auto;
}
.data-bulk-detail-log {
    min-height: 260px;
    resize: vertical;
    white-space: pre;
}

/* v99 日本語コメント：進捗カードの現在処理中パスは解凍中でも変化が分かるように余白を確保します。 */
.data-bulk-job-current-path {
    min-height: 1.4em;
}

/* v99 日本語コメント：猫ロゴクリック時のなごみ用パンチアニメーションです。 */
.brand-cat-button {
    border: 0;
    cursor: pointer;
    transform-origin: 50% 70%;
    position: relative;
}
.brand-cat-button::after {
    content: "🐾";
    position: absolute;
    right: -8px;
    top: 4px;
    font-size: 22px;
    opacity: 0;
    transform: translate(-8px, 8px) scale(.5) rotate(-18deg);
    pointer-events: none;
}
.brand-cat-button.is-cat-punching {
    animation: cat-logo-punch .78s ease-in-out both;
}
.brand-cat-button.is-cat-punching::after {
    animation: cat-paw-pop .78s ease-out both;
}
@keyframes cat-logo-punch {
    0% { transform: translateX(0) rotate(0deg) scale(1); }
    20% { transform: translateX(-3px) rotate(-5deg) scale(1.03); }
    42% { transform: translateX(10px) rotate(7deg) scale(1.08); }
    62% { transform: translateX(-2px) rotate(-3deg) scale(1.02); }
    100% { transform: translateX(0) rotate(0deg) scale(1); }
}
@keyframes cat-paw-pop {
    0% { opacity: 0; transform: translate(-10px, 10px) scale(.4) rotate(-24deg); }
    35% { opacity: 1; transform: translate(16px, -10px) scale(1.28) rotate(12deg); }
    70% { opacity: .9; transform: translate(10px, -4px) scale(1.0) rotate(2deg); }
    100% { opacity: 0; transform: translate(4px, 2px) scale(.7) rotate(0deg); }
}

/* v102 日本語コメント：データ一覧の大量読み込み時は、仮パスや途中状態が見えないよう画面全体で読み込み状態を示します。 */
[data-explorer] {
    position: relative;
}
.data-list-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 25;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .34);
    backdrop-filter: blur(2px);
    border-radius: 18px;
}
[data-explorer].is-list-loading .data-list-loading-overlay {
    display: flex;
}
.data-list-loading-card {
    width: min(420px, calc(100% - 32px));
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 22px 48px rgba(15, 23, 42, .22);
    padding: 24px;
    display: grid;
    gap: 8px;
    place-items: center;
    text-align: center;
}
.data-list-loading-card .spinner {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 3px solid rgba(37, 99, 235, .18);
    border-top-color: currentColor;
    animation: portal-spin .9s linear infinite;
}
.theme-dark .data-list-loading-overlay {
    background: rgba(2, 6, 23, .52);
}
.theme-dark .data-list-loading-card {
    color: #e5edf7;
    background: rgba(15, 23, 42, .96);
    border-color: rgba(148, 163, 184, .24);
}
@keyframes portal-spin { to { transform: rotate(360deg); } }

/* v102 日本語コメント：チャット新規作成・お気に入り等の共通部品をダークテーマへ統一します。 */
.theme-dark .embedded-section,
.theme-dark .recipient-row,
.theme-dark .chat-side-list,
.theme-dark .chat-side-item,
.theme-dark .chat-favorite-card,
.theme-dark .chat-favorite-open,
.theme-dark .chat-favorite-dialog,
.theme-dark .chat-favorite-body,
.theme-dark .chat-favorite-body + .action-row,
.theme-dark .opportunity-contact-log-row {
    background: rgba(15, 23, 42, .72);
    border-color: rgba(148, 163, 184, .22);
    color: #e5edf7;
}
.theme-dark .embedded-section .muted,
.theme-dark .chat-side-item small,
.theme-dark .chat-favorite-card small {
    color: #93a4b8;
}
.theme-dark .chat-side-item:hover,
.theme-dark .chat-favorite-card:hover {
    background: rgba(30, 41, 59, .9);
}
.theme-dark .embedded-section input,
.theme-dark .embedded-section select,
.theme-dark .embedded-section textarea,
.theme-dark .opportunity-contact-log-row input,
.theme-dark .opportunity-contact-log-row textarea {
    background: rgba(2, 6, 23, .7);
    color: #e5edf7;
    border-color: rgba(148, 163, 184, .28);
}

/* v102 日本語コメント：商談履歴の複数行入力を既存フォーム幅に合わせて整えます。 */
.opportunity-contact-log-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 14px;
    margin-bottom: 12px;
}
.opportunity-contact-log-row .wide-field {
    grid-column: span 3;
}
@media (max-width: 900px) {
    .opportunity-contact-log-row { grid-template-columns: 1fr; }
    .opportunity-contact-log-row .wide-field { grid-column: auto; }
}


/* 日本語コメント：ダークテーマで共通入力補助ブロック・検索結果・フォーカス状態が白く戻る問題を画面横断で補正します。 */
.theme-dark .embedded-section,
.theme-dark .recipient-row,
.theme-dark .dynamic-row,
.theme-dark .repeatable-row,
.theme-dark .assignee-picker,
.theme-dark .worklog-row,
.theme-dark .form-sub-panel,
.theme-dark .inline-editor-panel,
.theme-dark .nested-form-panel,
.theme-dark .file-list,
.theme-dark .contact-row,
.theme-dark .modal-body,
.theme-dark .search-result-panel,
.theme-dark .responsive-table,
.theme-dark .table-card,
.theme-dark .page-card {
    background-color: #1f2937;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, .26);
}
.theme-dark .responsive-table table,
.theme-dark .responsive-table tbody,
.theme-dark .responsive-table tr,
.theme-dark .responsive-table td,
.theme-dark .table-card table,
.theme-dark .table-card tbody,
.theme-dark .table-card tr,
.theme-dark .table-card td {
    background-color: #0f172a;
    color: #f8fafc;
}
.theme-dark .responsive-table:focus,
.theme-dark .responsive-table:focus-within,
.theme-dark .table-card:focus,
.theme-dark .table-card:focus-within,
.theme-dark .page-card:focus,
.theme-dark .page-card:focus-within,
.theme-dark .file-list:focus-within,
.theme-dark .contact-row:focus-within,
.theme-dark .embedded-section:focus-within,
.theme-dark .recipient-row:focus-within,
.theme-dark .dynamic-row:focus-within,
.theme-dark .repeatable-row:focus-within {
    background-color: #1f2937;
    color: #f8fafc;
    border-color: rgba(96, 165, 250, .65);
}
.theme-dark .responsive-table tbody tr:hover,
.theme-dark .table-card tbody tr:hover {
    background-color: #172033;
}
.theme-dark .responsive-table tbody tr:hover td,
.theme-dark .table-card tbody tr:hover td {
    background-color: #172033;
}
.theme-dark .empty,
.theme-dark .muted,
.theme-dark .hint,
.theme-dark small {
    color: #cbd5e1;
}
.remember-email-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}
.remember-email-row input {
    width: auto;
}
.cat-cheer-overlay {
    position: fixed;
    inset: auto 28px 28px auto;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 24px;
    background: rgba(15, 23, 42, .92);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .16);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    opacity: 0;
    transform: translateY(18px) scale(.96);
    pointer-events: none;
    animation: catCheerFloat 3.8s ease forwards;
}
.cat-cheer-face {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    font-size: 42px;
    background: linear-gradient(135deg, #fef3c7, #f9a8d4);
    animation: catCheerBounce .9s ease-in-out infinite alternate;
}
.cat-cheer-message {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: .05em;
}
@keyframes catCheerFloat {
    0% { opacity: 0; transform: translateY(18px) scale(.96); }
    15%, 82% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-12px) scale(.98); }
}
@keyframes catCheerBounce {
    from { transform: rotate(-5deg) translateY(0); }
    to { transform: rotate(5deg) translateY(-4px); }
}
.contract-public-card {
    max-width: 880px;
}
.contract-document-preview {
    margin: 20px 0;
    padding: 16px;
    border-radius: 16px;
    background: #f8fbff;
    border: 1px solid #dbe5f0;
}
.contract-stamp {
    width: 140px;
    height: 140px;
    margin: 24px auto;
    border: 5px double #dc2626;
    border-radius: 50%;
    color: #dc2626;
    display: grid;
    place-items: center;
    font-size: 28px;
    font-weight: 900;
    text-align: center;
    background: rgba(254, 242, 242, .88);
}

/* 日本語コメント：契約書テンプレートと契約書発行の予約語・プレビューUIを共通のカード表現に整えます。 */
.contract-token-panel {
    display: grid;
    gap: 14px;
}
.contract-token-row,
.contract-token-value-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) auto minmax(160px, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
}
.contract-token-value-row {
    grid-template-columns: minmax(260px, 1fr);
    align-items: stretch;
}
.contract-token-value-row label {
    margin: 0;
}
.contract-preview-box {
    min-height: 220px;
    max-height: 520px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f8fbff;
    color: var(--text);
    line-height: 1.8;
}
.theme-dark .contract-token-row,
.theme-dark .contract-token-value-row,
.theme-dark .contract-preview-box {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.34);
    color: #e5f0ff;
}
.theme-dark .contract-token-row:focus-within,
.theme-dark .contract-token-value-row:focus-within,
.theme-dark .contract-preview-box:focus,
.theme-dark .responsive-table:focus,
.theme-dark .responsive-table:focus-within,
.theme-dark .table-card:focus-within {
    background: #0f172a;
    color: #e5f0ff;
}
@media (max-width: 980px) {
    .contract-token-row {
        grid-template-columns: 1fr;
    }
}


/* v106 日本語コメント：部分Ajax遷移中は左メニューを維持し、右側だけに読み込み状態を重ねます。 */
.partial-navigation-loading {
    position: fixed;
    top: var(--topbar-height, 72px);
    right: 0;
    bottom: 0;
    left: var(--sidebar-width, 286px);
    z-index: 8000;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .14s ease, visibility .14s ease;
    pointer-events: none;
}
.app-shell.sidebar-collapsed ~ .partial-navigation-loading,
.app-shell.sidebar-collapsed .partial-navigation-loading { left: 78px; }
.partial-navigation-loading.is-visible { opacity: 1; visibility: visible; pointer-events: auto; }
.partial-navigation-loading-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 16px;
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, .34);
    box-shadow: 0 20px 58px rgba(0, 0, 0, .32);
}
.partial-navigation-spinner {
    width: 22px; height: 22px; border-radius: 50%;
    border: 3px solid rgba(147, 197, 253, .28); border-top-color: #60a5fa;
    animation: partialNavigationSpin .7s linear infinite;
}
@keyframes partialNavigationSpin { to { transform: rotate(360deg); } }
@media (max-width: 960px) { .partial-navigation-loading { left: 0; } }

/* v106 日本語コメント：ダークテーマの入力・検索・選択状態は白へ戻さず、共通カラートークンで統一します。 */
.theme-dark input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.theme-dark textarea,
.theme-dark select,
.theme-dark [contenteditable="true"],
.theme-dark .search-result-panel,
.theme-dark .suggestion-list,
.theme-dark .autocomplete-results,
.theme-dark .dropdown-panel {
    background-color: #0f172a;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, .34);
}
.theme-dark input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.theme-dark textarea:focus,
.theme-dark select:focus,
.theme-dark [contenteditable="true"]:focus,
.theme-dark .search-result-panel:focus-within,
.theme-dark .suggestion-list:focus-within,
.theme-dark .autocomplete-results:focus-within,
.theme-dark .dropdown-panel:focus-within {
    background-color: #0b1220;
    color: #ffffff;
    border-color: #60a5fa;
    outline-color: rgba(96, 165, 250, .32);
}
.theme-dark option { background: #0f172a; color: #f8fafc; }
.theme-dark ::placeholder { color: #93a4bb; opacity: 1; }
/* 日本語コメント：PDF・画像・帳票など原本確認用の紙面は、ダークテーマでも白背景を維持します。 */
.theme-dark .tax-mapping-page,
.theme-dark .tax-html-page,
.theme-dark .receipt-preview,
.theme-dark .image-preview-modal__body img,
.theme-dark .office-sheet,
.theme-dark .contract-public-card .contract-document-preview,
.theme-dark [data-document-preview-surface] {
    background: #ffffff !important;
    color: #0f172a !important;
}
.cat-cheer-visual {
    width: 108px; height: 88px; overflow: hidden; border-radius: 24px;
    background: linear-gradient(145deg, #fff7ed, #ffedd5);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
    animation: catCheerBounce .9s ease-in-out infinite alternate;
}
.cat-cheer-visual img { width: 100%; height: 100%; object-fit: cover; object-position: center 70%; display: block; }
.cat-cheer-message { display: grid; gap: 3px; }
.cat-cheer-message strong { font-size: 20px; }
.cat-cheer-message span { font-size: 12px; color: #cbd5e1; }

.hash-value { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* v108 日本語コメント：タスクを含む共通ファイル添付欄がダークモードで白く反転しないよう、背景・文字・ドラッグ状態を統一します。 */
.theme-dark .drop-zone {
    background: linear-gradient(180deg, #1e293b 0%, #111827 100%);
    border-color: #60a5fa;
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .08);
}
.theme-dark .drop-zone .drop-title {
    color: #93c5fd;
}
.theme-dark .drop-zone .drop-subtitle,
.theme-dark .drop-zone .drop-filename,
.theme-dark .drop-zone small {
    color: #cbd5e1;
}
.theme-dark .drop-zone.is-dragover,
.theme-dark .drop-zone.dragover {
    background: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
    border-color: #bfdbfe;
    color: #fff;
}
.theme-dark .drop-zone.required-missing-wrap {
    background: rgba(127, 29, 29, .34);
    border-color: #f87171;
}

/* v108 日本語コメント：添付・コメント・メタ情報の共通カードもダークテーマの配色へ揃えます。 */
.theme-dark .file-list,
.theme-dark .existing-documents,
.theme-dark .comment-item,
.theme-dark .meta-grid,
.theme-dark .chat-attachment-card {
    background: #111827;
    color: var(--text);
    border-color: var(--border);
}

/* v108 日本語コメント：チャットのホバー操作に添付アイコンを追加しても窮屈にならないよう、間隔と操作領域を整えます。 */
.chat-message-toolbar {
    gap: 4px;
    padding: 5px 6px;
    z-index: 3;
    max-width: calc(100% - 20px);
    overflow: visible;
}
.chat-message-toolbar button {
    width: 32px;
    height: 28px;
    min-width: 32px;
    min-height: 28px;
    font-size: 14px;
}
.chat-message-toolbar button[data-chat-attachment-toggle] {
    font-size: 15px;
}
.chat-attachment-card.chat-attachment-card-compact {
    grid-template-columns: auto minmax(0, 1fr);
}
.chat-inline-attachment-icon {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-size: 14px;
}

/* v108 日本語コメント：共通操作ボタン内のフォーム余白を除去し、折り返し時もボタン間隔が不均一にならないようにします。 */
.action-row,
.bulk-actions,
.table-actions,
.form-bottom-actions,
.chat-composer-toolbar {
    row-gap: 10px;
}
.action-row > form,
.bulk-actions > form,
.table-actions > form,
.form-bottom-actions > form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

@media (max-width: 640px) {
    .chat-message-toolbar {
        top: 6px;
        right: 6px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .chat-message-toolbar::-webkit-scrollbar { display: none; }
    .drop-zone.compact {
        min-height: 110px;
        padding: 18px 14px;
    }
}
