:root {
    --ink: #172033;
    --muted: #657086;
    --line: #bcc6d6;
    --surface: #fff;
    --soft: #f2f5f9;
    --accent: #1d4f91;
    --accent-soft: #dce9f8;
    --highlight: #fff200;
    --radius: 8px;
    font-family: "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: #e9edf3;
}

button {
    font: inherit;
}

.preview-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: #fff;
    background: #111827;
    box-shadow: 0 2px 12px #0003;
}

.preview-bar>div {
    display: flex;
    gap: 10px;
    align-items: baseline;
    white-space: nowrap;
}

.preview-bar span {
    color: #b7c0cf;
    font-size: 12px;
}

.preview-bar nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.preview-bar button {
    border: 1px solid #ffffff38;
    border-radius: 999px;
    padding: 7px 12px;
    color: #d9e0ea;
    background: transparent;
    white-space: nowrap;
    cursor: pointer;
}

.preview-bar button[aria-current="true"] {
    color: #111827;
    background: #fff;
}

.sheet-wrap {
    padding: 24px;
    overflow: hidden;
}

.sheet {
    position: relative;
    width: min(1600px, 100%);
    margin: 0 auto;
    padding: 18px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 14px 44px #1c2a401f;
    overflow: hidden;
}

.sample-mark {
    position: absolute;
    right: 25%;
    top: 45%;
    z-index: 0;
    transform: rotate(-22deg);
    color: #bf1c1c0e;
    font-size: clamp(70px, 13vw, 190px);
    font-weight: 900;
    pointer-events: none;
}

.sheet-head {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 12px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .16em;
}

h1 {
    margin: 0;
    font-family: "Yu Mincho", serif;
    font-size: 25px;
}

.meta {
    display: grid;
    gap: 3px;
    text-align: right;
}

.meta strong {
    font-size: 18px;
}

.meta span {
    color: var(--muted);
    font-size: 10px;
}

.notice {
    margin-bottom: 8px;
    padding: 5px 9px;
    color: #7a5c00;
    background: #fff8d5;
    border-left: 4px solid #e6be26;
    font-size: 10px;
}

.table-scroll {
    position: relative;
    overflow-x: auto;
    outline: none;
}

table {
    width: 100%;
    min-width: 1320px;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
}

th,
td {
    border: 1px solid var(--line);
    padding: 7px 5px;
    text-align: center;
    font-size: 11px;
    line-height: 1.3;
}

thead th {
    color: #162337;
    background: var(--soft);
    font-weight: 700;
}

th.bank {
    width: 128px;
}

th.rate {
    width: 126px;
    background: var(--accent-soft);
    font-size: 14px;
}

th.feature {
    width: 340px;
}

tbody th {
    background: #f8fafc;
    font-size: 12px;
}

.execution {
    border-inline-width: 2px;
    font-size: 18px;
    font-weight: 800;
}

.recommended {
    background: var(--highlight);
}

.feature-text {
    text-align: left;
    font-size: 9px;
}

.na {
    color: transparent;
    background: linear-gradient(to bottom right, transparent 49.5%, #8e99a9 50%, transparent 50.5%);
}

.sheet-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    margin-top: 10px;
    color: #4e596c;
    font-size: 9px;
}

.sheet-foot p {
    max-width: 980px;
    margin: 0;
}

.company-placeholder {
    min-width: 230px;
    padding: 12px 16px;
    border: 1px dashed #9ca7b7;
    text-align: center;
}

/* 1: 添付PDFに近い高密度一覧表 */
body[data-theme="dense"] {
    --accent: #263b54;
    --accent-soft: #c8d9ec;
    --line: #202020;
    --radius: 0;
}

body[data-theme="dense"] .sheet {
    padding: 16px;
}

body[data-theme="dense"] th,
body[data-theme="dense"] td {
    padding: 6px 4px;
}

/* 2: 銀行資料風 */
body[data-theme="trust"] {
    --accent: #075985;
    --accent-soft: #dff2fb;
    --line: #b9d0dc;
    --soft: #eff8fc;
    --highlight: #d9f99d;
    --radius: 12px;
}

body[data-theme="trust"] thead th {
    border-top: 3px solid var(--accent);
}

body[data-theme="trust"] tbody tr:nth-child(even) td,
body[data-theme="trust"] tbody tr:nth-child(even) th {
    background-color: #f5fbfe;
}

/* 3: 営業資料風 */
body[data-theme="sales"] {
    --accent: #b45309;
    --accent-soft: #ffedd5;
    --line: #e1c9b2;
    --soft: #fff8ed;
    --highlight: #fb923c;
    --radius: 14px;
}

body[data-theme="sales"] .recommended {
    color: #fff;
}

body[data-theme="sales"] .sheet-head {
    padding: 14px 18px;
    color: #fff;
    background: linear-gradient(120deg, #9a3412, #ea580c);
    border-radius: 10px;
}

body[data-theme="sales"] .eyebrow,
body[data-theme="sales"] .meta span {
    color: #ffedd5;
}

/* 4: カード型 */
body[data-theme="cards"] {
    --accent: #5b21b6;
    --accent-soft: #ede9fe;
    --line: #ddd6fe;
    --soft: #f5f3ff;
    --highlight: #c4b5fd;
    --radius: 18px;
}

body[data-theme="cards"] tbody tr {
    box-shadow: inset 4px 0 var(--accent);
}

body[data-theme="cards"] tbody th {
    color: var(--accent);
}

body[data-theme="cards"] .execution {
    color: var(--accent);
}

/* 5: A4シンプル */
body[data-theme="print"] {
    --accent: #111;
    --accent-soft: #e8e8e8;
    --line: #777;
    --soft: #f3f3f3;
    --highlight: #ddd;
    --radius: 0;
}

body[data-theme="print"] .sheet {
    box-shadow: none;
}

body[data-theme="print"] .eyebrow,
body[data-theme="print"] .notice,
body[data-theme="print"] .sample-mark {
    display: none;
}

body[data-theme="print"] th,
body[data-theme="print"] td {
    color: #000;
}

@media (max-width: 820px) {
    .preview-bar {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px;
    }

    .preview-bar nav {
        width: 100%;
    }

    .sheet-wrap {
        padding: 10px;
    }

    .sheet {
        padding: 12px;
    }

    .sheet-head {
        align-items: flex-start;
    }

    h1 {
        font-size: 19px;
    }

    .meta strong {
        font-size: 14px;
    }

    .sheet-foot {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .company-placeholder {
        min-width: 0;
    }
}

@page {
    size: A4 landscape;
    margin: 8mm;
}

@media print {
    body {
        background: #fff;
    }

    .preview-bar {
        display: none;
    }

    .sheet-wrap {
        padding: 0;
    }

    .sheet {
        width: 100%;
        padding: 0;
        box-shadow: none;
    }

    table {
        min-width: 0;
    }

    th,
    td {
        padding: 3px 2px;
        font-size: 7px;
    }

    th.bank {
        width: 25mm;
    }

    th.rate {
        width: 23mm;
    }

    th.feature {
        width: 62mm;
    }

    .execution {
        font-size: 10px;
    }

    .sheet-head {
        margin-bottom: 4mm;
    }

    .notice {
        font-size: 7px;
    }

    .sheet-foot {
        font-size: 6.5px;
    }
}