:root {
    --bg-color: #f0f4f8;
    --card-bg: #ffffff;
    --text-color: #333;
    --accent-color: #007bff;
    --border-color: #ddd;
    --normal: #28a745;
    --elevated: #ffc107;
    --stage1: #fd7e14;
    --stage2: #dc3545;
    --input: #fff;
    --overlay-bg: rgba(0, 0, 0, 0.85);
}

[data-theme="dark"] {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --accent-color: #193864;
    --border-color: #333;
    --input: #292524;
    --overlay-bg: rgba(18, 18, 18, 0.95);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s ease;
}

.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.card { background: var(--card-bg); padding: 15px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); margin-bottom: 15px; border: 1px solid var(--border-color); width: 100%; box-sizing: border-box; }

input, select, button { color: inherit; background: var(--input); width: 100%; padding: 10px; margin: 5px 0; border-radius: 4px; border: 1px solid var(--border-color); box-sizing: border-box; }
button { background: var(--accent-color); color: white; border: none; cursor: pointer; font-weight: bold; }
button:hover { opacity: 0.9; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary-panel { border-left: 4px solid var(--accent-color); }
.error-msg { color: var(--stage2); font-size: 0.85em; margin-top: 5px; display: none; }

.status-normal { color: var(--normal); }
.status-elevated { color: var(--elevated); }
.status-stage1 { color: var(--stage1); }
.status-stage2 { color: var(--stage2); }

.counter-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.counter-btns button { flex: 1; min-width: 80px; padding: 5px; }
.btn-icon { height: 35px; width: auto; pointer-events: none; }

/* Tab Styles */
.tabs { display: flex; justify-content: space-around; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); width: 100%; }
.tab-link { background: none; border: none; color: var(--text-color); padding: 10px; cursor: pointer; font-weight: normal; width: auto; font-size: 0.9em; }
.tab-link.active { border-bottom: 2px solid var(--accent-color); font-weight: bold; color: var(--accent-color); }
.tab-content { display: none; width: 100%; }
.tab-content.active { display: block; }

/* Table Styles */
table { width: 100%; border-collapse: collapse; font-size: 0.85em; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { color: var(--accent-color); text-transform: uppercase; letter-spacing: 1px; }

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--overlay-bg);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-card {
    max-width: 320px;
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.passcode-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 15px 0;
}

.code-input {
    width: 42px !important;
    height: 50px;
    text-align: center;
    font-size: 1.5em;
    padding: 0 !important;
}

.intake-config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 5px 10px;
    background: var(--input);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--normal);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    display: none;
    z-index: 2000;
}