/* Plánování léčby (záložka Léčebný plán) a editor léčebného plánu.
   Časová osa: velká oranžová čísla kroků na svislé čáře, žluté karty kroků. */

:root {
    --pl-orange: #f76707;
    --pl-orange-soft: #ffd8a8;
    --pl-yellow: #fff9db;
    --pl-yellow-line: #ffe58f;
    --pl-yellow-strong: #f59f00;
}

.pl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.pl-views { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px; background: var(--md-line-2, #f1f3f7); }
.pl-view-btn { border: 0; background: transparent; color: var(--md-ink-2, #5a6478); padding: 6px 12px; border-radius: 8px; font-size: 14px; display: inline-flex; align-items: center; white-space: nowrap; }
.pl-view-btn:hover { color: var(--md-ink, #101828); }
.pl-view-btn.active { background: var(--md-surface, #fff); color: var(--md-ink, #101828); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.pl-view-count { margin-left: 6px; font-size: 11px; font-weight: 600; background: var(--md-accent-wash, #e5edff); color: var(--md-accent-ink, #1d4ed8); border-radius: 9px; padding: 0 6px; line-height: 18px; }

.pl-plans { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pl-plan-pill { display: flex; flex-direction: column; padding: 6px 12px; border: 1px solid var(--md-line, #e7eaf0); border-radius: 10px; color: var(--md-ink, #101828); text-decoration: none; background: var(--md-surface, #fff); }
.pl-plan-pill small { color: var(--md-ink-2, #5a6478); }
.pl-plan-pill:hover { border-color: var(--pl-yellow-strong); text-decoration: none; }
.pl-plan-pill.active { border-color: var(--pl-orange); box-shadow: 0 0 0 2px rgba(247, 103, 7, .15); font-weight: 600; }

/* Vytvořené plány: kříž, fotka, součty */
.pl-overview { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(170px, .65fr) minmax(240px, 1fr); gap: 16px; align-items: start; }
.pl-box { border: 1px solid var(--md-line, #e7eaf0); border-radius: 12px; padding: 14px; background: var(--md-surface, #fff); min-width: 0; }
.pl-box-title { font-weight: 600; margin-bottom: 8px; }
.pl-tc .tc-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pl-tc .tc-canvas svg { width: 100%; height: auto; display: block; }
.pl-tc .tc-under { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 6px; }
.pl-photo-empty { height: 150px; border: 2px dashed var(--md-line, #e7eaf0); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--md-ink-3, #98a1b3); font-size: 13px; }
.pl-photo-empty .ti { font-size: 28px; }
.pl-photo-img { width: 100%; height: 150px; object-fit: cover; border-radius: 10px; display: block; }
.pl-approved { margin-top: 10px; font-size: 13px; color: var(--md-ink-2, #5a6478); }
.pl-approved strong { color: var(--md-ink, #101828); }

.pl-sums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pl-sum { display: flex; flex-direction: column; min-width: 0; }
.pl-sum span { font-size: 12px; color: var(--md-ink-2, #5a6478); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sum strong { font-size: 15px; white-space: nowrap; }
.pl-sum small { font-size: 11px; color: var(--md-ink-3, #98a1b3); }
.pl-sum--profit strong { color: var(--md-ok, #15803d); }
.pl-box--totals .pl-sums { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }

/* Hlavička plánu */
.pl-plan-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 22px 0 14px; }
.pl-plan-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pl-plan-name { font-size: 19px; font-weight: 700; margin: 0; }
.pl-rename { display: flex; gap: 6px; align-items: center; }
.pl-rename input { min-width: 220px; }
.pl-plan-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pl-tool { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--md-line, #e7eaf0); border-radius: 8px; background: var(--md-surface, #fff); color: var(--md-ink-2, #5a6478); font-size: 17px; padding: 0; text-decoration: none; }
.pl-tool:hover { color: var(--md-ink, #101828); border-color: var(--md-ink-3, #98a1b3); text-decoration: none; }
.pl-tool--add { background: #2fb344; border-color: #2fb344; color: #fff; }
.pl-tool--add:hover { background: #26a03a; color: #fff; border-color: #26a03a; }
.pl-tool--danger { color: var(--md-crit, #b91c1c); }
.pl-tool--danger:hover { background: var(--md-crit-wash, #fee2e2); color: var(--md-crit, #b91c1c); border-color: var(--md-crit-wash, #fee2e2); }
.pl-overview-link { margin-left: 6px; font-weight: 600; white-space: nowrap; }

/* Pracovní plocha: levý panel a časová osa */
.pl-work { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; align-items: start; }
.pl-work--readonly { grid-template-columns: minmax(0, 1fr); }
.pl-panel { position: sticky; top: calc(var(--md-topbar-h, 64px) + 12px); }
.pl-panel-card { border: 1px solid var(--md-line, #e7eaf0); border-radius: 12px; padding: 14px; background: var(--md-surface, #fff); }
.pl-panel-head { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 10px; }
.pl-panel-head select { margin-left: auto; max-width: 62%; }
.pl-panel .form-label { font-size: 12px; margin-bottom: 2px; color: var(--md-ink-2, #5a6478); }
.pl-fs { border-top: 1px solid var(--md-line, #e7eaf0); margin-top: 12px; padding-top: 10px; }
.pl-fs legend { float: none; width: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--md-ink, #101828); }
.pl-fs legend .ti { color: var(--pl-orange); font-size: 16px; }
.pl-checklist { max-height: 170px; overflow: auto; border: 1px solid var(--md-line, #e7eaf0); border-radius: 8px; padding: 6px 8px; margin-top: 6px; font-size: 13px; }
.pl-checklist .form-check { padding-top: 2px; padding-bottom: 2px; }
.pl-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--md-ink-2, #5a6478); background: var(--md-line-2, #f1f3f7); border-radius: 4px; padding: 0 4px; }

.pl-timeline { min-width: 0; }
.pl-step { display: grid; grid-template-columns: 58px minmax(0, 1fr); position: relative; padding-bottom: 18px; }
.pl-rail { position: relative; }
.pl-rail::before { content: ""; position: absolute; left: 50%; top: 8px; bottom: -26px; width: 3px; margin-left: -1.5px; background: var(--pl-orange-soft); border-radius: 2px; }
.pl-num { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 4px auto 0; border-radius: 50%; background: var(--pl-orange); color: #fff; font-size: 20px; font-weight: 700; box-shadow: 0 0 0 4px var(--md-surface, #fff); }
.pl-num-sm { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--pl-orange); color: #fff; font-size: 11px; font-weight: 700; margin-right: 6px; vertical-align: 1px; }
.pl-card { background: var(--pl-yellow); border: 1px solid var(--pl-yellow-line); border-radius: 12px; min-width: 0; transition: box-shadow .15s, border-color .15s; }
.pl-step.is-active .pl-card { border-color: var(--pl-yellow-strong); box-shadow: 0 0 0 3px rgba(245, 159, 0, .22); }
.pl-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--pl-yellow-line); }
.pl-card-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.pl-card-service { font-size: 16px; }
.pl-card-date { color: var(--md-ink-2, #5a6478); font-size: 14px; }
.pl-booked { font-weight: 500; }
.pl-tools { display: flex; gap: 4px; margin-left: auto; }
.pl-card-body { padding: 10px 14px 14px; }
.pl-step.is-collapsed .pl-card-body { display: none; }
.pl-step.is-collapsed .pl-card-head { border-bottom: 0; }
.pl-note { margin-bottom: 8px; }
.pl-note-text { white-space: pre-wrap; margin: 0 0 2px; }
.pl-note-form { margin-top: 6px; }
.pl-empty { color: var(--md-ink-2, #5a6478); font-size: 14px; margin: 4px 0 8px; }
.pl-items { background: var(--md-surface, #fff); border-radius: 8px; overflow: hidden; margin-bottom: 0; }
.pl-items thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .02em; color: var(--md-ink-2, #5a6478); white-space: normal; line-height: 1.2; vertical-align: bottom; }
.pl-items td { font-size: 14px; }
.pl-item-name { min-width: 170px; }
.pl-item-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 3px; }
.pl-item-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--md-ink-2, #5a6478); }
.pl-kind { border-radius: 9px; padding: 0 7px; font-size: 11px; font-weight: 600; }
.pl-kind--phrase { background: #f3e8ff; color: #7c3aed; }
.pl-kind--pricelist { background: var(--md-accent-wash, #e5edff); color: var(--md-accent-ink, #1d4ed8); }
.pl-kind--insurance { background: var(--md-ok-wash, #dcfce7); color: var(--md-ok, #15803d); }
.pl-item--refused .pl-item-name > div:first-child, .pl-item--cancelled .pl-item-name > div:first-child { text-decoration: line-through; color: var(--md-ink-3, #98a1b3); }
.pl-item--done td { color: var(--md-ink-2, #5a6478); }
.pl-item-actions { width: 1%; }
/* Skryté popisky (visually-hidden) jsou absolutně umístěné: bez vlastního
   kontextu by utekly z posuvné tabulky a rozšířily celou stránku na mobilu. */
.pl .table-responsive { position: relative; }
.pl-card .pl-sums { background: var(--md-surface, #fff); border-radius: 8px; padding: 8px 12px; margin-top: 10px; }
.pl-step-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.pl-add-step { display: grid; grid-template-columns: 58px minmax(0, 1fr); }
.pl-add-step-btn { grid-column: 1 / 3; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 0; color: var(--md-ink-2, #5a6478); font-weight: 600; }
.pl-add-step-btn:hover { color: var(--pl-orange); }
.pl-num--add { width: 44px; height: 44px; margin: 0 7px; background: var(--md-surface, #fff); color: var(--pl-orange); border: 2px dashed var(--pl-orange); box-shadow: none; font-size: 18px; }

.pl-orphans { margin-top: 28px; }
.pl-section-title { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.pl-proposal-steps { border: 1px solid var(--md-line, #e7eaf0); border-radius: 8px; padding: 8px 12px; max-height: 260px; overflow: auto; }

@media (max-width: 1199.98px) {
    .pl-work { grid-template-columns: minmax(0, 1fr); }
    .pl-panel { position: static; }
}
@media (max-width: 991.98px) {
    .pl-overview { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .pl-box--chart { grid-column: 1 / -1; }
}
@media (max-width: 575.98px) {
    .pl-overview { grid-template-columns: minmax(0, 1fr); }
    .pl-sums { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 8px; }
    .pl-step, .pl-add-step { grid-template-columns: 40px minmax(0, 1fr); }
    .pl-num { width: 34px; height: 34px; font-size: 16px; }
    .pl-num--add { width: 34px; height: 34px; margin: 0 3px; }
    .pl-card-head { padding: 8px 10px; }
    .pl-card-body { padding: 8px 10px 10px; }
    .pl-plan-tools { margin-left: 0; }
    .pl-rename input { min-width: 0; }
    .pl-panel-head { flex-wrap: wrap; }
    .pl-panel-head select { max-width: 100%; margin-left: 0; }
}

/* Editor léčebného plánu */
.pd-card { overflow: visible; }
.pd-toolbar { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px; border-bottom: 1px solid var(--md-line, #e7eaf0); background: var(--md-surface, #fff); }
.pd-toolbar--2 { background: var(--md-line-2, #f1f3f7); }
.pd-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pd-font { width: 150px; }
.pd-size { width: 110px; }
.pd-menu { max-height: 320px; overflow: auto; }
.pd-mark-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--md-line, #e7eaf0); border-radius: 14px; background: var(--md-surface, #fff); padding: 2px 10px; font-size: 13px; color: var(--md-ink, #101828); }
.pd-mark-btn:hover { border-color: var(--md-ink-3, #98a1b3); }
.pd-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pd-dot-paro { background: #7b8494; }
.pd-dot-endo { background: #2f9e44; }
.pd-dot-implant { background: #f76707; }
.pd-dot-prot { background: #d63939; }
.pd-dot-orto { background: #111; }
.pd-msg { padding: 6px 12px; background: var(--md-accent-wash, #e5edff); color: var(--md-accent-ink, #1d4ed8); font-size: 13px; }
.pd-msg--error { background: var(--md-crit-wash, #fee2e2); color: var(--md-crit, #b91c1c); }
.pd-sheet { background: var(--md-ground, #f7f9fb); padding: 24px; border-radius: 0 0 12px 12px; }
.pd-area { max-width: 820px; min-height: 900px; margin: 0 auto; background: #fff; padding: 56px 64px; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); border-radius: 4px; outline: none; font-size: 14px; line-height: 1.55; color: #111; }
.pd-area:focus { box-shadow: 0 0 0 2px var(--md-accent-wash, #e5edff), 0 1px 3px rgba(16, 24, 40, .12); }
.pd-area .pd-proposal-slot { border: 1px dashed var(--pl-yellow-strong); border-radius: 6px; padding: 4px 8px; background: var(--pl-yellow); }
.pd-chart-source { position: absolute; left: -10000px; top: 0; width: 900px; }
.pd-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; counter-reset: pdstep; }
.pd-steps li { flex: 1; counter-increment: pdstep; padding: 6px 8px; border-bottom: 3px solid var(--md-line, #e7eaf0); color: var(--md-ink-3, #98a1b3); font-weight: 600; font-size: 13px; }
.pd-steps li::before { content: counter(pdstep) ". "; }
.pd-steps li.active { border-color: var(--pl-orange); color: var(--md-ink, #101828); }
.pd-steps li.done { border-color: var(--pl-orange-soft); color: var(--md-ink-2, #5a6478); }

@media (max-width: 575.98px) {
    .pd-sheet { padding: 8px; }
    .pd-area { padding: 20px 16px; min-height: 600px; }
    .pd-font, .pd-size { width: 120px; }
}
