/* ===== MISSCALL.IO — PETROLEUM DESIGN v2 ===== */
@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700;800;900&family=DM+Serif+Display:ital@0;1&display=swap');

:root {
  --petrol: #1a6b7c;
  --petrol-light: #2589a0;
  --petrol-dark: #0f4a57;
  --petrol-deep: #0a3340;
  --accent: #38c9e8;
  --accent-hover: #25b5d4;
  --accent2: #f0a500;
  --teal: #1a6b7c;
  --teal-light: rgba(26,107,124,.06);
  --teal-mid: rgba(26,107,124,.1);
  --teal-hover: rgba(26,107,124,.04);
  --green: #2ecc71;
  --green-text: #2ecc71;
  --green-bg: rgba(46,204,113,.1);
  --green-border: rgba(46,204,113,.2);
  --red: #e74c3c;
  --red-light: rgba(231,76,60,.06);
  --bg: #fff;
  --bg2: #f5f3ef;
  --surface: #f0f4f5;
  --text: #1a1a2e;
  --text2: #5a6a72;
  --text3: #94a3ab;
  --border: rgba(26,107,124,.15);
  --border2: rgba(26,107,124,.08);
  --border-light: rgba(26,107,124,.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(26,107,124,.08);
  --shadow-md: 0 8px 24px rgba(26,107,124,.12);
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Figtree', sans-serif !important; font-size: 16px; line-height: 1.5; color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: 'Figtree', sans-serif !important; }

/* ===== LUCIDE IKONY ===== */
.lucide {
    display: inline-block;
    vertical-align: middle;
    stroke-width: 1.75;
}

.tab-icon .lucide {
    width: 20px;
    height: 20px;
}

.icon-heading {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
    color: var(--petrol);
}

.icon-sm {
    width: 15px;
    height: 15px;
    color: var(--text3);
}

.btn .lucide {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: 4px;
}

.btn-sm .lucide {
    width: 13px;
    height: 13px;
}

.modal-close .lucide {
    width: 18px;
    height: 18px;
}

.cal-context-menu button .lucide {
    width: 13px;
    height: 13px;
    vertical-align: middle;
    margin-right: 5px;
}

.logo h1 .lucide {
    width: 22px;
    height: 22px;
    vertical-align: middle;
    margin-right: 6px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.logo-icon svg {
    width: 14px;
    height: 14px;
    stroke: #fff;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===== ZÁKLADNÍ STYLY ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Figtree', system-ui, sans-serif;
    background: #f0f0f2;
    min-height: 100vh;
    padding: 20px;
    color: var(--text);
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
}

/* ===== PŘIHLAŠOVACÍ SEKCE ===== */
#loginSection {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: linear-gradient(135deg, var(--petrol-deep) 0%, var(--petrol-dark) 50%, #0e5e70 100%);
    padding: 40px 24px;
    position: fixed;
    inset: 0;
    overflow-y: auto;
    z-index: 500;
}

#loginSection::before {
    content: '';
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: rgba(56,201,232,.06);
    pointer-events: none;
}

.login-container {
    max-width: 420px;
    width: 100%;
    margin: auto 0;
    padding: 36px 32px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(20px);
    z-index: 1;
    position: relative;
}

.login-header {
    text-align: center;
    color: #fff;
    margin-bottom: 24px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 800;
    color: #fff;
}

.login-header p {
    color: rgba(255,255,255,.6);
    font-size: 14px;
}

/* Checkbox label */
.checkbox-label {
    display: flex; align-items: flex-start; gap: 8px; font-size: 0.85rem;
    color: #4b5563; cursor: pointer; line-height: 1.4;
}
.checkbox-label input[type="checkbox"] {
    margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; cursor: pointer;
}
.checkbox-label a { color: var(--teal); text-decoration: underline; }
.checkbox-label a:hover { color: #2d6d8a; }

/* Password visibility toggle */
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 40px; }
.pw-toggle {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--text3); padding: 4px;
    display: flex; align-items: center;
}
.pw-toggle:hover { color: #4b5563; }
.pw-toggle svg, .pw-toggle i { width: 18px; height: 18px; }

.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.06);
}

.login-box h2 {
    color: var(--text);
    margin-bottom: 10px;
    font-weight: 700;
}

.login-box p {
    color: var(--text2);
    margin-bottom: 25px;
}

.link-primary {
    color: var(--teal);
    text-decoration: none;
    font-weight: 600;
}

.link-primary:hover {
    text-decoration: underline;
}

#loginSection .lang-switcher-login {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 12px;
}

#loginSection .form-input,
#loginSection input[type="email"],
#loginSection input[type="password"],
#loginSection input[type="text"] {
    background: #fff;
    border: 1.5px solid #d1d5db;
    color: #1a1a2e;
}

#loginSection .form-input:focus,
#loginSection input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56,201,232,0.15);
}

#loginSection .form-input::placeholder,
#loginSection input::placeholder {
    color: #9ca3af;
}

#loginSection .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 15px;
}

#loginSection .login-footer {
    color: rgba(255,255,255,0.5);
}

#loginSection .login-footer a {
    color: var(--accent);
}

#loginSection #authError {
    color: #ff6b6b;
    background: rgba(231,76,60,0.15);
    border: 1px solid rgba(231,76,60,0.25);
    border-radius: 8px;
    padding: 8px 12px;
}

#loginSection #authSuccess {
    color: var(--accent);
    background: rgba(56,201,232,0.1);
    border: 1px solid rgba(56,201,232,0.2);
}

/* Auth karta je bílá — text checkboxů musí být tmavý (bílá rgba way byla pozůstatek tmavého designu a text byl neviditelný) */
#loginSection .checkbox-label {
    color: #4b5563;
}

#loginSection .checkbox-label a {
    color: var(--accent);
}

/* ===== EU-ONLY GATE ===== */
.eu-only-warning {
    background: rgba(255, 193, 7, 0.08);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.eu-only-warning-title {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 0.92em;
    color: rgba(255, 220, 130, 1);
}

.eu-only-warning-desc {
    margin: 0;
    font-size: 0.85em;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.7);
}

/* ===== HLAVNÍ SEKCE ===== */
.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* ===== HORNÍ LIŠTA ===== */
.top-bar {
    background: var(--petrol-deep);
    border-bottom: 1px solid rgba(56,201,232,.12);
    padding: 0 20px;
    height: 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
}

.logo h1 {
    font-size: 16px;
    color: var(--white, #fff);
    margin: 0;
    font-weight: 800;
    letter-spacing: -.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-email {
    color: rgba(255,255,255,.7);
    font-size: 0.82em;
}

/* ===== TAB NAVIGACE ===== */
.tabs-nav {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 240px;
    background: var(--petrol-dark);
    border-right: 1px solid rgba(56,201,232,.1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
    padding: 8px 0;
    scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar { display: none; }

.tab-button {
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    padding: 11px 18px;
    margin: 2px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,.65);
    white-space: nowrap;
    width: calc(100% - 20px);
    text-align: left;
}

.tab-button:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
}

.tab-button.active {
    background: rgba(56,201,232,.15);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 700;
}

.tab-icon {
    display: flex;
    align-items: center;
    opacity: .7;
}
.tab-button:hover .tab-icon,
.tab-button.active .tab-icon { opacity: 1; }

.tab-label {
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== TAB OBSAHY ===== */
.tabs-content {
    margin-left: 240px;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
    background: var(--surface);
    padding: 32px 28px;
    border: 1px solid var(--border);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    margin-bottom: 24px;
}

/* ===== EVENTS TAB – kompaktní horní část ===== */
#events-tab .page-title {
    margin-bottom: 8px;
    font-size: 1.25em;
}

#events-tab .card-compact {
    padding: 10px 14px;
    margin-bottom: 8px;
}

#events-tab .card-header-flex {
    margin-bottom: 8px;
    align-items: center;
}

#events-tab .card-header-flex h3 {
    margin-bottom: 0;
    font-size: 0.95em;
}

#events-tab .priority-info {
    padding: 3px 0;
    margin-bottom: 6px;
    font-size: 0.78em;
}

.events-subtitle {
    font-size: 0.78em;
    font-weight: 400;
    color: var(--text3);
}

/* ===== DASHBOARD – kompaktní rozestupy ===== */
#dashboard-tab .page-title {
    margin-bottom: 10px;
}

#dashboard-tab .card {
    padding: 12px 16px;
    margin-bottom: 8px;
}

#dashboard-tab .card h3 {
    margin-bottom: 4px;
    font-size: 0.95em;
}

#dashboard-tab .card-description {
    margin-bottom: 8px;
    font-size: 0.82em;
}

#dashboard-tab .status-display {
    margin: 6px 0;
}

/* ===== KARTY ===== */
.card {
    background: var(--card-bg, #fff);
    border-radius: var(--radius-lg, 16px);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 16px;
    transition: box-shadow var(--transition);
}

.card-danger {
    border-color: #fca5a5;
    background: #fff5f5;
}

.card-danger h3 {
    color: #dc2626;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.settings-grid-full {
    grid-column: 1 / -1;
}

@media (max-width: 600px) {
    .settings-grid { grid-template-columns: 1fr; }
}

.card h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card h3 .lucide, .card h3 .icon-heading {
    color: var(--petrol);
    width: 18px;
    height: 18px;
}

.card-description {
    color: var(--text2);
    font-size: 0.85em;
    margin-bottom: 14px;
}

/* Kompaktní karta pro univerzální odpověď */
.card-compact {
    padding: 12px 20px;
}

/* Ztlumení univerzální šablony když je aktivní specifická událost */
.card--overridden {
    opacity: 0.45;
    pointer-events: none;
    position: relative;
}

.card--overridden::after {
    content: 'Přebito aktivní událostí';
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 0.72em;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-radius: 20px;
    padding: 2px 9px;
    font-weight: 600;
    pointer-events: none;
}

.default-msg-header {
    margin-bottom: 8px;
}

.default-msg-header h3 {
    margin-bottom: 2px;
}

.default-msg-desc {
    font-size: 0.82em;
    color: var(--text3);
    margin: 0;
}

.default-msg-body {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.default-msg-body textarea {
    flex: 1;
    resize: none;
    min-height: 52px;
    overflow: hidden;
}

.default-msg-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.default-msg-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.default-msg-footer .char-counter {
    font-size: 0.78em;
    color: #999;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.85em;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

/* ===== FORMULÁŘOVÉ PRVKY ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-input,
.form-textarea,
.filter-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Figtree', system-ui, sans-serif;
    transition: .2s;
    background: var(--bg);
    color: var(--text);
    outline: none;
}

.form-input:focus,
.form-textarea:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(53,127,162,.08);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.char-counter {
    text-align: right;
    font-size: 0.85em;
    color: #999;
    margin-top: 5px;
}

/* ===== TLAČÍTKA ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
    font-family: 'Figtree', system-ui, sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: var(--petrol-deep);
    font-weight: 700;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg2);
    color: #374151;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-download-app {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--accent);
    color: var(--petrol-deep);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.82em;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

.btn-download-app:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn-download-app .lucide {
    width: 15px;
    height: 15px;
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,.2);
    color: rgba(255,255,255,.5);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.btn-logout:hover {
    border-color: var(--red);
    color: var(--red);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82em;
}

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}
.btn-danger-outline {
    background: transparent;
    color: #dc2626;
    border: 1px solid #dc2626;
}
.btn-danger-outline:hover {
    background: #fef2f2;
}

.btn-gcal {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.btn-gcal:hover {
    background: #dcfce7;
    border-color: #86efac;
}

/* ===== STATUS BADGE ===== */
.status-display {
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.service-toggle-inline {
    flex-shrink: 0;
}

.service-toggle-hint {
    margin-top: 10px;
    font-size: 0.82em;
    color: var(--text2);
    line-height: 1.5;
}

.status-badge {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-badge.status-active::before { background: var(--success); }
.status-badge.status-active { background: var(--success-bg); color: var(--success); border: 1px solid rgba(46,204,113,0.2); }

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-warning {
    background: #fff3cd;
    color: #856404;
}

.status-offline {
    background: #f1f1f1;
    color: var(--text2);
}

.status-badge.status-offline::before { background: var(--error); }
.status-badge.status-offline { background: var(--error-bg); color: var(--error); border: 1px solid rgba(231,76,60,0.2); }

/* ===== DOČASNÉ VYPNUTÍ ===== */
.temp-disable-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin: 15px 0;
}

.time-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.time-inputs input {
    width: 80px;
}

.disable-status {
    margin-top: 10px;
    padding: 10px;
    background: #fff3cd;
    border-radius: 8px;
    color: #856404;
    font-weight: 500;
}

/* ===== STAT CARDS ===== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--card-bg, #fff);
    border-radius: var(--radius-lg, 16px);
    border: 1px solid var(--border);
    padding: 24px 20px;
    text-align: center;
}

/* ===== STATISTIKY ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat-box {
    background: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--petrol);
    letter-spacing: -1px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 6px;
}

/* ===== UDÁLOSTI - DRAG & DROP ===== */
.priority-info {
    background: rgba(53,127,162,.06);
    padding: 8px 12px;
    border-radius: 7px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82em;
    color: #3730a3;
}

.info-icon {
    font-size: 1.2em;
}

.events-list {
    min-height: 100px;
}

.event-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: move;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.event-item:hover {
    border-color: var(--teal);
    box-shadow: 0 2px 8px rgba(53,127,162,.06);
}

.event-item.sortable-ghost {
    opacity: 0.4;
    background: #f0f0f0;
}

.event-item.sortable-drag {
    opacity: 0.8;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.event-priority {
    background: rgba(53,127,162,.06);
    color: var(--teal);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.78em;
    font-weight: 600;
}

.event-title {
    font-weight: 600;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 5px;
}

.event-time {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.event-message {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    color: #555;
    font-size: 0.9em;
    margin-bottom: 10px;
    font-style: italic;
    max-height: 3.2em;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: max-height 0.3s ease;
}
.event-message::after {
    content: '…  ▼';
    position: absolute;
    bottom: 0;
    right: 0;
    padding: 0 8px 2px 20px;
    background: linear-gradient(90deg, transparent, #f8f9fa 40%);
    font-size: 0.8em;
    color: var(--teal);
    font-style: normal;
}
.event-message.expanded {
    max-height: 500px;
}
.event-message.expanded::after {
    content: '▲';
    position: static;
    display: block;
    text-align: right;
    background: none;
    padding: 4px 0 0;
}

.event-actions {
    display: flex;
    gap: 10px;
}

.event-actions button {
    padding: 6px 12px;
    font-size: 0.85em;
}

.drag-handle {
    color: #999;
    font-size: 1.2em;
    margin-right: 10px;
    cursor: move;
}

/* ===== ŠABLONY ===== */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.template-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.template-card:hover {
    border-color: var(--teal);
    box-shadow: 0 2px 8px rgba(53,127,162,.08);
}

.template-icon {
    width: 40px;
    height: 40px;
    background: rgba(53,127,162,.06);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: var(--teal);
}

.template-icon .lucide {
    width: 20px;
    height: 20px;
}

.template-name {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.template-preview {
    font-size: 0.8em;
    color: var(--text2);
    font-style: italic;
    line-height: 1.4;
}

.templates-list {
    margin-top: 15px;
}

.template-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-item-content {
    flex: 1;
    min-width: 0;
}

/* Inline SVG ikony v dynamicky generovaném obsahu */
.ev-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    color: var(--text3);
    position: relative;
    top: -1px;
}

/* ===== HISTORIE ===== */
.filter-bar {
    display: flex;
    gap: 15px;
    align-items: center;
}

.filter-bar label {
    font-weight: 600;
    color: #333;
}

.history-list {
    margin-top: 10px;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 8px;
    padding: 9px 12px;
    margin-bottom: 5px;
    transition: background 0.15s;
}

.history-item:hover {
    background: #f3f0ff;
    border-color: #c4b5fd;
}

.history-item--skipped {
    background: #fffbf0;
    border-color: #fde68a;
    opacity: 0.9;
}

.history-item--skipped:hover {
    background: #fef9ec;
    border-color: #f59e0b;
}

.history-item--skipped .history-item-icon {
    background: #fef3c7;
    color: #d97706;
}

.history-skipped-reason {
    color: #b45309;
    font-size: 0.84em;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-skipped-reason svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.history-item-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    background: #ede9fe;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal);
    margin-top: 1px;
}

.history-item-icon svg {
    width: 14px;
    height: 14px;
}

.history-item-body {
    flex: 1;
    min-width: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.history-time {
    color: #b0b0b0;
    font-size: 0.78em;
    white-space: nowrap;
    margin-left: 8px;
}

.history-phone {
    font-weight: 600;
    font-size: 0.9em;
    color: #1a1a2e;
}

.history-message {
    color: #555;
    font-style: italic;
    font-size: 0.84em;
    margin-bottom: 3px;
    max-height: 2.8em;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: max-height 0.3s ease;
}
.history-message::after {
    content: '… ▼';
    position: absolute;
    bottom: 0;
    right: 0;
    padding: 0 6px 1px 16px;
    background: linear-gradient(90deg, transparent, white 40%);
    font-size: 0.85em;
    color: var(--teal);
    font-style: normal;
}
.history-message.expanded {
    max-height: 500px;
}
.history-message.expanded::after {
    content: '▲';
    position: static;
    display: block;
    text-align: right;
    background: none;
    padding: 2px 0 0;
}

.history-show-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 6px;
}

.history-count-info {
    font-size: 0.8em;
    color: #aaa;
}

.history-show-more-btns {
    display: flex;
    gap: 5px;
}

.history-show-more-btns button {
    font-size: 0.78em;
    padding: 4px 11px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: white;
    color: var(--teal);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
}

.history-show-more-btns button:hover {
    background: #ede9fe;
    border-color: var(--teal);
}

.hourly-stats {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}

.hour-stat {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 2px solid #ddd;
}

.hour-stat.active {
    background: var(--teal);
    color: white;
    border-color: var(--teal);
}

.hour-label {
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 5px;
}

.hour-count {
    font-size: 1.5em;
    font-weight: 700;
}

/* ===== NASTAVENÍ ===== */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
    cursor: pointer;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: 0.3s;
}

input[type="checkbox"]:checked + .toggle-slider {
    background: var(--teal);
}

input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-label {
    font-weight: 600;
    color: #333;
}

.app-info ul {
    list-style: none;
    padding-left: 0;
}

.app-info li {
    padding: 5px 0;
    color: #555;
}

/* ===== MODÁLY ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.modal-close {
    font-size: 2em;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-content form {
    padding: 25px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ===== KOPÍROVÁNÍ NASTAVENÍ ===== */
.copy-settings-from {
    margin: 0 0 16px;
    color: #555;
}

.copy-settings-fieldset {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 14px;
}

.copy-settings-fieldset legend {
    font-weight: 600;
    font-size: 0.85em;
    color: var(--teal);
    padding: 0 6px;
}

.copy-settings-fieldset label,
.copy-settings-merge label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    font-size: 0.95em;
}

.copy-settings-merge {
    margin-top: 4px;
    color: #555;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.day-checkbox {
    text-align: center;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.day-checkbox:hover {
    background: #e0e0e0;
}

.day-checkbox input:checked + span {
    color: var(--teal);
    font-weight: 700;
}

.day-checkbox input {
    display: none;
}

.day-checkbox span {
    font-size: 0.9em;
}

.time-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* ===== POMOCNÉ TŘÍDY ===== */
.empty-state {
    text-align: center;
    color: #999;
    padding: 30px;
    font-style: italic;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    font-weight: 500;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    font-weight: 500;
}

.active-event-display {
    background: white;
    padding: 14px 16px;
    border-radius: 8px;
    border-left: 3px solid var(--teal);
}

.active-event-name {
    font-size: 1em;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.active-event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.active-event-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78em;
    font-weight: 500;
    color: var(--text2);
    background: var(--bg2);
    border-radius: 5px;
    padding: 3px 8px;
}

.active-event-chip--onetime {
    color: var(--teal);
    background: rgba(53,127,162,.06);
}

.active-event-chip--recurring {
    color: #059669;
    background: #ecfdf5;
}

.active-event-message {
    font-size: 0.85em;
    color: #374151;
    font-style: italic;
    line-height: 1.4;
    padding: 8px 10px;
    background: var(--bg2);
    border-radius: 6px;
    border: 1px solid #f3f4f6;
}

/* ===== RESPONZIVITA ===== */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .top-bar {
        flex-direction: row;
        gap: 8px;
        padding: 0 12px;
    }

    .user-email { display: none; }

    .btn-download-app span { display: none; }
    .btn-download-app { padding: 6px 8px; }

    .tabs-nav {
        transform: translateX(-240px);
        transition: transform 0.3s ease;
        z-index: 300;
    }
    .tabs-nav.sidebar-open { transform: translateX(0); }

    .tabs-content {
        margin-left: 0;
        padding: 16px;
        margin-top: 56px;
    }

    .active-phone-header {
        margin-left: 0;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .card {
        padding: 16px;
    }

    .card-header-flex {
        flex-direction: column;
        gap: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .templates-grid {
        grid-template-columns: 1fr;
    }

    .time-row {
        grid-template-columns: 1fr;
    }

    .days-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .temp-disable-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-content {
        width: 95%;
    }
}

/* ===== TABLET BREAKPOINT ===== */
@media (max-width: 1024px) {
    .tabs-nav { width: 200px; }
    .tabs-content { margin-left: 200px; }
    .active-phone-header { margin-left: 200px; }
    .stat-cards { grid-template-columns: repeat(3, 1fr); }
}

/* ===== PROFIL SELECTOR ===== */
.profile-selector-card {
    max-width: 420px;
}

.profile-selector-custom {
    position: relative;
    user-select: none;
}

.psc-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.psc-selected:hover,
.psc-open .psc-selected {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(53,127,162,.08);
}

.psc-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(53,127,162,.06);
    border-radius: 6px;
    color: var(--teal);
    flex-shrink: 0;
}

.psc-icon .lucide { width: 15px; height: 15px; }

.psc-label {
    flex: 1;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.psc-arrow {
    color: var(--text3);
    display: flex;
    transition: transform 0.15s;
}

.psc-arrow .lucide { width: 16px; height: 16px; }

.psc-open .psc-arrow {
    transform: rotate(180deg);
}

.psc-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 200;
    overflow: hidden;
}

.psc-open .psc-dropdown {
    display: block;
}

.psc-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.psc-option:hover {
    background: #f5f5ff;
}

.psc-option--active {
    background: rgba(53,127,162,.06);
}

.psc-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: rgba(53,127,162,.06);
    border-radius: 6px;
    color: var(--teal);
    flex-shrink: 0;
}

.psc-option-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.psc-option-name {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--text);
}

.psc-option-number {
    font-size: 0.76em;
    color: var(--text3);
}

.psc-lock-btn {
    background: none;
    border: 1px solid var(--border);
    padding: 3px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 5px;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.psc-lock-btn:hover {
    background: var(--bg2);
    border-color: var(--text3);
}

/* ===== TELEFONY/PROFILY ===== */
.phones-list {
    margin-top: 12px;
}

.phone-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 5px;
    transition: all 0.2s;
}

.phone-card:hover {
    border-color: var(--teal);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.phone-card.active {
    border-color: var(--teal);
    background: rgba(53,127,162,.04);
}

.phone-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    position: relative;
}

.phone-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(53,127,162,.06);
    border-radius: 6px;
    color: var(--teal);
    flex-shrink: 0;
}

.phone-icon-deleted {
    background: var(--bg2);
    color: var(--text3);
}

.phone-info {
    flex: 1;
    min-width: 0;
}

.phone-name {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.3;
}

.phone-number {
    color: var(--text2);
    font-size: 0.75em;
}

.phone-deleted-badge {
    font-size: 0.72em;
    font-weight: 500;
    color: var(--text3);
    background: var(--bg2);
    padding: 1px 6px;
    border-radius: 4px;
}

.badge-active {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(53,127,162,.06);
    color: var(--teal);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    border: 1px solid rgba(53,127,162,.15);
}

.phone-lock-hint {
    font-size: 0.7em;
    color: var(--text3);
    padding: 4px 0 0 0;
    border-top: 1px solid #f3f4f6;
    margin-top: 5px;
}

.badge-locked {
    position: absolute;
    top: 0;
    right: 80px;
    background: #FEF2F2;
    color: #DC2626;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    border: 1px solid #FECACA;
}

.phone-stats {
    background: var(--bg2);
    border: 1px solid #f3f4f6;
    padding: 5px 8px;
    border-radius: 5px;
    margin-bottom: 6px;
}

.phone-stats .stat-item {
    margin-bottom: 2px;
    font-size: 0.65em;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #374151;
}

.phone-stats .stat-item:last-child {
    margin-bottom: 0;
}

.phone-stats .stat-label {
    color: var(--text3);
    margin-right: 1px;
    font-size: 1.1em;
}

.phone-stats .stat-value {
    color: #374151;
    font-weight: 500;
    font-size: 1.16em;
}

.phones-deleted-heading {
    font-size: 0.78em;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 20px 0 8px;
}

.phone-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* ===== PŘEKRÝVÁNÍ UDÁLOSTÍ ===== */
.event-overlap {
    border-left: 4px solid #ff9800;
    background: #fff3e0;
}

.overlap-warning {
    background: #fff3cd;
    border-left: 3px solid #ff9800;
    padding: 8px 12px;
    margin: 10px 0;
    border-radius: 5px;
    font-size: 0.9em;
    color: #856404;
}

/* ===== NÁPOVĚDA PRO DATUM KONCE ===== */
.end-date-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    border-radius: 4px;
    font-size: 0.85em;
    color: #166534;
}

.end-date-hint code {
    background: #dcfce7;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: monospace;
}

/* ===== SMS POČÍTADLO ===== */
.sms-count {
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
    padding: 8px 12px;
    margin-top: 8px;
    border-radius: 5px;
    font-size: 0.9em;
    color: #0d47a1;
    font-weight: 600;
}

/* ===== HISTORIE - PROFIL ===== */
.history-profile {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75em;
    color: var(--teal);
    font-weight: 500;
}

.history-profile svg {
    width: 11px;
    height: 11px;
}

/* ===== RESPONZIVITA - DOPLŇKY ===== */
@media (max-width: 768px) {
    .phone-header {
        flex-direction: column;
        text-align: center;
    }
    
    .badge-active {
        position: static;
        display: inline-block;
        margin-top: 10px;
    }
    
    .phone-actions {
        flex-direction: column;
    }
    
    .phone-actions button {
        width: 100%;
    }
}

/* ===== STICKY HEADER - AKTIVNÍ TELEFON ===== */
.active-phone-header {
    background: var(--petrol);
    color: white;
    padding: 10px 28px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(56,201,232,.2);
    margin-left: 240px;
    margin-top: 56px;
    position: sticky;
    top: 56px;
    z-index: 90;
    margin-bottom: 8px;
    border-radius: 8px;
}

.header-label {
    opacity: 0.8;
    font-size: 0.8em;
    font-weight: 400;
}

.header-phone-name {
    font-size: 0.9em;
}

/* ===== LAYOUT SLOUPCE ===== */
@media (min-width: 1024px) {
    .events-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .events-list .event-item {
        margin-bottom: 0;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .events-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .events-list .event-item {
        margin-bottom: 0;
    }
}

.events-list .empty-state {
    grid-column: 1 / -1;
}

/* ===== ČASOVÁ PÁSMA ===== */
.time-slot {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.time-slot-header {
    font-weight: 600;
    color: var(--teal);
    margin-bottom: 10px;
}

.time-slot-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 600px) {
    .time-slot-row {
        grid-template-columns: 1fr;
    }
}

/* ===== VYPRŠENÉ ODPOVĚDI ===== */
.event-expired {
    opacity: 0.5;
}

/* Stavy událostí v seznamu */
.event-state--active {
    border-left: 3px solid var(--teal);
    background: #f5f3ff;
}

.event-state--future {
    opacity: 0.65;
}

.event-state--expired {
    opacity: 0.3;
    filter: grayscale(0.5);
}

/* Stavy bloků v kalendáři */
.cal-event-block--active {
    opacity: 1;
    filter: none;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.6), 0 2px 8px rgba(0,0,0,0.25);
}

.cal-event-block--future {
    opacity: 0.6;
    filter: saturate(0.7);
}

.cal-event-block--expired {
    opacity: 0.25;
    filter: grayscale(0.6);
}

.expired-badge {
    background: #ff9800;
    color: white;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
}

/* ===== EVENTS GRID – levý sloupec (jednorázové + universální) + pravý (kalendář) ===== */
.events-grid-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    align-items: start;
}

.events-col-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.events-col-right {
    /* kalendář se drží nahoře */
}

/* Zachováno pro zpětnou kompatibilitu */
.events-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-top: 20px;
    align-items: start;
}

.events-list-vertical {
    min-height: 200px;
}

.events-list-vertical .event-item {
    margin-bottom: 15px;
}

@media (max-width: 900px) {
    .events-grid {
        grid-template-columns: 1fr;
    }
    .events-grid-layout {
        grid-template-columns: 1fr;
    }
    /* Kalendář (pravý sloupec) nad jednorázovými (levý sloupec) na mobilu */
    .events-col-right {
        order: -1;
    }
}

/* ===== TOGGLE SWITCH AUTO-SAVE ===== */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    user-select: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 26px;
    transition: background 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input {
    display: none;
}

.toggle-switch input:checked + .toggle-slider {
    background: #4caf50;
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(24px);
}

.toggle-label {
    font-weight: 500;
}

/* ===== SMAZANÉ TELEFONY ===== */
.phone-deleted {
    opacity: 0.65;
    border-style: dashed;
}

/* ===== COLOR PICKER ===== */

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.1s, border-color 0.1s;
    display: inline-block;
}

.color-swatch:hover {
    transform: scale(1.2);
}

.color-swatch.selected {
    border-color: #333;
    transform: scale(1.15);
    box-shadow: 0 0 0 2px white, 0 0 0 4px #333;
}

.color-custom-input {
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: none;
}

/* ===== VIEW TOGGLE ===== */

.view-toggle {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.view-toggle-btn {
    padding: 5px 12px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 0.82em;
    color: #555;
    transition: background 0.15s, color 0.15s;
}

.view-toggle-btn:hover {
    background: #f0f0f5;
}

.view-toggle-btn.active {
    background: var(--teal);
    color: white;
    font-weight: 600;
}

/* Nápověda v kalendáři */
.cal-hint {
    font-size: 0.78em;
    color: #999;
    margin: 8px 0 4px;
    font-style: italic;
}

/* ===== KONTEXTOVÉ MENU KALENDÁŘE ===== */

.cal-context-menu {
    position: fixed;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    overflow: hidden;
    min-width: 150px;
}

.cal-context-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 0.9em;
    color: #333;
    transition: background 0.1s;
}

.cal-context-menu button:hover {
    background: #f5f5ff;
}

#calCtxDelete {
    border-top: 1px solid #eee;
    color: #e53935;
}

#calCtxDelete:hover {
    background: #fff5f5;
}

.cal-new-event-label {
    padding: 7px 16px 4px;
    font-size: 0.78em;
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    pointer-events: none;
}

/* ===== TÝDENNÍ KALENDÁŘ ===== */

#weekCalendar {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
    margin-top: 15px;
    border-radius: 8px;
}

.cal-grid {
    display: flex;
    min-width: 520px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: clip;
    user-select: none;
}

.cal-time-col {
    width: 48px;
    flex-shrink: 0;
    border-right: 1px solid #e0e0e0;
    background: #fafafa;
}

.cal-day-col {
    flex: 1;
    border-right: 1px solid #e0e0e0;
    min-width: 60px;
}

.cal-day-col:last-child {
    border-right: none;
}

.cal-header-cell {
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85em;
    background: #f0f0f5;
    border-bottom: 2px solid #d0d0e0;
    color: #444;
    position: sticky;
    top: 0;
    z-index: 10;
}

.cal-day-body {
    position: relative;
    overflow: hidden;
}

.cal-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid #f0f0f0;
    pointer-events: none;
}

.cal-hour-line:nth-child(even) {
    border-top-color: #e8e8ee;
}

.cal-hour-label {
    position: absolute;
    right: 3px;
    font-size: 0.65em;
    color: #aaa;
    transform: translateY(-50%);
    white-space: nowrap;
    pointer-events: none;
}

.cal-event-block {
    /* !important + inline position v app.js: obrana proti CSS injektovanému rozšířeními
       prohlížeče, které blokům přebíjelo position na relative → bloky se skládaly pod sebe
       (posun o výšku předchozích, přetečení pod půlnoc = "neviditelné" události). */
    position: absolute !important;
    left: 2px;
    right: 2px;
    border-radius: 5px;
    cursor: grab;
    overflow: hidden;
    z-index: 2;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: box-shadow 0.1s;
    display: flex;
    flex-direction: column;
}

.cal-event-block:hover {
    z-index: 3;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.cal-event-block.cal-dragging {
    cursor: grabbing;
    z-index: 10;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    opacity: 0.9;
}

.cal-event-label {
    flex: 1;
    padding: 3px 5px;
    font-size: 0.68em;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    line-height: 1.3;
    overflow: hidden;
    cursor: grab;
}

.cal-event-label strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-message-preview {
    display: block;
    margin-top: 3px;
    font-size: 0.85em;
    opacity: 0.85;
    font-style: italic;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

/* ===== TOOLTIP BUBLINA ===== */
.cal-tooltip {
    position: absolute;
    z-index: 9999;
    background: #1e1e2e;
    color: #f0f0f5;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85em;
    max-width: 260px;
    line-height: 1.5;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    pointer-events: none;
    white-space: pre-wrap;
}


.cal-resize-handle {
    width: 100%;
    height: 8px;
    cursor: ns-resize;
    flex-shrink: 0;
    z-index: 4;
}

.cal-resize-handle[data-handle="top"] {
    background: linear-gradient(rgba(255,255,255,0.25), transparent);
}

.cal-resize-handle[data-handle="bottom"] {
    background: linear-gradient(transparent, rgba(0,0,0,0.2));
}

/* Drag ghost */
.cal-drag-ghost {
    cursor: grabbing !important;
}

/* Zvýraznění cílového dne při přetahování */
.cal-day-col.cal-day-drop-target .cal-day-body {
    background: rgba(79, 70, 229, 0.06);
}

.cal-day-col.cal-day-drop-target .cal-header-cell {
    background: var(--teal);
    color: white;
}

/* Legenda */
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82em;
    color: #555;
}

.cal-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Navigace týdnů */
.cal-week-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 4px;
    flex-wrap: wrap;
}

.cal-week-label {
    font-size: 0.9em;
    font-weight: 600;
    color: #444;
    min-width: 130px;
    text-align: center;
}

.cal-calendar-wrapper {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.cal-calendar-wrapper #weekCalendar {
    flex: 1;
    min-width: 0;
}

.cal-zoom-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
}

.cal-zoom-label {
    font-size: 0.72em;
    color: #999;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    letter-spacing: 0.03em;
    user-select: none;
}

#calZoomSlider {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 28px;
    height: 160px;
    cursor: pointer;
    accent-color: var(--teal);
    flex: 1;
}

/* Záhlaví sloupce – datum pod dnem */
.cal-header-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.cal-header-date {
    font-size: 0.75em;
    color: #888;
    font-weight: 400;
}

/* Dnešní sloupec */
.cal-today .cal-header-cell {
    color: #1976D2;
    font-weight: 700;
}

.cal-today .cal-day-body {
    background: rgba(25, 118, 210, 0.04);
}

/* Odznak typu události v bloku */
.cal-onetime-badge {
    font-size: 0.7em;
    margin-right: 2px;
    vertical-align: middle;
}

/* Opakovaná událost – plný blok se svislým pruhem vlevo */
.cal-event-block--recurring {
    border-left: 4px solid rgba(255,255,255,0.55);
    border-radius: 5px;
}

/* Jednorázová událost – přerušovaný okraj, zaoblené rohy */
.cal-event-block--onetime {
    border: 2px dashed rgba(255,255,255,0.7);
    border-radius: 10px;
    box-sizing: border-box;
}

/* Vizuální klíč typů událostí v legendě */
.cal-legend-separator {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: #ddd;
    margin: 0 4px;
    vertical-align: middle;
}

.cal-legend-type-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82em;
    color: #555;
}

.cal-legend-type-block {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 20px;
    font-size: 0.8em;
    color: white;
}

.cal-legend-type-recurring {
    background: #6b7280;
    border-left: 4px solid rgba(255,255,255,0.55);
    border-radius: 5px;
}

.cal-legend-type-onetime {
    background: #6b7280;
    border: 2px dashed rgba(255,255,255,0.7);
    border-radius: 10px;
    box-sizing: border-box;
}

.cal-legend-type-label {
    color: #666;
}

/* Jednorázové položky v legendě */
.cal-legend-onetime {
    font-style: italic;
}

/* ===== NASTAVENÍ – DVOUSLOUPCOVÝ LAYOUT ===== */
.settings-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0 20px;
    align-items: start;
}

.settings-col-main {
    min-width: 0;
}

.settings-col-side {
    position: sticky;
    top: 10px;
}

@media (max-width: 800px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }
    .settings-col-side {
        position: static;
        order: -1; /* Na mobilu nahoru */
    }
}

/* ===== BANNER PŘEPÍNÁNÍ ÚČTU ===== */
.account-switch-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 8px 16px;
    margin: 0 0 10px 0;
    font-size: 0.88em;
    color: #2d6d8a;
    gap: 10px;
}

.asb-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.asb-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ===== SPRÁVA PŘÍSTUPŮ ===== */
.add-user-form {
    margin-top: 12px;
}

.add-user-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.add-user-row .form-input {
    flex: 1;
}

.allowed-users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.allowed-user-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}

.aui-name {
    font-weight: 600;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aui-email {
    font-size: 0.8em;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aui-profiles {
    font-size: 0.78em;
    color: var(--text-secondary);
}

.aui-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

/* ===== MODAL PŘEPÍNÁNÍ ÚČTU ===== */
.account-switch-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.acct-switch-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.acct-switch-item:hover {
    background: var(--bg2);
}

.acct-switch-item.acct-switch-active {
    border-color: var(--teal);
    background: rgba(53,127,162,.06);
}

.acct-switch-item .lucide {
    width: 20px;
    height: 20px;
    color: var(--teal);
    flex-shrink: 0;
}

.acct-name {
    font-weight: 600;
    font-size: 0.9em;
}

.acct-email {
    font-size: 0.8em;
    color: var(--text-secondary);
}

.acct-badge {
    margin-left: auto;
    font-size: 0.75em;
    background: var(--teal);
    color: #fff;
    border-radius: 20px;
    padding: 2px 8px;
}

/* ===== MODAL NASTAVENÍ PŘÍSTUPU ===== */
.user-access-profile-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}

.access-profile-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    cursor: pointer;
    padding: 4px 2px;
}

.access-profile-item input[type=checkbox] {
    width: 16px;
    height: 16px;
}

.modal-content.modal-sm {
    max-width: 440px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
}

/* ===== DIAGNOSTIKA ===== */
.diag-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.diag-stat {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    text-align: center;
    min-width: 80px;
}
.diag-stat-warn {
    background: #fff7ed;
    border-color: #fed7aa;
}
.diag-stat-val {
    display: block;
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text);
}
.diag-stat-warn .diag-stat-val { color: #c2410c; }
.diag-stat-lbl {
    font-size: 0.72em;
    color: var(--text2);
}
.diag-row {
    display: grid;
    grid-template-columns: 160px 140px 1fr;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 0.82em;
    border-bottom: 1px solid #f3f4f6;
}
.diag-row:hover { background: var(--bg2); }
.diag-row-watchdog { background: #fff7ed; }
.diag-row-watchdog:hover { background: #ffedd5; }
.diag-row-stopped { background: #fef2f2; }
.diag-time { color: var(--text2); font-size: 0.9em; }
.diag-profile { color: #374151; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diag-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: 600;
}
.diag-started { background: #dcfce7; color: #15803d; }
.diag-stopped { background: #fee2e2; color: #dc2626; }
.diag-watchdog { background: #ffedd5; color: #c2410c; }
.diag-trigger { color: var(--text3); font-size: 0.88em; }

/* ===== MULTI-DATE PICKER ===== */
.modal-content-sm { max-width: 380px; }
.multi-date-picker { padding: 0 4px; }
.mdc-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.mdc-month-label { font-weight: 600; font-size: 1em; }
.mdc-grid { user-select: none; }
.mdc-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.78em;
    color: var(--text2);
    font-weight: 600;
    margin-bottom: 4px;
}
.mdc-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}
.mdc-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.15s;
}
.mdc-cell:hover { background: #e5e7eb; }
.mdc-cell.mdc-today { font-weight: 700; color: var(--primary, var(--teal)); }
.mdc-cell.mdc-selected { background: var(--primary, var(--teal)); color: #fff; }
.mdc-cell.mdc-selected:hover { background: #2d6d8a; }
.mdc-cell.mdc-empty { cursor: default; }
.mdc-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 28px;
    margin: 10px 0 4px;
    padding: 4px 0;
    border-top: 1px solid #e5e7eb;
}
.mdc-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(53,127,162,.08);
    color: #1e40af;
    border-radius: 12px;
    padding: 2px 8px 2px 10px;
    font-size: 0.8em;
}
.mdc-chip button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    line-height: 1;
    color: #1e40af;
    padding: 0;
}
.mdc-multi-info {
    font-size: 0.82em;
    color: var(--text2);
    margin-top: 4px;
}

/* ===== SPIN ANIMATION ===== */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }
.btn.loading { opacity: 0.6; pointer-events: none; }
.btn.loading svg, .btn.loading i { animation: spin 0.8s linear infinite; }

/* ===== HISTORY FILTERS ===== */
.filter-bar-sub {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin-top: 10px; padding-top: 10px; border-top: 1px solid #f3f4f6;
}
.filter-bar-sub .form-input-sm { max-width: 160px; padding: 6px 10px; font-size: 0.85rem; }
.hist-day-checks { display: flex; gap: 4px; flex-wrap: wrap; }
.day-check-sm {
    display: flex; align-items: center; gap: 3px; font-size: 0.8rem;
    padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px;
    cursor: pointer; user-select: none;
}
.day-check-sm:has(input:checked) { background: rgba(53,127,162,.08); border-color: #93c5fd; }
.day-check-sm input { display: none; }

/* ===== CALL STATS ===== */
.call-stats-summary {
    display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.call-stat-box {
    flex: 1; min-width: 100px; text-align: center; padding: 14px 10px;
    border-radius: 10px; background: var(--bg2); border: 1px solid var(--border);
}
.call-stat-val { font-size: 1.4rem; font-weight: 700; }
.call-stat-val small { font-size: 0.75rem; font-weight: 500; opacity: .7; }
.call-stat-lbl { font-size: 0.78rem; color: var(--text2); margin-top: 2px; }
.call-stat-answered .call-stat-val { color: #16a34a; }
.call-stat-missed .call-stat-val { color: #dc2626; }

.call-hourly-chart {
    display: flex; gap: 2px; align-items: flex-end; height: 120px; margin-bottom: 8px;
    padding: 0 2px;
}
.call-hour-col {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    opacity: 0.35;
}
.call-hour-col.active { opacity: 1; }
.call-hour-bars {
    display: flex; gap: 1px; align-items: flex-end; width: 100%; height: 90px;
}
.call-bar {
    flex: 1; border-radius: 2px 2px 0 0; min-height: 0; transition: height .2s;
}
.call-bar-answered { background: #22c55e; }
.call-bar-missed { background: #ef4444; }
.call-hour-label { font-size: 0.6rem; color: var(--text3); margin-top: 2px; }
.call-hour-count { font-size: 0.6rem; color: #374151; font-weight: 600; }

.call-legend {
    display: flex; gap: 16px; justify-content: center; font-size: 0.78rem; color: var(--text2);
}
.call-legend-item { display: flex; align-items: center; gap: 5px; }
.call-dot { width: 10px; height: 10px; border-radius: 2px; }
.call-dot-answered { background: #22c55e; }
.call-dot-missed { background: #ef4444; }

/* ===== LANGUAGE SWITCHER (app) ===== */
.lang-switcher { display: flex; gap: 3px; }
.lang-switcher-login {
    display: flex; gap: 6px; justify-content: center; margin-top: 12px;
}
.lang-switcher-app { margin-right: 8px; }
.lang-btn {
    background: rgba(255,255,255,.15);
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    color: rgba(255,255,255,.6);
    transition: all .15s;
}
.lang-btn:hover { background: rgba(255,255,255,.25); color: #fff; }
.lang-btn.active { background: var(--accent); color: var(--petrol-deep); }

/* ===== OPT-OUT ===== */
.optout-layout {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start;
}
.optout-col-left { display: flex; flex-direction: column; gap: 12px; }
.optout-col-right { display: flex; flex-direction: column; gap: 12px; }

.optout-status-banner {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    border-radius: 8px; margin-bottom: 12px; font-size: 0.82rem; font-weight: 500;
}
.optout-status-banner.active { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.optout-status-banner.inactive { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.optout-status-banner .status-icon { font-size: 1.1rem; }

.optout-preview {
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
    padding: 10px 12px; font-size: 0.8rem; color: #334155; line-height: 1.4;
    white-space: pre-wrap;
}

.optout-blocklist { max-height: 400px; overflow-y: auto; }
.optout-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #f3f4f6; font-size: 0.8rem; }
.optout-phone { font-weight: 600; flex: 1; }
.optout-date { color: var(--text2); font-size: 0.75rem; }
.optout-expiry { color: var(--text3); font-size: 0.72rem; }

/* Compact cards for optout */
.optout-layout .card-compact { padding: 16px 18px; }
.optout-layout .card-compact h3 { font-size: 0.88rem; margin-bottom: 8px; }
.optout-layout .card-compact .card-description { font-size: 0.78rem; margin-bottom: 8px; }
.optout-layout .form-group { margin-bottom: 8px; }
.optout-layout .form-input-sm { padding: 6px 10px; font-size: 0.82rem; }

@media (max-width: 768px) {
    .optout-layout { grid-template-columns: 1fr; }
}

/* ===== SUBSCRIPTION TOP BAR ===== */
.sub-top-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.08);
    cursor: pointer;
}
.sub-top-bar:hover { background: rgba(255,255,255,.12); }
.sub-top-badge {
    padding: 1px 6px; border-radius: 3px; font-weight: 600; font-size: 0.68rem;
    white-space: nowrap;
}
.sub-top-badge.trial { background: var(--warning); color: var(--petrol-deep); }
.sub-top-badge.active { background: var(--success); color: #fff; }
.sub-top-badge.expired { background: var(--error); color: #fff; }
.sub-top-badge.grace { background: var(--warning); color: var(--petrol-deep); }
.sub-top-days { color: rgba(255,255,255,0.6); white-space: nowrap; }
.upgrade-plans-list { display: flex; flex-direction: column; gap: 10px; }
.upgrade-plan-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 12px; background: var(--card-bg); transition: border-color .15s; }
.upgrade-plan-card:hover { border-color: #93c5fd; }
.upgrade-plan-card.current { border-color: var(--success); background: var(--success-bg); }
.upgrade-plan-card h4 { margin: 0 0 6px; }
.upgrade-plan-options { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.upgrade-plan-option { padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 0.85rem; text-align: center; min-width: 100px; flex: 1; transition: all .15s; }
.upgrade-plan-option:hover { border-color: var(--petrol); background: rgba(26,107,124,0.04); transform: translateY(-1px); }
.upgrade-plan-option .price { font-weight: 700; font-size: 1rem; color: var(--petrol); }
.upgrade-plan-option .price-eur { font-size: 0.7rem; color: var(--text2); }
.upgrade-plan-option .period { color: var(--text2); font-size: 0.78rem; }
.upgrade-plan-option .discount { color: #16a34a; font-size: 0.75rem; font-weight: 600; }
.upgrade-plan-option .btn { white-space: nowrap; }
@media (max-width: 640px) {
    .upgrade-plan-options { gap: 6px; }
    .upgrade-plan-option { min-width: 80px; padding: 6px 8px; font-size: 0.78rem; }
    .upgrade-plan-option .price { font-size: 0.9rem; }
    .upgrade-plan-card h4 { font-size: 0.9rem; }
    .upgrade-plan-card > div:first-child { flex-direction: column; gap: 4px; }
}

/* ===== CONTEXTUAL HELP ===== */
.help-trigger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%; background: rgba(26,107,124,0.08); color: var(--petrol);
    font-size: 11px; font-weight: 700; cursor: pointer; border: none;
    margin-left: 8px; vertical-align: middle; transition: .2s;
    line-height: 1;
}
.help-trigger:hover { background: var(--petrol); color: #fff; }
.help-panel {
    display: none; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 16px; margin: 8px 0 12px; font-size: 0.82rem; line-height: 1.6;
    color: #374151;
}
.help-panel.visible { display: block; }
.help-panel h4 { font-size: 0.85rem; font-weight: 600; margin: 0 0 6px; color: var(--petrol); }
.help-panel ul { margin: 4px 0; padding-left: 18px; }
.help-panel li { margin-bottom: 3px; }

/* ===== SIDEBAR MOBILE ===== */
@media (max-width: 768px) {
    .tabs-nav {
        transform: translateX(-240px);
        transition: transform 0.3s ease;
        z-index: 300;
    }
    .tabs-nav.sidebar-open { transform: translateX(0); }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 299;
    }
    .sidebar-overlay.open { display: block; }
    .tabs-content { margin-left: 0; padding: 20px 16px; }
    .active-phone-header { margin-left: 0; }
    .top-bar .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: rgba(255,255,255,.1);
        border: none;
        border-radius: var(--radius-sm);
        color: #fff;
        font-size: 18px;
        cursor: pointer;
    }
}
@media (min-width: 769px) {
    .top-bar .hamburger-btn { display: none; }
    .sidebar-overlay { display: none !important; }
}

/* ===== COMPLETE MOBILE FIXES ===== */
@media (max-width: 768px) {
    .settings-layout { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .stat-cards { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
    .stat-card { padding: 16px 10px; }
    .stat-value { font-size: 1.6rem; }
    .predefined-templates { grid-template-columns: repeat(2, 1fr); }
    .upgrade-plan-options { flex-direction: column; }
    .upgrade-plan-option { min-width: auto; }
    .history-header { flex-direction: column; align-items: flex-start; gap: 4px; }
}

@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr; }
    .predefined-templates { grid-template-columns: 1fr; }
    .page-title { font-size: 1.2rem; }
    .tabs-content { padding: 12px; }
}

/* ===== FINAL MOBILE OVERRIDE (highest priority) ===== */
@media (max-width: 768px) {
    /* GLOBÁLNÍ: zabránit jakémukoli přetečení */
    html, body { max-width: 100vw !important; overflow-x: hidden !important; }
    *, *::before, *::after { box-sizing: border-box !important; }
    body { word-break: break-word; }
    .app-container { max-width: 100vw !important; overflow-x: hidden !important; }

    /* Flex/grid potomci: povolit zmenšení */
    .top-bar > *, .user-info > *, .tabs-content > *,
    .card > *, .event-item > *, .history-item > *,
    .events-grid-layout > *, .events-grid > *,
    .stat-cards > *, .upgrade-plan-options > * { min-width: 0 !important; }

    /* LAYOUT: sidebar skrytý, obsah full width */
    .tabs-content { margin-left: 0 !important; margin-top: 56px; padding: 12px !important; max-width: 100vw !important; overflow-x: hidden !important; }
    .tab-pane { max-width: 100% !important; overflow-x: hidden !important; }
    .active-phone-header { margin-left: 0 !important; margin-top: 56px; }
    .tabs-nav { transform: translateX(-240px); position: fixed; top: 56px; left: 0; bottom: 0; width: 240px; z-index: 300; transition: transform 0.3s ease; }
    .tabs-nav.sidebar-open { transform: translateX(0); }

    /* TOPBAR: kompaktní, nic nepřetéká */
    .top-bar { flex-direction: row !important; gap: 4px !important; padding: 0 8px !important; height: 56px; overflow: hidden !important; }
    .logo { flex-shrink: 0; }
    .logo h1 { font-size: 14px !important; }
    .user-info { flex: 1; justify-content: flex-end; gap: 4px !important; overflow: hidden !important; }
    .user-email { display: none !important; }
    .icon-sm { display: none !important; }
    .btn-download-app span { display: none !important; }
    .btn-download-app { padding: 4px 6px !important; }
    .sub-top-bar { display: none !important; }
    .btn-logout { padding: 4px 6px !important; }
    .btn-logout span { display: none !important; }
    .lang-btn { padding: 2px 6px !important; font-size: 0.65rem !important; }

    /* KARTY a obsah */
    .card { padding: 12px !important; max-width: 100% !important; overflow: visible !important; }
    .card:not(.profile-selector-card) { overflow: hidden !important; }
    .profile-selector-card { overflow: visible !important; }
    .page-title { font-size: 1.2rem !important; margin-bottom: 12px; }

    /* GRIDY: pod sebe */
    .settings-layout { grid-template-columns: 1fr !important; }
    .settings-grid { grid-template-columns: 1fr !important; }
    .events-grid-layout { grid-template-columns: 1fr !important; }
    .events-grid { grid-template-columns: 1fr !important; }
    .stat-cards { grid-template-columns: repeat(3, 1fr) !important; gap: 6px !important; }
    .stat-card { padding: 10px 6px !important; }
    .stat-value { font-size: 1.3rem !important; }
    .stat-label { font-size: 0.6rem !important; }
    .predefined-templates { grid-template-columns: repeat(2, 1fr) !important; }

    /* KALENDÁŘ: horizontálně scrollovatelný uvnitř kontejneru */
    .cal-calendar-wrapper { overflow-x: auto !important; -webkit-overflow-scrolling: touch; max-width: 100% !important; }
    .cal-grid { min-width: 500px; }
    .cal-header-cell { padding: 3px 1px !important; font-size: 0.6rem !important; }
    .cal-hour-label { font-size: 0.55rem !important; width: 24px !important; min-width: 24px !important; }
    .cal-time-col { width: 24px !important; min-width: 24px !important; }
    .cal-day-col { min-width: 0 !important; }
    .cal-event-label { font-size: 0.5rem !important; overflow: hidden !important; }
    .cal-event-block { min-height: 14px !important; overflow: hidden !important; }
    .cal-week-nav { font-size: 0.7rem !important; flex-wrap: wrap; gap: 4px; }
    .cal-week-nav button { padding: 3px 6px !important; font-size: 0.7rem !important; }
    .cal-legend { font-size: 0.65rem !important; flex-wrap: wrap; gap: 3px; }
    .cal-zoom-control { font-size: 0.65rem !important; }
    /* Karta s kalendářem musí povolit scroll */
    .events-col-right .card { overflow-x: auto !important; overflow-y: visible !important; }

    /* UDÁLOSTI: vejít se do šířky */
    .event-item { max-width: 100% !important; overflow: hidden !important; }
    .event-actions { flex-wrap: wrap !important; gap: 4px !important; }
    .event-actions .btn { font-size: 0.7rem !important; padding: 4px 6px !important; }
    .event-title { font-size: 0.85rem !important; overflow: hidden; text-overflow: ellipsis; }
    .event-time { font-size: 0.75rem !important; }
    .event-message { font-size: 0.75rem !important; }

    /* UPGRADE plány */
    .upgrade-plan-options { flex-direction: column !important; }
    .upgrade-plan-option { min-width: auto !important; }
    .upgrade-plan-card h4 { font-size: 0.85rem !important; }

    /* HISTORIE */
    .history-header { flex-direction: column !important; align-items: flex-start !important; gap: 4px; }
    .history-item { max-width: 100% !important; overflow: hidden !important; }
    .history-item-icon { display: none !important; }
    .history-phone { font-size: 0.85rem !important; }
    .history-message { font-size: 0.75rem !important; }

    /* FORMULÁŘE */
    .form-group { margin-bottom: 10px; }
    .inline-form { flex-direction: column !important; }
    .form-input, input, select, textarea { font-size: 16px !important; } /* zabrání zoomu na iOS */

    /* TABULKY */
    table { font-size: 0.75rem !important; max-width: 100% !important; display: block; overflow-x: auto; }
    table th, table td { padding: 4px 6px !important; white-space: nowrap; }

    /* MODALY */
    .modal-content { margin: 4px !important; max-height: 95vh; max-width: calc(100vw - 8px) !important; }

    /* PROFIL selector */
    .psc-selected { padding: 8px !important; }
    .psc-label { font-size: 0.8rem !important; }
    .psc-dropdown { z-index: 500; max-width: 100% !important; }

    /* DOKUMENTY */
    .legal-content { font-size: 0.85rem !important; overflow-wrap: break-word; }
}

@media (max-width: 400px) {
    .stat-cards { grid-template-columns: 1fr !important; }
    .predefined-templates { grid-template-columns: 1fr !important; }
    .page-title { font-size: 1rem !important; }
    .tabs-content { padding: 8px !important; }
    .card { padding: 10px !important; }
    .btn { padding: 6px 10px !important; font-size: 0.75rem !important; }
    .top-bar .logo h1 { font-size: 13px !important; }
}

@media (max-width: 400px) {
    .stat-cards { grid-template-columns: 1fr !important; }
    .predefined-templates { grid-template-columns: 1fr !important; }
    .page-title { font-size: 1.1rem; }
    .tabs-content { padding: 10px; }
    .card { padding: 12px; }
    .btn { padding: 8px 14px; font-size: 0.8rem; }
    .top-bar .logo h1 { font-size: 14px; }
    .lang-btn { padding: 2px 6px; font-size: 0.65rem; }
}
