/* ========================================
   カタログPDFジェネレーター スタイルシート
   ======================================== */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans JP', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

/* ナビゲーション */
.navbar {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
}

.nav-brand a {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.nav-links a {
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-user {
    color: var(--gray-500);
    font-size: 0.85rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--gray-200);
}

.btn-link {
    background: none;
    border: none;
    color: var(--gray-500) !important;
    font-size: 0.85rem;
}

/* コンテナ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* フラッシュメッセージ */
.flash-messages { margin-bottom: 1rem; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-warning { background: #fef3c7; color: #92400e; }
.flash-info { background: #dbeafe; color: #1e40af; }

.flash-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.6;
}

/* ページヘッダー */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 { font-size: 1.5rem; }

.page-title-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.page-title-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.page-header-note {
    margin: 0.3rem 0 0;
    color: var(--gray-500);
    font-size: 0.86rem;
    line-height: 1.5;
}

.page-actions { display: flex; gap: 0.5rem; align-items: center; }
.page-actions .btn { margin-bottom: 0; }
.price-header-sync-form { margin: 0; }

/* ボタン */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
    background: #fff;
    color: var(--primary);
    border-color: #bfdbfe;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}
.btn-secondary:hover {
    background: #eff6ff;
    border-color: var(--primary);
    color: var(--primary-hover);
}
.btn-neutral {
    background: var(--gray-100);
    color: var(--gray-700);
    border-color: var(--gray-300);
    box-shadow: none;
}
.btn-neutral:hover {
    background: var(--gray-200);
    border-color: var(--gray-400);
    color: var(--gray-900);
}
.btn-model-create {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.12rem;
    padding: 0.55rem 0.8rem;
    background: #fff;
    color: #5b21b6;
    border-color: #c4b5fd;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12);
}
.btn-model-create:hover {
    background: #f5f3ff;
    border-color: #7c3aed;
    color: #4c1d95;
}
.btn-model-create__main {
    font-size: 0.95rem;
    line-height: 1.15;
}
.btn-model-create__sub {
    color: #6d28d9;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.1;
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ai {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}
.btn-ai:hover {
    background: #6d28d9;
    border-color: #6d28d9;
}
.btn-ai-retry {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fdba74;
}
.btn-ai-retry:hover {
    background: #ffedd5;
    border-color: #fb923c;
    color: #9a3412;
}
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.text-center { text-align: center; }

/* カード */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-100);
}

/* フォーム */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--gray-700);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.5rem;
}

.form-full { grid-column: 1 / -1; }
.checkbox-inline {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.required { color: var(--danger); }

/* 認証画面 */
.auth-container {
    max-width: 400px;
    margin: 3rem auto;
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-form {
    background: #fff;
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
}

.auth-form .btn { width: 100%; margin-top: 0.5rem; }

.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--gray-500);
}

.auth-link a { color: var(--primary); }

/* 商品テーブル */
.product-table-wrapper { overflow-x: auto; }

.product-table {
    width: 100%;
    background: #fff;
    border-collapse: collapse;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.product-table th,
.product-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.product-table th {
    background: var(--gray-50);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
}
.compact-table th,
.compact-table td {
    padding: 0.55rem 0.65rem;
    font-size: 0.82rem;
}
.price-list-table td {
    vertical-align: top;
    font-size: 0.82rem;
}
.price-list-page .card {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.price-list-page .card h2 {
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
}
.price-page-header {
    margin-bottom: 1rem;
}
.price-page-header h1 {
    margin-bottom: 0.2rem;
}
.price-import-form {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
}
.price-import-actions,
.price-filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.price-csv-actions-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    margin-top: 0.75rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--gray-100);
    color: var(--gray-600);
    font-size: 0.82rem;
}
.price-csv-actions-row span {
    margin-right: auto;
}
.price-output-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.price-template-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--gray-600);
    font-size: 0.78rem;
    font-weight: 700;
}
.price-template-picker select {
    min-width: 190px;
    min-height: 36px;
    padding: 0.35rem 0.55rem;
}
.price-modal[hidden] {
    display: none;
}
.price-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.price-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}
.price-modal__panel {
    position: relative;
    width: min(760px, 96vw);
    max-height: min(760px, 92vh);
    overflow: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}
.price-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}
.price-modal__header h2 {
    margin: 0;
    padding: 0;
    font-size: 1.05rem;
}
.price-modal__close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: #fff;
    color: var(--gray-600);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}
.price-pdf-settings-form {
    padding: 1rem 1.25rem 1.25rem;
}
.price-settings-grid {
    display: grid;
    grid-template-columns: 160px 180px 1fr;
    gap: 0.8rem;
}
.price-settings-title {
    min-width: 0;
}
.price-pdf-settings-form textarea {
    min-height: 90px;
    resize: vertical;
}
.price-pdf-settings-form input[type="color"] {
    min-height: 38px;
    padding: 0.15rem;
}
.price-default-template {
    margin: 0.25rem 0 0.85rem;
}
.price-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}
.price-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.price-mini-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    color: var(--gray-500);
    font-size: 0.74rem;
    line-height: 1.4;
}
.price-mini-stats strong {
    color: var(--gray-700);
    font-size: 0.78rem;
}
.price-management-card {
    margin-top: 1rem;
}
.price-list-limit-note {
    margin: 0.75rem 0 0;
    font-size: 0.82rem;
}
.price-tabs > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.price-tab-list {
    display: flex;
    gap: 0.35rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1rem;
    overflow-x: auto;
}
.price-tab-list label {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0.45rem 0.85rem;
    color: var(--gray-600);
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 700;
}
.price-tab-list label:hover {
    color: var(--gray-900);
    background: var(--gray-50);
}
.price-tab-panel {
    display: none;
}
#price-tab-import:checked ~ .price-tab-list label[for="price-tab-import"],
#price-tab-sync:checked ~ .price-tab-list label[for="price-tab-sync"],
#price-tab-guide:checked ~ .price-tab-list label[for="price-tab-guide"],
#price-tab-history:checked ~ .price-tab-list label[for="price-tab-history"] {
    color: var(--gray-900);
    background: #fff;
    border-color: var(--gray-200);
    margin-bottom: -1px;
}
#price-tab-import:checked ~ .price-tab-import,
#price-tab-sync:checked ~ .price-tab-sync,
#price-tab-guide:checked ~ .price-tab-guide,
#price-tab-history:checked ~ .price-tab-history {
    display: block;
}
.price-details {
    padding: 0;
    overflow: hidden;
}
.price-details summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
}
.price-details summary::-webkit-details-marker {
    display: none;
}
.price-details summary::before {
    content: '>';
    color: var(--gray-500);
    transition: transform 0.15s;
}
.price-details[open] summary::before {
    transform: rotate(90deg);
}
.price-details summary small {
    color: var(--gray-500);
    font-size: 0.78rem;
    font-weight: 500;
    margin-left: auto;
}
.price-details[open] {
    padding-bottom: 1rem;
}
.price-details[open] summary {
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 0.75rem;
}
.price-csv-guide {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 0.6rem;
    align-items: center;
    padding: 0 1rem;
    color: var(--gray-600);
    font-size: 0.8rem;
}
.price-csv-guide div {
    display: flex;
    gap: 0.35rem;
    min-width: 0;
}
.price-csv-guide strong {
    color: var(--gray-900);
    white-space: nowrap;
}
.price-csv-guide span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.price-csv-guide-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
}
.price-csv-fields {
    margin: 0.75rem 1rem 0;
}
.price-csv-fields table {
    box-shadow: none;
}
.price-csv-fields code {
    color: var(--gray-900);
    font-size: 0.78rem;
}
.price-csv-note {
    margin-top: 0.4rem;
    font-size: 0.8rem;
}
.price-filter-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 0.75rem;
    align-items: end;
}
.price-filter-form--compact {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
}
.price-filter-form .form-group,
.price-import-form .form-group {
    margin-bottom: 0;
}
.price-codes-field {
    grid-column: span 2;
}
.price-filter-form--compact .price-codes-field {
    grid-column: span 2;
}
.price-filter-wide {
    grid-column: span 2;
}
.price-card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--gray-100);
}
.price-card-title h2 {
    margin: 0;
    padding: 0;
    border: none;
}
.price-card-title-main {
    display: flex;
    align-items: baseline;
    gap: 0.85rem;
    flex-wrap: wrap;
}
.price-text-link {
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
}
.price-text-link:hover {
    text-decoration: underline;
}
.price-result-count {
    color: var(--gray-600);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}
.price-stats {
    margin-bottom: 1rem;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 0.75rem;
}
.price-stats .stat-card {
    padding: 0.8rem 1rem;
}
.price-stats .stat-card span {
    color: var(--gray-600);
    font-size: 0.82rem;
}
.price-stats .stat-card strong {
    font-size: 1.05rem;
}
@media (max-width: 980px) {
    .price-filter-form {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
}
@media (max-width: 700px) {
    .price-import-form,
    .price-filter-form,
    .price-csv-guide,
    .price-stats,
    .price-settings-grid {
        grid-template-columns: 1fr;
    }
    .price-codes-field {
        grid-column: span 1;
    }
    .price-card-title,
    .price-list-toolbar,
    .price-import-actions,
    .price-filter-actions,
    .price-output-actions,
    .price-csv-actions-row,
    .price-csv-guide-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .price-csv-actions-row span,
    .price-details summary small {
        margin-left: 0;
        margin-right: 0;
    }
}
.row-warning {
    background: #fffbeb;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}
.status-active {
    color: #166534;
    background: #dcfce7;
}
.status-limited,
.status-review {
    color: #92400e;
    background: #fef3c7;
}
.status-ended {
    color: #991b1b;
    background: #fee2e2;
}

.td-image img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.td-actions { white-space: nowrap; }

.no-image {
    width: 50px;
    height: 50px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--gray-500);
    border-radius: 4px;
}

/* タグ（PDF準拠: 4色ローテーション） */
.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    margin: 0.1rem;
}
.tag:nth-child(4n+1) { background: var(--tag-1-bg); color: var(--tag-1-text); }
.tag:nth-child(4n+2) { background: var(--tag-2-bg); color: var(--tag-2-text); }
.tag:nth-child(4n+3) { background: var(--tag-3-bg); color: var(--tag-3-text); }
.tag:nth-child(4n+4) { background: var(--tag-4-bg); color: var(--tag-4-text); }

.text-muted { color: var(--gray-500); }

.tag-color-settings {
    display: grid;
    gap: 0.75rem;
}

.tag-color-row {
    display: grid;
    grid-template-columns: 80px 140px 140px 96px;
    gap: 0.75rem;
    align-items: center;
}

.tag-color-label {
    font-weight: 600;
    color: var(--gray-700);
}

.tag-color-row label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
    font-size: 0.85rem;
}

.tag-color-row input[type="color"] {
    width: 48px;
    height: 34px;
    padding: 2px;
}

.tag-color-preview {
    width: 72px;
    margin: 0;
    text-align: center;
}

/* 商品グリッド（エディタ） */
.product-grid {
    display: grid;
    gap: 0.5rem;
    grid-auto-rows: var(--card-height);
    grid-auto-flow: dense;
}

.product-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
    --card-height: 488px;
    --name-area-height: 52px;
    --image-height: 240px;
    --info-height: 118px;
}
.product-grid.cols-2.layout-relaxed {
    --card-height: 690px;
    --image-height: 300px;
    --info-height: 260px;
}
.product-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
    --card-height: 378px;
    --name-area-height: 46px;
    --image-height: 160px;
    --info-height: 98px;
}
.product-grid.cols-3.layout-relaxed {
    --card-height: 470px;
    --image-height: 190px;
    --info-height: 170px;
}
.product-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
    --card-height: 322px;
    --name-area-height: 42px;
    --image-height: 120px;
    --info-height: 88px;
}
.product-grid.cols-4.layout-relaxed {
    --card-height: 382px;
    --image-height: 140px;
    --info-height: 140px;
}

/* colspan: 画像ブロックの幅拡張 */
.product-card.colspan-2 { grid-column: span 2; }
.product-card.colspan-3 { grid-column: span 3; }

.product-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s;
    height: var(--card-height);
}

.product-card.variant-expanded {
    grid-row: span 2;
    height: calc(var(--card-height) * 2 + 0.5rem);
}

.product-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* --- PDFレイアウト準拠カード --- */
/* PDF順序: 商品名 → 画像(+QR) → タグ → 説明 → 価格(右下固定) */

.product-card .product-name-area {
    padding: 0.3rem 0.5rem 0.15rem;
    height: var(--name-area-height);
    overflow: hidden;
}

.product-card .product-name {
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .product-image {
    height: var(--image-height);
    overflow: hidden;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.product-card .product-image img {
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.product-card .product-image .no-image {
    width: 100%;
    height: 100%;
    font-size: 0.9rem;
}

/* QRアイコン（PDF準拠: 画像右下） */
.product-card .qr-indicator {
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.85);
    border: 1px solid var(--gray-300);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    color: var(--gray-500);
}

.product-info {
    padding: 0.2rem 0.5rem 0.3rem;
    height: var(--info-height);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.product-card.variant-expanded .product-info {
    height: calc(var(--info-height) + var(--card-height));
}

.product-tags-wrap {
    display: flex;
    align-items: center;
    gap: 0.16rem;
    width: 100%;
    margin-bottom: 0.15rem;
}

.product-tags-wrap.is-cleared {
    display: none;
}

.product-tags {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.12rem;
    width: 100%;
}

.tag-edit-slot {
    position: relative;
    display: block;
    min-width: 0;
}

.product-tags .tag {
    display: block;
    min-width: 0;
    margin: 0;
    padding: 0.12rem 0.58rem 0.12rem 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.product-tags .tag-input {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 4px;
    font-family: inherit;
    appearance: none;
}

.product-tags .tag-edit-slot:nth-child(4n+1) .tag-input { background: var(--tag-1-bg); color: var(--tag-1-text); }
.product-tags .tag-edit-slot:nth-child(4n+2) .tag-input { background: var(--tag-2-bg); color: var(--tag-2-text); }
.product-tags .tag-edit-slot:nth-child(4n+3) .tag-input { background: var(--tag-3-bg); color: var(--tag-3-text); }
.product-tags .tag-edit-slot:nth-child(4n+4) .tag-input { background: var(--tag-4-bg); color: var(--tag-4-text); }

.product-tags .tag-input:hover,
.product-tags .tag-input:focus {
    border-color: var(--primary);
    outline: none;
}

.product-tags-editor.is-overridden .tag-input {
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.tag-delete-btn {
    position: absolute;
    top: 50%;
    right: 0.14rem;
    transform: translateY(-50%);
    width: 0.62rem;
    height: 0.62rem;
    border: 0;
    background: rgba(255, 255, 255, 0.72);
    color: var(--gray-500);
    border-radius: 50%;
    padding: 0;
    font-size: 0.52rem;
    line-height: 0.62rem;
    cursor: pointer;
}

.tag-delete-btn:hover {
    background: #fee2e2;
    color: var(--danger);
}

.product-desc,
.product-comment-editor {
    font-size: 0.72rem;
    color: var(--gray-500);
    line-height: 1.28;
}

.product-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-comment-editor {
    width: 100%;
    height: 2.32rem;
    min-height: 2.32rem;
    max-height: 2.32rem;
    padding: 0.15rem 0.2rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    resize: none;
    overflow: hidden;
    font-family: inherit;
    box-sizing: border-box;
}

.product-comment-editor:hover,
.product-comment-editor:focus {
    border-color: var(--primary);
    background: #fff;
    outline: none;
}

.product-comment-editor.is-overridden {
    color: var(--gray-800);
    background: #f8fafc;
}

.product-comment-editor.is-variant-comment {
    height: 1.35rem;
    min-height: 1.35rem;
    max-height: 1.35rem;
    margin-bottom: 0.1rem;
    white-space: nowrap;
}

.product-price {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gray-900);
    text-align: right;
    margin-top: auto;
    padding-top: 0.1rem;
}

.product-code {
    font-size: 0.68rem;
    color: var(--gray-400);
    margin-bottom: 0.15rem;
}

/* スペース・画像ブロックは高さ自動調整（行と揃う） */
.product-card.space-block,
.product-card.image-block {
    height: var(--card-height);
}

/* 画像ブロック内の画像: カード全体を使う */
.product-card.image-block .product-image {
    height: calc(var(--card-height) - 60px); /* top-bar + block-actions分を引く */
}

/* エディタ ツールバー（検索バーに統合済み） */

.product-count {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* 商品カード（共通） */
.product-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* カード上部バー（ドラッグハンドル・ID・削除） */
.card-top-bar {
    display: flex;
    align-items: center;
    padding: 0.3rem 0.5rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.75rem;
    gap: 0.4rem;
}

.drag-handle {
    cursor: grab;
    color: var(--gray-400);
    font-size: 1rem;
    user-select: none;
}

.drag-handle:active { cursor: grabbing; }

.card-id {
    color: var(--gray-500);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-ai-regenerate {
    border: 1px solid #fdba74;
    background: #fff7ed;
    color: #c2410c;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.68rem;
    line-height: 1;
    padding: 0.22rem 0.35rem;
    white-space: nowrap;
}

.card-ai-regenerate:hover {
    background: #ffedd5;
    border-color: #fb923c;
}

.card-ai-regenerate:disabled {
    cursor: wait;
    opacity: 0.65;
}

.product-card.ai-ng {
    border-color: #fca5a5;
    box-shadow: 0 0 0 1px #fecaca;
}

.card-ai-ng {
    border: 1px solid #fecaca;
    background: #fff;
    color: #dc2626;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.68rem;
    line-height: 1;
    padding: 0.22rem 0.35rem;
    white-space: nowrap;
}

.card-ai-ng.is-ng {
    background: #fee2e2;
    border-color: #dc2626;
    color: #991b1b;
    font-weight: 700;
}

.card-ai-mode {
    max-width: 70px;
    height: 1.45rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: #fff;
    color: var(--gray-600);
    font-size: 0.68rem;
    padding: 0 0.15rem;
}

.card-variant-mode {
    max-width: 58px;
    height: 1.45rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: #fff;
    color: var(--gray-700);
    font-size: 0.68rem;
    padding: 0 0.1rem;
}

.card-remove {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 0.2rem;
}

.card-remove:hover { color: var(--danger); }

/* ブロック下部アクションボタン（スペース・画像挿入） */
.block-actions {
    display: flex;
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
}

.block-action-btn {
    flex: 1;
    padding: 0.35rem;
    background: var(--gray-50);
    border: none;
    border-right: 1px solid var(--gray-200);
    font-size: 0.72rem;
    color: var(--gray-600);
    cursor: pointer;
    transition: background 0.1s;
}

.block-action-btn:last-child { border-right: none; }
.block-action-btn:hover { background: var(--gray-200); }

/* colspan選択ドロップダウン */
.colspan-selector {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.colspan-selector select {
    padding: 0.1rem 0.2rem;
    font-size: 0.7rem;
    border: 1px solid var(--gray-300);
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
}

/* スペースブロック */
.space-block {
    background: var(--gray-50);
}

.space-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: var(--gray-400);
    font-size: 0.85rem;
    flex: 1;
}

/* 画像ブロック */
.image-block .product-image img {
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

/* 商品コード */
.product-code {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.2rem;
}

/* 価格 */
.product-price {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-top: 0.2rem;
}

.catalog-variants {
    display: flex;
    flex-direction: column;
    gap: 0.06rem;
    min-height: 0;
    overflow: hidden;
    color: var(--gray-700);
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.24;
}

.product-card.variant-expanded .catalog-variants {
    gap: 0.1rem;
    font-size: 0.68rem;
    line-height: 1.32;
}

.variant-line {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.variant-line-note {
    color: var(--gray-500);
    font-size: 0.54rem;
    font-weight: 500;
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: var(--radius);
    width: 90%;
    max-width: 900px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
}

.modal iframe {
    flex: 1;
    border: none;
    width: 100%;
}

.preflight-modal-content {
    max-width: 760px;
    height: auto;
    max-height: 82vh;
}

.preflight-summary {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
}

.preflight-summary span {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.preflight-list {
    overflow: auto;
    padding: 0.75rem 1rem;
    max-height: 52vh;
}

.preflight-item {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
}

.preflight-item + .preflight-item {
    margin-top: 0.5rem;
}

.preflight-item--warn {
    border-color: #f59e0b;
    background: #fffbeb;
}

.preflight-item__type {
    color: var(--gray-700);
    font-weight: 700;
    font-size: 0.82rem;
}

.preflight-item__body {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.preflight-item__body strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preflight-item__body span {
    color: var(--gray-600);
    font-size: 0.82rem;
}

.preflight-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--gray-200);
}

/* インポート画面 */
.import-info {
    margin-bottom: 1.5rem;
}

.import-info h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.import-info p {
    font-size: 0.9rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
}

.info-table th,
.info-table td {
    padding: 0.4rem 0.75rem;
    text-align: left;
    border: 1px solid var(--gray-200);
    font-size: 0.85rem;
}

.info-table th { background: var(--gray-50); }

.import-form { margin-top: 1rem; }

.code-block {
    background: var(--gray-900);
    color: #e5e7eb;
    padding: 1rem;
    border-radius: var(--radius);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    margin-bottom: 0.75rem;
    white-space: pre;
}

/* 検索バー（EC-CUBE版スタイル） */
.search-bar {
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

.search-bar-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--gray-700);
}

.search-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.search-row select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.search-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-actions-right {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.btn-danger-outline {
    background: #fff;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger-outline:hover {
    background: #fee2e2;
}

/* CSV ダイレクト読み込みバー */
.csv-direct-collapsible {
    margin-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.csv-direct-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
}

.csv-direct-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    flex-wrap: wrap;
}

.csv-direct-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    white-space: nowrap;
}

.pdf-option-check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: #fff;
    color: var(--gray-700);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.pdf-option-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.45rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: #fff;
    color: var(--gray-700);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.pdf-option-inline select {
    min-width: 4.8rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

/* AIレイアウト補助 */
.ai-search-row {
    margin-top: 0.5rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--gray-200);
}

/* 検索履歴（折りたたみパネル内） */
.search-history-bar {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}

.history-icon {
    margin-right: 0.3rem;
}

.history-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-right: 0.5rem;
}

.history-entry {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.3rem 0;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--gray-100);
}

.history-entry:last-child {
    border-bottom: none;
}

.history-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.history-time {
    color: var(--gray-500);
}

.history-term {
    color: var(--gray-700);
}

.history-result {
    color: var(--primary);
}

/* レイアウト管理パネル → 折りたたみパネルに統合 */
.collapsible-panel {
    margin-bottom: 0.75rem;
    padding: 0;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--gray-700);
    user-select: none;
    transition: background 0.1s;
}

.collapsible-header:hover {
    background: var(--gray-50);
}

.collapsible-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.collapsible-arrow {
    font-size: 0.7rem;
    color: var(--gray-400);
    transition: transform 0.15s;
}

.history-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
}

.collapsible-body {
    border-top: 1px solid var(--gray-200);
    padding: 0.75rem 1rem;
}

.tools-section {
    margin-bottom: 0.75rem;
}

.tools-section:last-child {
    margin-bottom: 0;
}

.tools-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--gray-100);
}

.layout-panel {
    margin-bottom: 0.75rem;
    padding: 1rem 1.25rem;
}

.layout-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.layout-count {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: normal;
}

.layout-row {
    display: flex;
    gap: 1.5rem;
}

.layout-section {
    flex: 1;
}

.layout-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.4rem;
}

.layout-inline {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.layout-input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.layout-input:focus {
    outline: none;
    border-color: var(--primary);
}

.ai-prompt-textarea {
    min-height: 6.5rem;
    resize: vertical;
    line-height: 1.55;
}

.layout-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.layout-backup {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.ai-prompt-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.ai-prompt-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ai-prompt-inline input {
    flex: 1;
}

.ai-prompt-settings-panel {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--gray-50);
}

.ai-prompt-panel-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.ai-prompt-panel-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 1rem;
}

.ai-prompt-panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.ai-prompt-section {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--gray-50);
}

.ai-prompt-section h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.model-product-picker-content {
    max-width: 760px;
    height: auto;
    max-height: 82vh;
}

.model-product-picker-body {
    padding: 1rem;
    overflow: auto;
}

.model-product-picker-search {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.model-product-picker-status {
    margin: 0.8rem 0 0.5rem;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.model-product-picker-results {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.model-product-picker-item {
    display: grid;
    grid-template-columns: 8.5rem minmax(0, 1fr);
    gap: 0.25rem 0.7rem;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
    color: var(--gray-800);
    text-align: left;
    cursor: pointer;
}

.model-product-picker-item:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.model-product-picker-code {
    font-weight: 700;
    color: var(--gray-900);
}

.model-product-picker-name {
    font-weight: 600;
    color: var(--gray-900);
}

.model-product-picker-tags,
.model-product-picker-description {
    grid-column: 2;
    font-size: 0.78rem;
    color: var(--gray-600);
}

.model-text-candidates-content {
    max-width: 820px;
    height: auto;
    max-height: 82vh;
}

.model-text-candidates-body {
    padding: 1rem;
    overflow: auto;
}

.model-text-candidates-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.model-text-candidate {
    padding: 0.9rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
}

.model-text-candidate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.model-text-candidate p {
    margin: 0;
    color: var(--gray-900);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.6;
}

.model-text-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.6rem;
}

.model-text-tag {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 0.78rem;
    font-weight: 700;
}

.ai-saved-model-preview {
    margin-top: 1rem;
    padding: 0.9rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--gray-50);
}

.ai-saved-model-preview-title {
    margin-bottom: 0.65rem;
    color: var(--gray-700);
    font-weight: 800;
}

.saved-model-card {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
    align-items: stretch;
    padding: 0.8rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
}

.saved-model-image {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: #fff;
    overflow: hidden;
}

.saved-model-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.saved-model-no-image {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.saved-model-code {
    color: var(--gray-500);
    font-size: 0.8rem;
    font-weight: 700;
}

.saved-model-name {
    margin-top: 0.2rem;
    color: var(--gray-900);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.35;
}

.saved-model-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.55rem;
}

.saved-model-text {
    margin-top: 0.65rem;
    color: var(--gray-800);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.55;
}

.grid-model-select {
    min-width: 160px;
    max-width: 260px;
}

.ai-target-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
}

.ai-target-row + .ai-target-row {
    margin-top: 0.5rem;
}

.ai-target-row select {
    max-width: 120px;
}

.ai-viewpoint-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-viewpoint-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
}

.ai-viewpoint-row select {
    max-width: 120px;
}

.ai-reference-section {
    margin-top: 1rem;
    max-width: 980px;
}

.ai-reference-section label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
}

.ai-reference-textarea {
    width: 100%;
    min-height: 7.5rem;
    resize: vertical;
    line-height: 1.65;
    font-size: 0.95rem;
}

@media (max-width: 960px) {
    .model-text-candidates-list {
        grid-template-columns: 1fr;
    }
    .saved-model-card {
        grid-template-columns: 1fr;
    }
    .saved-model-image {
        height: 180px;
    }
}

/* グリッドヘッダー */
.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
}

.grid-action-bar {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.grid-action-section,
.grid-action-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.grid-action-section {
    align-items: stretch;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.grid-action-section--ai {
    flex: 1 1 360px;
    max-width: 560px;
}

.grid-action-section--layout {
    flex: 0 1 390px;
}

.grid-action-section--sort {
    flex: 0 1 360px;
}

.grid-action-section--review {
    flex: 0 0 auto;
}

.grid-action-section:last-child {
    border-right: 1px solid var(--gray-200);
}

.grid-action-separator {
    width: 1px;
    height: 1.8rem;
    background: var(--gray-300);
    margin: 0 0.25rem;
    flex: 0 0 auto;
}

.grid-action-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    font-weight: 600;
    white-space: nowrap;
}

.grid-action-section-title {
    font-size: 0.78rem;
    line-height: 1;
    color: var(--gray-600);
    font-weight: 800;
    white-space: nowrap;
}

.grid-action-controls {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.grid-action-section--ai .grid-action-controls {
    flex-wrap: nowrap;
}

.grid-action-section--ai .grid-model-select {
    flex: 1 1 auto;
    min-width: 12rem;
}

.grid-action-field {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
}

.grid-action-field > span {
    color: var(--gray-500);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.grid-action-bar .btn-sm {
    min-height: 2.15rem;
    white-space: nowrap;
    flex: 0 0 auto;
}

.grid-action-section--layout {
    order: 2;
}

.grid-action-section--ai {
    order: 1;
}

.grid-action-section--review {
    order: 4;
}

.grid-action-section--sort {
    order: 3;
}

.grid-view-links {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--gray-500);
    font-size: 0.82rem;
    font-weight: 500;
}

.view-link {
    border: none;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 600;
    padding: 0.1rem 0.15rem;
    cursor: pointer;
}

.view-link.active {
    color: var(--gray-900);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.col-select-inline {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.82rem;
    background: #fff;
    cursor: pointer;
}

.density-toggle {
    display: inline-flex;
    gap: 0.25rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--gray-100);
    padding: 0.2rem;
}

.density-toggle-btn {
    min-height: 2.05rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: calc(var(--radius) - 2px);
    background: #fff !important;
    color: var(--gray-700) !important;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
}

.density-toggle-btn:last-child {
    border-right: 0;
}

.density-toggle-btn.active {
    background: var(--gray-700) !important;
    border-color: var(--gray-700);
    color: #fff !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
}

.view-btn {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}

.view-btn.active {
    background: var(--gray-700);
    color: #fff;
    border-color: var(--gray-700);
}

/* リスト表示 */
.product-list-view {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.85rem;
    background: #fff;
    cursor: grab;
    transition: background 0.1s;
}

.list-item:active { cursor: grabbing; }

.list-item:last-child {
    border-bottom: none;
}

.list-item.sortable-ghost {
    opacity: 0.3;
    border: 2px dashed var(--primary);
}

.list-item.sortable-chosen {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10;
}

.list-item-thumb {
    width: 36px;
    height: 36px;
    border-radius: 3px;
    object-fit: cover;
    background: var(--gray-100);
    flex-shrink: 0;
}

.list-item-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.list-check {
    flex-shrink: 0;
}

.list-handle {
    color: var(--gray-400);
    cursor: grab;
    flex-shrink: 0;
}

.list-name {
    flex: 1;
    font-weight: 600;
}

.list-code {
    color: var(--gray-500);
    font-size: 0.8rem;
}

/* SortableJS */
.sortable-ghost {
    opacity: 0.3;
    border: 2px dashed var(--primary);
}

.sortable-chosen {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.sortable-drag {
    opacity: 0.9;
}

/* 空の状態 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

.empty-state a { color: var(--primary); }

/* PDF生成プログレス */
.pdf-progress {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.pdf-progress.hidden { display: none; }

/* 表紙・裏表紙グリッド（3列×2行） */
.cover-pages-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
@media (max-width: 768px) {
    .cover-pages-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .cover-pages-grid { grid-template-columns: 1fr; }
}
.cover-page-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.75rem;
    background: var(--gray-50);
}
.cover-page-label {
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.cover-preview {
    width: 100%;
    height: 120px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    display: block;
}
.cover-placeholder {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px dashed var(--gray-300);
    border-radius: 4px;
    color: var(--gray-400);
    font-size: 0.85rem;
}
.cover-page-item .upload-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.cover-page-item .upload-inline input[type="file"] {
    flex: 1;
    min-width: 0;
}
.cover-page-item .upload-inline .btn {
    white-space: nowrap;
    writing-mode: horizontal-tb;
}

/* 印刷用PDFボタン（Premium以上） */
.btn-print {
    background: #1e293b;
    color: #fff;
    border: 1px solid #1e293b;
}
.btn-print:hover { background: #0f172a; }

/* 解像度警告バナー */
.resolution-warning {
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}
.resolution-warning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.5rem;
}
.resolution-warning-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #92400e;
    font-size: 1rem;
    padding: 0 0.25rem;
}
.resolution-warning-list {
    margin: 0 0 0.75rem 1.25rem;
    padding: 0;
    font-size: 0.85rem;
    color: #78350f;
}
.resolution-warning-list li { margin-bottom: 0.2rem; }
.resolution-warning-footer { text-align: right; }

.pdf-progress-box {
    background: #fff;
    border-radius: 12px;
    padding: 2rem 2.5rem;
    text-align: center;
    min-width: 280px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.ai-progress-box {
    min-width: 320px;
    padding: 2.2rem 2.8rem;
}

.ai-progress .pdf-progress-text {
    font-size: 1.15rem;
    margin-bottom: 0.55rem;
}

.pdf-progress-spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 0.8s linear infinite;
}

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

.pdf-progress-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
}

.pdf-progress-bar-wrap {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.pdf-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.pdf-progress-detail {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* プランバッジ */
.plan-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.plan-free { background: var(--gray-200); color: var(--gray-600); }
.plan-pro { background: #fef3c7; color: #92400e; }
.plan-admin { background: #dbeafe; color: #1e40af; }

/* 管理者ダッシュボード */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.stat-label { font-size: 0.8rem; color: var(--gray-500); margin-bottom: 0.3rem; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--gray-800); line-height: 1.1; }
.stat-detail { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.3rem; }

/* バーチャート */
.chart-bar { display: flex; align-items: flex-end; gap: 0.4rem; padding: 1rem 0; min-height: 160px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.chart-bar-value { font-size: 0.7rem; color: var(--gray-500); margin-bottom: 0.2rem; }
.chart-bar-fill { width: 100%; max-width: 40px; background: var(--primary); border-radius: 2px 2px 0 0; min-height: 2px; }
.chart-bar-label { font-size: 0.65rem; color: var(--gray-500); margin-top: 0.3rem; }

/* ユーザーテーブル */
.user-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.user-table th { text-align: left; padding: 0.6rem 0.75rem; background: var(--gray-50); border-bottom: 2px solid var(--gray-200); font-size: 0.8rem; color: var(--gray-600); }
.user-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--gray-100); }
.plan-select { padding: 0.25rem 0.4rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 0.8rem; }

/* アクティビティログ */
.activity-list { max-height: 400px; overflow-y: auto; }
.activity-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--gray-100); font-size: 0.8rem; }
.activity-time { color: var(--gray-500); white-space: nowrap; width: 80px; flex-shrink: 0; }
.activity-user { font-weight: 600; width: 80px; flex-shrink: 0; }
.activity-action { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.7rem; white-space: nowrap; }
.badge-pdf { background: #dbeafe; color: #1e40af; }
.badge-csv { background: #d1fae5; color: #065f46; }
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-login { background: var(--gray-100); color: var(--gray-600); }
.activity-detail { color: var(--gray-500); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 設定画面 */
.url-fields { margin-top: 0.5rem; }

.form-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.2rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.image-selector {
    margin-top: 0.5rem;
}

.image-current {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.image-current label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    white-space: nowrap;
}

.preview-img {
    max-width: 200px;
    max-height: 40px;
    border: 1px solid var(--gray-200);
    border-radius: 3px;
}

.current-path {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.no-selection {
    font-size: 0.85rem;
    color: var(--gray-400);
}

.image-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.upload-inline {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.config-save-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
    margin: 1rem -1.5rem -1.5rem;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

/* ユーティリティ */
.hidden { display: none !important; }

/* スマホ用PC推奨バナー（PCでは非表示） */
.mobile-notice {
    display: none;
}

@media (max-width: 768px) {
    .mobile-notice {
        display: block;
        background: #eff6ff;
        border: 1px solid #bfdbfe;
        border-radius: var(--radius);
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
    }

    .mobile-notice-content {
        display: flex;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .mobile-notice-content span:first-child {
        font-size: 1.5rem;
        flex-shrink: 0;
    }

    .mobile-notice-content p {
        font-size: 0.78rem;
        color: var(--gray-600);
        margin: 0.2rem 0 0;
    }

    .mobile-notice-content strong {
        font-size: 0.85rem;
        color: var(--gray-800);
    }
}

/* レスポンシブ */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .nav-links { flex-wrap: wrap; gap: 0.5rem; }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .form-grid { grid-template-columns: 1fr; }

    .search-row {
        flex-direction: column;
    }

    .search-actions {
        flex-direction: column;
    }

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

    .search-actions .btn {
        width: 100%;
        text-align: center;
    }

    .layout-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .layout-inline {
        flex-wrap: wrap;
    }

    .grid-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .product-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
    .product-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

    /* スマホ: 選択した列数を維持、文字極小で画像メイン */
    .product-grid {
        gap: 3px;
    }

    .product-grid.cols-2 {
        --card-height: 280px;
        --name-area-height: 34px;
        --image-height: 160px;
        --info-height: 50px;
    }
    .product-grid.cols-2.layout-relaxed {
        --card-height: 390px;
        --image-height: 190px;
        --info-height: 140px;
    }
    .product-grid.cols-3 {
        --card-height: 220px;
        --name-area-height: 32px;
        --image-height: 110px;
        --info-height: 38px;
    }
    .product-grid.cols-3.layout-relaxed {
        --card-height: 285px;
        --image-height: 130px;
        --info-height: 90px;
    }
    .product-grid.cols-4 {
        --card-height: 195px;
        --name-area-height: 32px;
        --image-height: 90px;
        --info-height: 30px;
    }
    .product-grid.cols-4.layout-relaxed {
        --card-height: 245px;
        --image-height: 105px;
        --info-height: 70px;
    }

    .product-card .product-name-area {
        padding: 0.15rem 0.3rem 0.1rem;
    }

    .product-card .product-name {
        font-size: 0.55rem;
        line-height: 1.2;
        -webkit-line-clamp: 2;
    }

    /* top-bar: ドラッグハンドルのタップ領域を拡大 */
    .card-top-bar {
        padding: 0;
        font-size: 0.5rem;
        gap: 0;
    }
    .card-top-bar .card-id { display: none; }
    .drag-handle {
        font-size: 1rem;
        min-width: 44px;
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: grab;
    }
    .card-remove {
        font-size: 0.8rem;
        min-width: 36px;
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
    }

    /* info: 極小化 */
    .product-info {
        padding: 0.1rem 0.3rem 0.15rem;
    }
    .product-tags .tag {
        font-size: 0.45rem;
        padding: 0.05rem 0.25rem;
    }
    .product-desc {
        font-size: 0.45rem;
        -webkit-line-clamp: 1;
    }
    .product-comment-editor {
        min-height: 1.6em;
        font-size: 0.45rem;
        line-height: 1.15;
        padding: 0.02rem 0.1rem;
    }
    .product-price {
        font-size: 0.55rem;
    }

    /* QR indicator 小さく */
    .product-card .qr-indicator {
        width: 14px;
        height: 14px;
        font-size: 0.4rem;
    }

    /* block-actions: スマホでは縦並び */
    .block-actions {
        flex-direction: column;
    }
    .block-action-btn {
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        font-size: 0.55rem;
        padding: 0.25rem;
    }
    .block-action-btn:last-child { border-bottom: none; }

    /* colspan: スマホでも維持 */
    .product-card.colspan-2 { grid-column: span 2; }
    .product-card.colspan-3 { grid-column: span 3; }

    /* スペース・画像ブロック */
    .product-card.image-block .product-image {
        height: calc(var(--card-height) - 30px);
    }
    .space-label { font-size: 0.6rem; }

    /* PC推奨バナーを非表示（列数が正しく表示されるため不要に） */
    .mobile-notice { display: none; }
}

/* ========================================
   ヘルプ
   ======================================== */
.help-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.help-header {
    align-items: flex-start;
}

.help-search-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    display: grid;
    grid-template-columns: auto minmax(260px, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
}

.help-search-card label {
    font-weight: 700;
    color: var(--gray-700);
}

.help-search-card input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
}

.help-search-meta {
    color: var(--gray-500);
    font-size: 0.9rem;
    white-space: nowrap;
}

.help-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
    align-items: start;
}

.help-toc {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.75rem;
    position: sticky;
    top: 72px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.help-filter {
    border: 1px solid transparent;
    background: transparent;
    color: var(--gray-700);
    border-radius: var(--radius);
    padding: 0.65rem 0.75rem;
    text-align: left;
    font-weight: 700;
    cursor: pointer;
}

.help-filter:hover {
    background: var(--gray-50);
}

.help-filter.active {
    color: var(--primary);
    background: #eff6ff;
    border-color: #bfdbfe;
}

.help-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.help-item {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
}

.help-item.hidden {
    display: none;
}

.help-item__tag {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.55rem;
}

.help-item h2 {
    font-size: 1.05rem;
    margin-bottom: 0.55rem;
}

.help-item p,
.help-item li {
    color: var(--gray-700);
    font-size: 0.92rem;
}

.help-item ol,
.help-item ul {
    padding-left: 1.25rem;
    margin: 0.35rem 0 0.6rem;
}

.help-item strong {
    color: var(--gray-900);
}

@media (max-width: 900px) {
    .help-search-card {
        grid-template-columns: 1fr;
    }

    .help-layout {
        grid-template-columns: 1fr;
    }

    .help-toc {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .help-filter {
        flex: 1 1 auto;
        text-align: center;
    }

    .help-list {
        grid-template-columns: 1fr;
    }
}

/* Flerute+ estimate PDF editor */
.estimate-page { max-width: 1080px; margin: 0 auto; }
.proposal-brand { color:#075db7; font-weight:800; text-decoration:none; font-size:1rem; }
.estimate-hero { display:flex; justify-content:space-between; gap:2rem; align-items:center; padding:1.8rem; margin-bottom:1.2rem; color:#fff; border-radius:16px; background:linear-gradient(135deg,#075db7,#009cad); }
.estimate-hero h1 { margin:.2rem 0 .45rem; font-size:clamp(1.5rem,3vw,2.2rem); }
.estimate-hero p { margin:0; }
.estimate-eyebrow { font-size:.78rem; font-weight:800; letter-spacing:.12em; text-transform:uppercase; opacity:.82; }
.estimate-total-card { min-width:190px; padding:1rem 1.2rem; border-radius:12px; background:rgba(255,255,255,.16); text-align:right; }
.estimate-total-card span,.estimate-total-card strong { display:block; }
.estimate-total-card strong { margin-top:.25rem; font-size:1.55rem; }
.estimate-total-card small { display:block; margin-top:.45rem; opacity:.9; }
.estimate-toolbar { display:flex; justify-content:space-between; align-items:end; gap:1rem; padding:1rem 1.2rem; margin-bottom:1rem; background:#fff; border:1px solid var(--gray-200); border-radius:10px; }
.estimate-toolbar label,.estimate-fields label,.estimate-copy-grid label { display:grid; gap:.35rem; font-weight:700; color:var(--gray-800); }
.estimate-toolbar select { min-width:150px; }
.estimate-toolbar span { color:var(--gray-600); font-size:.9rem; }
.estimate-section { margin-bottom:1rem; padding:1.2rem; background:#fff; border:1px solid var(--gray-200); border-radius:12px; }
.estimate-section__head { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1rem; }
.estimate-section__head > div { display:flex; align-items:center; gap:.65rem; }
.estimate-section__head h2 { margin:0; font-size:1.15rem; color:var(--gray-900); }
.estimate-section__head p { margin:0; color:var(--gray-600); font-size:.85rem; }
.estimate-step-number { display:grid; place-items:center; width:30px; height:30px; border-radius:50%; background:#075db7; color:#fff; font-weight:800; }
.estimate-products-heading { margin:1.4rem .2rem .7rem; }
.estimate-cover-grid { display:grid; grid-template-columns:240px 1fr; gap:1.3rem; align-items:start; }
.estimate-cover-preview { position:relative; width:100%; aspect-ratio:210/297; overflow:hidden; color:#fff; background:radial-gradient(circle at 18% 15%,rgba(123,220,237,.44) 0 9%,transparent 10%),radial-gradient(circle at 88% 28%,rgba(89,201,223,.34) 0 15%,transparent 16%),radial-gradient(circle at 62% 86%,rgba(66,190,218,.25) 0 9%,transparent 10%),linear-gradient(180deg,#eaffff,#dff8fc 55%,#c9eef5); box-shadow:0 7px 22px rgba(15,23,42,.2); }
.estimate-cover-preview > img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.estimate-cover-preview__brand { position:absolute; z-index:1; top:17%; left:7%; right:7%; display:grid; gap:.2rem; color:#111827; text-align:center; }
.estimate-cover-preview__brand strong { font-size:1.05rem; }
.estimate-cover-preview__brand span { font-size:.42rem; }
.estimate-cover-preview__brand b { margin-top:.35rem; color:#075db7; font-size:.85rem; }
.estimate-cover-preview[data-brand-embedded="1"] .estimate-cover-preview__brand { display:none; }
.estimate-cover-preview__copy { position:absolute; z-index:1; left:10.48%; width:73.33%; height:30.3%; bottom:10.1%; box-sizing:border-box; padding:3.8% 5.7%; background:rgba(5,24,48,.74); color:#fff; transition:.2s; }
.estimate-cover-preview__copy strong { display:block; line-height:1.4; }
.estimate-cover-preview__recipient { position:absolute; left:7.8%; right:7.8%; top:36%; display:block; margin:0; line-height:1.35; }
.estimate-cover-preview__details { position:absolute; left:7.8%; right:7.8%; bottom:9%; display:flex; flex-direction:column; gap:4%; }
.estimate-cover-preview__details span,.estimate-cover-preview__details small { display:block; margin:0; line-height:1.35; }
.estimate-cover-preview[data-position="top"] .estimate-cover-preview__copy { top:13.47%; bottom:auto; }
.estimate-cover-preview[data-position="center"] .estimate-cover-preview__copy { top:50%; bottom:auto; transform:translateY(-50%); }
.estimate-cover-preview[data-position="bottom_right"] .estimate-cover-preview__copy { left:16.19%; }
.estimate-cover-preview[data-overlay="light"] .estimate-cover-preview__copy { color:#172033; background:rgba(255,255,255,.84); }
.estimate-cover-preview[data-overlay="none"] .estimate-cover-preview__copy { background:transparent; }
.estimate-cover-fields { display:grid; gap:.75rem; }
.estimate-cover-fields label,.estimate-style-controls label { display:grid; gap:.35rem; color:var(--gray-800); font-size:.85rem; font-weight:700; }
.estimate-cover-fields input,.estimate-cover-fields select,.estimate-style-controls select { width:100%; min-height:42px; padding:.6rem .7rem; border:1px solid var(--gray-300); border-radius:7px; background:#fff; }
.estimate-cover-upload > input { position:absolute; width:1px; height:1px; opacity:0; }
.estimate-cover-upload > span,.estimate-cover-upload > button { display:inline-flex; justify-content:center; padding:.65rem; border:1px solid #075db7; border-radius:7px; color:#075db7; background:#fff; cursor:pointer; font:inherit; }
.estimate-cover-upload > button { border-color:var(--gray-300); color:var(--gray-700); }
.estimate-cover-type-settings { display:grid; gap:.75rem; margin-top:.35rem; padding:1rem; border:1px solid #bae6fd; border-radius:10px; background:#f0f9ff; }
.estimate-cover-type-settings h3 { margin:0; color:#075db7; font-size:1rem; }
.estimate-cover-type-row { display:grid; grid-template-columns:1.5fr 1.1fr .8fr 1.25fr .75fr; gap:.55rem; align-items:end; padding-top:.65rem; border-top:1px solid #d5e9f5; }
.estimate-cover-type-row > strong { align-self:center; font-size:.82rem; }
.estimate-cover-type-row label,.estimate-cover-align { display:grid; gap:.3rem; font-size:.75rem; font-weight:700; }
.estimate-cover-type-row select,.estimate-cover-type-row input[type="number"],.estimate-cover-align select { width:100%; min-height:40px; padding:.5rem; border:1px solid var(--gray-300); border-radius:7px; background:#fff; }
.estimate-cover-type-row .estimate-color-control { min-height:40px; background:#fff; }
.estimate-cover-type-row .estimate-check { min-height:40px; background:#fff; }
.estimate-managed-cover-note { display:flex; gap:.7rem; align-items:center; padding:.75rem; border-radius:8px; background:#eef6ff; color:#164e84; }
.estimate-managed-cover-note span { font-size:.8rem; }
.estimate-product-type-settings { display:grid; gap:.7rem; }
.estimate-product-font { max-width:280px; display:grid; gap:.35rem; font-size:.85rem; font-weight:700; }
.estimate-product-font select { min-height:42px; padding:.6rem .7rem; border:1px solid var(--gray-300); border-radius:7px; background:#fff; }
.estimate-product-type-row { display:grid; grid-template-columns:1.5fr .8fr 1.25fr .75fr 1fr; gap:.6rem; align-items:end; padding:.75rem; border:1px solid #dbe7ef; border-radius:9px; background:#f8fbfd; }
.estimate-product-type-row > strong { align-self:center; font-size:.86rem; }
.estimate-product-type-row label { display:grid; gap:.3rem; font-size:.75rem; font-weight:700; }
.estimate-product-type-row select,.estimate-product-type-row input[type="number"] { width:100%; min-height:40px; padding:.5rem; border:1px solid var(--gray-300); border-radius:7px; background:#fff; }
.estimate-product-type-row .estimate-check,.estimate-product-type-row .estimate-color-control { min-height:40px; background:#fff; }
.estimate-admin-cover-form { display:grid; gap:.8rem; min-width:min(100%,620px); }
.estimate-admin-cover-form > label { display:grid; gap:.35rem; font-weight:700; }
.estimate-admin-cover-form input[type="file"],.estimate-admin-cover-form input[type="text"],.estimate-admin-cover-form input:not([type]) { width:100%; min-height:42px; padding:.6rem .7rem; border:1px solid var(--gray-300); border-radius:7px; }
.estimate-admin-cover-fields { display:grid; gap:.7rem; }
.estimate-admin-cover-fields label { display:grid; gap:.3rem; font-size:.8rem; font-weight:700; }
.estimate-admin-cover-type-row { display:grid; grid-template-columns:2fr .65fr 1.2fr .65fr; gap:.6rem; align-items:end; padding:.75rem; border:1px solid var(--gray-200); border-radius:9px; background:#f8fbfd; }
.estimate-admin-cover-type-row input[type="number"] { width:100%; min-height:42px; padding:.6rem; border:1px solid var(--gray-300); border-radius:7px; }
.estimate-admin-cover-type-row .estimate-check { min-height:42px; background:#fff; }
.estimate-admin-cover-check { display:flex!important; grid-template-columns:none!important; }
.estimate-inline-style-block { display:grid; gap:.75rem; margin:1rem 0 1.4rem; padding:1rem; border:1px solid #cfe1ee; border-radius:11px; background:#fff; }
.estimate-inline-style-block h3 { margin:0; color:#075db7; font-size:1rem; }
.estimate-appearance-row { display:grid; grid-template-columns:2fr 1fr; gap:.7rem; padding-bottom:.75rem; border-bottom:1px solid var(--gray-200); }
.estimate-appearance-row label { display:grid; gap:.3rem; font-size:.78rem; font-weight:700; }
.estimate-appearance-row input[type="number"] { width:100%; min-height:42px; padding:.55rem; border:1px solid var(--gray-300); border-radius:7px; background:#fff; }
.estimate-footer-appearance { padding-top:.75rem; padding-bottom:0; border-top:1px solid var(--gray-200); border-bottom:0; }
.estimate-admin-cover-form textarea { width:100%; padding:.7rem; border:1px solid var(--gray-300); border-radius:7px; resize:vertical; }
.estimate-cover-align { width:min(100%,260px); }
.estimate-style-controls { display:grid; grid-template-columns:1.2fr 1fr 1.4fr .75fr 1fr; gap:.8rem; align-items:end; }
.estimate-color-control { display:flex; align-items:center; gap:.55rem; min-height:42px; padding:.35rem .6rem; border:1px solid var(--gray-300); border-radius:7px; }
.estimate-color-control input { width:42px; height:29px; padding:0; border:0; background:transparent; }
.estimate-color-control output { font-size:.75rem; color:var(--gray-600); }
.estimate-check { display:flex !important; align-items:center; gap:.45rem; min-height:42px; padding:.6rem .7rem; border:1px solid var(--gray-300); border-radius:7px; }
.estimate-check input { width:20px; height:20px; }
.estimate-items { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.estimate-item { display:grid; grid-template-columns:150px 1fr; gap:1rem; padding:1rem; background:#fff; border:1px solid #bfdbfe; border-radius:12px; box-shadow:var(--shadow); }
.estimate-photo { position:relative; min-height:170px; border:2px dashed #93c5fd; border-radius:10px; overflow:hidden; background:#eff6ff; }
.estimate-photo img { width:100%; height:100%; object-fit:contain; background:#fff; }
.estimate-photo label { position:absolute; inset:auto .55rem .55rem; padding:.55rem; border-radius:8px; background:rgba(7,93,183,.92); color:#fff; text-align:center; cursor:pointer; font-weight:700; }
.estimate-photo input { position:absolute; width:1px; height:1px; opacity:0; }
.estimate-fields h2 { margin:0 0 .6rem; font-size:1.05rem; color:#075db7; }
.silhouette-picker { margin:0 0 .8rem; padding:0; border:0; }
.silhouette-picker legend { margin-bottom:.4rem; color:var(--gray-600); font-size:.78rem; font-weight:700; }
.silhouette-picker { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.35rem; }
.silhouette-picker legend { grid-column:1/-1; }
.silhouette-picker label { position:relative; cursor:pointer; }
.silhouette-picker input { position:absolute; width:1px; height:1px; opacity:0; }
.silhouette-picker span { display:grid; place-items:center; gap:.15rem; min-height:58px; padding:.3rem; border:1px solid var(--gray-200); border-radius:7px; color:#168fc4; background:#fff; }
.silhouette-picker svg { width:30px; height:30px; fill:none; stroke:currentColor; stroke-width:4; stroke-linecap:round; }
.silhouette-picker svg .is-filled { fill:currentColor; }
.silhouette-picker input:checked + span { border:2px solid #075db7; background:#eff6ff; }
.silhouette-picker small { color:var(--gray-700); font-size:.62rem; line-height:1; }
.estimate-fields input,.estimate-fields textarea,.estimate-copy-grid textarea,.estimate-toolbar select { width:100%; padding:.65rem .75rem; border:1px solid var(--gray-300); border-radius:7px; background:#fff; }
.estimate-fields textarea { resize:vertical; min-height:58px; }
.estimate-fields .silhouette-picker input { width:1px; height:1px; min-height:0; padding:0; border:0; }
.estimate-number-row { display:grid; grid-template-columns:1fr 1fr; gap:.65rem; margin-top:.65rem; }
.estimate-subtotal { margin:.7rem 0 0; text-align:right; color:var(--gray-600); }
.estimate-subtotal strong { color:#075db7; font-size:1.12rem; }
.estimate-copy-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem; margin-top:1rem; }
.estimate-copy-grid label { padding:1rem; background:#fff; border:1px solid var(--gray-200); border-radius:10px; }
.estimate-copy-grid textarea { resize:vertical; font:inherit; }
.estimate-page { padding-bottom:100px; }
.estimate-work-tabs { position:sticky; top:0; z-index:18; display:flex; gap:.45rem; margin:0 0 1rem; padding:.55rem; overflow-x:auto; border:1px solid #bfdbfe; border-radius:12px; background:rgba(255,255,255,.96); box-shadow:0 8px 24px rgba(15,23,42,.08); scrollbar-width:thin; }
.estimate-work-tab { display:flex; flex:1 0 150px; align-items:center; justify-content:center; gap:.45rem; min-height:48px; padding:.65rem .8rem; border:1px solid transparent; border-radius:8px; color:var(--gray-700); background:transparent; font:inherit; font-weight:800; white-space:nowrap; cursor:pointer; }
.estimate-work-tab span { display:grid; width:25px; height:25px; place-items:center; border-radius:50%; color:#075db7; background:#dbeafe; font-size:.78rem; }
.estimate-work-tab.is-active { color:#fff; background:#075db7; box-shadow:0 5px 14px rgba(7,93,183,.22); }
.estimate-work-tab.is-active span { color:#075db7; background:#fff; }
.estimate-work-tab:focus-visible { outline:3px solid #38bdf8; outline-offset:2px; }
.estimate-tab-panel[hidden] { display:none !important; }
.estimate-tab-panel.is-active { animation:estimate-tab-enter .16s ease-out; }
@keyframes estimate-tab-enter { from { opacity:.45; transform:translateY(3px); } to { opacity:1; transform:none; } }
.estimate-actions { position:fixed; z-index:40; left:0; right:0; bottom:0; display:flex; align-items:center; justify-content:center; gap:.7rem; min-height:76px; margin:0; padding:.75rem max(1rem,calc((100vw - 1180px)/2)); border-top:1px solid #bfdbfe; background:rgba(255,255,255,.97); box-shadow:0 -8px 28px rgba(15,23,42,.12); backdrop-filter:blur(8px); }
.estimate-actions .btn { min-width:190px; white-space:nowrap; }
#estimate-status { margin:0; color:var(--gray-700); }
.estimate-resolution,.estimate-print-job { margin:1rem 0 2rem; padding:1rem; border:1px solid var(--gray-200); border-radius:12px; background:#fff; }
.estimate-resolution[hidden],.estimate-print-job[hidden],.estimate-print-download[hidden] { display:none !important; }
.estimate-resolution__head { display:flex; align-items:baseline; justify-content:space-between; gap:1rem; }
.estimate-resolution__head h2 { margin:0; font-size:1.05rem; }
.estimate-resolution__head span { color:var(--gray-600); font-size:.82rem; }
.estimate-resolution ul { display:grid; gap:.55rem; padding:0; margin:1rem 0 0; list-style:none; }
.estimate-resolution li { display:grid; grid-template-columns:1fr auto; gap:.2rem 1rem; padding:.75rem .9rem; border-left:5px solid var(--gray-400); border-radius:7px; background:var(--gray-50); }
.estimate-resolution li.is-good { border-color:#16a34a; background:#f0fdf4; }
.estimate-resolution li.is-warning { border-color:#d97706; background:#fffbeb; }
.estimate-resolution li.is-poor { border-color:#dc2626; background:#fef2f2; }
.estimate-resolution li small { grid-column:1/-1; color:var(--gray-600); }
.estimate-print-job { display:flex; align-items:center; gap:1rem; border-color:#bae6fd; background:#f0f9ff; }
.estimate-print-job .btn { margin-left:auto; }
.pdf-preview-panel { margin:1rem 0 2rem; padding:1rem; border:1px solid #bfdbfe; border-radius:12px; background:#fff; }
.pdf-preview-panel__head { display:flex; align-items:baseline; justify-content:space-between; gap:1rem; margin-bottom:.75rem; }
.pdf-preview-panel__head h2 { margin:0; font-size:1.1rem; }
.pdf-preview-panel__head span { color:var(--gray-600); font-size:.85rem; }
.pdf-preview-panel iframe { width:100%; height:min(76vh,820px); border:1px solid var(--gray-200); border-radius:8px; }
.estimate-template-picker-section { margin:1rem 0; }
.estimate-template-picker { display:grid; grid-template-columns:repeat(3,1fr); gap:.75rem; }
.estimate-template-option { display:flex; align-items:center; gap:.7rem; padding:.85rem; border:2px solid var(--gray-200); border-radius:10px; background:#fff; cursor:pointer; }
.estimate-template-option.is-selected { border-color:#075db7; background:#eff8ff; box-shadow:0 0 0 2px rgba(7,93,183,.1); }
.estimate-template-option input { position:absolute; opacity:0; pointer-events:none; }
.estimate-template-option__number { display:grid; flex:0 0 34px; width:34px; height:34px; place-items:center; border-radius:50%; color:#fff; background:#075db7; font-weight:800; }
.estimate-template-option strong,.estimate-template-option small { display:block; }
.estimate-template-option small { margin-top:.2rem; color:var(--gray-600); font-size:.76rem; line-height:1.35; }
.estimate-template-preview-wrap { margin-top:1rem; padding:.8rem; border:1px solid #bae6fd; border-radius:10px; background:#f8fcff; }
.estimate-template-preview-head { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:.6rem; }
.estimate-template-preview-wrap > img { display:block; width:100%; height:auto; border:1px solid var(--gray-200); border-radius:7px; background:#fff; }
.estimate-template-dialog { width:min(96vw,1500px); max-width:none; height:94vh; padding:0; border:0; border-radius:12px; box-shadow:0 24px 80px rgba(0,0,0,.45); }
.estimate-template-dialog::backdrop { background:rgba(15,23,42,.82); }
.estimate-template-dialog__head { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.75rem 1rem; }
.estimate-template-dialog__head > div { display:flex; align-items:center; gap:.45rem; }
.estimate-template-dialog__head output { min-width:48px; text-align:center; font-weight:800; }
.estimate-template-dialog__canvas { height:calc(94vh - 64px); overflow:auto; background:#cbd5e1; }
.estimate-template-dialog__canvas img { display:block; width:100%; max-width:none; height:auto; margin:0 auto; }
.proposal-start { width:min(100%,780px); margin:1rem auto 3rem; }
.proposal-start__hero { padding:clamp(1.6rem,5vw,3.4rem); color:#fff; border-radius:20px; background:linear-gradient(135deg,#075db7,#009cad); }
.proposal-start__hero h1 { margin:.4rem 0 1rem; font-size:clamp(2rem,6vw,3.4rem); line-height:1.2; }
.proposal-start__hero p { max-width:600px; line-height:1.8; }
.proposal-flow { display:grid; gap:.8rem; padding:0; margin:1.2rem 0; counter-reset:flow; list-style:none; }
.proposal-flow li { position:relative; display:grid; gap:.2rem; min-height:78px; padding:1rem 1rem 1rem 4.4rem; border:1px solid var(--gray-200); border-radius:12px; background:#fff; }
.proposal-flow li::before { counter-increment:flow; content:counter(flow); position:absolute; left:1rem; top:1rem; display:grid; place-items:center; width:38px; height:38px; border-radius:50%; color:#fff; background:#075db7; font-weight:800; }
.proposal-flow span { color:var(--gray-600); }
.proposal-start__actions { display:grid; gap:.8rem; text-align:center; }
.proposal-line-button { background:#06c755; border-color:#06c755; color:#fff; font-size:1.05rem; }
.proposal-line-button.is-disabled { opacity:.55; cursor:not-allowed; }
.estimate-access { min-height:65vh; display:grid; place-items:center; }
.estimate-access-card { width:min(100%,430px); padding:2rem; border:1px solid var(--gray-200); border-radius:16px; background:#fff; box-shadow:var(--shadow); }
.estimate-access-card h1 { margin:.25rem 0 .5rem; }
.estimate-access-card .estimate-eyebrow { color:#075db7; }
.estimate-access-card form,.estimate-access-card label { display:grid; gap:.7rem; }
.estimate-access-card form { margin-top:1.3rem; }
.estimate-access-card input { width:100%; padding:.8rem; border:1px solid var(--gray-300); border-radius:7px; }
.estimate-admin-page { max-width:920px; margin:0 auto; }
.estimate-admin-header { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1.2rem; padding:1.5rem; border-radius:16px; color:#fff; background:linear-gradient(135deg,#075db7,#009cad); }
.estimate-admin-header h1 { margin:.2rem 0 .4rem; }
.estimate-admin-header p { margin:0; }
.estimate-admin-card { display:grid; gap:1rem; padding:1.4rem; border:1px solid var(--gray-200); border-radius:14px; background:#fff; box-shadow:var(--shadow); }
.estimate-admin-card h2 { margin:.25rem 0 .4rem; }
.estimate-admin-card p { margin:0; color:var(--gray-600); }
.estimate-admin-card__label { color:#075db7; font-size:.78rem; font-weight:800; letter-spacing:.08em; }
.estimate-admin-status { width:max-content; padding:.45rem .75rem; border-radius:999px; background:#fef2f2; color:#b91c1c; font-size:.85rem; font-weight:800; }
.estimate-admin-status.is-ready { background:#ecfdf5; color:#047857; }
.estimate-admin-notice { display:grid; gap:.25rem; padding:1rem; border-left:4px solid #009cad; border-radius:8px; background:#f0fdfa; }
.estimate-admin-notice span { color:var(--gray-600); font-size:.9rem; }
.estimate-admin-actions { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.estimate-admin-upload { display:grid; grid-template-columns:1fr auto; gap:.65rem 1rem; align-items:end; padding:1rem; border:1px solid #bae6fd; border-radius:10px; background:#f0f9ff; }
.estimate-admin-upload label { display:grid; gap:.4rem; font-weight:800; }
.estimate-admin-upload input { padding:.65rem; border:1px solid var(--gray-300); border-radius:7px; background:#fff; }
.estimate-admin-upload small { grid-column:1/-1; color:var(--gray-600); }
.estimate-template-admin-list { display:grid; gap:1rem; }
.estimate-template-admin-item { display:grid; grid-template-columns:1fr 1fr; gap:.7rem; padding:1rem; border:1px solid #bae6fd; border-radius:10px; background:#f8fcff; }
.estimate-template-admin-item__head { grid-column:1/-1; display:flex; align-items:center; justify-content:space-between; }
.estimate-template-admin-item label { display:grid; gap:.35rem; font-size:.82rem; font-weight:800; }
.estimate-template-admin-item input { min-height:42px; padding:.55rem .65rem; border:1px solid var(--gray-300); border-radius:7px; background:#fff; }
.estimate-template-admin-item small { grid-column:1/-1; color:var(--gray-600); }
.estimate-template-admin-item button { width:max-content; }
.estimate-admin-error { padding:.8rem; border-radius:8px; color:#b91c1c !important; background:#fef2f2; }
.estimate-admin-history { margin-top:1rem; }
.estimate-admin-history__list { display:grid; gap:.65rem; }
.estimate-admin-history__item { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.85rem; border:1px solid var(--gray-200); border-radius:9px; }
.estimate-admin-history__item strong,.estimate-admin-history__item small { display:block; }
.estimate-admin-history__item small { margin-top:.25rem; color:var(--gray-600); }
.estimate-admin-empty { padding:1rem; border-radius:8px; text-align:center; background:var(--gray-50); }
.estimate-access-admin { margin-bottom:1rem; }
.estimate-access-key-create { display:grid; grid-template-columns:1fr 1.4fr .8fr auto; gap:.75rem; align-items:end; padding:1rem; border:1px solid #bae6fd; border-radius:10px; background:#f0f9ff; }
.estimate-access-key-create label,.estimate-access-key-actions label { display:grid; gap:.35rem; font-size:.82rem; font-weight:800; }
.estimate-access-key-create input,.estimate-access-key-create select,.estimate-access-key-actions input { min-height:42px; padding:.55rem .65rem; border:1px solid var(--gray-300); border-radius:7px; background:#fff; }
.estimate-access-help { font-size:.85rem; }
.estimate-access-key-result { padding:1rem; border:2px solid #16a34a; border-radius:10px; background:#f0fdf4; }
.estimate-access-key-result > div { display:flex; gap:.6rem; align-items:center; margin:.5rem 0; }
.estimate-access-key-result code { flex:1; overflow-wrap:anywhere; padding:.7rem; border-radius:7px; background:#fff; color:#14532d; font-size:1rem; }
.estimate-access-key-result small { color:#166534; }
.estimate-access-key-list { display:grid; gap:.75rem; }
.estimate-access-key-item { display:grid; gap:.75rem; padding:1rem; border:1px solid var(--gray-200); border-radius:10px; }
.estimate-access-key-summary { display:flex; justify-content:space-between; gap:1rem; align-items:center; }
.estimate-access-key-summary strong,.estimate-access-key-summary small { display:block; }
.estimate-access-key-summary small { margin-top:.25rem; color:var(--gray-600); }
.estimate-access-current { display:inline-block; margin-left:.5rem; padding:.15rem .45rem; border-radius:999px; background:#dbeafe; color:#1e40af; font-size:.72rem; font-weight:800; }
.estimate-access-key-meta { display:grid; grid-template-columns:repeat(4,1fr); gap:.5rem; margin:0; }
.estimate-access-key-meta div { padding:.55rem; border-radius:7px; background:var(--gray-50); }
.estimate-access-key-meta dt { color:var(--gray-600); font-size:.72rem; font-weight:700; }
.estimate-access-key-meta dd { margin:.18rem 0 0; font-size:.82rem; font-weight:700; }
.estimate-access-key-actions { display:flex; flex-wrap:wrap; gap:.55rem; align-items:end; }
.estimate-access-key-actions label { width:130px; }
@media (max-width:800px) {
  html,body { max-width:100%; overflow-x:hidden; }
  .navbar,.container,.estimate-page,#estimate-form,.estimate-tab-panel { width:100%; max-width:100%; min-width:0; }
  .navbar { align-items:stretch; overflow:hidden; }
  .nav-brand,.nav-links { min-width:0; max-width:100%; }
  .nav-brand a { display:block; max-width:100%; overflow-wrap:anywhere; line-height:1.35; }
  .nav-links { overflow-x:auto; flex-wrap:nowrap; padding-bottom:.2rem; }
  .nav-links > * { flex:0 0 auto; }
  .estimate-hero,.estimate-toolbar { align-items:stretch; flex-direction:column; }
  .estimate-total-card { min-width:0; text-align:left; }
  .estimate-items,.estimate-copy-grid { grid-template-columns:1fr; }
  .estimate-cover-grid { grid-template-columns:180px 1fr; }
  .estimate-style-controls { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .estimate-cover-type-row { grid-template-columns:1fr 1fr; }
  .estimate-cover-type-row > strong { grid-column:1/-1; }
  .estimate-product-type-row { grid-template-columns:1fr 1fr; }
  .estimate-product-type-row > strong { grid-column:1/-1; }
  .estimate-admin-cover-fields { grid-template-columns:1fr; }
  .estimate-admin-cover-type-row { grid-template-columns:1fr 1fr; }
  .estimate-admin-cover-text { grid-column:1/-1; }
  .estimate-access-key-create { grid-template-columns:1fr 1fr; }
  .estimate-access-key-meta { grid-template-columns:1fr 1fr; }
  .estimate-template-picker { grid-template-columns:1fr; }
  .estimate-section__head { align-items:flex-start; flex-direction:column; }
  .estimate-item { grid-template-columns:110px 1fr; }
  .estimate-photo { min-height:150px; }
  .estimate-page { margin:-.5rem; }
  .estimate-hero { border-radius:0 0 16px 16px; }
  .estimate-hero,.estimate-hero > div { min-width:0; max-width:100%; }
  .estimate-hero h1 { max-width:100%; font-size:1.55rem; line-height:1.35; overflow-wrap:anywhere; word-break:normal; }
  .estimate-hero p { overflow-wrap:anywhere; }
  .estimate-work-tabs { width:100%; max-width:100%; }
  .estimate-toolbar { position:static; }
  .estimate-item { padding:.8rem; }
  .estimate-fields input { min-height:48px; font-size:16px; }
  .silhouette-picker span { min-height:70px; }
  .pdf-preview-panel { padding:.5rem; }
  .pdf-preview-panel iframe { height:72vh; }
}
@media (max-width:480px) {
  .estimate-access-key-create,.estimate-access-key-meta { grid-template-columns:1fr; }
  .estimate-template-admin-item { grid-template-columns:1fr; }
  .estimate-template-admin-item__head,.estimate-template-admin-item small { grid-column:1; }
  .estimate-template-dialog { width:100vw; height:100dvh; border-radius:0; }
  .estimate-template-dialog__head { align-items:flex-start; flex-direction:column; }
  .estimate-template-dialog__canvas { height:calc(100dvh - 105px); }
  .estimate-access-key-result > div,.estimate-access-key-summary { align-items:stretch; flex-direction:column; }
  .estimate-cover-grid { grid-template-columns:1fr; }
  .estimate-cover-preview { width:min(78vw,280px); margin:0 auto; }
  .estimate-style-controls { grid-template-columns:1fr 1fr; }
  .estimate-cover-type-row { grid-template-columns:1fr 1fr; }
  .estimate-product-type-row { grid-template-columns:1fr 1fr; }
  .estimate-admin-cover-type-row { grid-template-columns:1fr; }
  .estimate-admin-cover-text { grid-column:auto; }
  .estimate-appearance-row { grid-template-columns:1fr; }
  .estimate-item { grid-template-columns:1fr; }
  .estimate-photo { min-height:220px; }
  .estimate-page { padding-bottom:132px; }
  .estimate-work-tabs { top:0; margin-left:-.25rem; margin-right:-.25rem; border-radius:0; }
  .estimate-work-tab { flex-basis:138px; min-height:44px; padding:.55rem .65rem; font-size:.86rem; }
  .estimate-actions { width:100%; max-width:100vw; justify-content:flex-start; flex-wrap:wrap; gap:.45rem; min-height:0; padding:.55rem .65rem calc(.55rem + env(safe-area-inset-bottom)); overflow:hidden; }
  .estimate-actions .btn { width:auto; min-width:0; flex:1 1 calc(50% - .25rem); padding:.65rem .45rem; font-size:.78rem; }
  .estimate-actions .btn-print { flex-basis:100%; }
  #estimate-status { flex:1 0 100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.75rem; }
  .estimate-resolution__head,.estimate-print-job { align-items:stretch; flex-direction:column; }
  .estimate-resolution li { grid-template-columns:1fr; }
  .estimate-resolution li small { grid-column:auto; }
  .estimate-print-job .btn { width:100%; margin-left:0; }
  .silhouette-picker { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
