* {
    box-sizing: border-box;
}

body {
    margin: 0;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Noto Sans JP",
        sans-serif;

    background: #f5f7fb;
    color: #222;
}

a {
    color: inherit;
}

.header {
    height: 64px;

    background: #ffffff;

    border-bottom: 1px solid #e4e8ef;

    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 0 32px;
}

.logo {
    font-size: 22px;
    font-weight: 800;
}

.header nav {
    display: flex;

    align-items: center;

    gap: 24px;
}

.header nav a {
    text-decoration: none;

    font-weight: 600;
}

.container {
    width: min(1180px, 94%);

    margin: 32px auto;
}

.small-container {
    max-width: 700px;
}

.cards {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 18px;

    margin: 24px 0;
}

.card {
    background: white;

    border-radius: 14px;

    padding: 22px;

    box-shadow:
        0 3px 14px
        rgba(0, 0, 0, 0.05);
}

.card span {
    display: block;

    color: #687386;

    font-size: 14px;
}

.card strong {
    display: block;

    margin-top: 8px;

    font-size: 28px;
}

.warning-card {
    border-left: 5px solid #e6a700;
}

.danger-card {
    border-left: 5px solid #d64545;
}

.panel {
    background: #ffffff;

    border-radius: 14px;

    padding: 24px;

    margin-top: 22px;

    box-shadow:
        0 3px 14px
        rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 16px;
}

table {
    width: 100%;

    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;

    border-bottom:
        1px solid #e8ebf0;

    text-align: left;
}

th {
    color: #687386;

    font-size: 13px;
}

.empty {
    text-align: center;

    color: #8c96a5;

    padding: 35px;
}

.primary-button,
.secondary-button,
.danger-button {

    display: inline-block;

    border: none;

    border-radius: 8px;

    padding: 11px 18px;

    text-decoration: none;

    font-weight: 700;

    cursor: pointer;

    font-size: 14px;
}

.primary-button {
    background: #246bfd;

    color: white;
}

.secondary-button {
    background: #e9edf4;

    color: #222;
}

.danger-button {
    background: #d64545;

    color: white;
}

.badge {
    display: inline-block;

    padding: 4px 8px;

    border-radius: 999px;

    font-size: 12px;

    font-weight: bold;
}

.badge.danger {
    background: #ffe0e0;

    color: #b62323;
}

.actions {
    display: flex;

    align-items: center;

    gap: 12px;
}

.actions a {
    color: #246bfd;

    text-decoration: none;
}

.actions form {
    margin: 0;
}

.link-danger {
    border: 0;

    background: transparent;

    color: #d64545;

    padding: 0;

    cursor: pointer;
}

.form-panel {
    display: flex;

    flex-direction: column;

    gap: 10px;
}

.form-panel label {
    font-size: 14px;

    font-weight: 700;

    margin-top: 7px;
}

.form-panel input {
    width: 100%;

    border: 1px solid #ccd3dd;

    border-radius: 8px;

    padding: 12px;

    font-size: 16px;
}

.form-buttons {
    display: flex;

    justify-content: flex-end;

    gap: 12px;

    margin-top: 20px;
}

.inventory-grid {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 20px;
}

.login-body {
    min-height: 100vh;

    display: flex;

    align-items: center;

    justify-content: center;

    background: #f5f7fb;
}

.login-card {
    width: min(420px, 92%);

    background: white;

    padding: 38px;

    border-radius: 16px;

    box-shadow:
        0 6px 28px
        rgba(0, 0, 0, 0.08);
}

.login-card h1 {
    margin-bottom: 4px;

    font-size: 32px;
}

.login-card form {
    display: flex;

    flex-direction: column;

    gap: 10px;

    margin-top: 25px;
}

.login-card input {
    border: 1px solid #ccd3dd;

    border-radius: 8px;

    padding: 12px;

    font-size: 16px;
}

.login-card button {
    margin-top: 12px;
}

.dev-info {
    margin-top: 20px;

    font-size: 12px;

    color: #8c96a5;
}

.alert {
    padding: 10px;

    margin-top: 15px;

    border-radius: 8px;

    background: #e9f5eb;
}

.alert.error {
    background: #ffe2e2;

    color: #a72727;
}

.logout-form {
    margin: 0;
}

.logout-button {
    border: none;

    background: transparent;

    font-weight: 600;

    cursor: pointer;
}

@media (max-width: 800px) {

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

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

    .header {
        padding: 0 15px;
    }

    .header nav {
        gap: 10px;
    }

    table {
        font-size: 13px;
    }
}

@media (max-width: 520px) {

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

    .container {
        width: 96%;
    }

    .panel {
        overflow-x: auto;
    }
}
/* =========================
   検索フォーム
   ========================= */

.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.search-form input,
.search-form select {
    min-height: 42px;
    border: 1px solid #ccd3dd;
    border-radius: 8px;
    padding: 10px 12px;
    background: white;
    font-size: 14px;
}

.search-form input {
    min-width: 220px;
}

.search-form select {
    min-width: 150px;
}


/* =========================
   ダッシュボード補助
   ========================= */

.panel p {
    color: #687386;
}

.panel h2 {
    margin-top: 0;
}


/* =========================
   CSV
   ========================= */

input[type="file"] {
    margin-right: 12px;
}


/* =========================
   スマホ
   ========================= */

@media (max-width: 700px) {

    .search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form input,
    .search-form select,
    .search-form button,
    .search-form a {
        width: 100%;
    }
}
/* =========================
   PLAN
   ========================= */

.plan-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.plan-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    border: 1px solid #e3e7ee;
    box-shadow:
        0 4px 18px
        rgba(0, 0, 0, 0.05);
}

.plan-card.featured {
    border: 2px solid #246bfd;
}

.plan-price {
    font-size: 34px;
    font-weight: 800;
    margin: 20px 0;
}

.plan-price span {
    font-size: 14px;
    color: #687386;
}

.plan-card ul {
    line-height: 2;
    padding-left: 20px;
}

@media (max-width: 700px) {

    .plan-grid {
        grid-template-columns: 1fr;
    }
}
/* =========================
   BLOCK 3
   ========================= */

.field-error {
    color: #c62828;
    font-size: 13px;
    margin-top: -5px;
}

.error-page {
    margin-top: 80px;
    text-align: center;
    padding: 50px;
}

.legal {
    line-height: 1.8;
}

.legal h2 {
    margin-top: 32px;
}

.agreement {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    margin: 15px 0;
}

.agreement input {
    width: auto;
}

.footer-links {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
    font-size: 13px;
}
/* =========================
   SMARTPHONE FIX
   ========================= */

@media (max-width: 520px) {

    /* ヘッダーをスマホ向けに縦配置 */
    .header {
        height: auto;
        min-height: 64px;
        padding: 12px 16px;
        align-items: flex-start;
        gap: 12px;
    }

    .logo {
        flex-shrink: 0;
        font-size: 22px;
        line-height: 1.2;
    }

    .header nav {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px 12px;
    }

    .header nav a,
    .logout-button {
        white-space: nowrap;
        font-size: 14px;
    }

    /* コンテナ */
    .container {
        width: 94%;
        margin: 24px auto;
    }

    /* セクション上部 */
    .section-header {
        align-items: flex-start;
        gap: 12px;
    }

    .section-header h1,
    .section-header h2 {
        margin-top: 0;
    }

    /* テーブル横はみ出し対策 */
    table {
        width: 100%;
        table-layout: fixed;
    }

    th,
    td {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* 特に長い商品名・SKU */
    td {
        white-space: normal;
    }

    /* 操作リンク */
    .actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* CSV部分 */
    input[type="file"] {
        max-width: 100%;
        margin-right: 0;
    }

    /* ボタンが画面外に出ないようにする */
    .primary-button,
    .secondary-button,
    .danger-button {
        max-width: 100%;
        white-space: normal;
    }
}
/* =========================
   SMARTPHONE TABLE FIX
   ========================= */

@media (max-width: 520px) {

    .panel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .panel table {
        width: 100%;
        min-width: 720px;
        table-layout: auto;
    }

    .panel th,
    .panel td {
        white-space: nowrap;
        word-break: normal;
        overflow-wrap: normal;
    }

    .panel td:first-child {
        white-space: normal;
        min-width: 150px;
        max-width: 220px;
        overflow-wrap: anywhere;
    }

    .actions {
        flex-wrap: nowrap;
        white-space: nowrap;
    }
}