/* ==========================================================================
   SEIDENsystem 工程表作成 - 共通スタイル
   方針: 白～ごく薄いグレーのベース、ヘッダーは濃紺、主操作は青、
         状態は色だけでなく文字でも表す。装飾は最小限、業務システムらしく。
   ========================================================================== */

:root {
    --color-bg: #eef1f4;
    --color-surface: #ffffff;

    --color-navy: #0f2740;
    --color-navy-2: #16324f;

    --color-primary: #1a5fa8;
    --color-primary-dark: #12467f;
    --color-primary-bg: #e8f0f9;

    --color-success: #1b7a37;
    --color-success-bg: #e5f4ea;
    --color-success-border: #a9d8b6;

    --color-warning: #9a5b00;
    --color-warning-bg: #fff3de;
    --color-warning-border: #f0c274;

    --color-danger: #b3261e;
    --color-danger-bg: #fdeceb;
    --color-danger-border: #f0b4af;

    /* 進捗マーク「遅れ・要確認」専用のオレンジ（既存の要確認バッジの黄色とは別トーンにし、
       手動判定の進捗色と計算上の要確認フラグを見分けられるようにする） */
    --color-progress-warn-bg: #ffe3c7;
    --color-progress-warn-text: #9a3b00;

    --color-neutral: #4b5563;
    --color-neutral-bg: #eef0f2;

    --color-border: #cbd3db;
    --color-border-strong: #9fabb8;

    --color-text: #1b2430;
    --color-text-muted: #4c5661;
}

* {
    box-sizing: border-box;
}

html, body {
    min-width: 1180px;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Yu Gothic", "Meiryo", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

/* ---------------- ヘッダー ---------------- */
.app-header {
    background: var(--color-navy);
    color: #ffffff;
    border-bottom: 3px solid var(--color-primary);
}

.app-header-inner {
    width: min(1800px, 96%);
    margin: 0 auto;
    padding: 16px 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.app-header h1 {
    margin: 0;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.app-header-sub {
    margin: 3px 0 0;
    font-size: 13px;
    color: #c9d6e4;
}

.app-header-status {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.status-label {
    font-size: 11px;
    color: #a9bbcd;
}

.status-value {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    padding: 2px 12px;
    border-radius: 4px;
}

/* ---------------- レイアウト ---------------- */
.container {
    width: min(1800px, 96%);
    margin: 26px auto 60px;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 22px 24px;
    margin-top: 20px;
}

.section-head {
    margin-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 10px;
}

.section-head h2 {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 700;
    color: var(--color-navy);
}

.hint {
    color: var(--color-text-muted);
    font-size: 13px;
    margin: 4px 0 0;
}

/* ---------------- 製品選択 ---------------- */
.product-select-row {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.product-select-main {
    flex: 0 0 380px;
}

.product-select-main select {
    font-size: 17px;
    padding: 12px 12px;
    font-weight: 700;
    border: 2px solid var(--color-primary);
    color: var(--color-navy);
}

.product-info-box {
    flex: 1 1 420px;
    background: var(--color-primary-bg);
    border: 1px solid #b9d2e8;
    border-radius: 6px;
    padding: 14px 18px;
}

.product-info-heading {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary-dark);
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

/* ---------------- フォーム全般 ---------------- */
label {
    display: block;
    font-weight: 700;
    margin: 0 0 6px;
    font-size: 13px;
    color: var(--color-text);
}

input[type="text"],
input[type="date"],
input[type="number"],
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: 5px;
    font-size: 15px;
    background: #fff;
    color: var(--color-text);
}

input:disabled {
    background: #f0f1f3;
    color: #97a0aa;
    border-color: var(--color-border);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 18px 26px;
}

.field-disabled label {
    color: var(--color-text-muted);
}

/* トグルボタン（yes/no） */
.toggle-group {
    display: inline-flex;
    border: 1px solid var(--color-border-strong);
    border-radius: 5px;
    overflow: hidden;
}

.toggle-btn {
    margin: 0;
    position: relative;
    cursor: pointer;
}

.toggle-btn input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.toggle-btn span {
    display: block;
    padding: 9px 22px;
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text-muted);
    background: #fff;
    border-right: 1px solid var(--color-border-strong);
}

.toggle-btn:last-child span {
    border-right: none;
}

.toggle-btn input:checked + span {
    background: var(--color-primary);
    color: #ffffff;
}

.toggle-btn input:focus-visible + span {
    outline: 2px solid var(--color-primary-dark);
    outline-offset: -2px;
}

/* ---------------- ボタン ---------------- */
button {
    display: inline-block;
    border: none;
    border-radius: 5px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-large {
    font-size: 16px;
    padding: 14px 32px;
}

.btn-success {
    background: var(--color-success);
    color: #ffffff;
}

.btn-neutral {
    background: #ffffff;
    color: var(--color-text);
    border: 1px solid var(--color-border-strong);
}

.btn-small {
    padding: 7px 14px;
    font-size: 13px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 22px;
}

/* ---------------- メッセージ ---------------- */
.message {
    padding: 13px 16px;
    border-radius: 5px;
    margin-top: 16px;
    font-size: 14px;
}

.message ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.message.success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
    font-weight: 700;
}

.message.error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid var(--color-danger-border);
}

.message.warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
}

/* ---------------- 要確認事項（コンパクト・折りたたみ） ---------------- */
.notice-warning {
    margin-top: 14px;
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    border-left: 4px solid var(--color-warning);
    border-radius: 5px;
    padding: 2px 14px;
}

.notice-warning summary {
    cursor: pointer;
    list-style: none;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-warning);
    display: flex;
    align-items: center;
    gap: 6px;
}

.notice-warning summary::-webkit-details-marker {
    display: none;
}

.notice-warning summary::before {
    content: "▶";
    font-size: 10px;
    color: var(--color-warning);
    transition: transform 0.15s;
}

.notice-warning[open] summary::before {
    transform: rotate(90deg);
}

.notice-icon {
    font-size: 13px;
}

.notice-toggle-label {
    font-weight: 400;
    color: #8a6a2a;
    font-size: 12px;
    margin-left: 4px;
}

.notice-warning[open] .notice-toggle-label {
    display: none;
}

/* ブラウザ標準の details 非表示挙動に依存せず、明示的に開閉制御する */
.notice-warning:not([open]) ul {
    display: none;
}

.notice-warning ul {
    margin: 0 0 10px;
    padding: 0 0 0 18px;
    font-size: 12.5px;
    line-height: 1.5;
}

.notice-warning li {
    margin-bottom: 3px;
}

/* ---------------- 計算結果サマリー ---------------- */
.summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 6px;
}

.summary-card {
    background: #f6f8fa;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: 5px;
    padding: 12px 14px;
}

.summary-card-highlight {
    border-left-color: var(--color-navy);
    background: var(--color-navy);
}

.summary-card-highlight .summary-label,
.summary-card-highlight .summary-value {
    color: #ffffff;
}

.summary-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.summary-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--color-navy);
    line-height: 1.1;
}

.summary-unit {
    font-size: 13px;
    font-weight: 700;
    margin-left: 3px;
}

/* ---------------- 工程表（Excel「工程記録表」準拠テーブル） ---------------- */
.ptable-toolbar {
    margin-top: 20px;
    margin-bottom: 8px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}

.ptable-toolbar-left {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-muted);
}

.ptable-toolbar-hint {
    font-size: 12px;
    color: var(--color-text-muted);
}

.ptable-wrap {
    position: relative;
    /* 詳細表示（既定値） */
    --col-w: 92px;
    --fixed-3-w: 168px;
    --left-4: 276px;
    --left-5: 348px;
    --pad-y: 12px;
    --pad-x: 8px;
    --head-pad-y: 6px;
    --date-size: 15px;
    --label-size: 12px;
    --sub-size: 11.5px;
    --fixed-value-size: 13.5px;
}

/* 全体表示（会議・俯瞰用）: 列幅・文字・paddingを縮小し、横スクロールを減らす */
.ptable-wrap.is-overview {
    --col-w: 52px;
    --fixed-3-w: 118px;
    --left-4: 226px;
    --left-5: 298px;
    --pad-y: 5px;
    --pad-x: 4px;
    --head-pad-y: 3px;
    --date-size: 12px;
    --label-size: 10px;
    --sub-size: 9.5px;
    --fixed-value-size: 11.5px;
}

.ptable-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    background: #fff;
}

/* 右端に「まだ続きがある」ことを示すグラデーション（最後まで来たら消える） */
.ptable-scroll-hint {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: 34px;
    background: linear-gradient(to right, rgba(15, 39, 64, 0), rgba(15, 39, 64, 0.16));
    pointer-events: none;
    border-radius: 0 6px 6px 0;
    transition: opacity 0.15s ease;
    opacity: 1;
}

.ptable-scroll-hint.is-hidden {
    opacity: 0;
}

.ptable {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
}

.ptable th,
.ptable td {
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: var(--head-pad-y, 6px) var(--pad-x, 8px);
    font-size: 13px;
    text-align: center;
    vertical-align: middle;
    line-height: 1.3;
}

.ptable thead th {
    font-weight: 700;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
}

/* 工程名・サブ見出し列の幅を統一し、長い工程名は折返して2〜4行に収める
   （colgroupのcol要素で列幅を確定させる。table-layout:fixedはstickyと相性が
   悪いため使わず、colの明示幅のみで統一する） */
.ptable-col {
    width: var(--col-w, 92px);
}

.ptable-process-row th,
.ptable-sub-row th {
    height: 30px;
}

/* 固定（sticky）列: No./枝番/製品名/盤納期/工数 */
.ptable-fixed {
    position: sticky;
    z-index: 3;
    background: #fff;
    border-right: 1px solid var(--color-border-strong);
    text-align: left;
    color: var(--color-text);
    white-space: nowrap;
}

.ptable-fixed-1 { left: 0; width: 48px; }
.ptable-fixed-2 { left: 48px; width: 60px; }
.ptable-fixed-3 { left: 108px; width: var(--fixed-3-w, 168px); white-space: normal; }
.ptable-fixed-4 { left: var(--left-4, 276px); width: 72px; }
.ptable-fixed-5 { left: var(--left-5, 348px); width: 76px; box-shadow: 3px 0 6px rgba(15, 39, 64, 0.12); }

.ptable-fixed.ptable-dept-blank {
    background: var(--color-navy);
    color: #ffffff;
    z-index: 4;
    text-align: left;
    font-size: 12px;
}

/* td. を付けて .ptable th, .ptable td { font-size:13px } と同一詳細度にし、
   後勝ち（ソース順）でこちらのfont-size(var)を確実に効かせる */
td.ptable-fixed-value {
    font-weight: 700;
    font-size: var(--fixed-value-size, 13.5px);
    z-index: 2;
}

/* 部門ヘッダー行（row1） */
.ptable-dept {
    color: #ffffff;
    font-size: 13px;
    letter-spacing: 0.03em;
    height: 30px;
}

/* 工程名行（row2）・開始/完了サブ行（row3）は部門色の淡いトーン
   （th. を付けて .ptable th, .ptable td { font-size:13px } と同一詳細度にし、
   後勝ち＝こちらのfont-size(var)を確実に効かせる） */
th.ptable-process,
th.ptable-sub {
    font-size: var(--label-size, 12px);
    color: var(--color-text);
}

th.ptable-sub {
    font-size: var(--sub-size, 11.5px);
    font-weight: 700;
    color: var(--color-text-muted);
}

/* 部門配色（5色）: 濃色=部門ヘッダー行、淡色=工程名・サブ行 */
.dept-sales_intake { background: #4f8fca; }
.dept-sales_intake-soft { background: #eaf2fa; }

.dept-tech { background: #1a5fa8; }
.dept-tech-soft { background: #e3edf8; }

.dept-procurement { background: #5b6b7c; }
.dept-procurement-soft { background: #eaecef; }

.dept-assembly { background: #4caf7d; }
.dept-assembly-soft { background: #e6f5ec; }

.dept-shipping { background: #0f2740; }
.dept-shipping-soft { background: #dbe4ec; }

/* データ行: 会議室共有でも読める高さと文字強調 */
.ptable tbody td.ptable-value {
    background: #ffffff;
    padding-top: var(--pad-y, 12px);
    padding-bottom: var(--pad-y, 12px);
}

.ptable-date {
    display: block;
    font-weight: 700;
    font-size: var(--date-size, 15px);
    color: var(--color-navy);
}

.ptable tbody td.is-flagged {
    background: var(--color-warning-bg);
}

.ptable-flag {
    display: block;
    margin-top: 3px;
    font-size: 10px;
    font-weight: 400;
    color: var(--color-warning);
    opacity: 0.85;
}

/* ---------------- 進捗マーク（絵具モード） ---------------- */
/* 業務データとしての状態(on_schedule / needs_attention / unset)を色へ変換するのは
   ここ（CSS）だけ。DB・APIは色名を一切保持しない。 */
.ptable tbody td.status-on_schedule {
    background: var(--color-success-bg);
}

.ptable tbody td.status-on_schedule .ptable-date {
    color: var(--color-success);
}

.ptable tbody td.status-needs_attention {
    background: var(--color-progress-warn-bg);
}

.ptable tbody td.status-needs_attention .ptable-date {
    color: var(--color-progress-warn-text);
}

.ptable tbody td.is-paintable {
    cursor: pointer;
}

.ptable tbody td.is-paintable:hover {
    box-shadow: inset 0 0 0 2px var(--color-primary);
}

.ptable tbody td.is-paintable.is-saving {
    opacity: 0.55;
}

.ptable tbody td.is-paintable.is-save-error {
    box-shadow: inset 0 0 0 2px var(--color-danger);
}

/* 進捗マークツールバー */
.paint-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
}

.paint-toolbar-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
}

.paint-mode-group {
    display: inline-flex;
    gap: 6px;
}

.paint-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 2px solid var(--color-border-strong);
    border-radius: 5px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    cursor: pointer;
}

.paint-mode-btn.is-selected {
    border-color: var(--color-navy);
    background: #eef2f5;
}

.paint-mode-btn.is-selected::after {
    content: "✓";
    color: var(--color-navy);
    font-weight: 800;
    margin-left: 2px;
}

.paint-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.paint-dot.dot-green {
    background: var(--color-success);
}

.paint-dot.dot-orange {
    background: var(--color-progress-warn-text);
}

.paint-dot.dot-neutral {
    background: var(--color-neutral-bg);
    border-color: var(--color-border-strong);
}

.paint-mode-current {
    font-size: 12.5px;
    color: var(--color-text-muted);
}

/* ---------------- 凡例 ---------------- */
.legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--color-text-muted);
    font-weight: 700;
}

.legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ---------------- 情報グリッド（製品情報） ---------------- */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px 22px;
}

.info-grid > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-label {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 700;
}

.info-grid > div > span:last-child {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--color-text);
}

/* ---------------- 共通ナビゲーション ---------------- */
.app-nav {
    background: var(--color-navy);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.app-nav-inner {
    width: min(1800px, 96%);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 9px 4px;
}

.app-nav-brand {
    font-size: 13px;
    font-weight: 700;
    color: #c9d6e4;
    letter-spacing: 0.02em;
}

.brand-system {
    color: #ffffff;
}

.brand-sep {
    margin: 0 6px;
    color: #5c7595;
}

.app-nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    color: #c9d6e4;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 5px;
    transition: background 0.15s, color 0.15s;
}

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

.nav-link.is-active {
    background: var(--color-primary);
    color: #ffffff;
}

/* ---------------- ホームページ ---------------- */
.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 22px;
    margin-top: 24px;
}

.home-card {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: 4px solid var(--color-primary);
    border-radius: 6px;
    padding: 32px 28px;
    text-decoration: none;
    color: var(--color-text);
    transition: box-shadow 0.15s, border-color 0.15s;
}

.home-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 14px rgba(15, 39, 64, 0.12);
}

.home-card-icon {
    font-size: 30px;
    margin-bottom: 10px;
}

.home-card h2 {
    margin: 0 0 8px;
    font-size: 19px;
    color: var(--color-navy);
}

.home-card p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 14px;
}

/* ---------------- 詳細表示／全体表示 切替 ---------------- */
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--color-border-strong);
    border-radius: 5px;
    overflow: hidden;
    flex-shrink: 0;
}

.view-toggle-btn {
    border: none;
    border-right: 1px solid var(--color-border-strong);
    background: #ffffff;
    color: var(--color-text-muted);
    font-size: 12.5px;
    font-weight: 700;
    padding: 7px 14px;
    cursor: pointer;
}

.view-toggle-btn:last-child {
    border-right: none;
}

.view-toggle-btn.is-active {
    background: var(--color-primary);
    color: #ffffff;
}

/* ---------------- 工程表登録: 重複確認 ---------------- */
.duplicate-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.inline-form {
    display: inline-block;
    margin: 0;
}

/* ---------------- 工程表一覧ページ ---------------- */
.list-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.list-search-input {
    max-width: 260px;
}

.list-filter-bar select {
    width: auto;
    max-width: 140px;
}

.list-export-btns {
    margin-left: auto;
    display: inline-flex;
    gap: 8px;
}

.list-export-btns a {
    text-decoration: none;
}

/* 一覧テーブルの固定列（No./枝番の代わりに 製品番号/客先名/製品名/納期/工数/メモ）
   詳細表示（既定値）: 従来通りの余裕あるサイズ */
.ltable-fixed-1 { left: 0; width: 92px; }
.ltable-fixed-2 { left: 92px; width: 140px; white-space: normal; }
.ltable-fixed-3 { left: 232px; width: 160px; white-space: normal; }
.ltable-fixed-4 { left: 392px; width: 64px; }
.ltable-fixed-5 { left: 456px; width: 70px; }
.ltable-fixed-6 { left: 526px; width: 34px; text-align: center; }
.ltable-fixed-7 { left: 560px; width: 44px; box-shadow: 3px 0 6px rgba(15, 39, 64, 0.12); text-align: center; }

/* 案件行1件につき data行+メモ行の2<tr>があるため、data行だけを対象に
   1つおきで縞にする（4n+3 = 2番目・4番目…のdata行） */
.ltable tbody tr:nth-child(4n+3) td.ptable-value,
.ltable tbody tr:nth-child(4n+3) td.ptable-fixed-value {
    background: #f7f9fb;
}

.ltable tbody td {
    padding-top: calc(var(--pad-y, 12px) * 0.6);
    padding-bottom: calc(var(--pad-y, 12px) * 0.6);
}

/* ---------------- 全体表示（一覧ページ専用・全工程俯瞰） ----------------
   工程表作成ページの「全体表示」（.ptable-wrap.is-overview 共通ルール）とは
   独立させ、一覧ページ #listPtableWrap だけをさらに大幅圧縮する。
   目的: 1366px幅で横スクロール0pxに収め、支給品入荷日〜出荷方法の
   全27列を同時に表示すること。列幅はCSSだけでなく実寸（colgroup）で
   確実に収まるよう調整している（スクロールバーを隠すだけの対応はしない）。 */
#listPtableWrap.is-overview {
    --col-w: 31px;
    --pad-y: 2px;
    --pad-x: 2px;
    --head-pad-y: 1px;
    --date-size: 10px;
    --label-size: 8.5px;
    --sub-size: 8px;
    --fixed-value-size: 10px;
}

/* 全体表示では全列が収まるためstickyは不要。重なり・余計な幅を避けるため解除する */
#listPtableWrap.is-overview .ptable-fixed {
    position: static;
    box-shadow: none;
}

/* 実寸で収める（スクロールバーを隠すだけの対応は禁止のため、幅そのものを縮小した上でoverflow-x:hiddenにする） */
#listPtableWrap.is-overview .ptable-scroll {
    overflow-x: hidden;
}

#listPtableWrap.is-overview .ptable-scroll-hint {
    display: none;
}

#listPtableWrap.is-overview .ltable-fixed-1 { width: 68px; }
#listPtableWrap.is-overview .ltable-fixed-2 { width: 70px; }
#listPtableWrap.is-overview .ltable-fixed-3 { width: 90px; }
#listPtableWrap.is-overview .ltable-fixed-4 { width: 50px; }
#listPtableWrap.is-overview .ltable-fixed-5 { width: 42px; }
#listPtableWrap.is-overview .ltable-fixed-6 { width: 26px; }
#listPtableWrap.is-overview .ltable-fixed-7 { width: 26px; }

/* 長い客先名・製品名は2行までに丸め、以降は省略（tdのtitle属性で全文確認可） */
#listPtableWrap.is-overview .ltable-fixed-2 .ltable-fixed-text,
#listPtableWrap.is-overview .ltable-fixed-3 .ltable-fixed-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.2;
}

#listPtableWrap.is-overview .ptable-dept {
    height: 14px;
    font-size: 9.5px;
    letter-spacing: 0;
}

#listPtableWrap.is-overview .ptable-process-row th,
#listPtableWrap.is-overview .ptable-sub-row th {
    height: 12px;
}

#listPtableWrap.is-overview .ptable-fixed.ptable-dept-blank {
    font-size: 9px;
}

#listPtableWrap.is-overview .ltable-data-row td.ptable-value,
#listPtableWrap.is-overview .ltable-data-row td.ptable-fixed-value {
    padding-top: 5px;
    padding-bottom: 5px;
}

#listPtableWrap.is-overview .ptable-flag {
    font-size: 7.5px;
}

/* ---------------- 議事メモ ---------------- */
.ltable-memo-head {
    text-align: center;
    font-size: 11px;
}

.ltable-memo-cell {
    text-align: center;
    padding: 0 !important;
}

.ltable-evidence-head {
    text-align: center;
    font-size: 11px;
}

.ltable-evidence-cell {
    text-align: center;
    padding: 0 !important;
}

/* 計算根拠リンク: メモを開かなくても常時アクセス可能な列（一覧ページ）。
   全体表示（is-overview）でも幅を圧迫しないよう、メモボタンと同じ26x26のアイコンボタンにする。 */
.evidence-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--color-primary);
    border-radius: 5px;
    background: var(--color-primary-bg);
    color: var(--color-primary-dark);
    font-size: 13px;
    text-decoration: none;
}

.evidence-link-btn:hover {
    background: var(--color-primary);
    color: #ffffff;
}

#listPtableWrap.is-overview .evidence-link-btn {
    width: 22px;
    height: 22px;
    font-size: 11px;
}

.memo-toggle-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--color-border-strong);
    border-radius: 5px;
    background: #ffffff;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}

.memo-toggle-btn.has-note {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
}

/* メモありを示す小さなドット（ボタン右上に重ねる。行の高さに影響させない） */
.memo-badge-dot {
    display: inline-block;
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 1.5px solid #ffffff;
    pointer-events: none;
}

.ltable-memo-row td {
    background: #f4f7fa;
    border-top: 1px solid var(--color-border-strong);
}

.ltable-memo-panel {
    padding: 12px 16px !important;
    text-align: left;
}

.memo-panel-inner {
    max-width: 720px;
}

.memo-panel-label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 6px;
}

.memo-textarea {
    width: 100%;
    min-height: 64px;
    padding: 9px 11px;
    border: 1px solid var(--color-border-strong);
    border-radius: 5px;
    font-size: 13.5px;
    font-family: inherit;
    resize: vertical;
    color: var(--color-text);
    background: #ffffff;
}

.memo-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.memo-feedback {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-success);
    opacity: 0;
    transition: opacity 0.2s;
}

.memo-feedback.is-visible {
    opacity: 1;
}

.memo-feedback.is-error {
    color: var(--color-danger);
}

.memo-status {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* 完了操作（メモ展開パネル内。誤操作防止のため緑系、Dangerの赤は使わない） */
.row-complete-block {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.row-complete-hint {
    font-size: 11.5px;
    color: var(--color-text-muted);
}

/* ---------------- 完了案件ページ ---------------- */
.completed-count {
    margin-left: auto;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-muted);
}

.completed-table {
    width: 100%;
    border-collapse: collapse;
}

.completed-table th,
.completed-table td {
    border-bottom: 1px solid var(--color-border);
    padding: 12px 14px;
    text-align: left;
    font-size: 14px;
    vertical-align: middle;
}

.completed-table th {
    background: #f7f9fb;
    font-size: 12.5px;
    color: var(--color-text-muted);
    font-weight: 700;
}

.completed-table .col-product-no {
    font-weight: 800;
    font-size: 15px;
}

.product-no-link {
    color: var(--color-navy);
    text-decoration: none;
}

.product-no-link:hover {
    text-decoration: underline;
    color: var(--color-primary);
}

.note-badge {
    display: inline-block;
    background: var(--color-primary-bg);
    color: var(--color-primary-dark);
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.completed-note-text {
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    background: #f7f9fb;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 14px 16px;
    margin: 0;
}

/* ==========================================================================
   計算エビデンス（証跡）ページ専用スタイル
   既存クラスの見た目は変更せず、evidence- プレフィックスの新規クラスのみ追加する。
   ========================================================================== */
.table-wrap {
    overflow-x: auto;
}

.evidence-table th,
.evidence-table td {
    white-space: nowrap;
}

.evidence-table .evidence-formula {
    white-space: normal;
    font-size: 14px;
    color: var(--color-text);
}

.evidence-source {
    color: var(--color-text-muted);
    font-size: 12.5px;
}

.evidence-note {
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: normal;
}

.evidence-formula-table td:last-child strong {
    font-size: 15px;
    color: var(--color-primary-dark);
}

.evidence-row-included {
    background: var(--color-success-bg);
}

.evidence-row-excluded {
    background: #f7f9fb;
    color: var(--color-text-muted);
}

.evidence-reason-badge {
    display: inline-block;
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    white-space: normal;
}

.evidence-caveat {
    margin-top: 10px;
}

.evidence-back-links {
    margin: 0 0 14px;
    font-size: 13px;
}

.evidence-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.evidence-section-nav a {
    display: inline-block;
    padding: 5px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    color: var(--color-primary-dark);
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
}

.evidence-section-nav a:hover {
    background: var(--color-primary-bg);
    border-color: var(--color-primary);
}

.evidence-badge-ok {
    display: inline-block;
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
    font-size: 11.5px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 10px;
}

.evidence-badge-ng {
    display: inline-block;
    background: var(--color-neutral-bg);
    color: var(--color-neutral);
    border: 1px solid var(--color-border);
    font-size: 11.5px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 10px;
}

.evidence-spec + .evidence-spec {
    margin-top: 10px;
}

.evidence-pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
    font-size: 12.5px;
    line-height: 1.7;
    background: #f7f9fb;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 14px 16px;
    max-height: 480px;
    overflow-y: auto;
}

.evidence-calendar-table {
    max-height: 420px;
    display: block;
    overflow-y: auto;
}

.evidence-row-business td {
    color: var(--color-text);
}

.evidence-row-off td {
    color: var(--color-text-muted);
}
