:root {
    --teal: #2D9596;
    --teal-dark: #247576;
    --teal-light: #e8f5f5;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text-main: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

/* Header */
.app-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    height: 28px;
    width: auto;
}

.patient-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.patient-avatar {
    width: 36px;
    height: 36px;
    background: var(--teal-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal);
    font-weight: 600;
}

.patient-name {
    font-weight: 500;
    color: var(--text-main);
}

.patient-dob {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Main Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.help-icon {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: help;
}

/* MADRS Section */
.madrs-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.madrs-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.madrs-stat-label {
    color: var(--text-secondary);
}

.madrs-stat-value {
    font-weight: 600;
    color: var(--text-main);
}

.madrs-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--success);
    font-weight: 500;
}

.madrs-change.negative {
    color: var(--error);
}

.madrs-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.madrs-tab {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.madrs-tab:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.madrs-tab.active {
    background: var(--teal);
    border-color: var(--teal);
    color: white;
}

.chart-container {
    height: 200px;
    position: relative;
}

.chart-link {
    display: block;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--teal);
    text-decoration: none;
}

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

/* Treatment Status - Full Width */
.treatment-card {
    grid-column: 1 / -1;
}

.stimulation-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.stimulation-alert {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #fef2f2;
    color: var(--error);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.stimulation-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.stimulation-stats {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stimulation-stats strong {
    color: var(--text-main);
}

/* Week Grid */
#stimulation-weeks {
    max-height: 240px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

#stimulation-weeks::-webkit-scrollbar {
    width: 6px;
}

#stimulation-weeks::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 3px;
}

#stimulation-weeks::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

#stimulation-weeks::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.week-row {
    margin-bottom: 1rem;
}

.week-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.week-days {
    display: flex;
    gap: 0.5rem;
}

.day-slot {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.day-slot.completed {
    background: var(--teal);
    color: white;
}

.day-slot.completed::before {
    content: '🔒';
    font-size: 0.875rem;
}

.day-slot.missed {
    background: #f3f4f6;
    color: var(--text-muted);
}

.day-slot.missed::before {
    content: '✕';
    font-size: 1rem;
    color: var(--text-muted);
}

.day-slot.scheduled {
    background: var(--teal);
    color: white;
}

.day-slot.scheduled::before {
    content: '🔒';
    font-size: 0.875rem;
}

.day-slot.current {
    background: var(--teal);
    color: white;
    position: relative;
}

.day-slot.current::before {
    content: '▶';
    font-size: 0.75rem;
}

.day-slot.future {
    background: #f3f4f6;
    border: 1px dashed var(--border);
}

/* Treatment Status / Schedule Editor */
.treatment-card {
    margin-top: 1.5rem;
}

.treatment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.treatment-row:last-child {
    border-bottom: none;
}

.treatment-label {
    font-size: 0.9375rem;
    color: var(--text-main);
}

.treatment-value {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--teal);
    color: white;
}

.btn-primary:hover {
    background: var(--teal-dark);
}

.btn-secondary {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg);
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--text-main);
    background: var(--card-bg);
}

.form-input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(45, 149, 150, 0.1);
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.form-row .form-input {
    width: 80px;
}

.form-suffix {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Loading State */
.loading {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.3s ease-out;
}

/* Severity badges */
.severity-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.severity-mild {
    background: #dcfce7;
    color: #166534;
}

.severity-moderate {
    background: #fef3c7;
    color: #92400e;
}

.severity-severe {
    background: #fee2e2;
    color: #991b1b;
}

.severity-normal {
    background: #e0f2fe;
    color: #075985;
}
