:root {
    /* Variables globales : couleurs, ombres et rayons reutilises par tout le site. */
    --bg-start: #dbeafe;
    --bg-mid: #f1f7ff;
    --bg-end: #e7eefb;

    --glass: rgba(255, 255, 255, 0.78);
    --glass-strong: rgba(255, 255, 255, 0.92);
    --card: rgba(255, 255, 255, 0.86);
    --card-2: rgba(245, 250, 255, 0.92);

    --text: #102033;
    --muted: #627085;
    --border: rgba(110, 132, 165, 0.24);

    --primary: #062b55;
    --primary-2: #0b4a8b;
    --primary-3: #0ea5e9;

    --blue: #2563eb;
    --cyan: #06b6d4;

    --green: #16a34a;
    --green-bg: rgba(22, 163, 74, 0.13);

    --orange: #f59e0b;
    --orange-bg: rgba(245, 158, 11, 0.16);

    --red: #dc2626;
    --red-bg: rgba(220, 38, 38, 0.14);

    --info-bg: rgba(37, 99, 235, 0.12);

    --shadow-soft: 0 18px 55px rgba(15, 23, 42, 0.12);
    --shadow-card: 0 16px 42px rgba(15, 23, 42, 0.10);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

html[data-theme="dark"] {
    --bg-start: #020617;
    --bg-mid: #08111f;
    --bg-end: #0f172a;

    --glass: rgba(15, 23, 42, 0.78);
    --glass-strong: rgba(15, 23, 42, 0.94);
    --card: rgba(15, 23, 42, 0.86);
    --card-2: rgba(20, 32, 54, 0.88);

    --text: #e5eefc;
    --muted: #9caec6;
    --border: rgba(148, 163, 184, 0.18);

    --primary: #0b1220;
    --primary-2: #0f2d52;
    --primary-3: #22d3ee;

    --blue: #60a5fa;
    --cyan: #22d3ee;

    --green-bg: rgba(22, 163, 74, 0.18);
    --orange-bg: rgba(245, 158, 11, 0.18);
    --red-bg: rgba(220, 38, 38, 0.18);
    --info-bg: rgba(37, 99, 235, 0.18);

    --shadow-soft: 0 24px 70px rgba(0, 0, 0, 0.40);
    --shadow-card: 0 20px 55px rgba(0, 0, 0, 0.30);
}

/* RESET
   Base commune pour eviter les espacements et tailles imprevisibles. */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "Segoe UI", Inter, Arial, sans-serif;
    line-height: 1.55;
    background:
        radial-gradient(circle at 5% 5%, rgba(14, 165, 233, 0.26), transparent 32%),
        radial-gradient(circle at 90% 12%, rgba(37, 99, 235, 0.23), transparent 34%),
        radial-gradient(circle at 65% 95%, rgba(22, 163, 74, 0.14), transparent 36%),
        linear-gradient(135deg, var(--bg-start), var(--bg-mid) 48%, var(--bg-end));
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
}

/* BACKGROUND DECORATION
   Elements visuels fixes en arriere-plan de l'application. */

.background-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(35px);
    opacity: 0.35;
    pointer-events: none;
    z-index: -2;
}

.orb-one {
    width: 360px;
    height: 360px;
    background: #38bdf8;
    top: -90px;
    left: -80px;
}

.orb-two {
    width: 420px;
    height: 420px;
    background: #2563eb;
    right: -130px;
    bottom: -130px;
}

.background-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.14) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.14) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.30), transparent 78%);
    z-index: -3;
    pointer-events: none;
}

/* LAYOUT
   Conteneur general et espacement principal. */

.app-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px;
}

.main-content {
    margin-top: 26px;
}

/* HEADER
   Barre de navigation, logo HbVision AI et bascule de theme. */

.main-header {
    position: sticky;
    top: 16px;
    z-index: 100;
    min-height: 92px;
    padding: 18px 22px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255,255,255,0.18);
    background:
        linear-gradient(135deg, rgba(6, 43, 85, 0.98), rgba(10, 64, 122, 0.94)),
        radial-gradient(circle at 20% 0%, rgba(14,165,233,0.35), transparent 38%);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background:
        linear-gradient(145deg, rgba(255,255,255,0.24), rgba(255,255,255,0.08));
    border: 1px solid rgba(255,255,255,0.28);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.24);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gel-icon {
    width: 42px;
    height: 42px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    padding: 5px;
    border-radius: 12px;
    background: rgba(255,255,255,0.10);
}

.gel-icon .lane {
    position: relative;
    border-radius: 999px;
    background: rgba(255,255,255,0.34);
}

.gel-icon .lane::before,
.gel-icon .lane::after {
    content: "";
    position: absolute;
    left: 1px;
    right: 1px;
    height: 4px;
    border-radius: 999px;
}

.gel-icon .lane::before {
    top: 9px;
    background: #7dd3fc;
}

.gel-icon .lane-2::after,
.gel-icon .lane-5::after,
.gel-icon .lane-7::after {
    bottom: 8px;
    background: #22c55e;
}

.brand-text h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: -0.8px;
}

.brand-text p {
    margin: 7px 0 0;
    font-size: 13px;
    color: rgba(255,255,255,0.76);
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.main-nav a,
.theme-toggle {
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    border-radius: 999px;
    border: 1px solid transparent;
    color: #ffffff;
    background: transparent;
    font-weight: 750;
    font-size: 14px;
    cursor: pointer;
    transition: 0.22s ease;
}

.main-nav a:hover,
.main-nav a.active,
.theme-toggle:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.22);
    transform: translateY(-1px);
}

.logout-link {
    background: rgba(220, 38, 38, 0.22) !important;
    border-color: rgba(255,255,255,0.10) !important;
}

/* FOOTER */

.main-footer {
    margin: 34px 0 14px;
    padding: 20px 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    color: var(--muted);
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-brand strong {
    color: var(--text);
    font-size: 16px;
}

.footer-brand p {
    margin: 3px 0 0;
    font-size: 13px;
}

.footer-note {
    max-width: 520px;
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.mini-logo {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--primary), var(--primary-3));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    padding: 8px;
}

.mini-logo span {
    background: rgba(255,255,255,0.55);
    border-radius: 999px;
}

/* COMMON CARDS */

.hero-card,
.dashboard-container,
.form-container,
.auth-card,
.page-card,
.table-container,
.analysis-card,
.glass-card {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.72), rgba(255,255,255,0.52)),
        var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(18px);
}

html[data-theme="dark"] .hero-card,
html[data-theme="dark"] .dashboard-container,
html[data-theme="dark"] .form-container,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .page-card,
html[data-theme="dark"] .table-container,
html[data-theme="dark"] .analysis-card,
html[data-theme="dark"] .glass-card {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.86), rgba(20, 32, 54, 0.74)),
        var(--card);
}

.dashboard-container,
.page-card {
    padding: 28px;
}

.form-container {
    padding: 26px;
    max-width: 1060px;
}

.auth-card {
    max-width: 540px;
    margin: 34px auto;
    padding: 34px;
}

.hero-card {
    padding: 34px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    right: -90px;
    top: -90px;
    background: radial-gradient(circle, rgba(14,165,233,0.26), transparent 65%);
    border-radius: 50%;
}

.hero-card h2,
.dashboard-container h2,
.page-card h2,
.form-container h2,
.auth-card h2 {
    margin: 0 0 10px;
    font-size: 29px;
    line-height: 1.15;
    letter-spacing: -0.6px;
}

.hero-card p,
.dashboard-container p,
.page-card p,
.form-container p,
.auth-card p {
    color: var(--muted);
}

/* PAGE TITLE */

.page-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.page-title small {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    background: var(--info-bg);
    color: var(--blue);
    font-weight: 800;
}

/* DASHBOARD */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin: 22px 0;
}

.stat-card {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.68), rgba(255,255,255,0.38)),
        var(--card-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(16px);
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -42px;
    bottom: -42px;
    width: 120px;
    height: 120px;
    background: rgba(14, 165, 233, 0.13);
    border-radius: 50%;
}

.stat-card h3 {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.stat-number {
    font-size: 38px;
    font-weight: 900;
    color: var(--primary-2);
}

html[data-theme="dark"] .stat-number {
    color: #93c5fd;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0;
}

.esp32-card {
    background:
        linear-gradient(135deg, rgba(6, 43, 85, 0.96), rgba(14, 116, 144, 0.82));
    color: #ffffff;
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-card);
    margin: 20px 0;
}

.esp32-card p {
    color: rgba(255,255,255,0.78);
}

/* BUTTONS */

.btn,
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: none;
    border-radius: 14px;
    padding: 11px 17px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #ffffff;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    transition: 0.22s ease;
    box-shadow: 0 10px 24px rgba(6, 43, 85, 0.17);
}

.btn:hover,
button:hover,
input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(6, 43, 85, 0.24);
}

.btn-secondary {
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #f97316);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.btn-light {
    background: rgba(255,255,255,0.76);
    color: var(--primary);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.35);
    box-shadow: none;
}

.action-links {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

.inline-validation-form {
    display: inline-flex;
    width: auto;
}

.validation-confirmed {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--green-bg);
    color: var(--green);
    font-weight: 800;
}

.analysis-detail-grid,
.analysis-image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.analysis-image-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-card,
.analysis-image-card,
.validation-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.46);
    padding: 18px;
}

html[data-theme="dark"] .detail-card,
html[data-theme="dark"] .analysis-image-card,
html[data-theme="dark"] .validation-panel {
    background: rgba(15, 23, 42, 0.42);
}

.detail-card h3,
.analysis-image-card h3 {
    margin-top: 0;
    color: var(--primary);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

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

.detail-row span {
    color: var(--muted);
}

.detail-row strong {
    text-align: right;
    color: var(--text);
}

.analysis-image-card img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: min(44vh, 360px);
    object-fit: contain;
    margin: 0 auto;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #ffffff;
}

/* FORMS */

form {
    width: 100%;
}

label {
    display: block;
    margin: 14px 0 7px;
    font-weight: 800;
    color: var(--text);
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 45px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,0.76);
    color: var(--text);
    outline: none;
    font-size: 15px;
    transition: 0.22s ease;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: rgba(15, 23, 42, 0.78);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-3);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.16);
}

input::placeholder,
textarea::placeholder {
    color: #8a98ab;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.form-section {
    background: rgba(255,255,255,0.46);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 20px 0;
}

html[data-theme="dark"] .form-section {
    background: rgba(15, 23, 42, 0.46);
}

.form-section h3,
.form-section h4 {
    margin-top: 0;
}

.field-note {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

/* LANE CARDS */

.lane-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.lane-card {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.70), rgba(255,255,255,0.42));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: 0.22s ease;
}

html[data-theme="dark"] .lane-card {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.80), rgba(20, 32, 54, 0.54));
}

.lane-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.lane-card h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-size: 18px;
}

.lane-number {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-3));
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

/* ALERTS */

.alert,
.message,
.dashboard-container > p[style],
.form-container > p[style] {
    padding: 14px 16px !important;
    border-radius: 16px !important;
    border: 1px solid var(--border) !important;
    background: var(--glass) !important;
    color: var(--text) !important;
    box-shadow: var(--shadow-card);
}

.alert-success {
    background: var(--green-bg) !important;
    border-color: rgba(22, 163, 74, 0.25) !important;
}

.alert-error {
    background: var(--red-bg) !important;
    border-color: rgba(220, 38, 38, 0.25) !important;
}

.alert-info {
    background: var(--info-bg) !important;
    border-color: rgba(37, 99, 235, 0.25) !important;
}

/* TABLES */

.table-container {
    padding: 16px;
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 850px;
    overflow: hidden;
    border-radius: 18px;
}

th {
    text-align: left;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #ffffff;
    padding: 15px 14px;
    font-size: 14px;
    white-space: nowrap;
}

th:first-child {
    border-top-left-radius: 16px;
}

th:last-child {
    border-top-right-radius: 16px;
}

td {
    padding: 15px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    background: rgba(255,255,255,0.38);
}

html[data-theme="dark"] td {
    background: rgba(15, 23, 42, 0.38);
}

tr:hover td {
    background: rgba(14, 165, 233, 0.08);
}

td img {
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

/* BADGES */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.badge-aa,
.result-AA,
.result-aa {
    background: var(--green-bg);
    color: var(--green);
}

.badge-as,
.result-AS,
.result-as {
    background: var(--orange-bg);
    color: var(--orange);
}

.badge-ss,
.result-SS,
.result-ss {
    background: var(--red-bg);
    color: var(--red);
}

.badge-info {
    background: var(--info-bg);
    color: var(--blue);
}

/* ANALYSE GEL
   Styles pour le chargement d'image, l'aperçu, le calibrage manuel et les resultats. */

.gel-preview,
.manual-calibration-box {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.58), rgba(255,255,255,0.34));
    border: 1px dashed var(--border);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.esp32-capture-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.54);
    padding: 18px;
    margin: 18px 0 22px;
}

html[data-theme="dark"] .esp32-capture-box {
    background: rgba(15, 23, 42, 0.42);
}

.esp32-capture-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto auto;
    gap: 12px;
    align-items: center;
}

.capture-ok {
    color: var(--green);
    font-weight: 800;
}

.capture-error {
    color: var(--red);
    font-weight: 800;
}

.analysis-result-anchor,
#image-resultat-analyse {
    scroll-margin-top: 130px;
}

html[data-theme="dark"] .gel-preview,
html[data-theme="dark"] .manual-calibration-box {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.72), rgba(20, 32, 54, 0.45));
}

.gel-preview img,
.manual-calibration-box img {
    /* Les images restent lisibles sans prendre toute la page. */
    display: block;
    width: auto;
    max-height: min(58vh, 560px);
    object-fit: contain;
    margin: 0 auto;
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

.gel-preview.upload-preview {
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
    padding: 12px;
}

.gel-preview.upload-preview img {
    /* Apercu avant analyse : volontairement plus petit pour garder le formulaire visible. */
    width: auto !important;
    max-width: min(100%, 520px) !important;
    max-height: min(36vh, 280px) !important;
    height: auto !important;
}

.gel-preview.result-preview {
    /* Resultat final centre, avec une largeur limitee pour eviter l'effet image geante. */
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    padding: 12px;
}

.gel-preview.result-preview img {
    /* Image annotee apres analyse : assez grande pour lire les pistes, mais bornee. */
    width: auto !important;
    max-width: min(100%, 640px) !important;
    max-height: min(52vh, 460px) !important;
    height: auto !important;
}

.manual-calibration-box .gel-preview img {
    max-height: min(64vh, 640px);
}

.manual-calibration-box .gel-preview.upload-preview {
    max-width: 760px;
}

.manual-calibration-box .gel-preview.upload-preview img {
    /* En calibrage manuel, l'image reste un peu plus grande pour cliquer les 9 points. */
    max-width: min(100%, 680px) !important;
    max-height: min(50vh, 460px) !important;
}

.point-counter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--info-bg);
    color: var(--blue);
    padding: 8px 13px;
    border-radius: 999px;
    font-weight: 900;
}

/* PRINT */

.print-page {
    background: #ffffff !important;
    color: #111827 !important;
}

.print-card {
    max-width: 880px;
    margin: 0 auto;
    background: #ffffff;
    padding: 38px;
}

.print-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 2px solid #111827;
    padding-bottom: 18px;
    margin-bottom: 24px;
}

.print-title h1 {
    margin: 0;
    color: #062b55;
}

.print-result {
    text-align: center;
    border: 2px solid #111827;
    border-radius: 18px;
    padding: 22px;
    margin: 22px 0;
}

.print-result strong {
    font-size: 36px;
}

.signature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 36px;
    margin-top: 46px;
}

.signature-box {
    border-top: 1px solid #111827;
    padding-top: 8px;
    text-align: center;
}

/* RESPONSIVE */

@media (max-width: 1050px) {
    .main-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .main-nav {
        justify-content: flex-start;
    }

    .stats-grid,
    .lane-grid,
    .form-row,
    .esp32-capture-row,
    .analysis-detail-grid,
    .analysis-image-grid {
        grid-template-columns: 1fr;
    }

    .brand-text h1 {
        font-size: 25px;
    }
}

@media (max-width: 620px) {
    .app-shell {
        padding: 12px;
    }

    .main-header {
        top: 8px;
        border-radius: 22px;
        padding: 16px;
    }

    .brand-logo {
        width: 54px;
        height: 54px;
    }

    .brand-text h1 {
        font-size: 22px;
    }

    .brand-text p {
        display: none;
    }

    .main-nav a,
    .theme-toggle {
        height: 38px;
        padding: 0 10px;
        font-size: 13px;
    }

    .dashboard-container,
    .form-container,
    .auth-card,
    .page-card,
    .hero-card {
        padding: 20px;
    }

    .hero-card h2,
    .dashboard-container h2,
    .page-card h2,
    .form-container h2,
    .auth-card h2 {
        font-size: 24px;
    }
}

@media print {
    body {
        background: #ffffff !important;
    }

    .background-orb,
    .background-grid,
    .main-header,
    .main-footer,
    .no-print,
    .btn,
    button {
        display: none !important;
    }

    .app-shell {
        max-width: none;
        padding: 0;
    }

    .dashboard-container,
    .form-container,
    .page-card,
    .table-container {
        box-shadow: none;
        border: none;
        background: #ffffff;
    }
}

/* SELECT PATIENT PROFESSIONNEL */

.patient-select-wrapper {
    position: relative;
    width: 100%;
}

.patient-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    min-height: 48px;
    padding: 13px 46px 13px 14px;
    border-radius: 15px;
    border: 1px solid var(--border);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.82), rgba(255,255,255,0.58));
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
    cursor: pointer;
    transition: 0.22s ease;
}

html[data-theme="dark"] .patient-select {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.86), rgba(20, 32, 54, 0.72));
    color: var(--text);
}

.patient-select-wrapper::after {
    content: "⌄";
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-55%);
    font-size: 22px;
    color: var(--primary-3);
    pointer-events: none;
    font-weight: 900;
}

.patient-select:hover,
.patient-select:focus {
    border-color: var(--primary-3);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.16);
}

.patient-create-note {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--info-bg);
    color: var(--blue);
    font-size: 13px;
    font-weight: 700;
}

/* GESTION DES PISTES VIDES */

.lane-status-box {
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 16px;
    background: var(--info-bg);
    border: 1px solid rgba(14, 165, 233, 0.22);
}

.lane-status-box label {
    margin-top: 0;
}

.lane-card.lane-disabled {
    opacity: 0.55;
    filter: grayscale(0.4);
}

.lane-card.lane-disabled input,
.lane-card.lane-disabled select:not(.lane-status-select) {
    pointer-events: none;
}

.lane-empty-message {
    display: none;
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(220, 38, 38, 0.08);
    color: var(--red);
    font-weight: 800;
    font-size: 13px;
}

.lane-card.lane-disabled .lane-empty-message {
    display: block;
}

.patient-count-box {
    margin-bottom: 22px;
    padding: 18px;
    border-radius: 18px;
    background: var(--card);
    border: 1px solid var(--border);
}


