/* ================================================
   Station Manager Pro — Design System v2
   Plus coloré, plus compact, plus pro
   ================================================ */

:root {
    --primary: #1B4965;
    --primary-light: #2A6F97;
    --primary-dark: #122F42;
    --primary-bg: rgba(27,73,101,0.06);
    --accent: #FF6B35;
    --accent-light: #FF8C5A;
    --accent-bg: rgba(255,107,53,0.08);
    --white: #FFFFFF;
    --bg: #F0F2F5;
    --bg-warm: #FFF8F5;
    --text: #1A1D21;
    --text-secondary: #5F6B7A;
    --border: #E1E5EB;
    --border-light: #F0F2F5;
    --success: #00B894;
    --success-bg: rgba(0,184,148,0.1);
    --error: #E17055;
    --error-bg: rgba(225,112,85,0.1);
    --warning: #FDCB6E;
    --warning-bg: rgba(253,203,110,0.15);
    --info: #74B9FF;
    --info-bg: rgba(116,185,255,0.12);
    --purple: #A29BFE;
    --purple-bg: rgba(162,155,254,0.1);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-color: 0 4px 14px rgba(27,73,101,0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: 0.2s ease;
    --sidebar-width: 240px;
    --topbar-height: 52px;
    --bottomnav-height: 58px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text); background: var(--bg); line-height: 1.5;
    overflow-x: hidden; -webkit-font-smoothing: antialiased;
}

/* ================================================ Screens */
.screen { display: none; }
.screen.active { display: block; }
#main-app.active { display: flex; flex-direction: column; min-height: 100vh; }

/* ================================================ Login */
.login-container {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    min-height: 100vh; padding: 2rem;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 40%, var(--primary-light) 100%);
}
.login-header { text-align: center; margin-bottom: 2rem; color: var(--white); }
.login-header h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.5px; }
.login-header p { opacity: 0.7; margin-top: 0.4rem; font-size: 0.9rem; }
#login-form {
    width: 100%; max-width: 360px; background: var(--white);
    padding: 1.8rem; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
}

/* ================================================ Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 0.55rem 0.75rem; border: 1.5px solid var(--border);
    border-radius: var(--radius); font-size: 0.9rem; font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--white);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,73,101,0.08);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.8rem; }

/* ================================================ Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
    padding: 0.5rem 1rem; border: none; border-radius: var(--radius);
    font-size: 0.82rem; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: var(--white); box-shadow: var(--shadow-color); }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: var(--white); box-shadow: 0 4px 14px rgba(255,107,53,0.25); }
.btn-accent:hover { background: var(--accent-light); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 0.4rem 0.6rem; }
.btn-ghost:hover { color: var(--primary); background: var(--primary-bg); }
.btn-success { background: var(--success); color: var(--white); }
.btn-danger { background: var(--error); color: var(--white); }
.btn-warning { background: var(--warning); color: var(--text); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.75rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.7rem; border-radius: 6px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 50%; }

/* ================================================ Top Bar */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--topbar-height); background: var(--primary);
    display: flex; align-items: center; padding: 0 1rem;
    box-shadow: var(--shadow-color); gap: 0.6rem; color: var(--white);
}
.topbar__menu {
    display: flex; flex-direction: column; gap: 3px; background: none; border: none; cursor: pointer; padding: 4px;
}
.topbar__menu span { display: block; width: 18px; height: 2px; background: rgba(255,255,255,0.9); border-radius: 1px; transition: var(--transition); }
.topbar__title { flex: 1; font-size: 0.95rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--white); }
.topbar__actions { display: flex; align-items: center; gap: 0.4rem; }
.topbar__btn {
    position: relative; width: 34px; height: 34px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--white); transition: var(--transition);
}
.topbar__btn:hover { background: rgba(255,255,255,0.25); }
.topbar__btn svg { stroke: var(--white); }
#user-initials {
    font-size: 0.75rem; font-weight: 700; color: var(--primary);
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    background: var(--white); border-radius: 50%;
}
.badge {
    position: absolute; top: -3px; right: -3px; background: var(--accent); color: var(--white);
    font-size: 0.6rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; padding: 0 3px;
    border: 2px solid var(--primary);
}

/* ================================================ Sidebar — Dark Blue */
.sidebar {
    position: fixed; top: 0; left: -260px; bottom: 0; width: var(--sidebar-width);
    background: var(--primary-dark); z-index: 200; transition: left var(--transition);
    display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.sidebar.open { left: 0; }
.sidebar__header { padding: 1rem 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.1); background: var(--primary); }
.sidebar__header h3 { font-size: 0.95rem; font-weight: 700; color: var(--white); margin-bottom: 0.6rem; }
.sidebar__station-select {
    width: 100%; padding: 0.45rem 0.6rem; border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius); font-size: 0.8rem; font-family: inherit;
    background: rgba(255,255,255,0.1); font-weight: 500; color: var(--white);
}
.sidebar__station-select option { background: var(--primary-dark); color: var(--white); }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 0.3rem 0; list-style: none; }
.sidebar__nav li { margin: 0; }
.sidebar__nav a, .sidebar__nav button {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.6rem 1rem; width: 100%; border: none; background: none;
    font-size: 0.82rem; color: rgba(255,255,255,0.75); cursor: pointer;
    transition: all var(--transition); font-family: inherit; text-decoration: none;
    text-align: left; border-left: 3px solid transparent;
}
.sidebar__nav a:hover, .sidebar__nav button:hover { background: var(--accent); color: var(--white); border-left-color: var(--accent); }
.sidebar__nav .active a, .sidebar__nav .active button { background: var(--accent); color: var(--white); font-weight: 600; border-left-color: var(--accent-light); }
.sidebar__nav .nav-section { padding: 0.7rem 1rem 0.25rem; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: rgba(255,255,255,0.35); }
.sidebar__footer { padding: 0.8rem; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar__footer .btn { color: rgba(255,255,255,0.7); }
.sidebar__footer .btn:hover { color: var(--white); background: rgba(255,255,255,0.1); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 199; }
.sidebar-overlay.active { display: block; }

/* ================================================ Chip Grid (horizontal scrollable cards) */
.chip-grid {
    display: flex; gap: 0.4rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 0.2rem 0; scrollbar-width: none;
}
.chip-grid::-webkit-scrollbar { display: none; }
.date-filter { background: var(--bg-secondary); border-radius: var(--radius); padding: 0.6rem 0.8rem; }
.date-filter .form-row { align-items: flex-end; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 0.5rem 1rem; font-size: 0.8rem; font-weight: 600; color: var(--text-light); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: all var(--transition); background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Progress bar */
.progress-bar { width: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar__fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; background: var(--primary); }
.chip {
    flex-shrink: 0; display: flex; align-items: center; gap: 0.3rem;
    padding: 0.45rem 0.8rem; border-radius: 20px; border: 1.5px solid var(--border);
    background: var(--white); cursor: pointer; transition: all var(--transition);
    font-family: inherit; font-size: 0.78rem; font-weight: 600; color: var(--text);
    white-space: nowrap;
}
.chip:hover { border-color: var(--primary); background: var(--primary-bg); }
.chip.selected { background: var(--primary); color: var(--white); border-color: var(--primary); box-shadow: var(--shadow-color); }
.chip--accent.selected { background: var(--accent); border-color: var(--accent); box-shadow: 0 4px 14px rgba(255,107,53,0.25); }
.chip--success.selected { background: var(--success); border-color: var(--success); }
.chip--purple.selected { background: var(--purple); border-color: var(--purple); }

/* ================================================ Content */
.content {
    margin-top: var(--topbar-height); padding: 1rem;
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left var(--transition);
}

/* ================================================ Alert Banners */
.alert {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 1rem;
    border-radius: var(--radius); margin-bottom: 0.8rem; font-size: 0.82rem; font-weight: 500;
    animation: fadeSlideUp 0.3s ease;
}
.alert--warning { background: var(--warning-bg); color: #856404; border-left: 3px solid var(--warning); }
.alert--error { background: var(--error-bg); color: var(--error); border-left: 3px solid var(--error); }
.alert--info { background: var(--info-bg); color: var(--primary); border-left: 3px solid var(--info); }
.alert--success { background: var(--success-bg); color: #0d6832; border-left: 3px solid var(--success); }
.alert__icon { font-size: 1.1rem; flex-shrink: 0; }
.alert__text { flex: 1; }
.alert__action { flex-shrink: 0; }

/* ================================================ Cards v2 */
.card {
    background: var(--white); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); padding: 1rem; margin-bottom: 0.8rem;
    transition: box-shadow var(--transition), transform var(--transition);
    animation: fadeSlideUp 0.3s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card--clickable { cursor: pointer; }
.card--clickable:hover { transform: translateY(-1px); }
.card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.7rem; gap: 0.5rem; }
.card__title { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.card__subtitle { font-size: 0.75rem; color: var(--text-secondary); }
.card--colored { border-top: 3px solid var(--primary); }
.card--accent { border-top: 3px solid var(--accent); }
.card--success { border-top: 3px solid var(--success); }
.card--warning { border-top: 3px solid var(--warning); }
.card--compact { padding: 0.75rem; }

/* ================================================ Stats Cards v2 — More colorful */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.6rem; margin-bottom: 0.8rem; }
.stat-card {
    border-radius: var(--radius-lg); padding: 0.8rem; position: relative; overflow: hidden;
    animation: fadeSlideUp 0.3s ease;
}
.stat-card__label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; opacity: 0.8; }
.stat-card__value { font-size: 1.3rem; font-weight: 800; margin-top: 0.15rem; }
.stat-card__sub { font-size: 0.7rem; margin-top: 0.1rem; opacity: 0.7; }
.stat-card--primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: var(--white); box-shadow: var(--shadow-color); }
.stat-card--accent { background: linear-gradient(135deg, #FF6B35 0%, #FF8C5A 100%); color: var(--white); box-shadow: 0 4px 14px rgba(255,107,53,0.2); }
.stat-card--success { background: var(--success-bg); color: #0d6832; border: 1px solid rgba(0,184,148,0.2); }
.stat-card--warning { background: var(--warning-bg); color: #856404; border: 1px solid rgba(253,203,110,0.3); }
.stat-card--error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(225,112,85,0.2); }
.stat-card--info { background: var(--info-bg); color: var(--primary); border: 1px solid rgba(116,185,255,0.2); }
.stat-card--purple { background: var(--purple-bg); color: #5B4FCF; border: 1px solid rgba(162,155,254,0.2); }
.stat-card--white { background: var(--white); color: var(--text); box-shadow: var(--shadow-sm); border: 1px solid var(--border-light); }

/* ================================================ Action Grid — Quick Action Buttons */
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.5rem; margin-bottom: 0.8rem; }
.action-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem;
    padding: 0.8rem 0.5rem; border-radius: var(--radius-lg); border: 1.5px solid var(--border);
    background: var(--white); cursor: pointer; transition: all var(--transition); font-family: inherit;
    text-align: center;
}
.action-btn:hover { border-color: var(--primary); background: var(--primary-bg); transform: translateY(-1px); box-shadow: var(--shadow); }
.action-btn__icon { font-size: 1.4rem; }
.action-btn__label { font-size: 0.72rem; font-weight: 600; color: var(--text); line-height: 1.2; }
.action-btn--active { border-color: var(--primary); background: var(--primary-bg); }
.action-btn--warning { border-color: var(--warning); background: var(--warning-bg); }
.action-btn--accent { border-color: var(--accent); background: var(--accent-bg); }

/* ================================================ Compact Table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
thead th {
    text-align: left; padding: 0.5rem 0.6rem; background: var(--bg); color: var(--text-secondary);
    font-weight: 700; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.4px;
    border-bottom: 2px solid var(--border); white-space: nowrap;
}
tbody td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border-light); }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--primary-bg); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.row-highlight { background: var(--warning-bg) !important; }

/* ================================================ Inline Stats Row */
.inline-stats { display: flex; gap: 1.2rem; flex-wrap: wrap; padding: 0.5rem 0; }
.inline-stat { display: flex; flex-direction: column; }
.inline-stat__label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 0.3px; }
.inline-stat__value { font-size: 1rem; font-weight: 700; }

/* ================================================ Chart Container */
.chart-container { position: relative; height: 220px; margin-top: 0.5rem; }
.chart-container--sm { height: 160px; }

/* ================================================ Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border-light); margin-bottom: 0.8rem; }
.tab {
    padding: 0.5rem 1rem; border: none; background: none; font-size: 0.8rem; font-weight: 600;
    color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all var(--transition); font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ================================================ Filters Bar */
.filters { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.8rem; }
.filters select, .filters input[type="date"] {
    padding: 0.4rem 0.6rem; border: 1.5px solid var(--border); border-radius: var(--radius);
    font-size: 0.78rem; font-family: inherit; background: var(--white);
}

/* ================================================ Station Card (Admin) */
.station-card {
    background: var(--white); border-radius: var(--radius-lg); padding: 0.8rem;
    box-shadow: var(--shadow-sm); cursor: pointer; transition: all var(--transition);
    border-left: 4px solid var(--primary); animation: fadeSlideUp 0.3s ease;
}
.station-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.station-card__name { font-size: 0.95rem; font-weight: 700; }
.station-card__location { font-size: 0.75rem; color: var(--text-secondary); }
.station-card__stats { display: flex; gap: 1rem; margin-top: 0.5rem; flex-wrap: wrap; }
.station-card__stat { font-size: 0.72rem; }
.station-card__stat strong { display: block; font-size: 0.95rem; color: var(--primary); }

/* ================================================ Modal */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 300; align-items: center; justify-content: center; padding: 0.8rem;
    backdrop-filter: blur(2px);
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--white); border-radius: var(--radius-xl); width: 100%; max-width: 480px;
    max-height: 88vh; display: flex; flex-direction: column;
    animation: modalIn 0.25s ease; box-shadow: var(--shadow-lg);
}
.modal--lg { max-width: 640px; }
.modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.8rem 1rem; border-bottom: 1px solid var(--border-light);
    background: var(--primary-bg); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal__title { font-size: 0.92rem; font-weight: 700; color: var(--primary); }
.modal__close { width: 28px; height: 28px; border: none; background: var(--white); border-radius: 50%; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }
.modal__close:hover { background: var(--error-bg); color: var(--error); }
.modal__body { padding: 1rem; overflow-y: auto; flex: 1; }
.modal__footer { padding: 0.7rem 1rem; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 0.4rem; }

/* ================================================ Toast */
#toast-container { position: fixed; top: calc(var(--topbar-height) + 0.5rem); right: 0.5rem; z-index: 400; display: flex; flex-direction: column; gap: 0.4rem; }
.toast {
    padding: 0.65rem 1rem; border-radius: var(--radius); color: var(--white);
    font-size: 0.8rem; font-weight: 600; max-width: 300px;
    animation: toastIn 0.3s ease; box-shadow: var(--shadow-lg);
}
.toast--success { background: var(--success); }
.toast--error { background: var(--error); }
.toast--warning { background: var(--warning); color: var(--text); }
.toast--info { background: var(--primary); }
.toast.out { animation: toastOut 0.3s ease forwards; }

/* ================================================ Dropdown */
.dropdown {
    position: fixed; top: calc(var(--topbar-height) + 4px); right: 0.5rem;
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    min-width: 200px; z-index: 150; animation: fadeSlideUp 0.15s ease;
}
.dropdown__item { display: block; width: 100%; padding: 0.6rem 0.9rem; border: none; background: none; text-align: left; font-size: 0.82rem; cursor: pointer; font-family: inherit; }
.dropdown__item:hover { background: var(--bg); }
.dropdown__item strong { display: block; font-size: 0.85rem; }
.dropdown__item small { color: var(--text-secondary); font-size: 0.72rem; }
.dropdown hr { border: none; border-top: 1px solid var(--border-light); margin: 0; }

/* ================================================ Bottom Nav */
.bottomnav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--white); box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    z-index: 100; height: var(--bottomnav-height);
    padding: 0 0.3rem; align-items: center; justify-content: space-around;
}
.bottomnav__item {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 0.3rem 0.6rem; border: none; background: none; cursor: pointer;
    color: var(--text-secondary); font-size: 0.6rem; font-weight: 600;
    transition: color var(--transition); font-family: inherit;
}
.bottomnav__item.active { color: var(--primary); }
.bottomnav__item svg { width: 20px; height: 20px; }

/* ================================================ Status / Tags */
.status { display: inline-flex; padding: 0.15rem 0.5rem; border-radius: 20px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.2px; }
.status--open { background: var(--success-bg); color: var(--success); }
.status--closed { background: rgba(99,110,114,0.1); color: var(--text-secondary); }
.status--pending { background: var(--warning-bg); color: #E17055; }
.status--positive { color: var(--success); }
.status--negative { color: var(--error); }
.tag { display: inline-flex; padding: 0.15rem 0.45rem; border-radius: 4px; font-size: 0.65rem; font-weight: 700; }
.tag--primary { background: var(--primary-bg); color: var(--primary); }
.tag--accent { background: var(--accent-bg); color: var(--accent); }
.tag--success { background: var(--success-bg); color: var(--success); }

/* ================================================ Empty State */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-secondary); }
.empty-state__icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.4; }
.empty-state p { font-size: 0.85rem; margin-bottom: 0.8rem; }

/* ================================================ Loading */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
.loading-page { display: flex; justify-content: center; padding: 3rem; }

/* ================================================ Grid Layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.8rem; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 0.8rem; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 0.8rem; }

/* ================================================ Progress Bar */
.progress { height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.progress__bar { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.progress__bar--primary { background: var(--primary); }
.progress__bar--success { background: var(--success); }
.progress__bar--warning { background: var(--warning); }
.progress__bar--error { background: var(--error); }

/* ================================================ Animations */
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(-40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ================================================ Responsive */
@media (max-width: 768px) {
    .bottomnav { display: flex; }
    .content { padding-bottom: calc(var(--bottomnav-height) + 0.8rem); }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .topbar__menu { display: flex; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-2, .grid-3, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
    .action-grid { grid-template-columns: repeat(3, 1fr); }
    html { font-size: 13.5px; }
}

@media (min-width: 769px) {
    .sidebar { left: 0; top: var(--topbar-height); box-shadow: var(--shadow-sm); }
    .content { margin-left: var(--sidebar-width); }
    .topbar { left: var(--sidebar-width); }
    .topbar__menu { display: none; }
    .bottomnav { display: none; }
    .sidebar-overlay { display: none !important; }
}

@media (min-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ================================================ Utility */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.4rem; }
.mb-2 { margin-bottom: 0.8rem; }
.mb-3 { margin-bottom: 1.2rem; }
.mt-1 { margin-top: 0.4rem; }
.mt-2 { margin-top: 0.8rem; }
.p-0 { padding: 0; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 0.4rem; }
.gap-2 { gap: 0.8rem; }
.text-sm { font-size: 0.75rem; }
.text-xs { font-size: 0.68rem; }
.text-muted { color: var(--text-secondary); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.font-bold { font-weight: 700; }
.font-black { font-weight: 800; }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.amount--positive { color: var(--success); }
.amount--negative { color: var(--error); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.opacity-60 { opacity: 0.6; }

/* ============================================================
   Owner Dashboard — Excel-like grid + KPI deltas + dashboard bits
   ============================================================ */
.dash-header .switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.dash-header .switch input { accent-color: var(--primary); }

.kpi-delta {
    margin-top: 6px;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.kpi-delta--up   { background: rgba(0,184,148,0.12);  color: var(--success); }
.kpi-delta--down { background: rgba(225,112,85,0.12); color: var(--error); }
.kpi-delta--flat { background: rgba(99,110,114,0.10); color: var(--text-light); }
.kpi-delta .kpi-prev { font-weight: 500; opacity: 0.75; margin-left: 4px; }

.chart-tall { height: 280px; }

/* Excel-style table */
.excel-wrap {
    overflow-x: auto;
    border: 1px solid #d4dae0;
    border-radius: 4px;
    background: #fff;
    max-height: 520px;
    overflow-y: auto;
}
.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.excel-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--primary);
    color: #fff;
    padding: 8px 10px;
    text-align: left;
    border-right: 1px solid rgba(255,255,255,0.15);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.excel-table thead th.text-right { text-align: right; }
.excel-table tbody td, .excel-table tfoot td {
    padding: 7px 10px;
    border-right: 1px solid #ecedef;
    border-bottom: 1px solid #ecedef;
}
.excel-table tbody tr:nth-child(odd) { background: #fafbfc; }
.excel-table tbody tr:hover { background: #eef5fb; }
.excel-table .exc-sticky {
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
    border-right: 2px solid #d4dae0;
    min-width: 160px;
}
.excel-table tbody tr:nth-child(odd) .exc-sticky { background: #fafbfc; }
.excel-table tbody tr:nth-child(even) .exc-sticky { background: #fff; }
.excel-table tbody tr:hover .exc-sticky { background: #eef5fb; }

.excel-table .exc-section td {
    background: #1B4965 !important;
    color: #fff;
    font-size: 11px;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.excel-table .exc-section .text-primary { color: #FFD79A; }
.excel-table .exc-section .text-success { color: #6EE7B7; }

.excel-table tfoot td {
    background: #f3f6f9;
    font-weight: 700;
    border-top: 2px solid var(--primary);
    color: var(--primary);
}
.excel-table .exc-pos { color: var(--success); font-weight: 600; }
.excel-table .exc-neg { color: var(--error);   font-weight: 600; }

@media (max-width: 768px) {
    .excel-table { font-size: 11px; }
    .excel-table thead th, .excel-table tbody td, .excel-table tfoot td { padding: 6px 7px; }
    .chart-tall { height: 220px; }
}

/* ============================================================
   Owner Dashboard — Hero, ranked stations, alerts stack
   ============================================================ */
.owner-hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
    background: linear-gradient(135deg, #1B4965 0%, #2d6a8e 100%);
    border-radius: 14px;
    padding: 20px 24px;
    color: #fff;
    box-shadow: 0 6px 20px rgba(27,73,101,0.18);
}
.owner-hero__label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: 0.85;
    margin-bottom: 4px;
}
.owner-hero__value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    margin-bottom: 6px;
}
.owner-hero__delta { display: inline-block; }
.owner-hero__delta .kpi-prev { color: rgba(255,255,255,0.85); }
.owner-hero__side {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
}
.owner-hero__metric {
    background: rgba(255,255,255,0.10);
    border-radius: 10px;
    padding: 10px 14px;
}
.owner-hero__metric-label {
    font-size: 11px;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.owner-hero__metric-value {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin: 2px 0 4px;
}
.owner-hero__metric .text-success { color: #6EE7B7 !important; }
.owner-hero__metric .text-error   { color: #FCA5A5 !important; }
.owner-hero__metric .text-muted   { color: rgba(255,255,255,0.7) !important; }

.alerts-stack { display: flex; flex-direction: column; gap: 8px; }

.station-card--ranked {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    align-items: stretch;
}
.station-card--ranked .station-card__rank {
    background: linear-gradient(180deg, #1B4965, #2d6a8e);
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.station-card--ranked:nth-child(1) .station-card__rank { background: linear-gradient(180deg, #FFB627, #FF8A00); }
.station-card--ranked:nth-child(2) .station-card__rank { background: linear-gradient(180deg, #B7BEC9, #8993A1); }
.station-card--ranked:nth-child(3) .station-card__rank { background: linear-gradient(180deg, #D2691E, #A0522D); }
.station-card--ranked .station-card__body { min-width: 0; }

@media (max-width: 640px) {
    .owner-hero { grid-template-columns: 1fr; padding: 16px; }
    .owner-hero__value { font-size: 24px; }
    .station-card--ranked { grid-template-columns: 36px 1fr; gap: 8px; }
    .station-card--ranked .station-card__rank { font-size: 16px; }
}

/* ============================================================
   Dashboard Toolbar (Excel-style filters)
   ============================================================ */
.dash-toolbar {
    background: #fff;
    border: 1px solid #d4dae0;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dash-toolbar__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    padding: 6px 0;
}
.dash-toolbar__group { display: flex; flex-direction: column; gap: 4px; }
.dash-toolbar__label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-light);
    font-weight: 600;
}
.dash-toolbar__actions { margin-left: auto; display: flex; gap: 6px; }
.dash-toolbar__period-info {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e0e3e7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.chip-row {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    background: #f1f4f7;
    border-radius: 8px;
    padding: 3px;
}
.chip-row .chip {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
}
.chip-row .chip:hover { background: rgba(27,73,101,0.06); }
.chip-row .chip.selected {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(27,73,101,0.25);
}

.dash-station-panel {
    margin-top: 10px;
    padding: 10px;
    background: #fafbfc;
    border: 1px solid #e0e3e7;
    border-radius: 8px;
}
.dash-station-panel__head { display: flex; gap: 6px; margin-bottom: 8px; }
.dash-station-panel__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px;
}
.station-pick {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e0e3e7;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.station-pick:hover { border-color: var(--primary); }
.station-pick.selected {
    background: rgba(27,73,101,0.05);
    border-color: var(--primary);
    font-weight: 500;
}
.station-pick input { margin: 0; accent-color: var(--primary); }

/* ============================================================
   KPI Triplets (current / N-1 / delta%)
   ============================================================ */
.kpi-trip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.kpi-trip-card {
    background: #fff;
    border: 1px solid #d4dae0;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.kpi-trip__label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 6px;
}
.kpi-trip__cur {
    font-size: 19px;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.kpi-trip__prev {
    font-size: 11px;
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
    margin: 2px 0 4px;
}

/* ============================================================
   Excel-grid additions
   ============================================================ */
.excel-table .exc-mute { color: #b0b6bc; }
.exc-pos { color: var(--success); }
.exc-neg { color: var(--error); }

/* Chart contrôles compacts */
.chart-controls { flex-wrap: wrap; gap: 8px; }
.chip-row--sm { padding: 2px; }
.chip-row--sm .chip { padding: 4px 9px; font-size: 11px; }

.chart-xtall { height: 360px; }
@media (max-width: 768px) { .chart-xtall { height: 260px; } }

/* Row de 3 graphiques côte à côte */
.chart-row { align-items: stretch; }
.chart-card { display: flex; flex-direction: column; }
.chart-card .chart-container { flex: 1 1 auto; min-height: 280px; }
.chart-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 6px;
    min-height: 30px;
}
.chart-card__controls { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
@media (max-width: 1100px) {
    .chart-card__header { flex-direction: column; }
    .chart-card__controls { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
}

/* Sparkline dans le tableau Excel */
.station-cell { min-width: 180px; }
.station-cell__head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.spark { flex-shrink: 0; opacity: 0.85; }
.station-cell__head:hover .spark { opacity: 1; }

/* Tri colonnes */
.excel-table .sortable-col { user-select: none; }
.excel-table .sortable-col:hover { background: #15394f; }
.excel-table .sort-ind { font-size: 9px; color: #FFD79A; margin-left: 2px; }

/* ============================================================
   Owner Dashboard sections — hero XL, status strip, scorecards
   ============================================================ */
.owner-hero--xl { padding: 24px 28px; }
.owner-hero__side--3 { grid-template-rows: 1fr 1fr 1fr; }
@media (max-width: 900px) {
    .owner-hero--xl .owner-hero__side--3 { grid-template-rows: auto; grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 640px) {
    .owner-hero--xl .owner-hero__side--3 { grid-template-columns: 1fr; }
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}
.status-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e0e3e7;
    border-left: 4px solid #1B4965;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.status-tile--ok   { border-left-color: #00B894; }
.status-tile--warn { border-left-color: #FDCB6E; background: #fffbf2; }
.status-tile--err  { border-left-color: #E17055; background: #fff5f3; }
.status-tile__icon { font-size: 24px; line-height: 1; }
.status-tile__value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: #1B4965; }
.status-tile__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #636E72; font-weight: 600; }

/* Scorecards stations (vue d'ensemble immédiate) */
.scorecard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}
.scorecard {
    display: flex;
    background: #fff;
    border: 1px solid #e0e3e7;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.scorecard:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); border-color: #1B4965; }
.scorecard__bar { width: 5px; flex-shrink: 0; background: #B7BEC9; }
.scorecard--good .scorecard__bar { background: #00B894; }
.scorecard--avg  .scorecard__bar { background: #FDCB6E; }
.scorecard--low  .scorecard__bar { background: #E17055; }
.scorecard__body { flex: 1; padding: 10px 14px; min-width: 0; }
.scorecard__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; margin-bottom: 8px; }
.scorecard__name { font-weight: 700; font-size: 13px; color: #1B4965; }
.scorecard__loc  { font-size: 10px; color: #636E72; }
.scorecard__metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.scorecard__metric { display: flex; flex-direction: column; }
.scorecard__metric-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.4px; color: #636E72; font-weight: 600; }
.scorecard__metric-value { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; color: #2D3436; }
.scorecard__spark { display: flex; justify-content: flex-end; opacity: 0.9; }

/* Empty state inline (sur une carte vide) */
.empty-state-inline {
    padding: 12px;
    text-align: center;
    color: #636E72;
    font-size: 13px;
    background: #fafbfc;
    border-radius: 6px;
    border: 1px dashed #d4dae0;
}

/* ============================================================
   Station Detail Page (viewStation)
   ============================================================ */
.station-detail-header__right { display: flex; flex-direction: column; align-items: flex-end; }

.station-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}
.station-kpi-card {
    background: #fff;
    border: 1px solid #e0e3e7;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border-top: 3px solid #1B4965;
}
.station-kpi-card--primary { border-top-color: #1B4965; }
.station-kpi-card--accent  { border-top-color: #FF6B35; }
.station-kpi-card--success { border-top-color: #00B894; }
.station-kpi-card--error   { border-top-color: #E17055; }
.station-kpi-card__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #636E72;
    font-weight: 600;
    margin-bottom: 6px;
}
.station-kpi-card__value {
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #2D3436;
    line-height: 1.15;
    margin-bottom: 4px;
}

/* Stock grid 3 colonnes responsive */
.station-stock-grid { gap: 12px; }
@media (max-width: 900px) { .station-stock-grid { grid-template-columns: 1fr; } }

/* Tableau Excel compact */
.excel-table--compact thead th { padding: 5px 7px; font-size: 10px; }
.excel-table--compact tbody td { padding: 5px 7px; font-size: 11px; }

/* Barre de remplissage cuve */
.fill-bar { display: inline-block; width: 80px; height: 6px; background: #ecedef; border-radius: 3px; vertical-align: middle; overflow: hidden; }
.fill-bar__inner { height: 100%; border-radius: 3px; transition: width 0.3s; }
.fill-bar .fill-ok  { background: #00B894; }
.fill-bar .fill-mid { background: #FDCB6E; }
.fill-bar .fill-low { background: #E17055; }

/* Sparkline grande (en détail station) */
.spark-big { text-align: right; margin-bottom: 6px; }
.spark-big .spark { width: 100%; max-width: 280px; height: 36px; }

/* Station list — clickable + detail header */
.station-card--clickable { cursor: pointer; transition: all 0.15s; }
.station-card--clickable:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(27,73,101,0.10); transform: translateY(-1px); }
.station-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #1B4965 0%, #2d6a8e 100%);
    color: #fff;
    border-radius: 12px;
}
.station-detail-header__name {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
}
.station-detail-header .text-muted { color: rgba(255,255,255,0.85) !important; }
.station-detail-header__status .status,
.station-detail-header__status .tag { background: rgba(255,255,255,0.16) !important; color: #fff !important; border: 1px solid rgba(255,255,255,0.25); }

@media (max-width: 768px) {
    .dash-toolbar__row { gap: 10px; }
    .dash-toolbar__actions { margin-left: 0; width: 100%; }
    .kpi-trip__cur { font-size: 16px; }
    .kpi-trip-grid { grid-template-columns: repeat(2, 1fr); }
}
