/* Lucy 2 – nové sekce administrace (Osobnost, Prodej, Právní rámec, Stav znalostí, Reporty, Konektory).
   Staví na styles.css (barvy, karty, tlačítka); tady je jen to, co tam chybí. */

/* --- rozložení --- */
.l2-grid { display: grid; gap: 16px; }
.l2-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.l2-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.l2-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .l2-grid--3, .l2-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .l2-grid--2, .l2-grid--3, .l2-grid--4 { grid-template-columns: 1fr; } }
.l2-stack > * + * { margin-top: 16px; }
.l2-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.l2-row--between { justify-content: space-between; }
.l2-grow { flex: 1 1 auto; min-width: 0; }
.l2-help { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.l2-meta { font-size: 12px; color: var(--muted); }

/* --- volba ze tří karet (režim prodeje, úroveň právního rámce) --- */
.l2-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 820px) { .l2-choice { grid-template-columns: 1fr; } }
.l2-choice__opt {
  text-align: left; background: var(--bg-1, #fff); border: 1.5px solid var(--line, #ebe5e0); border-radius: 16px;
  padding: 14px 16px; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, background .15s;
}
.l2-choice__opt:hover { border-color: var(--ink-3, #8a817a); }
.l2-choice__opt.is-active { border-color: var(--ink, #1f1a17); background: var(--lime-50, #fff8e1); }
.l2-choice__title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.l2-choice__desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 6px; }

/* --- posuvník osobnosti --- */
.l2-slider { padding: 10px 0 14px; border-bottom: 1px solid var(--line, #ebe5e0); }
.l2-slider:last-child { border-bottom: 0; padding-bottom: 0; }
.l2-slider__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.l2-slider__name { font-weight: 600; font-size: 13.5px; }
.l2-slider__now { font-size: 12.5px; color: var(--muted); text-align: right; }
.l2-slider__track { display: grid; grid-template-columns: 96px 1fr 96px; gap: 10px; align-items: center; margin-top: 6px; }
.l2-slider__end { font-size: 12px; color: var(--muted); }
.l2-slider__end:last-child { text-align: right; }
.l2-slider input[type=range] { width: 100%; accent-color: var(--ink, #1f1a17); }
@media (max-width: 560px) { .l2-slider__track { grid-template-columns: 64px 1fr 64px; } }

/* --- přepínač --- */
.l2-switch { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line, #ebe5e0); cursor: pointer; }
.l2-switch:last-child { border-bottom: 0; }
.l2-switch input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--ink, #1f1a17); flex: none; }
.l2-switch__title { display: block; font-weight: 600; font-size: 13.5px; }
.l2-switch__desc { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 2px; }

/* --- náhled promptu --- */
.l2-preview {
  white-space: pre-wrap; font-size: 12.5px; line-height: 1.55; background: var(--bg-2, #f6f3f0); border: 1px solid var(--line, #ebe5e0);
  border-radius: 12px; padding: 14px 16px; max-height: 420px; overflow: auto; color: var(--ink-2, #3a332e);
}
.l2-textarea--tall { min-height: 190px; }
.l2-textarea--mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; line-height: 1.5; }

/* --- stavové značky --- */
.l2-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #b8b0a8; flex: none; }
.l2-dot--ok { background: #2e9e5b; }
.l2-dot--warn { background: #e8a400; }
.l2-dot--stale, .l2-dot--error, .l2-dot--missing { background: #d43d3d; }
.l2-dot--off { background: #cfc7bf; }
.l2-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* --- stavový pruh na Dashboardu --- */
.l2-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .l2-strip { grid-template-columns: 1fr; } }
.l2-strip__item {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line, #ebe5e0);
  background: var(--bg-1, #fff); cursor: pointer; text-align: left; font: inherit; color: inherit;
}
.l2-strip__item:hover { border-color: var(--ink-3, #8a817a); }
.l2-strip__item--bad { border-color: #f1b5b5; background: #fff6f5; }
.l2-strip__item--warn { border-color: #f3d58a; background: #fffaf0; }
.l2-strip__title { font-weight: 700; font-size: 13.5px; }
.l2-strip__text { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.l2-strip .l2-dot { margin-top: 5px; }

/* --- tabulka stavu znalostí --- */
.l2-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.l2-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line, #ebe5e0); }
.l2-table td { padding: 11px 12px; border-bottom: 1px solid var(--line, #ebe5e0); vertical-align: top; }
.l2-table tr:last-child td { border-bottom: 0; }
.l2-table__group td { background: var(--bg-2, #f6f3f0); font-weight: 700; font-size: 12px; padding: 7px 12px; }
.l2-table .l2-name { font-weight: 600; }
.l2-table select { font: inherit; font-size: 12px; padding: 3px 6px; border: 1px solid var(--line, #ebe5e0); border-radius: 8px; background: #fff; }
.l2-table-wrap { overflow-x: auto; max-width: 100%; }
/* Obsah stránky se nesmí roztáhnout podle nejširší tabulky (úzká okna, telefon) – tabulka se posouvá ve svém rámu. */
.main > #route { min-width: 0; max-width: 100%; }
#route .card, #route .l2-grid > * { min-width: 0; }

/* --- reporty --- */
.l2-score { display: grid; grid-template-columns: 120px 1fr 34px; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.l2-score__bar { height: 10px; border-radius: 999px; background: var(--bg-2, #f6f3f0); overflow: hidden; }
.l2-score__fill { height: 100%; border-radius: 999px; background: var(--ink, #1f1a17); }
.l2-score__fill--low { background: #d43d3d; }
.l2-score__fill--mid { background: #e8a400; }
.l2-score__val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.l2-big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.l2-big small { font-size: 16px; font-weight: 600; color: var(--muted); }
.l2-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; }
.l2-list li + li { margin-top: 4px; }
.l2-eval { border: 1px solid var(--line, #ebe5e0); border-radius: 16px; padding: 16px; background: var(--bg-1, #fff); }
.l2-eval + .l2-eval { margin-top: 12px; }
.l2-eval--problem { border-left: 4px solid #d43d3d; }
.l2-eval--ke_zlepseni { border-left: 4px solid #e8a400; }
.l2-eval--v_poradku { border-left: 4px solid #2e9e5b; }
.l2-eval__q { font-weight: 700; font-size: 14px; }
.l2-eval__sum { font-size: 13.5px; line-height: 1.55; margin-top: 6px; }
.l2-eval__mini { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.l2-pill { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--bg-2, #f6f3f0); color: var(--ink-2, #3a332e); white-space: nowrap; }
.l2-pill--bad { background: #fee2e2; color: #991b1b; }
.l2-pill--mid { background: #fef3c7; color: #92400e; }
.l2-box { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2, #f6f3f0); font-size: 13px; line-height: 1.55; }
.l2-box__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.l2-box--suggest { background: #fff8e1; border: 1px solid #f3d58a; }
.l2-box--done { background: #ecf8f0; border: 1px solid #b7e2c6; }
.l2-box--rejected { background: #f6f3f0; border: 1px dashed #cfc7bf; color: var(--muted); }
.l2-progress { height: 10px; border-radius: 999px; background: var(--bg-2, #f6f3f0); overflow: hidden; }
.l2-progress__fill { height: 100%; background: var(--lime, #f5b400); border-radius: 999px; transition: width .4s; }
.l2-report-row { display: grid; grid-template-columns: 1.3fr .7fr 1.4fr auto; gap: 14px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line, #ebe5e0); cursor: pointer; }
.l2-report-row:last-child { border-bottom: 0; }
.l2-report-row:hover { background: var(--bg-2, #f6f3f0); }
@media (max-width: 820px) { .l2-report-row { grid-template-columns: 1fr; gap: 6px; } }

/* --- konektory: záložky --- */
.l2-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line, #ebe5e0); margin-bottom: 16px; overflow-x: auto; }
.l2-tab { border: 0; background: none; font: inherit; font-weight: 600; font-size: 13.5px; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.l2-tab.is-active { color: var(--ink, #1f1a17); border-bottom-color: var(--lime, #f5b400); }
.l2-empty { text-align: center; padding: 40px 16px; color: var(--muted); font-size: 13.5px; }
.l2-kv { display: grid; grid-template-columns: 190px 1fr; gap: 6px 14px; font-size: 13px; }
.l2-kv dt { color: var(--muted); }
.l2-kv dd { margin: 0; word-break: break-word; }
@media (max-width: 620px) { .l2-kv { grid-template-columns: 1fr; } }

/* Zápisová tlačítka nových sekcí schovej tomu, kdo má jen čtení (stejně jako ve zbytku administrace). */
#route[data-readonly="1"] .l2-write { display: none !important; }

/* Úpravy z chatu – konverzace u úpravy */
.l2-up-conv { margin-top: 12px; display: grid; gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.l2-up-msg { padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; max-width: 88%; }
.l2-up-msg--user { justify-self: end; background: var(--bg-2, #f6f3f0); }
.l2-up-msg--bot { justify-self: start; background: var(--bg-1, #fff); border: 1px solid var(--line, #ebe5e0); }

/* Reporty – procenta odpovědí proti cíli, posun proti minulému období */
.l2-pct { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.l2-pct--sm { min-width: 0; padding: 1px 7px; font-size: 11px; }
.l2-pct--ok { background: #ecf8f0; color: #1d7a45; }
.l2-pct--mid { background: #fff3d6; color: #8a5a00; }
.l2-pct--bad { background: #fde4e4; color: #b42323; }
.l2-big--ok { color: #1d7a45; }
.l2-big--mid { color: #a86500; }
.l2-big--bad { color: #b42323; }
.l2-delta { font-size: 12px; font-weight: 700; white-space: nowrap; }
.l2-delta--up { color: #1d7a45; }
.l2-delta--down { color: #b42323; }
.l2-delta--flat { color: var(--muted); }
.l2-hero__main { display: grid; grid-template-columns: minmax(220px, 1fr) 1.4fr; gap: 28px; align-items: center; }
@media (max-width: 820px) { .l2-hero__main { grid-template-columns: 1fr; gap: 16px; } }
.l2-target { position: relative; height: 14px; border-radius: 999px; background: var(--bg-2, #f6f3f0); }
.l2-target__fill { height: 100%; border-radius: 999px; }
.l2-target__fill--ok { background: #2e9e5b; }
.l2-target__fill--mid { background: #e8a400; }
.l2-target__fill--bad { background: #d43d3d; }
.l2-target__mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink, #1f1a17); }
.l2-target__mark span { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; white-space: nowrap; }
.l2-score { grid-template-columns: 120px 1fr 48px 74px; }
.l2-score__d { text-align: right; }
.l2-ans { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line, #ebe5e0); font-size: 13px; line-height: 1.55; }
.l2-more { margin-top: 8px; font-size: 13px; }
.l2-more > summary { cursor: pointer; color: var(--muted); font-size: 12px; }

/* =====================================================================
 * Úpravy a reakce – návrh agenta úprav (teď → nově) a reakce u dotazu
 * ===================================================================== */
.l2-diff { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 10px; }
.l2-diff__col { padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  max-height: 320px; overflow-y: auto; }
.l2-diff__col--old { background: #fdf0f0; border: 1px solid #f1c9c9; }
.l2-diff__col--new { background: #ecf8f0; border: 1px solid #b7e2c6; }
a.l2-pill { text-decoration: none; color: inherit; cursor: pointer; }
.l2-flash { box-shadow: 0 0 0 3px var(--lime, #c6f432); transition: box-shadow .3s; }
.q-card__kb.q-card__kb--pending { border-color: #f3d58a; background: #fff8e1; }
.q-card__kb--pending a { color: inherit; }

/* --- Aktuálně → Sezóna a novinky: odkazy na další krátkodobé věci --- */
.l2-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .l2-links { grid-template-columns: 1fr; } }
.l2-link { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 12px 14px; border: 1px solid var(--line, #ebe5e0); border-radius: 12px; background: var(--bg-1, #faf8f6); font: inherit; color: inherit; cursor: pointer; }
.l2-link:hover { border-color: var(--ink-3, #8a817a); }
.l2-link[disabled] { cursor: default; opacity: .6; }
.l2-link__t { font-weight: 700; font-size: 13.5px; }
.l2-link__s { font-size: 12px; color: var(--muted); line-height: 1.4; }
.l2-slider__name .infotip, .l2-switch__title .infotip, .card__head h3 .infotip { margin-left: 2px; }
.card__head h3 { display: inline-flex; align-items: center; gap: 6px; }

/* Report – kritické chyby provozu a agenda (lucy2.js stavCritical / stavAgenda) */
.l2-crit__head { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.l2-crit__list { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.l2-crit__list li > div { margin-top: 2px; }
.l2-crit a { color: inherit; font-weight: 600; text-decoration: underline; white-space: nowrap; }
.l2-agenda { display: grid; gap: 6px; }
.l2-agenda li.is-crit { font-weight: 600; color: #991b1b; }
.l2-agenda a, .l2-list a[data-stav-go] { white-space: nowrap; }
