/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: visible;
}

/* ヘッダー */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4CAF50;
    animation: pulse 2s infinite;
}

.status-dot.running {
    background: #FF9800;
}

.status-dot.error {
    background: #F44336;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 14px;
    font-weight: 500;
}

/* メインコンテンツ */
main {
    padding: 30px;
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #e0e0e0;
}

.card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #667eea;
    border-bottom: 2px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.card h2:hover {
    color: #5568d3;
}

.section-toggle {
    font-size: 16px;
    transition: transform 0.3s ease;
    color: #667eea;
}

.section-toggle.collapsed {
    transform: rotate(-90deg);
}

.card-content {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.card-content.collapsed {
    max-height: 0 !important;
    opacity: 0;
    margin: 0;
    padding: 0;
    padding-bottom: 8px;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #555;
}

.prefecture-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.btn-link {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
    padding: 0;
    transition: color 0.2s;
}

.btn-link:hover {
    color: #764ba2;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-small:hover {
    background-color: #e0e0e0;
    border-color: #667eea;
}

.prefectures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
    margin: 10px 0;
}

.prefecture-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    border: 1px solid #e0e0e0;
}

.prefecture-checkbox:hover {
    background: #e8eaf6;
    border-color: #667eea;
}

.prefecture-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.prefecture-checkbox input[type="checkbox"]:checked+span {
    font-weight: 600;
    color: #667eea;
}

.prefecture-checkbox span {
    user-select: none;
    font-size: 13px;
}

.checkbox-group-inline {
    display: flex;
    gap: 15px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 6px;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: #e8eaf6;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.checkbox-label input[type="checkbox"]:checked+span {
    font-weight: 600;
    color: #667eea;
}

input[type="number"],
input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

input[type="number"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

small {
    display: block;
    margin-top: 4px;
    color: #666;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ボタン */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: #4CAF50;
    color: #fff;
}

.btn-success:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-icon {
    font-size: 16px;
}

/* ダッシュボード */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

#monthlyUsageCard {
    position: relative;
    overflow: hidden;
}

#monthlyUsageCard.warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
}

#monthlyUsageCard.danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c2c7 100%);
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.usage-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
    border-radius: 3px;
    transition: width 0.5s ease, background 0.3s ease;
}

.usage-bar-fill.warning {
    background: linear-gradient(90deg, #FFC107 0%, #FFD54F 100%);
}

.usage-bar-fill.danger {
    background: linear-gradient(90deg, #F44336 0%, #E57373 100%);
}

/* ログ */
.log-container {
    margin-top: 24px;
}

.log-container h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #555;
}

.log-output {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    max-height: 400px;
    overflow-y: auto;
}

.log-entry {
    padding: 4px 0;
    border-bottom: 1px solid #333;
}

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

.log-info {
    color: #4EC9B0;
}

.log-warn {
    color: #FFC107;
}

.log-error {
    color: #F44336;
}

.log-success {
    color: #4CAF50;
}

/* 実行結果 */
.result-summary {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.result-summary p {
    margin-bottom: 8px;
}

.result-summary strong {
    color: #667eea;
}

/* 履歴テーブル */
.history-container {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.history-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.history-table td {
    font-size: 14px;
}

.history-table tbody tr:hover {
    background: #f9f9f9;
}

.text-center {
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.success {
    background: #E8F5E9;
    color: #4CAF50;
}

.status-badge.error {
    background: #FFEBEE;
    color: #F44336;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* フッター */
footer {
    background: #f5f5f5;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* リスト管理 */
.list-management {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 20px;
}

.list-management-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.upload-section,
.database-stats-section,
.list-section {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.upload-section h3,
.database-stats-section h3,
.list-section h3 {
    margin-bottom: 16px;
    font-size: 18px;
    color: #667eea;
}

/* データベース統計セクション */
.stats-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.stat-label {
    font-weight: 500;
    color: #555;
    min-width: 80px;
}

.stat-value {
    font-weight: 600;
    color: #333;
    flex: 1;
}

/* データベース確認画面 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.database-table,
.sample-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.database-table th,
.database-table td,
.sample-table th,
.sample-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.database-table th,
.sample-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #555;
}

.database-table tr:hover,
.sample-table tr:hover {
    background: #f9f9f9;
}

.sample-info {
    margin-bottom: 16px;
    padding: 12px;
    background: #f0f8ff;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.sample-info p {
    margin: 0;
    color: #555;
    font-weight: 500;
}

/* 企業一覧画面 */
.search-form {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.table-info {
    margin-bottom: 16px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
}

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

.companies-table {
    width: 100%;
    min-width: 2000px;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 14px;
}

.companies-table th,
.companies-table td {
    padding: 6px 4px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
    font-size: 12px;
}

.companies-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
}

.companies-table tr:hover {
    background: #f9f9f9;
}

.url-link {
    color: #667eea;
    text-decoration: none;
}

.url-link:hover {
    text-decoration: underline;
}

.pagination-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-text {
    font-size: 14px;
    color: #666;
}

.list-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}

.list-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.list-header strong {
    font-size: 16px;
    color: #333;
}

.list-details {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #666;
}

.list-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-default {
    background: #e0e0e0;
    color: #666;
}

.badge-success {
    background: #4caf50;
    color: #fff;
}

.badge-warning {
    background: #ff9800;
    color: #fff;
}

.badge-danger {
    background: #f44336;
    color: #fff;
}

.message {
    margin-top: 12px;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
}

.message-info {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #1976d2;
}

.message-success {
    background: #e8f5e9;
    color: #388e3c;
    border: 1px solid #388e3c;
}

.message-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #c62828;
}

.text-muted {
    color: #999;
    font-style: italic;
}

.text-error {
    color: #c62828;
}

.btn-danger {
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
    color: #fff;
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #e53935 0%, #d32f2f 100%);
}

/* リスト検索 */
.list-search-container {
    padding: 20px;
}

.list-search-info h3 {
    color: #667eea;
    margin-bottom: 12px;
}

.list-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    font-size: 14px;
    color: #666;
}

.capital-filter {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.capital-filter h4 {
    margin-bottom: 16px;
    color: #333;
}

.filter-result {
    margin-top: 16px;
    padding: 12px;
    background: #e3f2fd;
    border-left: 4px solid #1976d2;
    font-size: 14px;
    font-weight: 500;
}

.search-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

/* 検索進捗 */
.search-progress {
    background: #f9f9f9;
    padding: 24px;
    border-radius: 8px;
    margin-top: 24px;
}

.search-progress h4 {
    margin-bottom: 16px;
    color: #333;
}

.progress-bar-container {
    position: relative;
    margin-bottom: 16px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.progress-details {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}

.progress-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.progress-label {
    color: #666;
}

.progress-value {
    font-weight: 600;
    color: #333;
}

.progress-success {
    color: #4caf50;
}

.progress-error {
    color: #f44336;
}

.current-company {
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    font-size: 14px;
}

/* 検索結果 */
.search-result {
    background: #e8f5e9;
    padding: 24px;
    border-radius: 8px;
    margin-top: 24px;
    border: 2px solid #4caf50;
}

.search-result h4 {
    margin-bottom: 16px;
    color: #2e7d32;
}

.result-summary {
    margin-bottom: 16px;
}

.result-actions {
    display: flex;
    gap: 12px;
}

/* 結果テーブル */
.results-table-container {
    margin: 24px 0;
}

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

.results-header h3 {
    color: #667eea;
    margin: 0;
}

.results-info {
    font-size: 14px;
    color: #666;
}

.table-wrapper {
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 16px;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.results-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.results-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.results-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s;
}

.results-table tbody tr:hover {
    background-color: #f5f5f5;
}

.results-table td {
    padding: 12px 16px;
    font-size: 14px;
    vertical-align: middle;
}

.company-name {
    font-weight: 500;
    color: #333;
}

.company-url a {
    color: #1976d2;
    text-decoration: none;
}

.company-url a:hover {
    text-decoration: underline;
}

.company-address {
    color: #666;
}

.company-capital {
    text-align: right;
    font-weight: 500;
    color: #4caf50;
}

.company-employees {
    text-align: right;
    color: #666;
}

.company-phone,
.company-email {
    font-size: 13px;
    color: #666;
}

/* ページネーション */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
}

.pagination-info label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.pagination-info select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pagination-text {
    font-size: 14px;
    color: #666;
}

.pagination-text strong {
    color: #333;
}

/* リスト詳細画面 */
.header-actions {
    display: flex;
    gap: 12px;
}

.list-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.info-value {
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
}

.form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-select-small {
    padding: 6px 10px;
    font-size: 13px;
}

.progress-container {
    padding: 20px;
}

.progress-text-display {
    margin-bottom: 16px;
    font-size: 14px;
    color: #666;
    text-align: center;
}

.progress-bar-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.progress-bar-bg {
    width: 100%;
    height: 40px;
    background: #e0e0e0;
    border-radius: 20px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
}

.progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.progress-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    font-size: 14px;
    color: #666;
}

.progress-stats strong {
    font-size: 16px;
    margin-left: 4px;
}

.text-success {
    color: #4caf50;
}

.text-error {
    color: #f44336;
}

.text-center {
    text-align: center;
}

.results-summary {
    margin-bottom: 20px;
    padding: 16px;
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    border-radius: 4px;
}

.pagination-range {
    font-size: 14px;
    color: #666;
}

/* 業種チェックボックス */
.industry-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
}

.industry-controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

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

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

    .btn {
        width: 100%;
        justify-content: center;
    }

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

    .list-management-two-column {
        grid-template-columns: 1fr;
    }

    .list-details {
        flex-direction: column;
        gap: 8px;
    }
}

/* API使用量詳細セクション */
.usage-details-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.usage-current-period {
    margin-bottom: 32px;
}

.usage-current-period h3 {
    color: #667eea;
    margin-bottom: 16px;
    font-size: 18px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.period-info {
    background: #f5f7ff;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.period-info p {
    margin: 8px 0;
    font-size: 14px;
}

.period-info strong {
    color: #555;
    display: inline-block;
    min-width: 120px;
}

.period-details h4 {
    color: #555;
    font-size: 16px;
    margin: 16px 0 12px;
}

.usage-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.usage-details-table th {
    background: #f0f4ff;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #ddd;
}

.usage-details-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.usage-details-table tr:hover {
    background: #fafafa;
}

.usage-history h3 {
    color: #764ba2;
    margin-bottom: 16px;
    font-size: 18px;
    border-bottom: 2px solid #764ba2;
    padding-bottom: 8px;
}

.usage-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.usage-history-table th {
    background: #f9f0ff;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #ddd;
}

.usage-history-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.usage-history-table tr:hover {
    background: #fafafa;
}

.badge-info {
    background: #2196F3;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* ========================================
   モーダル
======================================== */

/* モーダルオーバーレイ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* モーダルウィンドウ */
.modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
}

/* モーダルヘッダー */
.modal-header {
    padding: 24px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* モーダルボディ */
.modal-body {
    padding: 24px;
}

.modal-section {
    margin-bottom: 20px;
}

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

.modal-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-info-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-info-list li:last-child {
    border-bottom: none;
}

.modal-info-label {
    font-weight: 500;
    color: #666;
}

.modal-info-value {
    font-weight: 600;
    color: #333;
}

.modal-info-value.highlight {
    color: #667eea;
    font-size: 18px;
}

.modal-info-value.warning {
    color: #ff9800;
}

.modal-info-value.danger {
    color: #f44336;
}

.modal-info-value.success {
    color: #4caf50;
}

/* 注意事項 */
.modal-warning-box {
    background: #fff3cd;
    border-left: 4px solid #ff9800;
    padding: 16px;
    border-radius: 4px;
    margin-top: 16px;
}

.modal-warning-box h5 {
    font-size: 14px;
    font-weight: 600;
    color: #856404;
    margin-bottom: 8px;
}

.modal-warning-box ul {
    margin: 0;
    padding-left: 20px;
}

.modal-warning-box li {
    color: #856404;
    font-size: 13px;
    margin-bottom: 4px;
}

/* エラーボックス */
.modal-error-box {
    background: #ffebee;
    border-left: 4px solid #f44336;
    padding: 16px;
    border-radius: 4px;
}

.modal-error-box h5 {
    font-size: 14px;
    font-weight: 600;
    color: #c62828;
    margin-bottom: 8px;
}

.modal-error-box p {
    color: #c62828;
    font-size: 13px;
    margin: 0;
}

/* 成功ボックス */
.modal-success-box {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
    padding: 16px;
    border-radius: 4px;
}

.modal-success-box h5 {
    font-size: 14px;
    font-weight: 600;
    color: #2e7d32;
    margin-bottom: 8px;
}

/* モーダルフッター */
.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-footer .btn {
    min-width: 100px;
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* スクロール禁止 */
body.modal-open {
    overflow: hidden;
}

/* ============================================
   Phase 2: モーダルスタイル
   ============================================ */

/* モーダルオーバーレイ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

/* モーダルコンテナ */
.modal-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

/* モーダルヘッダー */
.modal-header {
    padding: 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header .modal-icon {
    font-size: 24px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

/* モーダルボディ */
.modal-body {
    padding: 24px;
}

.modal-body p {
    margin-bottom: 16px;
    line-height: 1.6;
    color: #666;
}

/* モーダルフッター */
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-footer .btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.modal-footer .btn-secondary:hover {
    background: #e0e0e0;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.modal-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.modal-footer .btn-danger {
    background: #f44336;
    color: #fff;
}

.modal-footer .btn-danger:hover {
    background: #d32f2f;
}

/* 確認モーダル用のスタイル */
.confirm-details {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
}

.confirm-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.confirm-details .detail-row:last-child {
    border-bottom: none;
}

.confirm-details .detail-label {
    font-weight: 500;
    color: #666;
}

.confirm-details .detail-value {
    font-weight: 600;
    color: #333;
}

/* アラートモーダル用のスタイル */
.alert-message {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
    color: #856404;
}

.alert-message.error {
    background: #f8d7da;
    border-color: #f44336;
    color: #721c24;
}

.alert-message.info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* 完了モーダル用のスタイル */
.result-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 16px 0;
}

.result-card {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.result-card .result-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.result-card .result-value {
    font-size: 24px;
    font-weight: 600;
    color: #667eea;
}

.result-card .result-unit {
    font-size: 14px;
    color: #999;
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* スムーススクロール */
html {
    scroll-behavior: smooth;
}

/* スクロールバーのスタイリング（Webkit系ブラウザ） */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

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

.modal-content {
    background-color: #fefefe;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin: 0 0 20px 0;
    color: #333;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-actions .btn {
    min-width: 80px;
}