:root { 
    --primary: #0098a6; --primary-dark: #007985; --bg: #f4f7f6; 
    /* --- ELEGANTNÍ TLUMENÝ SVĚTLÝ REŽIM (více přibarvený břidlicí z tmavého režimu) --- */
    --card-bg: rgba(255, 255, 255, 0.94); --border: #cbd5e1; --text-color: #0f172a; --header-h1: #1e1b4b;
    --label-color: #334155; --input-bg: #fff;
    --alert-success-bg: #d1e7dd; --alert-success-text: #0f5132; --alert-success-border: #badbcc;
    --alert-danger-bg: #f8d7da; --alert-danger-text: #842029; --alert-danger-border: #f5c2c7;
    --tool-btn-bg: #fff; --tool-btn-text: #333; --grid-container-bg: #fff;
    --grid-header-bg: #e2e8f0; --grid-cell-border: #f1f5f9; --grid-cell-hour-border: #cbd5e1;
    --history-card-bg: #f1f5f9; --history-table-bg: #fff; --history-mini-cell-bg: #cbd5e1;
    --history-mini-cell-border: #fff; --history-title-color: #0098a6;
    --admin-yellow-bg: #fff3cd; --admin-yellow-border: #ffe69c; --admin-yellow-text: #212529;
    --admin-grey-bg: #e2e8f0; --admin-table-bg: #fff; --admin-table-hdr-bg: #cbd5e1;
    --admin-table-hdr-text: #333; --dialog-bg: #fff; --dialog-hdr-bg: #cbd5e1;
    --color-spanek: #1f2937; --color-ospalost: #f59e0b; --color-probouzeni: #ef4444; --color-polospanek: #a855f7; 
}

/* --- PŮVODNÍ TMAVÝ REŽIM --- */
body.dark-theme {
    --card-bg: rgba(23, 21, 59, 0.95); --border: #3b3775; --text-color: #f1f5f9; --header-h1: #38bdf8;
    --label-color: #94a3b8; --input-bg: #0f172a;
    --alert-success-bg: #064e3b; --alert-success-text: #6ee7b7; --alert-success-border: #047857;
    --alert-danger-bg: #7f1d1d; --alert-danger-text: #fca5a5; --alert-danger-border: #b91c1c;
    --tool-btn-bg: #0f172a; --tool-btn-text: #cbd5e1; --grid-container-bg: #0f172a;
    --grid-header-bg: #1e293b; --grid-cell-border: #1e293b; --grid-cell-hour-border: #334155;
    --history-card-bg: #111827; --history-table-bg: #0f172a; --history-mini-cell-bg: #1e293b;
    --history-mini-cell-border: #0f172a; --history-title-color: #38bdf8;
    --admin-yellow-bg: rgba(120, 80, 20, 0.25); --admin-yellow-border: #d97706; --admin-yellow-text: #f59e0b;
    --admin-grey-bg: rgba(30, 41, 59, 0.7); --admin-table-bg: #111827; --admin-table-hdr-bg: #1f2937;
    --admin-table-hdr-text: #38bdf8; --dialog-bg: #111827; --dialog-hdr-bg: #1e293b;
    --color-spanek: #0098a6; --color-ospalost: #f59e0b; --color-probouzeni: #ef4444; --color-polospanek: #a855f7; 
}

/* --- GLOBÁLNÍ STYLY --- */
* { box-sizing: border-box; }

body {
    /* Světlý režim: břidlicové pozadí s výrazným tyrkysovým půlměsícem přesně uprostřed */
    background: radial-gradient(circle at 48.3% 48.3%, #cbd5e1 6%, transparent 6.1%), 
                radial-gradient(circle at 50% 50%, #0098a6 0%, #0098a6 6%, rgba(0, 152, 166, 0.15) 8%, transparent 15%), 
                linear-gradient(to bottom, #94a3b8, #cbd5e1, #e2e8f0);
    background-attachment: fixed; color: var(--text-color); transition: background 0.3s, color 0.3s; margin: 0;
}

body.dark-theme {
    /* Tmavý režim: vesmír s výrazným žlutým půlměsícem přesně uprostřed a hvězdami */
    background: radial-gradient(circle at 48.3% 48.3%, #120e3d 6%, transparent 6.1%), 
                radial-gradient(circle at 50% 50%, #fef3c7 0%, #fef3c7 6%, rgba(254, 243, 199, 0.25) 8%, transparent 15%), 
                radial-gradient(circle at 20% 40%, rgba(255,255,255,0.15) 1px, transparent 1px),
                radial-gradient(circle at 60% 70%, rgba(255,255,255,0.1) 1px, transparent 1px),
                radial-gradient(circle at 80% 60%, rgba(255,255,255,0.2) 1px, transparent 1px),
                linear-gradient(to bottom, #0f172a, #1e1b4b, #311042);
}

/* --- DEKORATIVNÍ POSTRANNÍ MĚSÍČKY A HVĚZDY --- */
body::before,
body::after {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    pointer-events: none; /* Aby nepřekážely klikání na stránce */
    z-index: 0;
    transition: color 0.3s, opacity 0.3s;
    animation: snovySvit 4s ease-in-out infinite alternate;
}

/* Levá strana: Měsíček */
body::before {
    content: "🌙";
    left: 25px;
}

/* Pravá strana: Měsíček */
body::after {
    content: "🌙";
    right: 25px;
    animation-delay: 2s;
}

/* Přizpůsobení barev a svícení pro SVĚTLÝ režim */
body::before,
body::after {
    color: #0098a6;
    opacity: 0.25; /* Jemné, nerušivé zobrazení ve světlém režimu */
    filter: drop-shadow(0 0 8px rgba(0, 152, 166, 0.2));
}

/* Přizpůsobení barev a svícení pro TMAVÝ režim */
body.dark-theme::before,
body.dark-theme::after {
    color: #fef3c7;
    opacity: 0.4; /* O něco výraznější svit ve tmě */
    filter: drop-shadow(0 0 12px rgba(254, 243, 199, 0.5));
}

/* Animace jemného pulzování (jako když měsíček dýchá/svítí) */
@keyframes snovySvit {
    0% {
        transform: translateY(-50%) scale(0.95);
        opacity: 0.2;
    }
    100% {
        transform: translateY(-50%) scale(1.05);
        opacity: 0.45;
    }
}

/* Skrytí měsíčků na malých obrazovkách, aby nepřekážely layoutu */
@media (max-width: 1300px) {
    body::before,
    body::after {
        display: none !important;
    }
}

.container {
    background: var(--card-bg); color: var(--text-color); border-radius: 16px; padding: 30px; margin: 30px auto; max-width: 1200px;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(0,0,0,0.05); transition: background 0.3s, color 0.3s;
    position: relative;
    z-index: 1; /* Kontejner bude nad dekorativními měsíčky na pozadí */
}
body.dark-theme .container {
    box-shadow: 0 15px 35px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05);
}
h2, h3 { color: var(--text-color); }

/* --- HLAVIČKA & ANIMOVANÝ NADPIS --- */
header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--primary); padding-bottom: 15px; margin-bottom: 25px; }
header > div:first-child { display: flex; flex-direction: column; align-items: flex-start; }
header small { margin-top: 5px; color: var(--label-color); font-size: 13px; }

header h1 { 
    font-family: 'Montserrat', 'Segoe UI', sans-serif; font-size: 2.2rem; font-weight: 800; letter-spacing: 1.5px;
    text-transform: uppercase; margin: 0; padding-bottom: 8px; position: relative; display: inline-block;
    background: linear-gradient(135deg, #0098a6 0%, #1e1b4b 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
header h1::after { content: ''; position: absolute; bottom: 0; left: 0; width: 60px; height: 4px; background: linear-gradient(90deg, #0098a6, #1e1b4b); border-radius: 2px; transition: width 0.3s ease; }
header h1:hover::after { width: 100%; }

body.dark-theme header h1 { background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
body.dark-theme header h1::after { background: linear-gradient(90deg, #38bdf8, #0098a6); }

/* --- FORMULÁŘOVÉ PRVKY --- */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 20px; }
label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 14px; color: var(--label-color); }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; background-color: var(--input-bg); color: var(--text-color); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0, 152, 166, 0.3); }
button { width: 100%; padding: 10px; border-radius: 6px; font-size: 14px; background: var(--primary); color: #fff; border: none; font-weight: bold; cursor: pointer; transition: 0.2s; }
button:hover { background: var(--primary-dark); }

/* --- ALERTY & BADGES --- */
.alert { padding: 12px; margin-bottom: 20px; border-radius: 6px; font-weight: bold; }
.alert-success { background: var(--alert-success-bg); color: var(--alert-success-text); border: 1px solid var(--alert-success-border); }
.alert-danger { background: var(--alert-danger-bg); color: var(--alert-danger-text); border: 1px solid var(--alert-danger-border); }
.badge { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 12px; font-weight: bold; color: #fff; }
.badge-admin { background: #ef4444; } .badge-doktor { background: #3b82f6; } .badge-pacient { background: #10b981; }

/* --- AKTIVNÍ ČASOVÁ OSA --- */
.timeline-section { margin: 25px 0; }
.tool-selector { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }

/* --- OPRAVENÝ STYL PRO TLAČÍTKA NÁSTROJŮ --- */
.tool-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important; /* Přesná mezera mezi kolečkem a textem */
    width: auto !important; /* Přepisuje 100% šířku globálního buttonu */
    padding: 8px 16px !important;
    background-color: var(--tool-btn-bg) !important;
    color: var(--tool-btn-text) !important;
    border: 2px solid var(--border) !important;
    transition: all 0.2s ease !important;
}

/* Vynucení stabilního zobrazení barevného kolečka před textem */
.tool-btn::before {
    content: "" !important;
    display: inline-block !important;
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    flex-shrink: 0 !important;
}

/* Přiřazení přesné barvy pro jednotlivé fáze (přebírá barvy z aktivního režimu) */
.tool-btn[data-type="spanek"]::before { background-color: var(--color-spanek) !important; }
.tool-btn[data-type="polospanek"]::before { background-color: var(--color-polospanek) !important; }
.tool-btn[data-type="probouzeni"]::before { background-color: var(--color-probouzeni) !important; }
.tool-btn[data-type="ospalost"]::before { background-color: var(--color-ospalost) !important; }
.tool-btn[data-type="ulehnuti"]::before { background-color: #3b82f6 !important; }
.tool-btn[data-type="vstavani"]::before { background-color: #10b981 !important; }
.tool-btn[data-type="guma"]::before { background-color: #ef4444 !important; }

/* Styl pro právě aktivní (vybrané) tlačítko - obarví se celé tlačítko */
.tool-btn.active[data-type="spanek"] { background-color: var(--color-spanek) !important; color: #fff !important; border-color: var(--color-spanek) !important; }
.tool-btn.active[data-type="polospanek"] { background-color: var(--color-polospanek) !important; color: #fff !important; border-color: var(--color-polospanek) !important; }
.tool-btn.active[data-type="probouzeni"] { background-color: var(--color-probouzeni) !important; color: #fff !important; border-color: var(--color-probouzeni) !important; }
.tool-btn.active[data-type="ospalost"] { background-color: var(--color-ospalost) !important; color: #fff !important; border-color: var(--color-ospalost) !important; }
.tool-btn.active[data-type="ulehnuti"] { background-color: #3b82f6 !important; color: #fff !important; border-color: #3b82f6 !important; }
.tool-btn.active[data-type="vstavani"] { background-color: #10b981 !important; color: #fff !important; border-color: #10b981 !important; }
.tool-btn.active[data-type="guma"] { background-color: #ef4444 !important; color: #fff !important; border-color: #ef4444 !important; }

/* Kontrastnější ohraničení tečky u aktivního tlačítka */
.tool-btn.active::before {
    border-color: #fff !important;
}

.grid-container { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 20px; background: var(--grid-container-bg); }
.timeline-grid { display: grid; grid-template-columns: repeat(48, minmax(22px, 1fr)); min-width: 1050px; }
.grid-header { text-align: center; font-weight: bold; font-size: 11px; background: var(--grid-header-bg); padding: 6px 0; border-bottom: 1px solid var(--border); border-right: 1px solid var(--grid-cell-hour-border); grid-column: span 2; display: flex; align-items: center; justify-content: center; color: var(--label-color); }
.grid-cell { height: 40px; border-right: 1px solid var(--grid-cell-border); cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 14px; text-align: center; line-height: 1; user-select: none; color: #fff; box-sizing: border-box; }
.grid-cell.cela-hodina { border-left: 1px solid var(--grid-cell-hour-border); }

/* Vykreslování fází */
.cell-spanek { background-color: var(--color-spanek) !important; }
.cell-polospanek { background-color: var(--color-polospanek) !important; }
.cell-probouzeni { background-color: var(--color-probouzeni) !important; }
.cell-ospalost { background-color: var(--color-ospalost) !important; }
.cell-ulehnuti { background-color: #3b82f6 !important; }
.cell-vstavani { background-color: #10b981 !important; }

/* --- VYHLEDÁVACÍ A TISKOVÝ PANEL --- */
.filter-search-panel { background: var(--admin-grey-bg) !important; border: 1px solid var(--border) !important; border-radius: 8px; padding: 20px; margin: 20px 0; color: var(--text-color) !important; }
.filter-search-form { display: flex; align-items: flex-end; gap: 15px; flex-wrap: wrap; width: 100%; }
.filter-group { flex: 1; min-width: 180px; }
.filter-group input[type="date"], .filter-group select { height: 42px !important; box-sizing: border-box !important; padding: 10px 12px !important; }
.filter-buttons { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }

.btn-filter, .btn-export { height: 42px !important; box-sizing: border-box !important; padding: 0 20px !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; font-weight: bold !important; font-size: 14px !important; text-decoration: none !important; border-radius: 6px !important; cursor: pointer !important; white-space: nowrap; line-height: 1 !important; transition: 0.2s; }
.btn-filter { background: var(--primary) !important; color: #fff !important; border: none !important; }
.btn-filter:hover { background: var(--primary-dark) !important; }
.btn-export.pdf { background: #0098a6 !important; color: #fff !important; border: none !important; }
.btn-export.pdf:hover { background: #007985 !important; }
.btn-export.csv { background: #10b981 !important; color: #fff !important; border: none !important; }
.btn-export.csv:hover { background: #059669 !important; }

/* --- HISTORIE ZÁZNAMŮ --- */
.history-card { background: var(--history-card-bg) !important; border: 1px solid var(--border); border-radius: 8px; padding: 15px; margin-bottom: 15px; color: var(--text-color) !important; transition: background 0.3s; }
.history-card strong, .history-card b { color: var(--history-title-color); }
.history-table { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 15px; background: var(--history-table-bg) !important; }
.history-table th, .history-table td { padding: 0; text-align: center; border: none; }
.history-table td { height: 24px; }
.history-table .mini-cell-td { background: var(--history-mini-cell-bg) !important; border-right: 1px solid var(--history-mini-cell-border); font-size: 10px; font-weight: bold; color: #fff !important; vertical-align: middle; }
.history-table .mini-cell-td:last-child { border-right: none; }
.history-table-container { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; margin-top: 10px; padding: 5px; background: var(--history-table-bg) !important; }
.history-table th { font-size: 9px; color: var(--label-color); font-weight: bold; height: 20px; border-bottom: 1px dashed var(--border); text-align: left; padding-left: 2px !important; }

/* Osa historie: Tmavý režim */
body.dark-theme .history-table .mini-cell-td.cell-spanek { background-color: #0098a6 !important; }
body.dark-theme .history-table .mini-cell-td.cell-polospanek { background-color: #8b5cf6 !important; } 
body.dark-theme .history-table .mini-cell-td.cell-probouzeni { background-color: #ef4444 !important; } 
body.dark-theme .history-table .mini-cell-td.cell-ospalost { background-color: #d97706 !important; } 
body.dark-theme .history-table .mini-cell-td.cell-ulehnuti { background-color: #2563eb !important; } 
body.dark-theme .history-table .mini-cell-td.cell-vstavani { background-color: #059669 !important; } 
/* Osa historie: Světlý režim */
.history-table .mini-cell-td.cell-spanek { background-color: #1f2937 !important; } 
.history-table .mini-cell-td.cell-polospanek { background-color: #a855f7 !important; } 
.history-table .mini-cell-td.cell-probouzeni { background-color: #ef4444 !important; } 
.history-table .mini-cell-td.cell-ospalost { background-color: #f59e0b !important; } 
.history-table .mini-cell-td.cell-ulehnuti { background-color: #3b82f6 !important; } 
.history-table .mini-cell-td.cell-vstavani { background-color: #10b981 !important; } 

/* --- ADMIN SEKCE & TABULKY --- */
body.dark-theme div[style*="background: #fff3cd"] { background: rgba(120, 80, 20, 0.25) !important; border: 1px solid #d97706 !important; color: var(--text-color) !important; }
body.dark-theme div[style*="background: #fff3cd"] h3 { color: #f59e0b !important; }
div[style*="background: #fff3cd"] { background: var(--admin-yellow-bg) !important; border: 1px solid var(--admin-yellow-border) !important; color: var(--admin-yellow-text) !important; }
div[style*="background: #eef2f3"] { background: var(--admin-grey-bg) !important; border: 1px solid var(--border) !important; color: var(--text-color) !important; }
table[style*="background: white"] { background: var(--admin-table-bg) !important; border: 1px solid var(--border) !important; }
table[style*="background: white"] tr[style*="background: #ddd"] { background: var(--admin-table-hdr-bg) !important; color: var(--admin-table-hdr-text) !important; }
table[style*="background: white"] tr { border-bottom: 1px solid var(--border) !important; }
table[style*="background: white"] td { color: var(--text-color) !important; }
div[style*="background: #eef2f3"] form input, div[style*="background: #eef2f3"] form select { background-color: var(--input-bg) !important; }
/* Oprava čitelnosti detailů v tabulce logů pro tmavý režim */
body.dark-theme dialog td[style*="color: #444"] {
    color: #cbd5e1 !important; /* Vynutí jasnou, čitelnou břidlicovou barvu */
}


/* --- DIALOGY (MODÁLY) --- */
dialog { background: var(--dialog-bg) !important; color: var(--text-color) !important; border: 1px solid var(--border) !important; border-radius: 12px; box-shadow: 0 20px 40px rgba(0,0,0,0.8); }
dialog table { color: var(--text-color) !important; }
dialog tr[style*="background: #eee"] { background: var(--dialog-hdr-bg) !important; color: var(--admin-table-hdr-text) !important; }
dialog td { border-bottom: 1px solid var(--border) !important; }
.dialog-header h2 { color: var(--admin-table-hdr-text) !important; }
.close-dialog-btn { background: #ef4444 !important; } .close-dialog-btn:hover { background: #dc2626 !important; }
.filter-panel { background: var(--dialog-hdr-bg) !important; padding: 10px; border-radius: 8px; margin-bottom: 15px; border: 1px solid var(--border); }

/* --- OPRAVA: ROZMAZÁNÍ POZADÍ PŘI OTEVŘENÉM DIALOGU --- */
dialog::backdrop {
    background-color: rgba(15, 23, 42, 0.5); /* Jemné ztmavení pozadí */
    backdrop-filter: blur(3px);              /* Rozmazání zbytku stránky */
    -webkit-backdrop-filter: blur(3px);      /* Podpora pro Safari */
    transition: backdrop-filter 0.5s ease;
}

.theme-switch-btn { width: auto; padding: 6px 12px; font-size: 13px; background: transparent; border: 1px solid var(--primary); color: var(--primary); margin-right: 15px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; }
.theme-switch-btn:hover { background: rgba(0, 152, 166, 0.1); }

/* --- EXPORT PDF --- */
.pdf-body { font-family: 'Segoe UI', Arial, sans-serif; color: #333 !important; margin: 0; padding: 20px; background: #fff !important; }
.pdf-body h1, .pdf-body h2, .pdf-body h3, .pdf-body strong, .pdf-body td { color: #000 !important; }
.print-container { max-width: 1050px; margin: 0 auto; }
.pdf-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 3px solid #0098a6; padding-bottom: 10px; }
.pdf-header h1 { color: #0098a6 !important; font-size: 28px; margin: 0; text-transform: uppercase; font-weight: bold; letter-spacing: 1px; }
.logo-nudz { font-size: 28px; font-weight: bold; }
.logo-nudz span.n { color: #e11d48; } .logo-nudz span.u { color: #f59e0b; } .logo-nudz span.d { color: #10b981; } .logo-nudz span.z { color: #3b82f6; }
.meta-info { font-size: 14px; margin-bottom: 15px; font-weight: bold; color: #333 !important; }

.nudz-table { 
    width: 100%; 
    border-collapse: collapse !important; 
    table-layout: fixed; 
    font-size: 11px;
    box-sizing: border-box !important;
}
.nudz-table th, .nudz-table td { 
    border: 1px solid #000 !important; 
    text-align: center; 
    padding: 0; 
    height: 15px !important; 
    vertical-align: middle; 
}
.nudz-table th:last-child, 
.nudz-table td:last-child {
    border-right: 1px solid #000 !important;
}
.col-datum { width: 9%; } .col-cas { width: 48%; } .col-hodnoceni-box { width: 5.5%; } .col-poznamky { width: 21%; }
.header-top th { font-weight: bold; background: #f3f4f6 !important; height: 25px; font-size: 11px; color: #000 !important; }
.hours-row th { font-size: 8px; font-weight: normal; height: 15px; border: 1px solid #ccc !important; color: #000 !important; }

.grid-cell-pdf { 
    border-right: 1px solid #ddd !important; 
    height: 15px !important; /* ZMĚNA: Sjednoceno s tabulkou */
    font-size: 11px; 
    font-weight: bold; 
    position: relative; 
    background: transparent !important; 
}
.grid-cell-pdf.hour-boundary { border-right: 1px solid #000 !important; }

.pdf-body .cell-spanek { background-color: #3b82f6 !important; background-image: repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.15) 2px, rgba(255,255,255,0.15) 4px) !important; }

/* Oprava zobrazení polospánku v PDF exportu */
/* Modré šrafování pouze nahoře a dole, střed s "P" zůstává čistý */
.pdf-body .cell-polospanek { 
    background: 
        repeating-linear-gradient(45deg, #3b82f6, #3b82f6 2px, #ffffff 2px, #ffffff 5px) top / 100% 3px no-repeat,
        repeating-linear-gradient(45deg, #3b82f6, #3b82f6 2px, #ffffff 2px, #ffffff 5px) bottom / 100% 3px no-repeat,
        #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    position: relative !important;
    height: 15px !important; /* ZMĚNA: Sjednoceno */
} 

.pdf-body .cell-polospanek::after { 
    content: "P" !important; 
    color: #000000 !important; 
    font-weight: normal !important; 
    font-size: 10px !important; 
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: #ffffff !important; 
    width: 86% !important;     
    height: 9px !important;   /* ZMĚNA: Zmenšeno na 9px, aby boxík perfektně seděl v 15px buňce */
    line-height: 9px !important;
    text-align: center !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
}

.pdf-body .cell-probouzeni { background: repeating-linear-gradient(45deg, #cbd5e1, #cbd5e1 2px, #fff 2px, #fff 5px) !important; }
.pdf-body .cell-ospalost { background-color: transparent !important; } .pdf-body .cell-ospalost::after { content: "S"; color: #000 !important; }
.pdf-body .cell-ulehnuti { background-color: transparent !important; } .pdf-body .cell-ulehnuti::after { content: "↓"; font-weight: bold; color: #000 !important; }
.pdf-body .cell-vstavani { background-color: transparent !important; } .pdf-body .cell-vstavani::after { content: "↑"; font-weight: bold; color: #000 !important; }

.legend-section { margin-top: 30px; font-size: 11px; line-height: 1.6; border-top: 1px solid #ddd; padding-top: 15px; color: #333 !important; }
.legend-row { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; margin-bottom: 8px; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-box { width: 18px; height: 18px; border: 1px solid #000 !important; display: inline-block; }

@media print {
    @page {
        size: landscape;
    }
    .pdf-body { padding: 0; background: #fff !important; }
    .no-print { display: none; }
    .nudz-table, .legend-box { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    html, body {
        height: 99% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important; /* Zakáže prohlížeči generovat další listy pod obsahem */
    }
    
    /* Pojistka pro legendu, aby za ní tiskový engine už nic nehledal */
    .legend-section {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }
}