/* ============================================================
   OhkuKogyoSystem Custom CSS
   大久幸業 業務管理システム - プレミアムUIデザイン
   電子帳簿保存法（電帳法）対応スタイル含む
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Noto+Sans+JP:wght@300;400;500;700;900&display=swap');

/* ============================================================
   CSS Variables（デザイントークン）
   ============================================================ */
:root {
    /* ブランドカラー */
    --company-blue: #00305B;
    --company-blue-light: #004a99;
    --company-blue-hover: #001f3f;
    --company-blue-50: rgba(0, 48, 91, 0.05);
    --company-blue-100: rgba(0, 48, 91, 0.1);
    --company-blue-200: rgba(0, 48, 91, 0.2);

    /* アクセントカラー */
    --accent-gold: #f59e0b;
    --accent-gold-light: #fef3c7;

    /* セマンティックカラー */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --purple: #8b5cf6;
    --purple-light: #ede9fe;

    /* 背景・サーフェス */
    --bg-base: #f0f4f8;
    --bg-card: #ffffff;
    --bg-muted: #f8fafc;

    /* テキスト */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #ffffff;

    /* ボーダー */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;

    /* シャドウ */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);
    --shadow-blue: 0 4px 14px rgba(0, 48, 91, 0.2);
    --card-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.03);

    /* ボーダー半径 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* フォント */
    --font-sans: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;

    /* トランジション */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================
   ベーススタイル
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   プレミアムヘッダー
   ============================================================ */
.header-premium {
    background: linear-gradient(135deg, #001f3f 0%, var(--company-blue) 50%, #004a99 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(0, 31, 63, 0.3);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 0.875rem 0;
    position: sticky;
    top: 0;
    z-index: 1050;
    transition: var(--transition-base);
}

.header-premium .logo-text {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.header-logo-icon {
    height: 30px;
    width: auto;
    object-fit: contain;
}

.tracking-tight { letter-spacing: -0.02em; }
.op-70 { opacity: 0.7; }
.op-80 { opacity: 0.8; }
.hover-op-100:hover { opacity: 1; }

/* ============================================================
   電子帳簿保存法 バナー & バッジ
   ============================================================ */
.compliance-banner {
    background: linear-gradient(135deg, #0c4a6e 0%, #0e7490 100%);
    color: white;
    padding: 0.4rem 1rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.compliance-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(135deg, #0c4a6e, #0e7490);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(14, 116, 144, 0.3);
}

.compliance-info-panel {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-left: 4px solid #0284c7;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
}

.compliance-lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #b91c1c;
    border: 1px solid #fca5a5;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* ============================================================
   ステータスバッジ
   ============================================================ */
.status-badge-premium {
    padding: 0.38rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.status-draft    { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.status-sent     { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.status-ordered  { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.status-delivered { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.status-billed   { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.status-paid     { background: #ecfdf5; color: #047857; border: 1px solid #6ee7b7; }

/* ============================================================
   ダッシュボードカード
   ============================================================ */
.dash-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-spring), box-shadow var(--transition-base), border-color var(--transition-base);
    overflow: hidden;
    height: 100%;
    cursor: pointer;
    text-decoration: none !important;
    display: flex;
    flex-direction: column;
    position: relative;
}

.dash-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.dash-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--company-blue-200);
}

.dash-card:hover::before {
    opacity: 1;
}

.dash-card-blue::before  { background: linear-gradient(90deg, var(--company-blue), var(--company-blue-light)); }
.dash-card-green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.dash-card-amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.dash-card-purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.dash-card .card-body {
    padding: 1.75rem;
}

.dash-icon-box {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    transition: transform var(--transition-spring);
    font-size: 1.5rem;
}

.dash-card:hover .dash-icon-box {
    transform: scale(1.12) rotate(6deg);
}

/* アイコンボックスのカラーバリアント */
.bg-primary-light  { background: linear-gradient(135deg, #eff6ff, #dbeafe); color: var(--company-blue); }
.bg-success-light  { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #059669; }
.bg-warning-light  { background: linear-gradient(135deg, #fffbeb, #fef3c7); color: #d97706; }
.bg-danger-light   { background: linear-gradient(135deg, #fff1f2, #fee2e2); color: #dc2626; }
.bg-info-light     { background: linear-gradient(135deg, #eff6ff, #dbeafe); color: #2563eb; }
.bg-purple-light   { background: linear-gradient(135deg, #faf5ff, #ede9fe); color: #7c3aed; }

/* ============================================================
   カード汎用
   ============================================================ */
.card-premium {
    background: var(--bg-card);
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base);
}

.card-premium:hover {
    box-shadow: var(--shadow-md);
}

/* ============================================================
   テーブル
   ============================================================ */
.table-premium {
    border-collapse: separate;
    border-spacing: 0;
}

.table-premium thead th {
    background: var(--bg-muted);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.875rem 1rem;
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
}

.table-premium tbody tr {
    transition: background-color var(--transition-fast);
}

.table-premium tbody tr:hover {
    background-color: var(--company-blue-50);
}

.table-premium tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table-premium tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   ボタン
   ============================================================ */
/* Primary */
.btn.btn-primary,
button.btn-primary,
a.btn.btn-primary,
input[type="submit"].btn-primary {
    background: linear-gradient(135deg, var(--company-blue), var(--company-blue-light)) !important;
    border-color: transparent !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: var(--shadow-blue);
    transition: all var(--transition-base);
}

.btn.btn-primary:hover,
button.btn-primary:hover,
a.btn.btn-primary:hover {
    background: linear-gradient(135deg, var(--company-blue-hover), var(--company-blue)) !important;
    box-shadow: 0 6px 20px rgba(0, 48, 91, 0.35) !important;
    transform: translateY(-1px);
    color: #ffffff !important;
}

.btn-primary:visited,
a.btn-primary:visited {
    color: #ffffff !important;
}

/* Outline Primary */
.btn-outline-primary {
    color: var(--company-blue) !important;
    border-color: var(--company-blue) !important;
    font-weight: 600;
    transition: all var(--transition-base);
}

.btn-outline-primary:hover,
a.btn-outline-primary:hover {
    background-color: var(--company-blue) !important;
    color: #ffffff !important;
    box-shadow: var(--shadow-blue);
    transform: translateY(-1px);
}

/* ボタン共通 */
.btn {
    transition: all var(--transition-base);
    font-weight: 500;
}

.btn:active {
    transform: translateY(1px) !important;
}

/* ============================================================
   フォームコントロール
   ============================================================ */
.form-control:focus,
.form-select:focus {
    border-color: var(--company-blue-light) !important;
    box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.12) !important;
    background-color: #fff;
    outline: none;
}

.form-control, .form-select {
    border-color: var(--border-medium);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-check-input:checked {
    background-color: var(--company-blue) !important;
    border-color: var(--company-blue) !important;
}

/* ============================================================
   伝票入力用（明細行）
   ============================================================ */
.input-qty { 
    background-color: #eef6ff !important; 
    border: 1px solid #cbdcf0 !important; 
    border-radius: 6px !important;
}
.input-price { 
    background-color: #fffbeb !important; 
    border: 1px solid #f3e5b5 !important; 
    border-radius: 6px !important;
}
.input-item-name { 
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important; 
    border-radius: 6px !important;
}

/* モバイルラベルの強調 */
@media (max-width: 768px) {
    .mobile-card-view td::before {
        font-weight: 800 !important;
        color: var(--company-blue) !important;
        opacity: 0.8;
    }
}

/* ============================================================
   カラーオーバーライド
   ============================================================ */
.text-primary  { color: var(--company-blue) !important; }
.bg-primary    { background-color: var(--company-blue) !important; }
.border-primary { border-color: var(--company-blue) !important; }

.btn-outline-primary:hover i,
a.btn-outline-primary:hover i { color: #ffffff !important; }

/* List group */
.list-group-item.active {
    background-color: var(--company-blue) !important;
    border-color: var(--company-blue) !important;
}

/* Nav pills */
.nav-pills .nav-link.active {
    background-color: var(--company-blue) !important;
}

/* Links */
a:not(.btn):not(.nav-item-mobile):not(.dash-card) {
    color: var(--company-blue) !important;
    transition: color var(--transition-fast);
}

a:not(.btn):not(.nav-item-mobile):not(.dash-card):hover {
    color: var(--company-blue-hover) !important;
}

.bg-primary a { color: white !important; }
.bg-primary a:hover { color: rgba(255,255,255,0.85) !important; }

/* Badge */
.badge.bg-primary { background-color: var(--company-blue) !important; }

/* Pagination */
.pagination .page-link { color: var(--company-blue) !important; }
.pagination .page-item.active .page-link {
    background-color: var(--company-blue) !important;
    border-color: var(--company-blue) !important;
}

/* ============================================================
   ヘッダーバー各種
   ============================================================ */
.header-bar-navy {
    background: linear-gradient(135deg, #001f3f 0%, var(--company-blue) 100%) !important;
    color: white !important;
}

.header-bar-navy i,
.header-bar-navy span { color: white !important; }

.bg-primary .btn-outline-light {
    color: white !important;
    border-color: rgba(255,255,255,0.5) !important;
}

.bg-primary .btn-outline-light:hover {
    background-color: rgba(255,255,255,0.15) !important;
    color: #ffffff !important;
}

/* ============================================================
   モバイルボトムナビ
   ============================================================ */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 -8px 30px rgba(0,0,0,0.06);
    z-index: 1060;
}

.nav-item-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #94a3b8;
    text-decoration: none !important;
    font-size: 0.65rem;
    font-weight: 600;
    flex: 1;
    transition: color var(--transition-fast), transform var(--transition-fast);
    padding: 2px 0;
}

.nav-item-mobile.active {
    color: var(--company-blue);
}

.nav-item-mobile i {
    font-size: 1.35rem;
    margin-bottom: 2px;
    transition: transform var(--transition-spring);
}

.nav-item-mobile.active i {
    transform: scale(1.1);
}

.nav-item-mobile:hover i {
    transform: scale(1.05);
}

/* ============================================================
   テーブル → モバイルカードビュー
   ============================================================ */
@media (max-width: 768px) {
    .mobile-card-view {
        border: none !important;
        background: transparent;
    }

    .mobile-card-view thead {
        display: none;
    }

    .mobile-card-view tbody tr {
        display: block;
        background: white;
        border-radius: var(--radius-lg);
        margin-bottom: 1.25rem;
        padding: 1.25rem 1.5rem;
        box-shadow: var(--shadow-md);
        border: 1px solid var(--border-light);
        transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    }

    .mobile-card-view tbody tr:active {
        transform: scale(0.99);
    }

    .mobile-card-view td {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 0.6rem 0 !important;
        border-bottom: 1px solid var(--bg-muted) !important;
        text-align: left !important;
        width: 100%;
    }

    .mobile-card-view td:last-child {
        border-bottom: none !important;
        padding-top: 0.75rem !important;
    }

    .mobile-card-view td::before {
        content: attr(data-label);
        font-size: 0.7rem;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.06em;
        min-width: 90px;
        flex-shrink: 0;
        margin-right: 0.5rem;
    }

    .mobile-card-view td > * {
        font-size: 1rem;
        word-break: break-word;
        white-space: normal;
    }

    .has-mobile-nav {
        padding-bottom: 95px !important;
    }

    .btn, th, td {
        white-space: nowrap !important;
    }

    td.allow-wrap {
        white-space: normal !important;
    }
}

/* ============================================================
   モバイル大型ボタン
   ============================================================ */
@media (max-width: 575.98px) {
    .btn-huge-mobile {
        padding: 1.1rem !important;
        font-size: 1.25rem !important;
        font-weight: 800 !important;
        border-radius: var(--radius-xl) !important;
        width: 100% !important;
        height: 72px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 8px 25px rgba(0, 44, 91, 0.25) !important;
        background: linear-gradient(135deg, var(--company-blue), var(--company-blue-light)) !important;
        border: none !important;
        white-space: nowrap !important;
    }

    .btn-action-lg {
        height: 68px !important;
        font-size: 1.2rem !important;
        font-weight: 700 !important;
        border-radius: var(--radius-xl) !important;
        margin-bottom: 0.65rem;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: nowrap !important;
        transition: all var(--transition-spring) !important;
    }

    .btn-action-lg:active {
        transform: scale(0.96) !important;
    }
}

/* ============================================================
   アニメーション
   ============================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes highlight-glow {
    0%   { background-color: rgba(27, 54, 93, 0.15); }
    100% { background-color: transparent; }
}

@keyframes pulse-compliance {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.7; }
}

.fade-in-up {
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.amount-changed {
    animation: highlight-glow 0.8s ease-out;
}

/* ============================================================
   ログイン画面
   ============================================================ */
.login-bg {
    background: linear-gradient(135deg, #001f3f 0%, #003366 40%, #004a99 100%);
    min-height: 100vh;
}

.login-card {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.05);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.login-header {
    background: linear-gradient(135deg, var(--company-blue), var(--company-blue-light));
    color: white;
    padding: 2.5rem 2rem;
    text-align: center;
}

/* ============================================================
   見積書・請求書 用紙スタイル
   ============================================================ */
.estimate-paper {
    background: #fff;
    padding: 3rem 4rem;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 20px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
    max-width: 210mm;
    margin: 0 auto;
}

/* ============================================================
   スティッキー合計バー
   ============================================================ */
.sticky-total-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 2px solid var(--company-blue-100);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.08);
    z-index: 1040;
    padding: 1rem 0;
    transition: var(--transition-base);
}

body.has-sticky-bar { padding-bottom: 100px; }

@media (max-width: 768px) {
    .sticky-total-bar {
        padding: 0.75rem 0;
    }
    .sticky-total-bar .btn {
        width: 100% !important;
        height: 58px !important;
        font-size: 1.1rem !important;
    }
}

/* ============================================================
   テーブル ドラッグハンドル
   ============================================================ */
.item-row:hover { background-color: var(--bg-muted) !important; }
.drag-handle { cursor: grab; color: #cbd5e0; }
.drag-handle:active { cursor: grabbing; }

/* ============================================================
   ショートカットヒント
   ============================================================ */
.shortcut-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
    padding: 1px 4px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    background: var(--bg-muted);
}

/* ============================================================
   テーブル汎用
   ============================================================ */
table th, table td { vertical-align: middle !important; }

.table-compact { font-size: 0.875rem; }
.table-compact td, .table-compact th { padding: 0.25rem; }

input.num { text-align: right; }

/* ============================================================
   ホバーリフト（設定マスタ等）
   ============================================================ */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
    border: 1px solid var(--border-light) !important;
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--company-blue) !important;
    background: white !important;
}

/* ============================================================
   fw-* ユーティリティ
   ============================================================ */
.fw-900 { font-weight: 900; }
.fw-800 { font-weight: 800; }
.fw-500 { font-weight: 500; }
.smaller { font-size: 0.8rem; }

/* ============================================================
   印刷スタイル
   ============================================================ */
/* ============================================================
   印刷スタイル (共通)
   ============================================================ */
@page {
    size: A4 portrait;
    margin: 10mm; /* プリンターの余白に合わせて10mm（約1cm）を確保 */
}

@media print {
    .no-print { display: none !important; }

    body {
        background-color: #fff !important;
        padding: 0 !important;
        margin: 0 !important;
        font-family: var(--font-sans), "Helvetica Neue", Arial, sans-serif;
        font-size: 11pt;
        color: #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Bootstrapコンテナの横幅を印刷範囲いっぱいに */
    .container, .container-fluid {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* 帳票用紙のスタイル（シャドウや背景をリセット） */
    .estimate-paper, .content-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    /* テーブルの罫線を黒に固定 */
    .table-bordered,
    .table-bordered > :not(caption) > * > * {
        border: 1px solid #000 !important;
    }
    
    .table-bordered th, 
    .table-bordered td { 
        border-color: #000 !important; 
    }

    /* 印刷時の背景色強制 */
    .bg-light, .table-light {
        background-color: #f8f9fa !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .text-muted { color: #444 !important; }

    /* 見出しと各種マージンの調整 */
    h1.display-6 { 
        font-size: 1.75rem !important; 
        margin-bottom: 1.5rem !important;
        border-bottom: 1px solid #000 !important;
        padding-bottom: 0.5rem !important;
    }
    .mb-5 { margin-bottom: 1.5rem !important; }
    
    table { 
        font-size: 10pt !important; 
        border-collapse: collapse !important;
    }

    .compliance-banner { display: none !important; }

    /* レイアウトの崩れ防止（flexの固定） */
    .row {
        display: flex !important;
        flex-wrap: nowrap !important;
    }
    
    .col-7 {
        width: 58% !important;
        flex: 0 0 58% !important;
        max-width: 58% !important;
    }
    
    .col-5 {
        width: 42% !important;
        flex: 0 0 42% !important;
        max-width: 42% !important;
    }
    
    /* 合計金額テーブルの幅調整 */
    .total-amount-table {
        width: auto !important;
        min-width: 250px !important;
    }
    
    /* 会社印（透過維持） */
    .company-stamp {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* モバイル専用レスポンシブ表示を印刷時に解除 */
    .table-responsive-mobile {
        overflow: visible !important;
        display: block !important;
        width: 100% !important;
    }

    /* ページまたぎでの罫線切れ防止 */
    tr {
        page-break-inside: avoid !important;
    }
    
    thead {
        display: table-header-group;
    }
}

/* ============================================================
   PDF出力スタイル
   ============================================================ */
body.is-exporting-pdf {
    width: 1000px !important;
    font-size: 8px !important;
    line-height: 1.2 !important;
    background-color: white !important;
    padding-top: 0 !important;
}

body.is-exporting-pdf .container-fluid,
body.is-exporting-pdf .container {
    width: 1000px !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.is-exporting-pdf table th,
body.is-exporting-pdf table td {
    white-space: nowrap !important;
    font-size: 8px !important;
    padding: 1px 2px !important;
}

body.is-exporting-pdf .card-body { padding: 5px !important; }
body.is-exporting-pdf .no-print  { display: none !important; }
body.is-exporting-pdf .btn       { box-shadow: none !important; }
body.is-exporting-pdf .card      { border: none !important; box-shadow: none !important; }

body.is-exporting-pdf .table-responsive {
    max-height: none !important;
    overflow: visible !important;
}

body.is-exporting-pdf .form-select,
body.is-exporting-pdf .form-check-input {
    background-image: none !important;
}

/* ============================================================
   スマホ 詳細レスポンシブ調整
   ============================================================ */
@media (max-width: 767.98px) {
    table, .table, .table-compact {
        font-size: 0.78rem !important;
    }

    .table td, .table th {
        padding: 0.35rem 0.25rem !important;
        white-space: nowrap;
    }

    td.address, td.content, td.note {
        white-space: normal !important;
        min-width: 150px;
    }

    .form-select-sm, .form-control-sm, .btn-sm {
        font-size: 0.85rem !important;
        padding: 0.3rem 0.6rem !important;
        height: auto !important;
    }

    .btn {
        padding: 0.5rem 1rem !important;
        font-size: 1rem !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .table-responsive {
        border-right: 1px solid var(--border-light);
        margin-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 768px) {
    .estimate-paper {
        padding: 1.5rem !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .estimate-paper h1 {
        font-size: 1.5rem !important;
        letter-spacing: 0.2em !important;
    }

    .table-responsive-mobile {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive-mobile table {
        min-width: 600px;
    }
}

@media (max-width: 576px) {
    .estimate-paper { padding: 1rem !important; }
    .estimate-paper table { font-size: 0.85rem; }
    .estimate-paper .fs-4 { font-size: 1.25rem !important; }

    .header-bar-navy .btn-group { width: 100%; display: flex; }
    .header-bar-navy .btn-group .btn { flex: 1; padding: 8px 4px; }
}

/* ============================================================
   検索フォーム強化スタイル
   ============================================================ */
.search-panel {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.search-panel .search-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
    display: block;
}

/* ============================================================
   プレースホルダー
   ============================================================ */
::placeholder {
    color: #c1c9d4 !important;
    opacity: 1;
}

::-ms-input-placeholder {
    color: #c1c9d4 !important;
}

/* ============================================================
   メニューアウトラインボタン
   ============================================================ */
.btn-menu-outline {
    color: var(--company-blue) !important;
    border: 2px solid var(--company-blue) !important;
    background-color: transparent !important;
    transition: all var(--transition-base);
    font-weight: 600;
}

.btn-menu-outline:hover,
a.btn-menu-outline:hover {
    background-color: var(--company-blue) !important;
    color: white !important;
    box-shadow: var(--shadow-blue);
    transform: translateY(-1px);
}

/* ============================================================
   カスタムアクションボタン
   ============================================================ */
.btn-card-action {
    transition: all var(--transition-fast);
    border-radius: 4px;
    padding: 1px 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-card-action:hover {
    background-color: var(--company-blue-100) !important;
    transform: scale(1.1);
}

.btn-card-action.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

#loading {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* ============================================================
   印鑑・社判レイアウト
   ============================================================ */
.stamp-container {
    position: relative;
    display: inline-block;
}

.company-stamp {
    position: absolute;
    top: -15px; /* 会社名の上に少し被せる */
    right: -25px; /* 会社名の右側に配置 */
    width: 64px;
    height: auto;
    opacity: 0.85;
    z-index: 10;
    pointer-events: none;
    mix-blend-mode: multiply; /* 白背景を透過させる（ブラウザ対応状況による） */
}

@media print {
    .company-stamp {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}