body {
    background: #f7f8fa;
    color: #222;
    font-size: 14px;
    letter-spacing: 0;
}

.app-header {
    align-items: center;
    background: #151a22;
    color: #fff;
    display: flex;
    gap: 24px;
    min-height: 56px;
    padding: 0 24px;
}

.brand {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
}

.brand:hover {
    color: #fff;
}

.main-nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.main-nav a {
    border-radius: 5px;
    color: #d9e2ee;
    font-weight: 600;
    line-height: 1.2;
    padding: 8px 10px;
    text-decoration: none;
}

.main-nav a:hover,
.main-nav a.is-active {
    background: #263241;
    color: #fff;
}

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

.settings-link {
    border-radius: 5px;
    color: #d9e2ee;
    display: inline-flex;
    font-weight: 600;
    line-height: 1.2;
    padding: 8px 10px;
    text-decoration: none;
    white-space: nowrap;
}

.settings-link:hover,
.settings-link.is-active {
    background: #263241;
    color: #fff;
}

.logout-link {
    background: #2a3038;
    border: 1px solid #414956;
    border-radius: 5px;
    color: #dce3ea;
    display: inline-flex;
    font-weight: 600;
    line-height: 1.2;
    padding: 8px 12px;
    text-decoration: none;
    white-space: nowrap;
}

.logout-link:hover {
    background: #363e49;
    border-color: #596575;
    color: #fff;
}

.app-main {
    margin: 0 auto;
    max-width: 1600px;
    padding: 28px 20px 48px;
    width: 100%;
}

.page-subnav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.page-subnav-link {
    background: #fff;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    color: #263241;
    display: inline-flex;
    font-weight: 700;
    line-height: 1.2;
    min-height: 38px;
    padding: 9px 13px;
    text-decoration: none;
}

.page-subnav-link:hover {
    background: #edf4fb;
    border-color: #8fb4d8;
    color: #183047;
}

.page-subnav-link.is-active {
    background: #263241;
    border-color: #263241;
    color: #fff;
}

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

.upload-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-card {
    display: flex;
    flex-direction: column;
}

.upload-card form {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.upload-card textarea {
    min-height: 86px;
}

.upload-card button {
    align-self: flex-start;
    margin-top: auto;
}

.form-actions {
    align-items: end;
    display: flex;
}

.muted-text {
    color: #5c6875;
}

.report-description h2 {
    font-size: 18px;
    margin: 0 0 8px;
}

.report-description p {
    margin: 0;
}

.report-description-list {
    color: #39495a;
    margin: 10px 0 0;
}

.section-eyebrow {
    color: #66778a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 4px;
}

.ai-csv-upload-panel {
    padding: 22px;
}

.ai-csv-upload-header {
    align-items: flex-start;
    border-bottom: 1px solid #e1e7ee;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 16px;
}

.ai-csv-upload-header h2 {
    font-size: 24px;
    line-height: 1.35;
    margin: 0 0 6px;
}

.ai-csv-upload-header .button {
    flex: 0 0 auto;
    margin: 2px 0 0;
}

.ai-csv-upload-form {
    display: grid;
    gap: 14px;
}

.ai-csv-file-row,
.ai-csv-submit-row {
    align-items: center;
    background: #f7f9fb;
    border: 1px solid #dce4ec;
    border-radius: 6px;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 420px);
    padding: 14px;
}

.ai-csv-file-row p,
.ai-csv-submit-row p {
    margin: 4px 0 0;
}

.ai-csv-file-row .input {
    margin: 0;
}

.ai-csv-file-row input[type="file"] {
    background: #fff;
    border: 1px solid #cbd6e2;
    border-radius: 5px;
    margin: 0;
    padding: 10px;
    width: 100%;
}

.ai-csv-submit-row button {
    justify-self: start;
    margin: 0;
    min-width: 220px;
}

.json-import-preview {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin: 0 0 16px;
}

.json-import-preview div {
    background: #f7f9fb;
    border: 1px solid #dde3ea;
    border-radius: 6px;
    padding: 10px;
}

.json-import-preview dt {
    color: #5c6875;
    font-size: 12px;
    font-weight: 700;
}

.json-import-preview dd {
    font-size: 18px;
    font-weight: 700;
    margin: 2px 0 0;
}

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

.summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
}

.product-detail-report-grid {
    grid-template-columns: minmax(0, 1fr);
}

.product-detail-table-scroll {
    overflow-x: auto;
}

.product-detail-yearly-table {
    width: 100%;
}

.product-detail-ai-table {
    min-width: 1420px;
    table-layout: fixed;
    width: 100%;
}

.product-detail-ai-table th,
.product-detail-ai-table td {
    vertical-align: top;
}

.product-detail-ai-table th:nth-child(1),
.product-detail-ai-table td:nth-child(1) {
    width: 46px;
}

.product-detail-ai-table th:nth-child(2),
.product-detail-ai-table td:nth-child(2) {
    width: 136px;
}

.product-detail-ai-table th:nth-child(3),
.product-detail-ai-table td:nth-child(3) {
    width: 54px;
}

.product-detail-ai-table th:nth-child(4),
.product-detail-ai-table td:nth-child(4) {
    width: 86px;
}

.product-detail-image-cell {
    min-width: 136px;
    width: 136px;
}

.dashboard-summary-grid {
    grid-template-columns: minmax(0, 1fr);
}

.stat {
    background: #fff;
    border: 1px solid #dde3ea;
    border-radius: 6px;
    padding: 16px;
}

.stat strong {
    display: block;
    font-size: 26px;
}

.table-scroll {
    overflow-x: auto;
    width: 100%;
}

.wide-table-scroll {
    max-width: 100%;
}

.wide-table {
    min-width: 1480px;
}

.analysis-table {
    min-width: 1500px;
}

.stamp-thumb {
    background: #fff;
    border: 1px solid #d8e1ea;
    border-radius: 6px;
    cursor: zoom-in;
    height: 80px;
    object-fit: contain;
    padding: 4px;
    position: relative;
    transform: scale(1);
    transform-origin: center;
    vertical-align: middle;
    width: 80px;
    z-index: 1;
}

.stamp-thumb:hover {
    border-color: #8fb4d6;
    box-shadow: 0 2px 8px rgba(38, 50, 65, 0.14);
}

.stamp-thumb:focus-visible {
    outline: 3px solid #2f80ed;
    outline-offset: 2px;
}

.stamp-thumb.small {
    height: 80px;
    width: 80px;
}

.stamp-thumb.replay-only {
    cursor: pointer;
}

.stamp-thumb.product-detail-thumb {
    box-sizing: border-box;
    display: block;
    height: 120px;
    min-width: 120px;
    width: 120px;
}

.image-meta-preview {
    align-items: center;
    display: flex;
    gap: 18px;
    margin: 12px 0 22px;
}

.stamp-thumb.image-meta-thumb {
    box-sizing: border-box;
    display: block;
    height: 160px;
    min-width: 160px;
    width: 160px;
}

.image-meta-actions {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr auto 1fr;
    margin-top: 18px;
}

.image-meta-ai-actions {
    display: flex;
    justify-content: center;
    margin: 18px 0 6px;
}

.image-meta-ai-header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 12px;
}

.image-meta-ai-header h3 {
    margin: 0;
}

.image-meta-save-button {
    font-size: 18px;
    font-weight: 700;
    min-height: 48px;
    min-width: 180px;
    padding: 12px 32px;
}

.image-meta-back-button {
    justify-self: end;
}

.image-meta-preview-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.image-meta-pair-summary {
    align-items: center;
    display: flex;
    gap: 12px;
    margin: 8px 0 14px;
}

.image-meta-pair-summary > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.image-meta-copy-box {
    background: #f8fafc;
    border: 1px solid #d8e1eb;
    border-radius: 8px;
    margin: 16px 0 18px;
    padding: 12px;
}

.image-meta-inline-compare {
    border-left: 4px solid #7daee8;
}

.image-meta-edit-detail input,
.image-meta-edit-detail textarea {
    box-sizing: border-box;
    width: 100%;
}

.image-meta-edit-detail textarea {
    min-height: 78px;
}

.ai-draft-modal-panel {
    max-height: 88vh;
    max-width: 980px;
    overflow: auto;
    width: min(94vw, 980px);
}

.ai-draft-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ai-draft-body .image-meta-thumb {
    align-self: flex-start;
}

.ai-draft-body textarea,
.ai-draft-body input {
    box-sizing: border-box;
    width: 100%;
}

.ai-draft-body textarea {
    min-height: 74px;
}

.ai-draft-generate-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    margin-top: -6px;
}

.ai-draft-generate-actions .button {
    min-width: 110px;
}

.ai-draft-status {
    background: #eef5ff;
    border: 1px solid #c8ddf6;
    border-radius: 6px;
    color: #1f4f80;
    padding: 10px 12px;
}

.ai-draft-result {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-meta-copy-box-header {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 10px;
}

.image-meta-copy-box-header h3 {
    font-size: 16px;
    margin: 0;
}

.image-meta-copy-box-header .button {
    flex: 0 0 auto;
}

.image-meta-copy-box-header .button.is-copied {
    background: #168a5f;
    border-color: #168a5f;
    color: #fff;
}

.image-meta-compact-detail {
    font-size: 13px;
    grid-template-columns: 118px minmax(0, 1fr);
}

.image-meta-compact-detail dd {
    max-height: 110px;
    overflow: auto;
    white-space: pre-wrap;
}

.stamp-thumb.ranking-thumb {
    height: 118px;
    width: 118px;
}

.stamp-thumb.is-expanded {
    border-color: #7fb0df;
    box-shadow: 0 12px 28px rgba(38, 50, 65, 0.22);
    cursor: zoom-out;
    transform: scale(2.35);
    z-index: 12;
}

.stamp-thumb.ranking-thumb.is-expanded {
    transform: scale(1);
}

.product-title-with-image {
    align-items: center;
    display: inline-flex;
    gap: 8px;
    min-width: 0;
}

.product-main-thumb {
    background: #fff;
    border: 1px solid #d8e1ea;
    border-radius: 5px;
    cursor: pointer;
    flex: 0 0 auto;
    height: 80px;
    object-fit: contain;
    padding: 3px;
    width: 80px;
}

.product-main-thumb:hover {
    border-color: #8fb4d6;
    box-shadow: 0 2px 8px rgba(38, 50, 65, 0.14);
}

.product-main-thumb:focus-visible {
    outline: 3px solid #2f80ed;
    outline-offset: 2px;
}

.product-title-text {
    min-width: 0;
}

.detail-list {
    display: grid;
    gap: 8px 18px;
    grid-template-columns: 130px minmax(0, 1fr);
    margin: 0;
}

.detail-list dt {
    color: #607080;
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
}

.num-cell {
    text-align: right;
    white-space: nowrap;
}

.badge {
    background: #eef2f6;
    border: 1px solid #ccd6e0;
    border-radius: 999px;
    color: #263241;
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    padding: 4px 8px;
    white-space: nowrap;
}

.badge.is-single {
    background: #eaf5ef;
    border-color: #b9dcc8;
    color: #25643a;
}

.badge.is-premium {
    background: #eef0fb;
    border-color: #c7ccec;
    color: #394385;
}

.badge[class*="成長中"],
.status-成長中 {
    background: #e6f5eb;
    border-color: #a8d9b8;
    color: #226437;
}

.status-安定,
.status-復活傾向 {
    background: #edf5fb;
    border-color: #b9d6ea;
    color: #255f85;
}

.status-陰りあり {
    background: #fff6e6;
    border-color: #f0d29a;
    color: #8a5a00;
}

.status-急落 {
    background: #fff0f0;
    border-color: #efb4b4;
    color: #a22b2b;
}

.status-新規 {
    background: #f3f0fb;
    border-color: #d4c6ef;
    color: #5c3f91;
}

table {
    background: #fff;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    line-height: 1.45;
    table-layout: auto;
    white-space: normal;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid #e5ebf1;
    overflow-wrap: break-word;
    padding: 10px 8px;
    vertical-align: top;
    word-break: normal;
}

th {
    background: #eef2f6;
    color: #263241;
    font-weight: 700;
    line-height: 1.35;
}

.sort-link {
    align-items: center;
    color: #263241;
    display: inline-flex;
    gap: 4px;
    min-height: 30px;
    padding: 2px 0;
    text-decoration: none;
}

.sort-link:hover {
    color: #0b6fae;
    text-decoration: underline;
}

.sort-link span {
    background: #fff;
    border: 1px solid #c8d2dd;
    border-radius: 4px;
    color: #6b7785;
    display: inline-flex;
    font-size: 11px;
    justify-content: center;
    min-width: 22px;
    padding: 1px 4px;
}

.sort-link.is-active {
    color: #0b6fae;
}

.sort-link.is-active span {
    background: #0b6fae;
    border-color: #0b6fae;
    color: #fff;
}

tbody tr:nth-child(even) td {
    background: #fafbfd;
}

tbody tr:hover td {
    background: #f1f7fc;
}

td a {
    overflow-wrap: anywhere;
}

.log-json {
    background: #f7f9fb;
    border: 1px solid #dce4ec;
    border-radius: 4px;
    font-size: 12px;
    margin: 8px 0 0;
    max-height: 180px;
    overflow: auto;
    padding: 8px;
    white-space: pre-wrap;
}

.actions {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.actions a,
.actions button {
    line-height: 1.2;
    margin-bottom: 0;
    min-height: 30px;
    padding: 6px 9px;
    white-space: nowrap;
}

.actions.image-meta-actions {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr auto 1fr;
    margin-top: 18px;
}

.actions .image-meta-save-button {
    font-size: 18px;
    font-weight: 700;
    min-height: 48px;
    min-width: 180px;
    padding: 12px 32px;
}

.actions .image-meta-back-button {
    justify-self: end;
}

.toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.pagination-bar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: space-between;
    margin: 18px 0 28px;
}

.pagination-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination-links li {
    list-style: none;
    margin: 0;
}

.pagination-links a,
.pagination-links .current {
    background: #fff;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    color: #243142;
    display: inline-flex;
    font-weight: 600;
    height: 40px;
    line-height: 1;
    min-width: 40px;
    padding: 0 13px;
    place-items: center;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pagination-links a:hover {
    background: #edf4fb;
    border-color: #8fb4d8;
    color: #183047;
}

.pagination-links li.active a,
.pagination-links .current {
    background: #243142;
    border-color: #243142;
    color: #fff;
}

.pagination-links li.disabled a {
    background: #f3f5f7;
    border-color: #dce3ea;
    color: #9aa6b2;
    cursor: default;
    pointer-events: none;
}

.pagination-counter {
    color: #607080;
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
}

.name-ranking-sticky-tools {
    background: #fff;
    border-bottom: 1px solid #dce4ec;
    margin: -4px 0 14px;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 70;
}

.name-ranking-sticky-tools .pagination-bar {
    margin: 0;
}

.name-ranking-table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.name-ranking-table.is-overall {
    min-width: 1180px;
}

.name-ranking-table.is-detail {
    min-width: 1560px;
}

.name-ranking-table.is-product-summary {
    min-width: 0;
    width: 100%;
}

.name-ranking-table thead th {
    box-shadow: inset 0 -1px 0 #dce4ec, 0 2px 4px rgba(38, 50, 65, 0.08);
    position: sticky;
    top: 64px;
    vertical-align: middle;
    z-index: 60;
}

.name-ranking-table th,
.name-ranking-table td {
    overflow-wrap: normal;
    padding: 12px 10px;
    white-space: nowrap;
}

.name-ranking-table th:first-child,
.name-ranking-table td:first-child {
    width: 72px;
}

.name-ranking-table th:nth-child(2),
.name-ranking-table td:nth-child(2) {
    text-align: left;
    width: 160px;
}

.name-ranking-table .num-cell {
    text-align: right;
}

.custom-stamp-table,
.custom-compare-table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.custom-stamp-table {
    min-width: 0;
    width: 100%;
}

.custom-stamp-scroll {
    overflow-x: hidden;
}

.custom-compare-table {
    min-width: 0;
    width: 100%;
}

.custom-compare-scroll {
    overflow-x: hidden;
}

.custom-stamp-table thead th,
.custom-compare-table thead th {
    box-shadow: inset 0 -1px 0 #dce4ec, 0 2px 4px rgba(38, 50, 65, 0.08);
    position: sticky;
    top: 64px;
    vertical-align: middle;
    z-index: 60;
}

.custom-stamp-table th,
.custom-stamp-table td,
.custom-compare-table th,
.custom-compare-table td {
    overflow-wrap: normal;
    padding: 12px 10px;
    vertical-align: middle;
    white-space: nowrap;
}

.custom-compare-table th,
.custom-compare-table td {
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: normal;
}

.custom-compare-table .num-cell {
    white-space: normal;
}

.custom-compare-classification {
    line-height: 1.55;
    white-space: normal;
}

.custom-compare-table th:nth-child(1),
.custom-compare-table td:nth-child(1) {
    width: 4%;
}

.custom-compare-table th:nth-child(2),
.custom-compare-table td:nth-child(2) {
    width: 20%;
}

.custom-compare-table th:nth-child(3),
.custom-compare-table td:nth-child(3) {
    width: 11%;
}

.custom-compare-table th:nth-child(4),
.custom-compare-table td:nth-child(4) {
    width: 7%;
}

.custom-compare-table th:nth-child(5),
.custom-compare-table td:nth-child(5) {
    width: 8%;
}

.custom-compare-table th:nth-child(6),
.custom-compare-table td:nth-child(6) {
    width: 9%;
}

.custom-compare-table th:nth-child(7),
.custom-compare-table td:nth-child(7),
.custom-compare-table th:nth-child(8),
.custom-compare-table td:nth-child(8) {
    width: 6%;
}

.custom-compare-table th:nth-child(9),
.custom-compare-table td:nth-child(9),
.custom-compare-table th:nth-child(12),
.custom-compare-table td:nth-child(12) {
    width: 7%;
}

.custom-compare-table th:nth-child(10),
.custom-compare-table td:nth-child(10),
.custom-compare-table th:nth-child(11),
.custom-compare-table td:nth-child(11) {
    width: 7.5%;
}

.custom-stamp-table .custom-col-rank {
    width: 3.5%;
}

.custom-stamp-table .custom-col-product {
    width: 18%;
}

.custom-stamp-table .custom-col-name-sale {
    width: 6%;
}

.custom-stamp-table .custom-col-count {
    width: 7%;
}

.custom-stamp-table .custom-col-money {
    width: 8%;
}

.custom-stamp-table .custom-col-trend {
    width: 6.5%;
}

.custom-stamp-table .custom-col-current {
    width: 13%;
}

.custom-stamp-table .custom-col-edit {
    width: 5%;
}

.custom-stamp-table .custom-col-date {
    width: 5.5%;
}

.custom-stamp-table th:nth-child(2),
.custom-stamp-table td:nth-child(2),
.custom-stamp-table th:nth-child(11),
.custom-stamp-table td:nth-child(11),
.custom-stamp-table th:nth-child(12),
.custom-stamp-table td:nth-child(12) {
    white-space: normal;
}

.name-sale-badge {
    border-radius: 999px;
    color: #fff;
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    padding: 5px 9px;
    text-align: center;
    white-space: nowrap;
}

.name-sale-badge.is-unreleased {
    background: #d63b3b;
}

.name-sale-badge.is-available {
    background: #2f8f5b;
}

.custom-stamp-table .custom-meta-form {
    display: none;
}

.custom-meta-modal[hidden] {
    display: none;
}

.custom-meta-modal {
    align-items: center;
    background: rgba(21, 26, 34, 0.46);
    bottom: 0;
    display: flex;
    justify-content: center;
    left: 0;
    padding: 24px;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1000;
}

.custom-meta-dialog {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 22px 70px rgba(21, 26, 34, 0.32);
    max-width: 620px;
    padding: 22px;
    width: min(620px, 100%);
}

.custom-meta-dialog-header {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.custom-meta-dialog-header h2 {
    font-size: 22px;
    margin: 0;
}

.custom-meta-close {
    align-items: center;
    background: #eef2f6;
    border: 1px solid #cfd8e3;
    border-radius: 50%;
    color: #263241;
    display: inline-flex;
    font-size: 24px;
    height: 38px;
    justify-content: center;
    line-height: 1;
    margin: 0;
    padding: 0;
    width: 38px;
}

.custom-meta-product {
    align-items: center;
    background: #f7f9fb;
    border: 1px solid #dce4ec;
    border-radius: 7px;
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    padding: 12px;
}

.custom-meta-product-image {
    background: #fff;
    border: 1px solid #d8e1ea;
    border-radius: 6px;
    height: 80px;
    object-fit: contain;
    padding: 4px;
    width: 80px;
}

.custom-meta-product-image.is-empty {
    display: none;
}

.custom-meta-modal-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.custom-meta-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}

.custom-meta-actions .button {
    margin-left: auto;
}

.sticky-table {
    border-collapse: separate;
    border-spacing: 0;
}

.sticky-table thead th {
    background: #eef2f6;
    box-shadow: inset 0 -1px 0 #dce4ec, 0 2px 4px rgba(38, 50, 65, 0.08);
    position: sticky;
    top: 0;
    vertical-align: middle;
    z-index: 60;
}

.sticky-table-tools {
    background: #fff;
    border-bottom: 1px solid #dce4ec;
    margin: -4px 0 14px;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 80;
}

.sticky-table-tools .pagination-bar {
    margin: 0;
}

.sticky-table-tools + .table-scroll .sticky-table thead,
.sticky-table-with-tools thead {
    position: static;
    top: auto;
    z-index: auto;
}

.sticky-table-tools + .table-scroll .sticky-table thead th,
.sticky-table-with-tools thead th {
    position: static;
    top: auto;
    z-index: auto;
}

.sticky-table-tools + .table-scroll .sticky-table tbody::before,
.sticky-table-with-tools tbody::before {
    content: none;
    display: none;
}

.sticky-table-header-clone {
    display: none;
    left: 0;
    overflow: hidden;
    pointer-events: auto;
    position: fixed;
    right: auto;
    top: 0;
    z-index: 75;
}

.sticky-table-header-clone.is-visible {
    display: block;
}

.sticky-table-header-clone table {
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    table-layout: fixed;
    width: 100%;
}

.sticky-table-header-clone th {
    background: #eef2f6;
    box-shadow: inset 0 -1px 0 #dce4ec, 0 2px 4px rgba(38, 50, 65, 0.08);
    position: static !important;
    top: auto !important;
}

.sticky-table-header-clone th,
.sticky-table-header-clone td {
    box-sizing: border-box;
}

.custom-meta-form {
    margin: 0;
}

.custom-meta-grid {
    align-items: center;
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(4, minmax(92px, 1fr)) auto;
    min-width: 520px;
}

.custom-meta-grid select {
    margin: 0;
}

.custom-candidate-toolbar {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

.custom-candidate-panel h2,
.custom-candidate-done-panel h2 {
    font-size: 22px;
    margin: 0 0 14px;
}

.custom-candidate-table th,
.custom-candidate-table td {
    vertical-align: middle;
}

.custom-candidate-table th:nth-child(2),
.custom-candidate-table td:nth-child(2),
.custom-candidate-table th:nth-child(5),
.custom-candidate-table td:nth-child(5) {
    white-space: normal;
}

.custom-candidate-check {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    gap: 7px;
    margin: 0;
    white-space: nowrap;
}

.custom-candidate-check input {
    margin: 0;
}

.custom-candidate-check span {
    font-weight: 700;
}

.button-small {
    line-height: 1.2;
    margin: 0;
    min-height: 36px;
    padding: 6px 12px;
}

.muted {
    color: #7c8998;
}

.button-secondary {
    background: #607080;
    border-color: #607080;
}

.disabled-button {
    background: #a9b2bc;
    border-color: #a9b2bc;
    cursor: not-allowed;
    opacity: 0.75;
}

.button-danger {
    background: #b23b3b;
    border-color: #b23b3b;
}

.filter-grid {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-grid > label {
    flex: 0 1 220px;
    margin-bottom: 0;
}

.filter-grid select,
.filter-grid input[type="date"],
.filter-grid input[type="month"],
.filter-grid input[type="number"],
.filter-grid input[type="search"],
.filter-grid input[type="text"] {
    margin-bottom: 0;
    width: 100%;
}

.filter-grid > .check-label {
    flex: 0 0 auto;
}

.sales-filter-grid > label {
    flex-basis: 170px;
}

.missing-filter-grid > label {
    flex-basis: 180px;
}

.compact-table {
    font-size: 12px;
}

.compact-table th,
.compact-table td {
    padding: 8px 7px;
}

.ai-analysis-table {
    min-width: 1580px;
    table-layout: fixed;
}

.ai-analysis-table th,
.ai-analysis-table td {
    vertical-align: top;
}

.ai-text-cell {
    overflow-wrap: anywhere;
    white-space: normal;
}

.ai-col-rank { width: 56px; }
.ai-col-image { width: 140px; }
.ai-col-usage { width: 94px; }
.ai-col-product { width: 270px; }
.ai-col-type { width: 82px; }
.ai-col-id { width: 96px; }
.ai-col-character { width: 110px; }
.ai-col-no { width: 78px; }
.ai-col-category { width: 120px; }
.ai-col-rate { width: 74px; }
.ai-col-release { width: 104px; }
.ai-col-status { width: 92px; }
.ai-col-emotion { width: 110px; }
.ai-col-detail { width: 74px; }

.ai-analysis-table .ranking-thumb {
    display: block;
    height: 118px;
    width: 118px;
}

.ai-analysis-table .product-title-with-image {
    align-items: flex-start;
}

.image-pair-kun-cell {
    background: #dbeafe;
}

.image-pair-kun-head {
    background: #9dbded;
    color: #0f172a;
}

.sticky-table thead th.image-pair-kun-head,
.sticky-table-header-clone th.image-pair-kun-head {
    background: #9dbded;
    color: #0f172a;
}

.image-pair-col-image {
    width: 180px;
}

.image-pair-image-cell {
    text-align: center;
    width: 180px;
}

.image-pair-image-cell .ranking-thumb {
    margin: 0 auto;
}

.image-pair-thumbs {
    align-items: center;
    display: flex;
    gap: 6px;
    justify-content: center;
    min-width: 166px;
}

.image-pair-center-cell {
    text-align: center;
    vertical-align: middle;
}

.analysis-table tbody tr[id^="image-row-"] {
    scroll-margin-top: 92px;
}

.image-pair-chan-cell {
    background: #fee2e2;
}

.image-pair-single-cell {
    background: #eef2f7;
    text-align: center;
}

.image-pair-chan-head {
    background: #ee9295;
    color: #111827;
}

.sticky-table thead th.image-pair-chan-head,
.sticky-table-header-clone th.image-pair-chan-head {
    background: #ee9295;
    color: #111827;
}

.image-pair-id-list,
.image-pair-products {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.image-pair-product-link {
    background: #f8fafc;
    border: 1px solid #dbe3ef;
    border-radius: 4px;
    color: #6f42c1;
    display: block;
    line-height: 1.25;
    padding: 5px 8px;
    text-decoration: none;
}

.image-pair-product-link:hover {
    background: #edf4fb;
    border-color: #9db8d3;
}

.image-pair-detail-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 72px;
}

.image-pair-detail-link {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 4px;
    color: #6f42c1;
    display: block;
    font-weight: 700;
    line-height: 1.35;
    padding: 7px 9px;
    text-align: center;
    white-space: nowrap;
}

.image-pair-detail-link:hover {
    background: #edf4fb;
    border-color: #9db8d3;
}

.image-pair-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.image-pair-kun-cell.is-usage-high,
.image-pair-chan-cell.is-usage-high,
.image-pair-single-cell.is-usage-high {
    background: #5fc187;
}

.image-pair-kun-cell.is-usage-mid-high,
.image-pair-chan-cell.is-usage-mid-high,
.image-pair-single-cell.is-usage-mid-high {
    background: #a7c977;
}

.image-pair-kun-cell.is-usage-mid,
.image-pair-chan-cell.is-usage-mid,
.image-pair-single-cell.is-usage-mid {
    background: #f7d465;
}

.image-pair-kun-cell.is-usage-low,
.image-pair-chan-cell.is-usage-low,
.image-pair-single-cell.is-usage-low {
    background: #f4a066;
}

.image-pair-ratio-cell.is-ratio-kun {
    background: #b9ccec;
}

.image-pair-ratio-cell.is-ratio-close {
    background: #d4e0f5;
}

.image-pair-ratio-cell.is-ratio-even {
    background: #f4f4f4;
}

.image-pair-ratio-cell.is-ratio-chan {
    background: #f6dddd;
}

.ai-analysis-detail dd {
    overflow-wrap: anywhere;
}

.ai-settings-grid > label {
    flex-basis: 230px;
}

.setting-status {
    align-items: center;
    border-radius: 6px;
    display: inline-flex;
    font-weight: 700;
    min-height: 38px;
    padding: 8px 12px;
}

.setting-status.is-ok {
    background: #e6f5eb;
    color: #226437;
}

.setting-status.is-ng {
    background: #fff0f0;
    color: #a22b2b;
}

.setting-note {
    background: #f7f9fb;
    border: 1px solid #dce4ec;
    border-radius: 6px;
    color: #39495a;
    margin: 16px 0;
    padding: 12px 14px;
}

.setting-note p {
    margin: 0 0 6px;
}

.setting-note p:last-child {
    margin-bottom: 0;
}

.check-label {
    align-items: center;
    display: flex;
    gap: 8px;
    min-height: 42px;
}

.check-label input {
    margin: 0;
}

.year-nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    justify-content: center;
    margin: 16px 0;
}

.year-nav-all {
    gap: 8px;
}

.year-nav.is-sticky {
    background: #f7f8fa;
    border-bottom: 1px solid #dce4ec;
    box-shadow: 0 2px 8px rgba(38, 50, 65, 0.08);
    margin: 0 -20px 16px;
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.year-nav a,
.year-nav .current-year {
    background: #fff;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    color: #263241;
    display: inline-flex;
    font-weight: 600;
    min-height: 38px;
    padding: 8px 14px;
}

.year-nav .current-year {
    background: #263241;
    border-color: #263241;
    color: #fff;
}

.year-nav a:hover {
    background: #edf4fb;
    border-color: #8fb4d8;
    color: #183047;
}

.cache-status {
    background: #eef5fb;
    border: 1px solid #c9dceb;
    border-radius: 6px;
    color: #29455f;
    margin: 14px 0 0;
    padding: 10px 12px;
}

.missing-check-table th,
.missing-check-table td {
    font-size: 12px;
    padding: 8px 6px;
}

.missing-check-table {
    border-collapse: separate;
    border-spacing: 0;
}

.missing-check-scroll {
    overflow: visible;
}

.missing-check-table thead {
    position: sticky;
    top: 59px;
    z-index: 60;
}

.missing-check-table thead th {
    background: #eef2f6;
    box-shadow: inset 0 -1px 0 #dce4ec, 0 2px 4px rgba(38, 50, 65, 0.08);
    position: relative;
    z-index: 61;
    text-align: center;
}

.account-cell {
    background: #eef2f6;
    min-width: 190px;
    position: sticky;
    left: 0;
    z-index: 20;
    width: 190px;
}

.missing-check-table thead .account-cell,
.missing-check-table thead th:first-child {
    background: #eef2f6;
    left: 0;
    position: sticky;
    z-index: 70;
}

.missing-check-table tbody th,
.missing-check-table tbody td {
    position: relative;
    z-index: 1;
}

.missing-check-table tbody .account-cell {
    position: sticky;
    z-index: 10;
}

.account-cell small {
    color: #667384;
    display: block;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.missing-cell {
    min-width: 78px;
    text-align: center;
}

.missing-cell.is-ok {
    background: #fff;
}

.missing-cell.has-issue {
    background: #f7fbff;
}

.issue-badge {
    background: #6b7785;
    border-radius: 4px;
    color: #fff;
    display: inline-block;
    font-size: 11px;
    line-height: 1.2;
    margin: 2px 0;
    padding: 3px 5px;
}

.issue-badge.is-missing {
    background: #c62828;
    box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.14);
    font-weight: 700;
}

.missing-cell:has(.issue-badge.is-missing) {
    background: #fff0f0;
    outline: 2px solid #ef9a9a;
    outline-offset: -2px;
}

.issue-badge.is-incomplete {
    background: #b15f00;
}

.issue-badge.is-duplicate {
    background: #7a4fb3;
}

.issue-badge.is-info {
    background: #2f7d57;
}

.missing-cell:has(.issue-badge.is-info):not(:has(.issue-badge.is-missing)) {
    background: #eef8f2;
}

.missing-cell details {
    margin-top: 4px;
    text-align: left;
}

.missing-cell summary {
    cursor: pointer;
    font-size: 11px;
}

.summary-row {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.login-body {
    align-items: center;
    background: #eef2f6;
    display: flex;
    min-height: 100vh;
}

.login-shell {
    margin: 0 auto;
    max-width: 420px;
    width: 100%;
}

.login-card {
    background: #fff;
    border: 1px solid #d9e0e8;
    border-radius: 8px;
    padding: 28px;
}

.login-card h1 {
    font-size: 28px;
    line-height: 1.3;
}

.otp-status {
    background: #e9f5ee;
    border: 1px solid #b8ddc6;
    border-radius: 4px;
    color: #25643a;
    padding: 10px 12px;
}

.message {
    background: #fff;
    border-left: 4px solid #1976d2;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.message.error {
    border-left-color: #c62828;
}

.message.success {
    border-left-color: #2e7d32;
}

.zip-progress-page {
    margin: 0 auto;
    max-width: 760px;
    padding: 24px 18px 40px;
}

.progress-meter {
    background: #e4e9ef;
    border-radius: 999px;
    height: 18px;
    margin: 14px 0 18px;
    overflow: hidden;
}

.progress-meter div {
    background: #2e7d32;
    height: 100%;
    transition: width 0.2s ease;
}

.progress-stats {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    margin: 0 0 14px;
}

.progress-stats div {
    background: #f7f9fb;
    border: 1px solid #e1e7ee;
    border-radius: 6px;
    padding: 10px;
}

.progress-stats dt {
    color: #607080;
    font-size: 12px;
    margin: 0;
}

.progress-stats dd {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}

.progress-errors {
    background: #fff7f7;
    border: 1px solid #efcaca;
    border-radius: 6px;
    color: #9b2b2b;
    max-height: 220px;
    overflow: auto;
    padding: 10px;
    white-space: pre-wrap;
}

.item-link-preview {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 18px 0 0;
}

.item-link-preview img {
    background: #fff;
    border: 1px solid #dce4ec;
    border-radius: 6px;
    object-fit: contain;
    padding: 6px;
}

.item-page-nav {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin: 18px 0 0;
}

.item-list-back {
    margin-top: 28px;
}

/* Global table polish: readable headers, vertically centered rows, no horizontal table scroll. */
.table-scroll,
.wide-table-scroll,
.product-detail-table-scroll {
    overflow-x: visible;
}

table,
.wide-table,
.analysis-table,
.ai-analysis-table,
.product-detail-ai-table,
.name-ranking-table,
.name-ranking-table.is-overall,
.name-ranking-table.is-detail {
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

table thead th,
.sticky-table-header-clone th {
    text-align: center !important;
}

table th,
table td,
.product-detail-ai-table th,
.product-detail-ai-table td,
.ai-analysis-table th,
.ai-analysis-table td {
    vertical-align: middle !important;
}

table th,
table td {
    overflow-wrap: anywhere;
}

.stamp-idea-toolbar {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.stamp-idea-toolbar h2,
.stamp-idea-block h2 {
    margin-top: 0;
}

.stamp-idea-form select[multiple] {
    min-height: 160px;
}

.stamp-idea-grid,
.stamp-option-grid,
.selected-condition-grid,
.option-source-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stamp-idea-grid label,
.stamp-option-grid label {
    font-weight: 700;
}

.stamp-idea-grid select,
.stamp-idea-grid input,
.stamp-option-grid select,
.stamp-option-grid input {
    margin-top: 6px;
    width: 100%;
}

.stamp-idea-grid-compact {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stamp-idea-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.character-profile-build-grid,
.character-profile-columns,
.character-profile-detail-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.character-profile-build-card,
.character-profile-card {
    border: 1px solid #dce4ec;
    border-radius: 8px;
    padding: 16px;
}

.character-profile-build-card h3,
.character-profile-card h3 {
    margin-top: 0;
}

.character-profile-setting-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.character-profile-build-card .check-label {
    align-items: center;
    display: flex;
    gap: 8px;
    margin: 8px 0;
}

.character-profile-build-card .check-label input {
    margin: 0;
    width: auto;
}

.character-profile-card {
    margin-top: 16px;
}

.character-profile-card-header {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.character-profile-summary {
    background: #f7f9fb;
    border-left: 4px solid #6a7b8d;
    margin: 12px 0;
    padding: 10px 12px;
}

.character-profile-images {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    margin-bottom: 16px;
}

.character-profile-images figure {
    margin: 0;
}

.character-profile-images img {
    background: #fff;
    border: 1px solid #dce4ec;
    border-radius: 8px;
    display: block;
    height: 96px;
    object-fit: contain;
    padding: 4px;
    width: 96px;
}

.character-profile-images figcaption {
    color: #5c6875;
    font-size: 11px;
    line-height: 1.35;
    margin-top: 4px;
}

.selected-condition-grid div,
.option-source-grid div {
    background: #f7f9fb;
    border: 1px solid #dce4ec;
    border-radius: 6px;
    padding: 12px;
}

.selected-condition-grid dt {
    color: #5c6875;
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 4px;
}

.selected-condition-grid dd {
    font-weight: 700;
    margin: 0;
}

.source-badge,
.status-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    margin: 2px 4px 2px 0;
    padding: 4px 8px;
    white-space: nowrap;
}

.source-badge {
    background: #e8eef5;
    color: #2d3b4a;
}

.status-on {
    background: #e8f5ee;
    color: #17623a;
}

.status-off {
    background: #f2f4f7;
    color: #687586;
}

.stamp-option-type-filter {
    max-width: 360px;
}

.stamp-option-edit-form .check-label {
    align-items: center;
    display: flex;
    gap: 8px;
    margin-top: 28px;
}

.stamp-option-edit-form .check-label input {
    margin: 0;
    width: auto;
}

.usage-category-field {
    align-items: stretch;
    display: flex;
    gap: 8px;
}

.usage-category-field input {
    flex: 1;
    min-width: 0;
}

.usage-category-open {
    flex: 0 0 auto;
    margin: 0;
    padding-left: 14px;
    padding-right: 14px;
}

.usage-category-modal {
    align-items: center;
    background: rgba(15, 23, 42, 0.48);
    display: none;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: fixed;
    z-index: 1000;
}

.usage-category-modal.is-open {
    display: flex;
}

.usage-category-modal-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
    max-height: min(720px, calc(100vh - 48px));
    max-width: 460px;
    padding: 18px;
    width: min(100%, 460px);
}

.usage-category-modal-header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.usage-category-modal-header h2 {
    font-size: 20px;
    margin: 0;
}

.usage-category-modal-close {
    background: transparent;
    border: 0;
    color: #5c6875;
    margin: 0;
    padding: 4px 0;
}

.usage-category-modal-input {
    margin-bottom: 12px;
}

.usage-category-option-list {
    border: 1px solid #dce4ec;
    border-radius: 6px;
    max-height: 360px;
    overflow-y: auto;
    padding: 6px;
}

.usage-category-option-list button {
    background: #fff;
    border: 0;
    border-radius: 4px;
    color: #2d3748;
    display: block;
    font-weight: 700;
    height: auto;
    line-height: 1.35;
    margin: 0;
    padding: 9px 10px;
    text-align: left;
    text-transform: none;
    width: 100%;
}

.usage-category-option-list button:hover,
.usage-category-option-list button.is-selected {
    background: #edf4fb;
    color: #1f3a5f;
}

.usage-category-option-list button.is-selected {
    box-shadow: inset 0 0 0 2px #7aa5d8;
}

.usage-category-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 14px;
}

.usage-category-modal-actions .button {
    margin-bottom: 0;
}

@media (max-width: 760px) {
    .app-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding: 12px 16px;
    }

    .main-nav {
        gap: 10px;
    }

    .header-actions {
        margin-left: 0;
    }

    .pagination-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .pagination-links a,
    .pagination-links .current {
        height: 38px;
        min-width: 38px;
        padding: 0 11px;
    }

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

    .ai-csv-upload-header,
    .ai-csv-file-row,
    .ai-csv-submit-row {
        grid-template-columns: 1fr;
    }

    .ai-csv-upload-header {
        display: grid;
    }

    .ai-csv-submit-row button {
        width: 100%;
    }

    .stamp-idea-toolbar {
        display: grid;
    }
}
