/* ProPsychology – styly aplikace (bez externích závislostí) */
:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --success: #15803d;
  --success-light: #f0fdf4;
  --warning: #b45309;
  --warning-light: #fffbeb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0; font-weight: 700; color: #374151; }
h2 { font-size: 1.1rem; margin: 0 0 1rem; font-weight: 700; color: #374151; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
hr { border: 0; border-top: 1px dashed var(--border-strong); margin: 1.25rem 0; }
code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; }
[hidden] { display: none !important; }

/* Horní lišta */
.topbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.topbar-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; }
.brand img { display: block; height: auto; }
.mainnav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.mainnav > a { padding: .5rem .75rem; color: #4b5563; font-weight: 600; border-bottom: 2px solid transparent; }
.mainnav > a:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--border-strong); }
.mainnav > a.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.usermenu { margin-left: auto; display: flex; align-items: center; gap: .5rem; color: #4b5563; }
.usermenu form { margin: 0; }
.usermenu-name { font-weight: 600; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 6px; font-size: 1.3rem; padding: .2rem .6rem; cursor: pointer; }

/* Hlavička stránky */
.page-header { background: #fff; box-shadow: var(--shadow); }
.page-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 1.1rem; padding-bottom: 1.1rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .95rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb > * + *::before { content: "›"; margin-right: .4rem; color: #9ca3af; }
.breadcrumb > span:last-child { color: var(--text); font-weight: 600; }
.main { padding-top: 1.5rem; padding-bottom: 2rem; }
.footer { color: #9ca3af; font-size: .8rem; padding-bottom: 1.5rem; text-align: center; }

/* Karty */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.5rem; }
.card-flush { padding: 0; overflow: hidden; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-title-row h2 { margin: 0; }

/* Tlačítka */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .55rem 1.05rem; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: #374151; border-color: var(--border-strong); }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: #fff; color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover { background: var(--danger-light); }
.btn-link { background: none; border: 0; color: var(--primary-dark); padding: .3rem .5rem; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.btn-icon { padding: .45rem .75rem; font-size: 1.1rem; }

/* Formuláře */
.field { margin-bottom: 1rem; flex: 1; min-width: 0; }
.field label, fieldset legend { display: block; font-weight: 700; font-size: .88rem; margin-bottom: .35rem; color: #111827; }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--border-strong); border-radius: 8px; background: #f9fafb; font: inherit; font-size: .92rem; color: var(--text);
}
input:focus, select:focus, textarea:focus, .editor-content:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2,132,199,.15); background: #fff; }
input:disabled { background: #f3f4f6; cursor: not-allowed; color: var(--muted); }
input[type=file] { font: inherit; font-size: .9rem; max-width: 100%; }
input[type=file]::file-selector-button { background: var(--primary); color: #fff; border: 0; border-radius: 6px; padding: .45rem .9rem; margin-right: .75rem; cursor: pointer; font-weight: 600; }
textarea { min-height: 110px; resize: vertical; }
.hint { color: var(--muted); font-size: .8rem; margin: .3rem 0 0; }
.field-error { color: var(--danger); font-size: .82rem; margin: .3rem 0 0; }
.has-error input, .has-error select, .has-error textarea, .has-error .tagselect, .has-error .editor { border-color: var(--danger); background: var(--danger-light); }
.has-error > label { color: var(--danger); }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > * { flex: 1 1 240px; }
.form-row-3 > * { flex-basis: 180px; }
.form-row-datetime > .field:first-child { flex: 2 1 200px; }
.form-row-datetime > .field { flex: 1 1 100px; }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.check { display: flex; align-items: flex-start; gap: .5rem; margin: .45rem 0; }
.check input { margin-top: .25rem; width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.check label { font-weight: 500; cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; margin-bottom: 1rem; }
.filter-bar .field { flex: 0 1 200px; margin-bottom: 0; }
.field-button { flex: 0 0 auto !important; }

/* Opakovatelné řádky */
.repeater-row { display: flex; gap: .75rem; align-items: flex-end; padding: .75rem 0; border-bottom: 1px dashed var(--border); }
.repeater-row:last-child { border-bottom: 0; }
.repeater-row .field { margin-bottom: 0; }
.repeater-row .btn-icon { margin-bottom: 1px; }
.field-wide { flex: 4 1 300px; }
.field-narrow { flex: 0 0 110px; }

/* Tabulky */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .7rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table thead th { background: var(--primary); color: #fff; text-transform: uppercase; font-size: .75rem; letter-spacing: .03em; font-weight: 700; }
.table tfoot th { background: #f9fafb; }
.table tbody th { font-weight: 600; }
.table th.num, .table td.num { text-align: right; }
.table-hover tbody tr[data-href] { cursor: pointer; }
.table-hover tbody tr:hover { background: #f9fafb; }
.table-hover tbody tr a { color: inherit; }
.table-details th { width: 32%; color: #374151; background: #fafafa; }
.col-check { width: 40px; }
.col-check input { width: 16px; height: 16px; accent-color: var(--primary); }
.rich p { margin: 0 0 .5rem; }
.rich ul, .rich ol { margin: 0 0 .5rem 1.25rem; padding: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: .15rem 0; }

/* Štítky, uživatel */
.tag { display: inline-block; background: var(--primary-light); color: var(--primary-dark); padding: .15rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 600; margin: 0 .3rem .3rem 0; }
.user-chip { display: inline-flex; align-items: center; gap: .4rem; }
.clinic-logo { max-width: 200px; max-height: 120px; border-radius: 6px; margin-top: .5rem; }

/* Hlášky */
.flash { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 600; font-size: .92rem; border: 1px solid transparent; }
.flash ul { margin: .4rem 0 0 1.2rem; padding: 0; font-weight: 400; }
.flash-success { background: var(--success-light); color: var(--success); border-color: #bbf7d0; }
.flash-error { background: var(--danger-light); color: var(--danger); border-color: #fecaca; }
.flash-info { background: var(--primary-light); color: var(--primary-dark); border-color: #bae6fd; }
.flash-warning { background: var(--warning-light); color: var(--warning); border-color: #fde68a; }
.flash.hide { opacity: 0; transition: opacity .6s; }

/* Záložky */
.tab-list { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tab-list button { background: none; border: 0; border-bottom: 2px solid transparent; padding: .7rem 1rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab-list button:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.tab-list button[aria-selected=true] { color: var(--primary-dark); border-bottom-color: var(--primary); }
.tabs.js .tab-panel { display: none; }
.tabs.js .tab-panel.active { display: block; }

/* Stránkování */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.pagination-info { color: var(--muted); font-size: .85rem; margin: .75rem 0; }
.pagination ul { display: flex; list-style: none; margin: 0; padding: 0; gap: .25rem; }
.pagination li a, .pagination li span { display: inline-block; min-width: 36px; text-align: center; padding: .4rem .65rem; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: #374151; font-weight: 600; font-size: .88rem; }
.pagination li a:hover { background: #f3f4f6; text-decoration: none; }
.pagination li.active span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination li.disabled span { color: #9ca3af; }

/* Vyhledávání klientů */
.client-search { position: relative; margin-bottom: 1rem; }
.search-input { padding: .8rem 1rem !important; font-size: 1rem !important; background: #fff !important; box-shadow: var(--shadow); }
.search-results { position: absolute; left: 0; right: 0; top: 100%; margin: .25rem 0 0; padding: .25rem; list-style: none; background: #fff; border: 1px solid var(--primary); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,.12); max-height: 360px; overflow-y: auto; z-index: 20; }
.search-results li { padding: .55rem .75rem; border-radius: 6px; cursor: pointer; font-size: .92rem; }
.search-results li.active, .search-results li:hover { background: var(--primary); color: #fff; }
.search-results li.empty { color: var(--muted); cursor: default; background: none; }

/* Vícenásobný výběr */
.tagselect { position: relative; border: 1px solid var(--border-strong); border-radius: 8px; background: #f9fafb; padding: .3rem; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; min-height: 44px; cursor: text; }
.tagselect.focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2,132,199,.15); background: #fff; }
.tagselect .chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--primary); color: #fff; border-radius: 6px; padding: .25rem .5rem; font-size: .85rem; max-width: 100%; }
.tagselect .chip.first { background: var(--primary-dark); }
.tagselect .chip button { background: none; border: 0; color: #fff; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .1rem; }
.tagselect input { border: 0 !important; background: transparent !important; box-shadow: none !important; flex: 1; min-width: 160px; padding: .35rem .4rem !important; }
.tagselect .dropdown { position: absolute; left: -1px; right: -1px; top: 100%; margin-top: .25rem; background: #fff; border: 1px solid var(--primary); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,.12); max-height: 280px; overflow-y: auto; z-index: 25; list-style: none; padding: .25rem; }
.tagselect .dropdown li { padding: .45rem .65rem; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.tagselect .dropdown li.active, .tagselect .dropdown li:hover { background: var(--primary); color: #fff; }
.tagselect .dropdown li.empty { color: var(--muted); cursor: default; background: none; }

/* Editor */
.editor { border: 1px solid var(--border-strong); border-radius: 8px; background: #f9fafb; overflow: hidden; }
.editor-toolbar { display: flex; gap: .15rem; padding: .3rem; border-bottom: 1px solid var(--border); background: #f3f4f6; flex-wrap: wrap; }
.editor-toolbar button { background: #fff; border: 1px solid var(--border); border-radius: 5px; min-width: 32px; padding: .2rem .5rem; cursor: pointer; font: inherit; font-size: .88rem; }
.editor-toolbar button:hover { background: var(--primary-light); }
.editor-content { min-height: 110px; padding: .6rem .75rem; background: #fff; font-size: .92rem; border: 0; border-radius: 0; }
.editor-content p { margin: 0 0 .5rem; }
.editor-content ul, .editor-content ol { margin: 0 0 .5rem 1.25rem; padding: 0; }

/* Modální okno */
dialog.modal { border: 0; border-radius: 12px; padding: 0; width: min(640px, 94vw); max-height: 92vh; box-shadow: 0 25px 50px rgba(0,0,0,.25); color: var(--text); }
dialog.modal::backdrop { background: rgba(17,24,39,.45); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; }
.modal-close { background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 1.25rem; overflow-y: auto; max-height: calc(92vh - 140px); }
.modal-footer { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }

/* Akordeon */
details.accordion { border: 1px solid var(--border-strong); border-radius: 8px; margin-bottom: .5rem; }
details.accordion summary { padding: .75rem 1rem; cursor: pointer; font-weight: 600; }
details.accordion[open] summary { border-bottom: 1px solid var(--border); }
details.accordion > :not(summary) { padding: .75rem 1rem; margin: 0; }

/* Import */
.import-result { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border-strong); }
.stats { list-style: none; padding: 0; display: flex; gap: 1.5rem; flex-wrap: wrap; }

/* Přihlášení / chyby */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-logo { margin-bottom: 1.5rem; }
.auth-card { width: 100%; max-width: 440px; }
.auth-title { margin-bottom: 1.25rem; font-size: 1.25rem; }
.auth-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.link { color: var(--primary-dark); }
.error-card { text-align: center; }
.error-code { font-size: 3.5rem; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: .5rem; }
.error-details { text-align: left; font-size: .75rem; background: #111827; color: #e5e7eb; padding: 1rem; border-radius: 8px; overflow: auto; max-height: 400px; }

/* Mobilní zobrazení */
@media (max-width: 960px) {
  .nav-toggle { display: block; }
  .mainnav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: .5rem 1rem 1rem; border-bottom: 1px solid var(--border); box-shadow: 0 10px 20px rgba(0,0,0,.08); }
  .mainnav.open { display: flex; }
  .mainnav > a { border-bottom: 0; border-left: 3px solid transparent; }
  .mainnav > a.active { border-left-color: var(--primary); }
  .usermenu { margin: .5rem 0 0; padding-top: .5rem; border-top: 1px solid var(--border); }
  .table-details th { width: 40%; }
}
@media (max-width: 600px) {
  .card { padding: 1rem; }
  .repeater-row { flex-wrap: wrap; }
  .field-narrow { flex: 1 1 100px; }
  .table th, .table td { padding: .55rem .6rem; }
}
@media print {
  .topbar, .page-header .actions, .footer, .form-actions { display: none; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* Úvodní stránka */
body.home { background: #fff; }
.home-nav { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--border); backdrop-filter: blur(6px); }
.home-nav-inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 1rem; }
.home-nav nav { display: flex; align-items: center; gap: 1.25rem; }
.home-nav nav > a:not(.btn) { color: #4b5563; font-weight: 600; }
.hero { background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 45%, #ffffff 100%); padding: 4rem 0 4.5rem; }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 400px); gap: 3rem; align-items: center; }
.hero-kicker { color: var(--primary-dark); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .82rem; margin: 0 0 .75rem; }
.hero h1 { font-size: clamp(1.8rem, 3.6vw, 2.7rem); line-height: 1.2; color: #0f172a; margin-bottom: 1rem; }
.hero-lead { font-size: 1.1rem; color: #374151; max-width: 40rem; }
.hero-points { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.hero-points li { padding: .3rem 0 .3rem 1.8rem; position: relative; color: #374151; }
.hero-points li::before { content: "✓"; position: absolute; left: 0; color: #fff; background: var(--primary); width: 1.25rem; height: 1.25rem; border-radius: 50%; font-size: .75rem; display: flex; align-items: center; justify-content: center; top: .45rem; }
.hero-login { margin: 0; box-shadow: 0 20px 40px rgba(2,132,199,.12), 0 2px 6px rgba(0,0,0,.05); scroll-margin-top: 90px; }
.hero-login h2 { font-size: 1.25rem; }
.hero-forgot { text-align: center; margin: .9rem 0 0; font-size: .9rem; }
.btn-block { width: 100%; padding-top: .75rem; padding-bottom: .75rem; }
.home-section { padding: 4rem 0; }
.home-section-alt { background: var(--bg); }
.section-title { font-size: 1.6rem; margin-bottom: 1.75rem; color: #0f172a; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 960px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .feature-grid { grid-template-columns: 1fr; } }
.feature { margin: 0; border: 1px solid var(--border); box-shadow: none; transition: box-shadow .2s, transform .2s; }
.feature:hover { box-shadow: 0 10px 25px rgba(0,0,0,.08); transform: translateY(-2px); }
.feature-icon { font-size: 1.8rem; width: 3rem; height: 3rem; display: flex; align-items: center; justify-content: center; background: var(--primary-light); border-radius: 12px; margin-bottom: .75rem; }
.feature h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.feature p { margin: 0; color: #4b5563; font-size: .93rem; }
.two-col { display: grid; grid-template-columns: 1fr 1.2fr; gap: 3rem; align-items: start; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { background: #fff; border-radius: 10px; padding: .9rem 1rem .9rem 2.8rem; margin-bottom: .75rem; position: relative; box-shadow: var(--shadow); }
.check-list li::before { content: "🔒"; position: absolute; left: 1rem; top: .85rem; }
.cta { text-align: center; }
.cta h2 { font-size: 1.6rem; color: #0f172a; margin-bottom: .5rem; }
.home-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; color: var(--muted); font-size: .88rem; text-align: center; }
@media (max-width: 860px) {
  .hero { padding: 2.5rem 0 3rem; }
  .hero-inner, .two-col { grid-template-columns: 1fr; gap: 2rem; }
  .home-nav nav > a:not(.btn) { display: none; }
}
