/**
 * Discipline Planner - Mobile-First Stylesheet
 * Optimized for phone usage with touch-friendly targets
 */

:root {
    /* Color palette */
    --primary: #c812cc;
    --primary-dark: #830c86;
    --primary-light: #ea3dee;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #0ea5e9;
    --info-light: #e0f2fe;
    
    /* Neutrals */
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    
    /* Spacing & Sizing */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
    
    /* Mobile-first touch targets (minimum 44px) */
    --touch-target: 44px;
    --touch-target-sm: 36px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========== Mobile Header & Navigation ========== */
header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.125rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.user-badge {
    font-size: 0.75rem;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 10px;
    border-radius: 999px;
    margin-left: auto;
}

/* Mobile Navigation - Horizontal Scroll */
nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin: 0 -16px;
    padding: 0 16px;
    scroll-snap-type: x mandatory;
}

nav::-webkit-scrollbar {
    display: none;
}

nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    min-height: var(--touch-target);
    display: flex;
    align-items: center;
    scroll-snap-align: start;
    flex-shrink: 0;
}

nav a:hover, nav a:active, nav a.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

nav a.logout {
    color: rgba(255, 255, 255, 0.7);
}

/* ========== Main Container ========== */
.container {
    padding: 16px;
    max-width: 100%;
}

.container-sm {
    max-width: 100%;
}

.container-md {
    max-width: 100%;
}

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

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

.card-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ========== Forms - Mobile Optimized ========== */
label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem; /* Prevents iOS zoom */
    font-family: inherit;
    color: var(--text);
    background: var(--bg-card);
    transition: var(--transition);
    margin-bottom: 12px;
    min-height: var(--touch-target);
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-light);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.form-group {
    margin-bottom: 12px;
}

/* ========== Buttons - Touch Friendly ========== */
button,
.btn,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    background: var(--primary);
    color: white;
    min-height: var(--touch-target);
    width: 100%;
    touch-action: manipulation;
}

button:active,
.btn:active,
input[type="submit"]:active {
    transform: scale(0.98);
    opacity: 0.9;
}

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

.btn-success {
    background: var(--success);
}

.btn-danger {
    background: var(--danger);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:active {
    background: var(--bg);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.875rem;
    min-height: var(--touch-target-sm);
    width: auto;
}

.btn-icon {
    width: var(--touch-target);
    height: var(--touch-target);
    padding: 0;
    border-radius: var(--radius-sm);
}

/* ========== Tags & Badges ========== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.tag-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-color: transparent;
}

.tag-success {
    background: var(--success-light);
    color: #065f46;
    border-color: transparent;
}

.tag-warning {
    background: var(--warning-light);
    color: #92400e;
    border-color: transparent;
}

.tag-danger {
    background: var(--danger-light);
    color: #991b1b;
    border-color: transparent;
}

.tag-info {
    background: var(--info-light);
    color: #0369a1;
    border-color: transparent;
}

/* ========== Status Pills ========== */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-not_started {
    background: var(--bg);
    color: var(--text-muted);
}
.status-not_started::before { background: var(--text-light); }

.status-in_progress {
    background: var(--info-light);
    color: #0369a1;
}
.status-in_progress::before { background: var(--info); }

.status-blocked {
    background: var(--danger-light);
    color: #991b1b;
}
.status-blocked::before { background: var(--danger); }

.status-done {
    background: var(--success-light);
    color: #065f46;
}
.status-done::before { background: var(--success); }

/* ========== Progress Bar ========== */
.progress {
    height: 8px;
    background: var(--bg);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.progress-bar.complete {
    background: linear-gradient(90deg, var(--success) 0%, #34d399 100%);
}

/* ========== Lists - Touch Friendly ========== */
.list {
    list-style: none;
}

.list-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 500;
    color: var(--text);
    font-size: 1rem;
}

.list-item-title a {
    color: inherit;
    text-decoration: none;
    display: block;
    padding: 4px 0;
}

.list-item-title a:active {
    color: var(--primary);
}

.list-item-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.list-item-actions {
    display: flex;
    gap: 8px;
}

/* ========== Grid Layouts ========== */
.grid {
    display: grid;
    gap: 16px;
}

.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }
.grid-7 { grid-template-columns: repeat(2, 1fr); }

/* ========== Calendar - Mobile ========== */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 8px;
}

.calendar-title {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    flex: 1;
}

.calendar-nav {
    display: flex;
    gap: 8px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day-name {
    text-align: center;
    font-weight: 600;
    font-size: 0.6875rem;
    color: var(--text-muted);
    padding: 8px 2px;
    text-transform: uppercase;
}

.calendar-cell {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px;
    min-height: 70px;
    font-size: 0.75rem;
}

.calendar-cell.today {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.calendar-date {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text);
    margin-bottom: 4px;
}

.calendar-date.today {
    color: var(--primary);
}

.task-pill {
    display: block;
    padding: 2px 4px;
    margin-bottom: 2px;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 500;
    background: var(--info-light);
    color: #0369a1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-pill.done {
    background: var(--success-light);
    color: #065f46;
}

.task-pill.blocked {
    background: var(--danger-light);
    color: #991b1b;
}

/* ========== Schedule - Mobile ========== */
.schedule-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.week-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.week-column {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 14px;
}

.week-column-header {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.schedule-pill {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
}

.schedule-pill.delivered {
    background: var(--success-light);
    border-color: #86efac;
}

.schedule-pill-title {
    font-weight: 500;
    font-size: 0.9375rem;
    margin-bottom: 8px;
}

.schedule-pill-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.schedule-pill-meta label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    min-height: var(--touch-target-sm);
    margin: 0;
}

.schedule-pill-meta input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    min-height: auto;
}

/* ========== KPI Bar - Mobile ========== */
.kpi-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 14px;
    background: linear-gradient(135deg, var(--bg) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.kpi-item {
    display: flex;
    flex-direction: column;
    text-align: center;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

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

/* ========== Tree View - Mobile ========== */
.tree-view {
    padding: 8px 0;
}

.tree-branch {
    position: relative;
    margin-left: 16px;
}

.tree-branch::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 0;
    bottom: 12px;
    width: 2px;
    background: var(--border);
}

.tree-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin: 4px 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-height: var(--touch-target);
    position: relative;
}

.tree-node::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    width: 12px;
    height: 2px;
    background: var(--border);
}

.tree-node:active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.tree-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.tree-label {
    flex: 1;
    font-weight: 500;
    font-size: 0.9375rem;
}

.tree-level-group { border-left: 3px solid var(--primary); }
.tree-level-topic { border-left: 3px solid var(--info); }
.tree-level-project { border-left: 3px solid var(--success); }
.tree-level-milestone { border-left: 3px solid var(--warning); }
.tree-level-task { border-left: 3px solid var(--secondary); }

/* ========== Tables - Mobile Scrollable ========== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 0 -16px;
    padding: 0 16px;
}

table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
}

.table-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    min-height: 36px;
    margin: 0;
}

/* ========== Sections (Mind, Health, etc.) ========== */
.section-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.section-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9375rem;
}

.section-content {
    padding: 12px;
}

.section-textarea {
    width: 100%;
    min-height: 200px;
    border: none;
    resize: vertical;
    font-size: 1rem;
    line-height: 1.7;
    padding: 0;
    margin: 0;
}

.section-textarea:focus {
    outline: none;
    box-shadow: none;
}

/* ========== Alerts & Messages ========== */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9375rem;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #86efac;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background: var(--info-light);
    color: #0369a1;
    border: 1px solid #7dd3fc;
}

/* ========== Details/Accordion - Touch Friendly ========== */
details {
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

summary {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--primary);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: var(--touch-target);
}

summary::-webkit-details-marker {
    display: none;
}

summary::before {
    content: '+';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--bg-card);
    border-radius: 4px;
    font-weight: 700;
    font-size: 1rem;
}

details[open] summary::before {
    content: '−';
}

details > div {
    padding: 16px;
    border-top: 1px solid var(--border);
}

/* ========== Breadcrumbs ========== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    padding: 4px 0;
}

.breadcrumb-separator {
    color: var(--text-light);
}

/* ========== Empty States ========== */
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

/* ========== Utilities ========== */
.flex { display: flex; }
.flex-center { align-items: center; }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 16px; }

.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 12px; }
.mt-lg { margin-top: 16px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 12px; }
.mb-lg { margin-bottom: 16px; }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }

.hidden { display: none !important; }

.w-full { width: 100%; }
.w-auto { width: auto; }

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ========== Login Page - Mobile ========== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, #4338ca 100%);
    padding: 16px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 24px;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 12px;
}

.login-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: #1e293b;
}

.login-subtitle {
    color: #64748b;
    margin-top: 4px;
    font-size: 0.9375rem;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    height: 50px;
    font-size: 1rem;
}

.login-form button {
    height: 50px;
    font-size: 1rem;
    margin-top: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: #64748b;
    font-size: 0.9375rem;
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.password-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: -8px;
    margin-bottom: 12px;
}

/* ========== Period Selector - Mobile Friendly ========== */
.period-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.period-selector select {
    flex: 1;
    min-width: 0;
}

.period-selector .btn {
    width: 100%;
}

/* ========== Floating Action Button ========== */
.fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 50;
}

/* ========== Bottom Nav (optional mobile) ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.625rem;
    padding: 4px 8px;
    min-width: 50px;
}

.bottom-nav a.active {
    color: var(--primary);
}

.bottom-nav-icon {
    font-size: 1.25rem;
}

/* ========== Safe Areas for notched phones ========== */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ========================================================
   TABLET & DESKTOP BREAKPOINTS (min-width: upward)
   ======================================================== */

/* Small tablets (600px+) */
@media (min-width: 600px) {
    .container {
        padding: 20px;
    }
    
    .card {
        padding: 20px;
    }
    
    .form-row {
        flex-direction: row;
        gap: 16px;
    }
    
    .form-row .form-group {
        flex: 1;
    }
    
    button,
    .btn,
    input[type="submit"] {
        width: auto;
    }
    
    .list-item {
        flex-direction: row;
        align-items: center;
    }
    
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .week-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .kpi-bar {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .period-selector {
        flex-direction: row;
        align-items: center;
    }
    
    .period-selector select {
        width: auto;
        flex: none;
    }
    
    .period-selector .btn {
        width: auto;
    }
}

/* Tablets (768px+) */
@media (min-width: 768px) {
    .header-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    nav {
        margin: 0;
        padding: 0;
        overflow-x: visible;
    }
    
    .container {
        padding: 24px;
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .container-sm {
        max-width: 480px;
    }
    
    .container-md {
        max-width: 800px;
    }
    
    .card {
        padding: 24px;
        margin-bottom: 20px;
    }
    
    .card-header {
        flex-direction: row;
        align-items: center;
    }
    
    .calendar-cell {
        min-height: 100px;
        padding: 8px;
    }
    
    .task-pill {
        font-size: 0.6875rem;
        padding: 3px 6px;
    }
    
    .week-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .section-textarea {
        min-height: 300px;
    }
    
    .login-card {
        padding: 40px;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .schedule-layout {
        flex-direction: row;
    }
    
    .schedule-layout > .card:first-child {
        width: 350px;
        flex-shrink: 0;
    }
    
    .schedule-layout > .card:last-child {
        flex: 1;
    }
    
    .week-grid {
        grid-template-columns: repeat(7, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
    .calendar-cell {
        min-height: 120px;
    }
    
    .task-pill {
        font-size: 0.75rem;
    }
}

/* ========== Dark Mode Support ========== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --bg-card: #1e293b;
        --border: #334155;
        --text: #f1f5f9;
        --text-muted: #94a3b8;
        --text-light: #64748b;
    }
    
    .login-card {
        background: var(--bg-card);
    }
    
    .login-title,
    .login-subtitle {
        color: var(--text);
    }
    
    input, textarea, select {
        background: var(--bg);
        border-color: var(--border);
        color: var(--text);
    }
}
