:root {
    var(--primary-color): #004d7a;
    --primary-color: #004d7a;
    --accent-color: #009bdd;
    --bg-color: #e1f0f8;
    --card-bg: #ffffff;
    --border-color: #b3d7e8;
    --readonly-bg: #f0f7fb;
    --disabled-color: #a5c6d9;
    --thu-color: #17a589;
    --danger-color: #e74c3c;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 12px;
    color: #1c1c1e;
}

h1 {
    font-size: 18px;
    text-align: center;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    margin: 0 0 16px 0;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 155, 221, 0.2);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

h1::before {
    content: "💧";
    font-size: 20px;
}

/* タブナビゲーション */
.tab-container { display: flex; background: #cce4f0; border-radius: 10px; padding: 4px; margin-bottom: 8px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.05); }
.tab-btn { flex: 1; text-align: center; padding: 10px 0; font-size: 14px; font-weight: bold; color: var(--primary-color); background: transparent; border: none; border-radius: 8px; cursor: pointer; transition: 0.2s; opacity: 0.6; }
.tab-btn.active { background: #fff; color: var(--accent-color); box-shadow: 0 2px 4px rgba(0,0,0,0.05); opacity: 1; }

.dev-toggle { text-align: center; margin-bottom: 12px; font-size: 13px; color: #5a7b8c; }

/* 薬品管理バナー */
.status-banner {
    background-color: #fff3cd; color: #856404; border-left: 5px solid #ffc107;
    padding: 12px; margin-bottom: 16px; border-radius: 8px; font-size: 14px; font-weight: bold;
    display: none; line-height: 1.4; box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.status-banner div { margin-bottom: 4px; }
.status-banner div:last-child { margin-bottom: 0; }

.card { background: var(--card-bg); border-radius: 16px; padding: 16px; margin-bottom: 16px; box-shadow: 0 4px 12px rgba(0,77,122,0.05); border: 1px solid rgba(255,255,255,0.5); }
.system-title { font-size: 15px; font-weight: bold; color: var(--primary-color); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 2px solid var(--accent-color); }

/* 3列グリッド */
.grid-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.grid-row:last-child { margin-bottom: 0; }
.input-cell { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border-color); border-radius: 10px; padding: 8px; box-shadow: inset 0 1px 3px rgba(0,77,122,0.03); transition: all 0.3s ease; }
.input-cell:focus-within { border-color: var(--accent-color); }
.input-cell label { font-size: 11px; color: #5a7b8c; margin-bottom: 4px; line-height: 1.2; white-space: nowrap; overflow: hidden; font-weight: 600; transition: color 0.3s ease; }
.input-cell .unit { font-size: 9px; color: #8ba9b8; margin-left: 2px; font-weight: normal; }
.input-cell input { border: none; border-bottom: 1px solid transparent; font-size: 18px; text-align: right; width: 100%; padding: 2px 0; background: transparent; color: #2c3e50; font-weight: 500; transition: color 0.3s ease; }
.input-cell input:focus { outline: none; }
.input-cell.readonly { background: var(--readonly-bg); border-color: transparent; }
.input-cell.readonly input { color: var(--accent-color); font-weight: bold; }
.empty-cell { visibility: hidden; pointer-events: none; }

/* アラート用スタイル */
.input-cell.alert-warning { background-color: #fff8e1; border-color: #ffc107; box-shadow: inset 0 0 5px rgba(255,193,7,0.3); }
.input-cell.alert-warning label { color: #b08d00; }
.input-cell.alert-warning input { color: #d32f2f; font-weight: bold; }

.input-cell.alert-danger { background-color: #ffebee; border-color: #f44336; box-shadow: inset 0 0 5px rgba(244,67,54,0.3); }
.input-cell.alert-danger label { color: #c62828; }
.input-cell.alert-danger input { color: #b71c1c; font-weight: bold; }

/* 木曜セクション */
.thu-wrapper { border: 2px solid var(--thu-color); border-radius: 16px; padding: 12px; background: #f4fbf7; margin-top: 16px; }
.thu-wrapper .system-title { border-bottom-color: var(--thu-color); color: var(--thu-color); margin-bottom: 10px; }
.thu-wrapper.disabled { opacity: 0.5; pointer-events: none; background: var(--bg-color); border-color: var(--disabled-color); }

/* ボタン */
.btn { display: block; width: 100%; padding: 16px; margin-bottom: 12px; font-size: 16px; font-weight: bold; color: white; border: none; border-radius: 12px; cursor: pointer; box-shadow: 0 4px 8px rgba(0,0,0,0.1); text-align: center; transition: transform 0.1s, box-shadow 0.1s; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn-save { background: linear-gradient(135deg, #009bdd, #0072bc); }
.btn-export { background: linear-gradient(135deg, #5856d6, #4341b5); }
.btn-delete { background: linear-gradient(135deg, #ff4b40, #d63025); margin-top: 24px; opacity: 0.9; }

/* メイン画面用発注ボタン */
.main-order-btn { background: linear-gradient(135deg, #f39c12, #d68910); color: white; border: none; border-radius: 10px; font-size: 13px; font-weight: bold; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: 0.2s; display: flex; align-items: center; justify-content: center; padding: 0 10px; }
.main-order-btn:active { transform: translateY(1px); box-shadow: none; }
.main-order-btn.waiting { background: var(--readonly-bg); color: var(--disabled-color); box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); cursor: default; border: 1px solid var(--border-color); }

.chart-container { position: relative; height: 250px; width: 100%; margin-bottom: 24px; }
.view-section { display: none; animation: fadeIn 0.3s ease; }
.view-section.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* モーダル (ポップアップ) 用スタイル */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; backdrop-filter: blur(2px); }
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease; }
.modal-content { background: #fff; width: 100%; max-width: 450px; border-radius: 20px; padding: 24px; position: relative; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.modal-close { position: absolute; top: 16px; right: 20px; font-size: 28px; color: #aaa; cursor: pointer; line-height: 1; }
.modal-title { font-size: 18px; color: var(--primary-color); margin-top: 0; margin-bottom: 20px; border-bottom: 2px solid var(--accent-color); padding-bottom: 8px; }

.chem-card { border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; margin-bottom: 16px; background: var(--bg-color); }
.chem-card h3 { margin: 0 0 12px 0; font-size: 15px; color: var(--primary-color); display: flex; justify-content: space-between; align-items: center; }
.badge { font-size: 11px; padding: 4px 8px; border-radius: 12px; background: #fff; color: #27ae60; font-weight: bold; border: 1px solid #27ae60; }
.badge.waiting { background: #ffc107; color: #856404; border-color: #ffc107; }

.action-row { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.action-row input { flex: 1; min-width: 0; padding: 10px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 15px; text-align: right; }
.btn-small { padding: 10px 16px; font-size: 14px; font-weight: bold; border: none; border-radius: 8px; cursor: pointer; color: white; white-space: nowrap; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn-small:active { transform: translateY(1px); }
.btn-order { background: linear-gradient(135deg, #f39c12, #d68910); }
.btn-replenish { background: linear-gradient(135deg, #27ae60, #2ecc71); }
