/* BIKO 生産管理システムの共通色・余白 */
:root {
    --color-primary: #2C5F8A;
    --color-primary-hover: #244e72;
    --color-primary-active: #1d3f5c;
    --color-primary-soft: #eef4fa;
    --color-sidebar: #305287;
    --color-text: #2b323c;
    --color-text-strong: #222b38;
    --color-text-muted: #5b6472;
    --color-text-faint: #8a929c;
    --color-border: #e3e6ea;
    --color-border-input: #d5d9df;
    --color-bg: #f3f4f6;
    --color-surface: #ffffff;
    --color-surface-alt: #f7f8fa;
    --color-danger: #c0392b;
    --color-danger-hover: #a93226;
    --color-danger-soft: #fdf1f1;
    /* 要調整（チェックシートのNG）は削除・危険操作とは別系統の赤 */
    --color-adjustment: #9e2b2b;
    --color-adjustment-hover: #852323;
    --color-adjustment-soft: #fdf6f6;
    --color-adjustment-border: #e3bcbc;
    --radius: 7px;
    --radius-lg: 10px;
    --focus-ring: 0 0 0 3px rgba(44, 95, 138, .12);
    --shadow-card: 0 6px 16px rgba(20, 31, 45, .06);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    color: #2b323c;
    background: #f3f4f6;
    font-family: 'Noto Sans JP', sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    flex: 0 0 240px;
    width: 240px;
    min-height: 100vh;
    color: #dbe3f2;
    background: #305287;
    border-right: 1px solid #264367;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
}

.brand {
    height: 60px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .14);
    display: flex;
    align-items: center;
}

.brand-logo {
    width: auto;
    height: 20px;
}

.nav {
    flex: 1;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-link {
    padding: 8px 12px;
    color: #dbe3f2;
    border-radius: 7px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .10);
}

.nav-link.primary {
    padding: 9px 12px;
    color: #e7ecf6;
    font-size: 13.5px;
}

.nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .16);
    border-left: 3px solid #fff;
    font-weight: 700;
}

/* マスター配下は親メニューより10px深くする。選択中は左borderの3px分を差し引き、文字開始位置を通常時と揃える */
.nav-link.master {
    padding: 8px 12px 8px 22px;
}

.nav-link.master.active {
    padding-left: 19px;
}

.nav-dot {
    width: 7px;
    height: 7px;
    background: #a9b6d4;
    border-radius: 2px;
}

.nav-link.active .nav-dot {
    background: #fff;
}

.nav-section {
    margin-top: 16px;
    padding: 8px 12px 6px;
    color: #c4cee2;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.shell {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.header {
    height: 60px;
    flex: 0 0 60px;
    padding: 0 28px;
    background: #fff;
    border-bottom: 1px solid #e3e6ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
}

.header-title-wrap {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-title {
    color: #2b323c;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .01em;
}

.mobile-menu-toggle,
.sidebar-overlay {
    display: none;
}

.mobile-menu-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    color: #5b6472;
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    flex: 0 0 auto;
}

.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

.header-user {
    color: #3b434f;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13.5px;
}

.account-menu { position: relative; }
.account-menu-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 13px;
    border: 1px solid #d5d9df;
    border-radius: 7px;
    background: #fff;
    color: #3b434f;
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
}
.account-menu-toggle:hover,
.account-menu.is-open .account-menu-toggle { background: #f5f6f8; border-color: #c4c9d1; }
.account-mobile-label { display: none; }
.account-menu-caret { color: #8a919c; font-size: 8px; line-height: 1; transition: transform .15s; }
.account-menu.is-open .account-menu-caret { transform: rotate(180deg); }
.account-menu-panel {
    position: absolute;
    z-index: 510;
    top: 46px;
    right: 0;
    width: 220px;
    padding: 6px;
    border: 1px solid #e0e4e9;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(24, 32, 44, .16);
}
.account-menu-profile { display: flex; flex-direction: column; gap: 3px; margin-bottom: 5px; padding: 10px 10px 9px; border-bottom: 1px solid #eef0f3; }
.account-menu-profile strong { color: #222b38; font-size: 12.5px; }
.account-menu-profile span { color: #8a919c; font-size: 11px; }
.account-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #3b434f;
    font: inherit;
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
}
.account-menu-item:hover { background: #f3f5f8; }
.account-menu-item i { width: 6px; height: 6px; border-radius: 2px; background: #9aa4b2; }
.account-menu-separator { height: 1px; margin: 5px 4px; background: #eef0f3; }
.account-menu-logout { color: #a8434a; }
.account-menu-logout:hover { background: #fbf1f2; }
.account-menu-logout i { background: #d29a9e; }

.divider {
    width: 1px;
    height: 22px;
    background: #e3e6ea;
}

.logout {
    padding: 7px 14px;
    color: #5b6472;
    background: #fff;
    border: 1px solid #d5d9df;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
}

.logout:hover {
    background: #f5f6f8;
    border-color: #c4c9d1;
}

.password-dialog { width: min(420px, 100%); }
.password-dialog-body { display: flex; flex-direction: column; gap: 15px; padding: 20px 24px 4px; }
.password-field { display: flex; flex-direction: column; gap: 7px; }
.password-field label { color: #5b6472; font-size: 12px; font-weight: 600; }
.password-field label span { color: #c0392b; }
.password-field .control { height: 42px; }
.password-field .field-error { padding-left: 2px; color: #c0392b; font-size: 12px; }

.biko-loading {
    position: fixed;
    inset: 0;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(43, 50, 60, 0.35);
    animation: biko-loading-fade-in 0.15s ease-out;
}

.biko-loading[hidden] {
    display: none;
}

.biko-loading-spinner {
    width: 64px;
    height: 64px;
    border: 6px solid #dbe3ee;
    border-top-color: #2c5f8a;
    border-radius: 50%;
    animation: biko-loading-spin 0.8s cubic-bezier(0.6, 0.15, 0.4, 0.85) infinite;
}

@keyframes biko-loading-spin {
    to { transform: rotate(360deg); }
}

@keyframes biko-loading-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.main {
    flex: 1;
    min-width: 0;
    padding: 26px 28px 40px;
}

.page-title {
    margin: 0 0 18px;
    color: #222b38;
    font-size: 21px;
    font-weight: 700;
}

.breadcrumb-row {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.breadcrumb {
    color: #8a929c;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
}

.breadcrumb a {
    color: #2C5F8A;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #b8bec7;
}

.back-link {
    height: 36px;
    padding: 0 16px;
    color: #5b6472;
    background: #fff;
    border: 1px solid #d5d9df;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.back-link:hover {
    background: #f5f6f8;
    border-color: #c4c9d1;
}

.panel {
    margin-bottom: 18px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 10px;
}

.section-card {
    margin-bottom: 22px;
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 10px;
    overflow: hidden;
}

/* カード内の見出し帯。案件詳細・チェックシート・マイページで共通に使う。
   モックは1画面ずつ直書きのため画面ごとに値が割れているが、同じ役割の部品は
   統一が正しいと判断し、案件詳細の青帯にそろえた（2026-08-01 大島判断）。
   画面固有CSSでここを上書きしない。 */
.section-card-header {
    padding: 13px 20px;
    background: #eaf1f8;
    color: #244e72;
    border-bottom: 1px solid #dce6f1;
    font-size: 14px;
    font-weight: 700;
}

/* 見出し帯の上に置く件数。帯の色と反転させて数字を目立たせる */
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 8px;
    border-radius: 20px;
    background: #fff;
    color: #2C5F8A;
    font-size: 11.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.info-list {
    margin: 0;
}

.assignee-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.assignee-chip {
    padding: 4px 11px;
    color: #3b434f;
    background: #eef2f6;
    border: 1px solid #e1e7ef;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
}

.chip-overflow {
    color: #5b6472;
    background: #e9ebee;
    border-color: #dcdfe4;
    font-weight: 700;
}

.muted {
    color: #b8bec7;
}

.status-badge {
    padding: 3px 11px;
    color: #244e72;
    background: #dde9f6;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
}

.status-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    background: #2C5F8A;
    border-radius: 50%;
}

.search-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 18px 22px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field.keyword {
    flex: 1 1 280px;
    min-width: 240px;
}

.field.status {
    flex: 0 1 200px;
    min-width: 170px;
}

.field.anken-job-no {
    flex: 0 1 160px;
    min-width: 140px;
}

.field.anken-search-text {
    flex: 1 1 200px;
    min-width: 170px;
}

.master-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px 20px;
}

.master-search-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.note-text {
    color: #9aa1ab;
    font-size: 11.5px;
    line-height: 1.6;
}

.label {
    color: #5b6472;
    font-size: 12px;
    font-weight: 500;
}

.control {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    color: #2b323c;
    background: #fff;
    border: 1px solid #d5d9df;
    border-radius: 7px;
    outline: none;
    font-size: 13.5px;
}

.control:focus {
    border-color: #2C5F8A;
    box-shadow: 0 0 0 3px rgba(44, 95, 138, .12);
}

/* 書き込めない入力欄。押せないボタン（.btn:disabled）とは別の薄いグレーにする */
.control:disabled {
    border-color: #d5d9df;
    background: #f4f5f7;
    color: #9aa1ab;
    cursor: not-allowed;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-range .control {
    width: 154px;
    cursor: pointer;
}

.month-range {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.month-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.month-field-label {
    color: #8a929c;
    font-size: 11.5px;
}

.month-selects {
    display: flex;
    align-items: center;
    gap: 6px;
}

.month-year {
    width: 82px;
}

.month-month {
    width: 66px;
}

.date-separator {
    color: #9aa1ab;
    font-size: 13px;
}

.actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* button と a のどちらで使っても同じ見た目にする（下線・文字寄せをcolor別classへ書かない） */
.btn {
    height: 38px;
    padding: 0 18px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn:disabled {
    border: 1px solid #e3e6ea;
    background: #eef0f3;
    color: #a6acb5;
    cursor: not-allowed;
}

.btn-primary {
    padding: 0 22px;
    color: #fff;
    background: #2C5F8A;
    border: 0;
    font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
    background: #244d70;
}

.btn-secondary {
    color: #5b6472;
    background: #fff;
    border: 1px solid #d5d9df;
}

.btn-secondary:hover:not(:disabled) {
    background: #f5f6f8;
    border-color: #c4c9d1;
}

/* 承認・確定・納品完了。役割が同じボタンは画面をまたいで同じ緑にする */
.btn-approve {
    height: 40px; padding: 0 24px;
    border: 1px solid #2f7345; border-radius: 8px;
    background: #3f9460; color: #fff;
    font-size: 14px; font-weight: 700; font-family: inherit;
    cursor: pointer;
}

.btn-approve:hover:not(:disabled) { background: #357e51; }

/* チェックシートの一時保存を画面上部へ貼り付ける。入力後に最上部まで戻らなくても保存できるようにするため（No.217・No.264） */
.sheet-sticky {
    position: sticky;
    top: 60px;
    z-index: 18;
}
.sheet-sticky-tools {
    display: flex;
    justify-content: flex-end;
    padding: 8px 2px;
    background: #f3f4f6;
}

/* 固定バーのボタンは1つだけなので、狭い画面でも横いっぱいに広げない（上部の操作群とは並び方が違う）。
   狭い画面の .sheet-actions .btn { flex: 1 } より後に効かせるため、セレクタを1段強くしている */
.sheet-sticky .sheet-sticky-tools .btn { flex: none; }

/* CSVインポートなど、主要操作（新規登録）の隣に並べる枠線ボタン */
.btn-outline {
    gap: 7px;
    color: #2C5F8A;
    background: #fff;
    border: 1px solid #2C5F8A;
    font-weight: 700;
}

.btn-outline:hover:not(:disabled) {
    background: #eef4fa;
}

.date-input-control {
    display: contents;
}

.mobile-date-clear-button {
    display: none;
}

@media (max-width: 767px) {
    .date-input-control {
        width: 100%;
        min-width: 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .date-input-control > .control {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .date-input-control > .mobile-date-clear-button {
        display: inline-flex;
        padding: 0 12px;
        white-space: nowrap;
    }
}

.result-meta {
    margin-bottom: 10px;
    padding: 0 2px;
    color: #5b6472;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.result-meta strong {
    color: #222b38;
}

/* 一覧の右上に複数のボタンを並べるとき（取引先マスタのCSVインポート＋新規登録） */
.master-result-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range {
    color: #8a929c;
    font-size: 12.5px;
}

.table-card {
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 10px;
    overflow: hidden;
}

.mobile-card-list {
    display: none;
}

/* モバイル用の並び替えバー（PCでは非表示） */
.mobile-sort {
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.mobile-sort-label {
    flex-shrink: 0;
    color: var(--color-text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.mobile-sort .control {
    flex: 1;
    min-width: 0;
}

.mobile-sort-dir {
    flex-shrink: 0;
    white-space: nowrap;
}

.list-card {
    padding: 14px;
    color: inherit;
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 8px;
    display: block;
    text-decoration: none;
}

.list-card:hover {
    border-color: #cbd3dc;
    box-shadow: 0 6px 16px rgba(20, 31, 45, .06);
}

.list-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.list-card-code {
    margin-bottom: 3px;
    color: #8a929c;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.list-card-title {
    margin: 0;
    color: #222b38;
    font-size: 15px;
    line-height: 1.45;
}

.list-card-meta {
    margin: 12px 0 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.list-card-meta div {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 8px;
}

.list-card-meta dt {
    color: #8a929c;
    font-size: 12px;
}

.list-card-meta dd {
    min-width: 0;
    margin: 0;
    color: #3b434f;
    font-size: 13px;
}

.list-card-actions {
    margin-top: 13px;
    display: flex;
    justify-content: flex-end;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 880px;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table th {
    padding: 12px 16px;
    color: #4a5564;
    background: #f7f8fa;
    border-bottom: 1px solid #e3e6ea;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.data-table th:hover {
    background: #eef0f3;
}

.data-table td {
    padding: 13px 16px;
    color: #3b434f;
    border-bottom: 1px solid #eef0f3;
}

.data-table tr:hover td {
    background: #f9fafb;
}

/* 検索結果0件のプレースホルダ（テーブル / モバイルカード共通） */
.empty-cell {
    padding: 28px 16px;
    color: var(--color-text-faint);
    text-align: center;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:focus {
    outline: 3px solid rgba(44, 95, 138, .18);
    outline-offset: -3px;
}

.align-center {
    text-align: center;
}

.nowrap {
    white-space: nowrap;
}

.num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.project-name {
    color: #222b38;
    font-weight: 500;
}

.email-cell {
    word-break: break-all;
}

.sort-arrow {
    color: #2C5F8A;
    font-size: 12px;
}

/* 見出しはセル全体をクリックできるよう、thのpaddingぶん外へ広げる。
   paddingを打ち消すとデータ側の1文字目と頭がそろわなくなるため、同じ値を持たせる。 */
.data-table th .th-sort {
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: -12px -16px;
    padding: 12px 16px;
    background: none;
    border: 0;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.data-table th[aria-sort="none"] .sort-arrow {
    color: #aab0b9;
}

.badge {
    padding: 3px 11px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* 案件ステータス（jobs.status の値をクラスに出す）。チェック完了は納品完了より淡くして2段の差を出す */
.badge.is-status-1 { background: #e9ebee; color: #5b6472; }
.badge.is-status-1 .badge-dot { background: #8a929c; }
.badge.is-status-2 { background: #dde9f6; color: #244e72; }
.badge.is-status-2 .badge-dot { background: #2C5F8A; }
.badge.is-status-3 { background: #eef5ef; color: #4b7a58; }
.badge.is-status-3 .badge-dot { background: #7fb08d; }
.badge.is-status-4 { background: #fce8e8; color: #8b2020; }
.badge.is-status-4 .badge-dot { background: #c0392b; }
.badge.is-status-5 { background: #d3e8da; color: #245c39; }
.badge.is-status-5 .badge-dot { background: #2f7345; }

.admin-badge.is-admin {
    color: #244e72;
    background: #dde9f6;
}

.admin-badge.is-normal {
    color: #5b6472;
    background: #e9ebee;
}

.operation-col {
    width: 76px;
}

.btn-mini {
    height: 30px;
    padding: 0 14px;
    color: #2C5F8A;
    background: #fff;
    border: 1px solid #2C5F8A;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

.btn-mini:hover:not(:disabled) {
    background: #eef4fa;
}

.btn-plus {
    margin-right: 6px;
    font-size: 16px;
    line-height: 1;
}

.detail-link {
    color: #2C5F8A;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.detail-link:hover {
    text-decoration: underline;
}

.empty {
    padding: 48px 16px;
    color: #9aa1ab;
    text-align: center;
    font-size: 13.5px;
}

.pagination {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.page-link {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    color: #5b6472;
    background: #fff;
    border: 1px solid #d5d9df;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.page-link:hover {
    background: #f5f6f8;
}

.page-link.active {
    color: #fff;
    background: #2C5F8A;
    border-color: #2C5F8A;
}

.page-link.disabled,
.page-link:disabled {
    color: #a4abb5;
    background: #f5f6f8;
    border-color: #e3e6ea;
    cursor: not-allowed;
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 400;
    padding: 20px;
    background: rgba(0, 0, 0, .55);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-backdrop[hidden] {
    display: none;
}

.dialog-panel {
    width: min(540px, 100%);
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dialog-head {
    flex: 0 0 auto;
    padding: 18px 24px;
    border-bottom: 1px solid #e3e6ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #222b38;
    font-size: 16px;
    font-weight: 700;
}

.dialog-close {
    width: 32px;
    height: 32px;
    color: #5b6472;
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
}

.dialog-close:hover {
    background: #f3f4f6;
}

.dialog-body {
    flex: 1 1 auto;
    padding: 20px 24px 8px;
    overflow-y: auto;
}

.user-dialog-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dialog-actions {
    flex: 0 0 auto;
    padding: 14px 24px 20px;
    border-top: 1px solid #e3e6ea;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.required {
    color: #c0392b;
}

/* 「使用不可」等、ラベル脇の小さな注記 */
.field-note {
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text-faint);
    font-size: 11px;
    vertical-align: middle;
}

.field-hint {
    margin: 2px 0 0;
    color: #8a929c;
    font-size: 11.5px;
}

.toggle-field {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #8a929c;
    font-size: 13.5px;
}

.toggle-field input {
    position: absolute;
    opacity: 0;
}

.toggle-ui {
    width: 46px;
    height: 26px;
    background: #d0d5dd;
    border-radius: 13px;
    position: relative;
    transition: background .18s;
}

.toggle-ui::after {
    content: "";
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 4px;
    left: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
    transition: left .18s;
}

.toggle-field input:checked + .toggle-ui {
    background: #2C5F8A;
}

.toggle-field input:checked + .toggle-ui::after {
    left: 24px;
}

.toggle-field input:checked ~ .toggle-label {
    color: #244e72;
    font-weight: 700;
}

@media (max-width: 840px) {
    .app {
        display: block;
    }

    .sidebar {
        display: none;
    }

    .has-mobile-drawer .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 299;
        background: rgba(0, 0, 0, .45);
        border: 0;
        padding: 0;
    }

    .app.has-mobile-drawer.sidebar-open > .sidebar-overlay {
        display: block;
    }

    .has-mobile-drawer .sidebar {
        width: 260px;
        min-height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 300;
        display: flex;
        transform: translateX(-260px);
        transition: transform .25s ease-out;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 0 44px rgba(8, 16, 28, .42);
    }

    .app.has-mobile-drawer.sidebar-open > .sidebar {
        left: 260px;
    }

    .nav {
        max-height: 220px;
    }

    .header {
        gap: 10px;
        padding: 0 14px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .header-title {
        min-width: 0;
        overflow: hidden;
        font-size: 14px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-user {
        gap: 0;
        flex: 0 0 auto;
    }

    .account-user-label { display: none; }
    .account-mobile-label { display: inline; }

    .main {
        padding: 16px 14px calc(40px + env(safe-area-inset-bottom, 0px));
    }

    .page-title {
        font-size: 19px;
        line-height: 1.45;
    }

    .breadcrumb-row {
        align-items: flex-start;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .back-link,
    .btn {
        min-height: 40px;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    .date-range,
    .month-range {
        flex-wrap: wrap;
    }

    .date-range .control {
        flex: 1 1 120px;
        min-width: 120px;
    }

    .month-range {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .date-separator {
        display: none;
    }

    .month-field {
        width: 100%;
    }

    .month-selects {
        width: 100%;
    }

    .month-year,
    .month-month {
        flex: 0 0 auto;
        width: 66px;
    }

    .actions {
        width: 100%;
        margin-left: 0;
    }

    .actions .btn {
        flex: 1;
    }

    .master-search-grid {
        grid-template-columns: 1fr;
    }

    .master-search-actions,
    .master-result-meta {
        flex-direction: row;
        align-items: stretch;
    }

    .master-search-actions .btn,
    .master-result-meta .btn {
        flex: 1;
    }

    .master-result-actions {
        width: 100%;
    }

    .table-card {
        display: none;
    }

    .mobile-card-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .mobile-sort {
        display: flex;
    }

    .user-card .list-card-actions {
        justify-content: flex-end;
    }

    .user-card-meta div {
        grid-template-columns: 84px 1fr;
    }

    .result-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .dialog-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .dialog-panel {
        width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
    }
}

@media (max-width: 480px) {
    .section-card {
        border-radius: 8px;
    }
}

/* =========================================================
 * 汎用ダイアログフォーム（マスタ共通コンポーネント）
 * ========================================================= */
.master-dialog-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.control-textarea {
    height: auto;
    min-height: 76px;
    padding: 10px 12px;
    line-height: 1.6;
    resize: vertical;
}

.row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.row-actions-center {
    justify-content: center;
}

.check-attribute-table .operation-col,
.check-attribute-table .operation-cell {
    width: 104px;
    text-align: center;
}

.operation-col {
    width: 132px;
}

.btn-mini-danger {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.btn-mini-danger:hover:not(:disabled) {
    background: var(--color-danger-soft);
}

.dialog-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dialog-actions.split {
    justify-content: space-between;
}

.dialog-actions .actions-right {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

/* 削除確認ダイアログ */
.dialog-panel.dialog-confirm {
    width: min(440px, 100%);
}

.dialog-panel.dialog-save-confirm {
    width: min(400px, 100%);
}

.confirm-body {
    flex: 1 1 auto;
    padding: 22px 24px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.confirm-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fde8e8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-main {
    flex: 1 1 auto;
    min-width: 0;
}

.confirm-text {
    font-size: 14px;
    color: var(--color-text);
    line-height: 1.6;
    white-space: pre-line;
}

.confirm-target {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--color-text-strong);
}

/* 画像ビューア（共通部品。画像を大きく見るだけで、拡大縮小・回転は持たない） */
.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 500;
    /* 画像の周りに余白を確保し、矢印・閉じる・位置表示が画像へ重ならないようにする */
    padding: 64px 72px;
    background: rgba(0, 0, 0, .82);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer[hidden] {
    display: none;
}

.image-viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
}

.image-viewer-close,
.image-viewer-nav {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-strong);
    background: rgba(255, 255, 255, .92);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.image-viewer-close {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 17px;
}

.image-viewer-nav {
    top: 50%;
    width: 44px;
    height: 44px;
    transform: translateY(-50%);
}

.image-viewer-nav.prev {
    left: 16px;
}

.image-viewer-nav.next {
    right: 16px;
}

.image-viewer-close:hover,
.image-viewer-nav:hover:not(:disabled) {
    background: #fff;
}

.image-viewer-nav:disabled {
    opacity: .35;
    cursor: default;
}

.image-viewer-count {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    color: #fff;
    background: rgba(0, 0, 0, .5);
    border-radius: 12px;
    font-size: 13px;
}

/* スマホは横幅が狭いので、矢印を左右ではなく下段へ置いて画像を大きく見せる */
@media (max-width: 767px) {
    .image-viewer {
        padding: 56px 12px 76px;
    }

    .image-viewer-nav {
        top: auto;
        bottom: 18px;
        width: 40px;
        height: 40px;
        transform: none;
    }

    .image-viewer-nav.prev {
        left: calc(50% - 82px);
    }

    .image-viewer-nav.next {
        right: calc(50% - 82px);
    }

    .image-viewer-count {
        bottom: 28px;
    }
}

.btn-danger {
    color: #fff;
    background: var(--color-danger);
    border: 0;
    font-weight: 700;
}

.btn-danger:hover:not(:disabled) {
    background: var(--color-danger-hover);
}

.btn-danger-outline {
    color: var(--color-danger);
    background: var(--color-surface);
    border: 1px solid var(--color-danger);
    font-weight: 700;
}

.btn-danger-outline:hover:not(:disabled) {
    background: var(--color-danger-soft);
}

.btn-adjustment {
    color: #fff;
    background: var(--color-adjustment);
    border: 1px solid var(--color-adjustment);
    font-weight: 700;
}

.btn-adjustment:hover:not(:disabled) {
    background: var(--color-adjustment-hover);
    border-color: var(--color-adjustment-hover);
}

.btn-adjustment-outline {
    color: var(--color-adjustment);
    background: var(--color-surface);
    border: 1px solid var(--color-adjustment-border);
    font-weight: 700;
}

.btn-adjustment-outline:hover:not(:disabled) {
    background: var(--color-adjustment-soft);
    border-color: #c98686;
}

.field-error {
    color: var(--color-danger);
    font-size: 12px;
    line-height: 1.5;
}

.control.is-error {
    border-color: var(--color-danger);
    background: #fffafa;
}

.app-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    z-index: 700;
    max-width: 90vw;
    padding: 13px 22px;
    color: #fff;
    background: #222b38;
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
    display: flex;
    align-items: center;
    gap: 8px;
    transform: translateX(-50%);
    font-size: 13.5px;
    font-weight: 500;
}

.app-toast[hidden] {
    display: none;
}

/* 担当者選択 */
.select-combo {
    position: relative;
    width: 100%;
}

.select-combo-input {
    width: 100%;
    height: 38px;
    padding: 0 32px 0 11px;
    border: 1px solid #d5d9df;
    border-radius: 7px;
    outline: none;
    color: #2b323c;
    background: #fff;
    font-size: 13.5px;
}

/* 候補を絞り込む欄。グループ見出し付きの長い候補でだけ出す */
.select-combo-search-wrap {
    padding: 8px;
    border-bottom: 1px solid #eef0f3;
}

.select-combo-search {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #d5d9df;
    border-radius: 6px;
    color: #2b323c;
    outline: none;
    font-size: 13px;
}

.select-combo-search:focus {
    border-color: #2c5f8a;
    box-shadow: 0 0 0 3px rgba(44, 95, 138, 0.12);
}

.select-combo-input:focus,
.select-combo.is-open .select-combo-input {
    border-color: #2C5F8A;
    box-shadow: 0 0 0 3px rgba(44, 95, 138, .12);
}

.select-combo-toggle {
    position: absolute;
    inset: 0 0 0 auto;
    width: 32px;
    border: 0;
    background: transparent;
    color: #9aa1ab;
    font-size: 10px;
    cursor: pointer;
}

.select-combo-dropdown {
    position: fixed;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid #d5d9df;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(31, 42, 58, .16);
}

.select-combo-options {
    max-height: 260px;
    overflow-y: auto;
}

.select-combo-option,
.select-combo-add {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    background: #fff;
    color: #3b434f;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
}

.select-combo-add {
    border-bottom: 1px solid #eef0f3;
    color: #244e72;
    background: #f7faff;
}

.select-combo-option.is-selected {
    background: #f3f7fb;
}

/* 見出しの見た目は担当者選択（person-select）とそろえる */
.select-combo-group-label {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 7px 12px 6px;
    border-bottom: 1px solid #eef0f3;
    background: #f6f8fa;
    color: #5a7ba6;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.select-combo-group .select-combo-option {
    padding-left: 20px;
}

.select-combo-option:hover,
.select-combo-add:hover {
    background: #eef4fb;
}

.select-combo-empty {
    padding: 16px 12px;
    color: #9aa1ab;
    text-align: center;
    font-size: 12.5px;
}

/* hidden属性はdisplay指定を持つ要素でも常に非表示にする */
[hidden] {
    display: none !important;
}

/* 共有メモ。案件詳細・文字校正・初期量産で同じ寸法にする。幅の指定はここ1か所だけに置く */
.shared-memo-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
    padding-top: 14px;
    border-top: 1px solid #f1f2f5;
}

/* ラベルは入力欄の1行目に合わせる。縦中央にすると入力欄を伸ばしたときラベルだけ下がる */
.shared-memo-row > .shared-memo-label {
    flex: 0 0 132px;
    margin: 0;
    padding-top: 10px;
    color: var(--color-text-faint);
    font-size: 12.5px;
    font-weight: 500;
}

.shared-memo {
    width: 100%;
    min-height: 96px;
    line-height: 1.7;
    resize: vertical;
}

/* スマホはラベルを上へ出し、入力欄をカード内の全幅にする */
@media (max-width: 767px) {
    .shared-memo-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .shared-memo-row > .shared-memo-label {
        flex-basis: auto;
        padding-top: 0;
    }
}

/* 自分専用メモ（付箋）。案件詳細・文字校正・初期量産で共通。配色はここ1か所で決める */
.personal-notes-heading {
    display: flex;
    align-items: center;
    gap: 8px;
}
.personal-notes-heading strong {
    color: #222b38;
    font-size: 12.5px;
}
.personal-notes-heading span {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 8px;
    border-radius: 3px;
    background: #eef1f6;
    color: #5b6472;
    font-size: 10px;
    font-weight: 700;
}
.personal-note-card {
    position: relative;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
    background: #f7f8fa;
}
.personal-note-card textarea {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #3b3320;
    font: inherit;
}
.personal-note-remove {
    position: absolute;
    z-index: 1;
    top: 5px;
    right: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #8a929c;
    line-height: 1;
    cursor: pointer;
}
.personal-note-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px dashed #b7bfc9;
    border-radius: 7px;
    background: #fff;
    color: #5b6472;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
/* 破線ボタンのマウスオーバー（モック準拠） */
.personal-note-add:hover:not(:disabled) {
    background: #f3f6fb;
    border-color: #8496b8;
}
.personal-note-add:disabled {
    opacity: .5;
    cursor: default;
}
/* 操作後にアンカーで戻る位置。固定ヘッダー(60px)の下に潜らせない */
[id^="item-"],
#part-list,
#job-summary {
    scroll-margin-top: 76px;
}

/* シート右上の操作ボタン（文字校正・初期量産で共通） */
.sheet-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sheet-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.sheet-action-icon {
    display: block;
    flex: none;
    width: 15px;
    height: 15px;
}

@media (max-width: 767px) {
    .sheet-actions {
        width: 100%;
    }

    .sheet-actions .btn {
        flex: 1;
        padding: 0 12px;
    }
}

/* ============ マスタのCSVインポート ============ */
/* 取引先マスタで使用。他マスタへ広げても使えるよう共通CSSに置く */

.csv-dialog-panel {
    width: min(760px, 100%);
}

.csv-lead {
    margin-bottom: 12px;
    color: #5b6472;
    font-size: 13px;
    line-height: 1.7;
}

.csv-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 26px 16px;
    border: 1.5px dashed #c4ccd6;
    border-radius: 10px;
    background: #fafbfc;
    text-align: center;
    cursor: pointer;
}

.csv-drop:hover {
    border-color: #2C5F8A;
    background: #f4f8fc;
}

.csv-drop input {
    display: none;
}

.csv-drop-icon {
    display: block;
    color: #2C5F8A;
}

.csv-drop-label {
    color: #2C5F8A;
    font-size: 13.5px;
    font-weight: 700;
}

.csv-drop-hint {
    color: #9aa1ab;
    font-size: 12px;
}

.csv-file {
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid #e3e6ea;
    border-radius: 8px;
    background: #f7f8fa;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2b323c;
    font-size: 13px;
    font-weight: 500;
}

.csv-file-name {
    flex: 1;
    word-break: break-all;
}

.csv-section-title {
    margin: 22px 0 10px;
    color: #222b38;
    font-size: 13.5px;
    font-weight: 700;
}

.csv-counts {
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.csv-count {
    padding: 14px 16px;
    border: 1px solid #d7e3f0;
    border-radius: 9px;
    background: #f2f7fc;
}

.csv-count dt {
    color: #4a5564;
    font-size: 12px;
    font-weight: 500;
}

.csv-count dd {
    margin-top: 2px;
    color: #2C5F8A;
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.csv-count dd span {
    margin-left: 3px;
    font-size: 13px;
    font-weight: 500;
}

/* エラー0件のときは灰色。1件でもあると赤くして目を引かせる */
.csv-count.is-error {
    border-color: #e3e6ea;
    background: #f7f8fa;
}

.csv-count.is-error dd {
    color: #8a929c;
}

.csv-count.is-error.has-errors {
    border-color: #f0d3d0;
    background: #fdf2f1;
}

.csv-count.is-error.has-errors dd {
    color: #c0392b;
}

.csv-errors {
    border: 1px solid #f0d3d0;
    border-radius: 9px;
    overflow: hidden;
}

.csv-errors-head {
    padding: 9px 14px;
    border-bottom: 1px solid #f0d3d0;
    background: #fdf2f1;
    color: #b23b30;
    font-size: 12.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 7px;
}

.csv-errors-scroll {
    max-height: 260px;
    overflow: auto;
}

.csv-errors-table {
    width: 100%;
    min-width: 460px;
    border-collapse: collapse;
    font-size: 12.5px;
}

.csv-errors-table th {
    padding: 8px 14px;
    background: #faf6f6;
    border-bottom: 1px solid #f0d3d0;
    color: #7a4a45;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.csv-errors-table th:first-child {
    width: 80px;
}

.csv-errors-table th:nth-child(2) {
    width: 130px;
}

.csv-errors-table td {
    padding: 9px 14px;
    border-bottom: 1px solid #f4e4e2;
    color: #3b434f;
    line-height: 1.6;
}

.csv-errors-table td:first-child {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.csv-errors-table td:nth-child(2) {
    color: #222b38;
    font-weight: 500;
    white-space: nowrap;
}

.csv-errors-note {
    margin-top: 10px;
    color: #8a929c;
    font-size: 12px;
    line-height: 1.7;
}

.csv-ok {
    padding: 11px 14px;
    border: 1px solid #cbe6d5;
    border-radius: 8px;
    background: #eef7f1;
    color: #2f7a52;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.csv-alert {
    margin-top: 12px;
    padding: 11px 14px;
    border: 1px solid #f0d3d0;
    border-radius: 8px;
    background: #fdf2f1;
    color: #b23b30;
    font-size: 13px;
    font-weight: 500;
}

.csv-done {
    padding: 30px 12px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
}

.csv-done-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e4f4ea;
    display: flex;
    align-items: center;
    justify-content: center;
}

.csv-done-title {
    color: #222b38;
    font-size: 16px;
    font-weight: 700;
}

.csv-done-text {
    color: #5b6472;
    font-size: 13.5px;
    line-height: 1.8;
}

@media (max-width: 767px) {
    .csv-counts {
        grid-template-columns: 1fr;
    }
}
