:root {
    --color-background: #f0f2f5;
    /* 非常に薄いグレー/オフホワイト */
    --color-header-bg: #e0e6ed;
    /* 薄い青みがかったグレー */
    --color-header-text: #34495e;
    /* 濃いグレー */
    --color-text-primary: #34495e;
    /* 濃いグレー */
    --color-text-secondary: #5c6f82;
    /* 中程度のグレー */
    --color-accent: #6c757d;
    /* 青みがかった紫 */
    --color-button-bg: #6c757d;
    /* 青みがかった紫 */
    --color-button-hover-bg: #5a6268;
    /* 濃い青みがかった紫 */
    --color-card-bg: #ffffff;
    /* 白 */
    --color-border: #d1d9e6;
    /* 薄いグレー */
    --color-shadow: rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    background-color: var(--color-background);
    color: var(--color-text-primary);
}

.message-box-center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    white-space: pre-wrap;
    /* 複数行のメッセージに対応 */
}

/* 1画面の情報量を多くするための調整 */



/* スマートフォン向けにテーブルのレイアウトを調整 (変更なし) */
@media (max-width: 640px) {
    .table-container table {
        table-layout: fixed;
        width: 100%;
    }

    .table-container th,
    .table-container td {
        word-wrap: break-word;
        white-space: normal;
        padding: 0.5rem;
    }

    .table-container thead {
        display: none;
        /* スマホではヘッダーを非表示 */
    }

    .table-container tbody,
    .table-container tr {
        display: block;
        /* tbodyとtrをブロック要素にして積み重ねる */
    }

    .table-container tr {
        margin-bottom: 1rem;
        padding: 0.5rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
    }

    .table-container td {
        display: flex;
        /* Flexboxを使って項目と内容を横並びに */
        align-items: flex-start;
        width: 100%;
        border-bottom: none;
        padding: 0.25rem 0.5rem;
    }

    .table-container td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #4b5563;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        flex-shrink: 0;
        /* ラベルが縮まないように固定 */
        width: 80px;
        /* ラベルの幅を確保 */
        margin-right: 0.5rem;
        /* ラベルと内容の間にスペースを追加 */
    }

    .truncate-lines {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        /* 2行に制限 */
        line-clamp: 2;
        /* 標準プロパティ */
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* スマートフォンで非表示にする項目 (変更なし) */
    td[data-label='成分名'],
    td[data-label='出荷量状況'] {
        display: none;
    }
}

.status-button {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    transition: color 0.15s, background-color 0.15s;
    line-height: 1;
}

.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #4f46e5;
    /* Tailwind's indigo-600 */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

.sort-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    /* テキスト選択を防ぐ */
}

.sort-icon {
    margin-left: 4px;
    font-size: 0.8rem;
    color: #4f46e5;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: #6366f1;
    /* Tailwind's indigo-500 */
    transition: width 0.3s ease-in-out;
}

.table-cell-with-padding {
    padding: 12px 16px;
}

.card-item {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

a.manufacturer-link {
    color: #4f46e5;
    /* indigo-600 */
    text-decoration: none;
}

a.manufacturer-link:hover {
    text-decoration: underline;
}

.status-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 0.5rem 0;
}

.name-clickable {
    color: #3730a3;
    /* indigo-700 */
    text-decoration: none;
    cursor: pointer;
}

.name-clickable:hover {
    text-decoration: underline;
}

/* --- Style Unification --- */
.unified-button {
    padding: 8px 12px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.unified-button:hover {
    background-color: #5a6268;
}

.unified-input {
    padding: 10px;
    border: 1px solid #d1d9e6;
    border-radius: 5px;
    font-size: 1rem;
}

.page-wrapper {
    background-color: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    width: 100%;
    max-width: 80rem;
    position: relative;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
}

/* hiyari_app/style.css から統合 */
.search-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.search-controls,
.filter-controls {
    background-color: #ffffff;
    /* var(--color-card-bg) */
    padding: 1.2rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    /* var(--color-shadow) */
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    min-width: 280px;
    flex-wrap: nowrap;
}

.search-controls label,
.filter-controls label {
    font-weight: bold;
    color: #34495e;
    /* var(--color-text-primary) */
    margin-right: 5px;
}

.search-controls .unified-input,
.filter-controls .unified-input {
    flex-grow: 1;
}

.search-controls .unified-button,
.filter-controls .unified-button {
    width: 80px;
    flex-shrink: 0;
}

.incident-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.incident-card {
    background-color: #ffffff;
    /* var(--color-card-bg) */
    border: 1px solid #d1d9e6;
    /* var(--color-border) */
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    /* var(--color-shadow) */
    transition: transform 0.2s ease-in-out;
}

.incident-card:hover {
    transform: translateY(-5px);
}

.incident-card h2 {
    margin-top: 0;
    font-size: 1.3rem;
    color: #6c757d;
    /* var(--color-accent) */
    border-bottom: 2px solid #d1d9e6;
    /* var(--color-border) */
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.incident-card p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #5c6f82;
    /* var(--color-text-secondary) */
    margin-bottom: 1em;
}

.incident-card p strong {
    color: #6c757d;
    /* var(--color-accent) */
    border-bottom: 2px solid #d1d9e6;
    /* var(--color-border) */
    padding-bottom: 2px;
    display: inline-block;
    margin-bottom: 0.5em;
}

.incident-date {
    font-size: 0.85rem;
    color: #5c6f82;
    /* var(--color-text-secondary) */
    text-align: right;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .search-filter-container {
        flex-direction: column;
    }

    .search-controls,
    .filter-controls {
        flex-wrap: wrap;
        row-gap: 1rem;
    }
}

#filter-word {
    max-width: 300px;
}

.text-red-500 {
    color: #ef4444;
}

.text-red-600 {
    color: #dc2626;
}