/* Lcontrol – jen světlý vzhled */
:root {
  --bg: #f5f6f8; --panel: #fff; --line: #e1e5eb; --line2: #eef1f4;
  --text: #1c2330; --muted: #5d6777; --faint: #8a93a1;
  --accent: #1f6feb; --accent-bg: #eaf2ff;
  --red: #d1242f; --red-bg: #fdecec; --yellow: #b7791f; --yellow-bg: #fff6dd; --blue-bg: #e9f2ff;
  --green: #1a7f37; --green-bg: #e6f6ea;
  --radius: 8px; --side: 232px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- rozvržení */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side); background: var(--panel); border-right: 1px solid var(--line); flex-shrink: 0;
        position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { padding: 16px 16px 12px; font-weight: 700; font-size: 18px; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 2px;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 8px 16px; color: var(--text); border-left: 3px solid transparent; }
.nav a:hover { background: var(--line2); text-decoration: none; }
.nav a.on { background: var(--accent-bg); border-left-color: var(--accent); font-weight: 600; }
.nav a.later { color: var(--faint); }
.nav .sep { height: 1px; background: var(--line); margin: 8px 16px; }
.cnt { margin-left: auto; font-size: 12px; font-weight: 600; border-radius: 10px; padding: 0 7px; line-height: 19px; }
.cnt.red { background: var(--red); color: #fff; } .cnt.yellow { background: #f2c94c; color: #3d2c00; }
.side-foot { margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.main { flex: 1; min-width: 0; padding: 20px 24px 60px; }
.top { display: none; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

@media (max-width: 860px) {
  .side { position: fixed; z-index: 30; left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0,0,0,.15); }
  .side.open { transform: none; }
  .top { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--panel);
         border-bottom: 1px solid var(--line); padding: 8px 16px; }
  .main { padding: 14px 16px 60px; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 25; }
}

/* ---------- prvky */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.tight { padding: 0; overflow: hidden; }
button, .btn { white-space: nowrap; font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 6px;
               padding: 7px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; }
button:hover, .btn:hover { background: var(--line2); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #1a5fd0; }
button.danger { color: var(--red); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button.icon { padding: 6px 9px; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea { font: inherit; border: 1px solid #cdd3dc; border-radius: 6px; padding: 7px 9px; background: #fff; color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
textarea { min-height: 64px; resize: vertical; }
input[type=checkbox] { width: auto; }
label.f { display: block; margin-bottom: 10px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
label.f > span b { color: var(--red); font-weight: 400; }
label.chk { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 12px; }
@media (max-width: 600px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.err { color: var(--red); font-size: 13px; margin: 4px 0 8px; }
.hint { font-size: 13px; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

.search { position: relative; flex: 1; min-width: 220px; max-width: 520px; }
.search input { padding-left: 32px; }
.search::before { content: "⌕"; position: absolute; left: 10px; top: 5px; color: var(--faint); font-size: 18px; }

/* ---------- tabulka zákazníků */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); background: #fafbfc; }
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: #f8fafc; }
td.stripe { width: 4px; padding: 0 !important; }
td.stripe i { display: block; width: 4px; min-height: 40px; height: 100%; }
.s-red { background: var(--red); } .s-yellow { background: #f2c94c; } .s-blue { background: var(--accent); }
.dev-chip { display: inline-block; font-size: 12px; background: var(--line2); border-radius: 4px; padding: 1px 6px; margin: 0 4px 2px 0; }
@media (max-width: 700px) {
  table.list thead { display: none; }
  table.list tr { display: grid; grid-template-columns: 4px 1fr auto; }
  table.list td { border: 0; padding: 4px 10px; }
  table.list td.stripe { grid-row: 1 / span 2; grid-column: 1; }
  table.list td.c-num, table.list td.c-rev { display: none; }
  table.list td.c-name { grid-column: 2; grid-row: 1; }
  table.list td.c-city { grid-column: 3; grid-row: 1; text-align: right; }
  table.list td.c-dev { grid-column: 2; grid-row: 2; }
  table.list td.c-act { grid-column: 3; grid-row: 2; }
  table.list tbody tr { border-bottom: 1px solid var(--line2); padding: 6px 0; }
}

/* ---------- menu akcí */
.menu { position: relative; display: inline-block; }
.menu-pop { position: absolute; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--line);
            border-radius: 6px; box-shadow: 0 6px 24px rgba(20,30,50,.12); min-width: 180px; z-index: 15; padding: 4px 0; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; border: 0; border-radius: 0; padding: 7px 14px; color: var(--text); background: none; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--line2); text-decoration: none; }

/* ---------- detail */
.bar { border-radius: 6px; padding: 8px 12px; margin-bottom: 6px; font-size: 14px; }
.bar.warn { background: var(--yellow-bg); border: 1px solid #f4dd99; }
.bar.info { background: var(--blue-bg); border: 1px solid #c8dcfb; }
.bar.danger { background: var(--red-bg); border: 1px solid #f5c2c2; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 16px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 14px; padding: 2px 10px; font-size: 13px; background: var(--line2); }
.chip.state { background: var(--green-bg); color: var(--green); font-weight: 600; }
.chip.state.arch { background: var(--line2); color: var(--muted); }
.chip button { border: 0; background: none; padding: 0 0 0 2px; color: var(--faint); font-size: 14px; }
.chip input { border: 0; padding: 0; width: 110px; font-size: 13px; background: transparent; }
.cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } .cols > div:last-child { order: -1; } }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 10px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 500px) { dl.kv { grid-template-columns: 1fr; } dl.kv dt { padding-top: 6px; } }
.site { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.site-head { padding: 10px 14px; background: #fafbfc; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.site-head b { font-size: 15px; }
.dev { padding: 10px 14px; border-bottom: 1px solid var(--line2); display: flex; gap: 10px; align-items: flex-start; }
.dev:last-child { border-bottom: 0; }
.dev.child { padding-left: 34px; }
.dev .ico { width: 30px; height: 30px; border-radius: 6px; background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; font-size: 15px; flex-shrink: 0; }
.dev .t { font-weight: 600; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.timeline { color: var(--muted); font-size: 14px; }

/* ---------- formulář rychlého založení */
.form-sec { margin-bottom: 14px; }
.form-sec > h2 { display: flex; align-items: center; gap: 8px; }
.form-sec > h2 .n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; display: grid; place-items: center; }
.dups { background: var(--yellow-bg); border: 1px solid #f4dd99; border-radius: 6px; padding: 8px 12px; margin: 0 0 10px; font-size: 14px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 14px 0 6px; display: flex; gap: 8px; }

/* ---------- modal, toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 620px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-h h2 { margin: 0; flex: 1; }
.modal-b { padding: 16px 18px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1c2330; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 60; max-width: calc(100% - 32px); }
.toast.bad { background: var(--red); }

/* ---------- přihlášení */
.login { max-width: 380px; margin: 12vh auto; padding: 0 16px; }
.login .card { padding: 24px; }
.login h1 { margin-bottom: 4px; }

/* ---------- přehled */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .v { font-size: 26px; font-weight: 700; }
.tile .l { color: var(--muted); font-size: 13px; }
.tile.later { color: var(--faint); }

/* ---------- zprávy */
.msg { border-bottom: 1px solid var(--line2); padding: 8px 0; }
.msg:last-child { border-bottom: 0; }
.msg-body { white-space: pre-line; font-size: 14px; margin-top: 3px; overflow-wrap: anywhere; }
.st { font-size: 12px; border-radius: 10px; padding: 0 8px; background: var(--line2); }
.st.ok { background: var(--green-bg); color: var(--green); }
.st.bad { background: var(--red-bg); color: var(--red); }
.card > .msg:first-of-type { padding-top: 0; }

/* ---------- plánovač */
.kind { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
        border-radius: 4px; padding: 0 5px; background: var(--line2); color: var(--muted); }
.kind.installation { background: #efe7ff; color: #6b3fc6; } .kind.service { background: #e3f1ff; color: #1f5fbf; }
.kind.revision { background: #e4f6ea; color: #1a7f37; } .kind.fault { background: #fdecec; color: #c42b2b; }
.pl-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.pl-title { font-size: 16px; margin-left: 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.pl-wrap { display: flex; gap: 14px; align-items: flex-start; }
.pl-queue { width: 250px; flex-shrink: 0; position: sticky; top: 10px; max-height: calc(100vh - 40px); overflow-y: auto; }
.pl-main { flex: 1; min-width: 0; }
.qcard { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 6px; padding: 8px 10px;
         margin-bottom: 8px; cursor: grab; }
.qcard.p-urgent { border-left-color: var(--red); } .qcard.p-high { border-left-color: #f2c94c; }
.qcard .qt { font-weight: 600; margin: 3px 0 1px; }
@media (max-width: 1000px) { .pl-wrap { flex-direction: column; } .pl-queue { width: 100%; position: static; max-height: none; order: 2; } .pl-main { width: 100%; } }

.pl-day { overflow-x: auto; }
.pl-head, .pl-body { display: flex; min-width: fit-content; }
.pl-head { border-bottom: 1px solid var(--line); background: #fafbfc; position: sticky; top: 0; z-index: 3; }
.pl-gut { width: 52px; flex-shrink: 0; }
.pl-colh { flex: 1; min-width: 150px; padding: 8px; font-weight: 600; font-size: 14px; border-left: 1px solid var(--line); }
.pl-hour { height: 60px; font-size: 11px; color: var(--faint); text-align: right; padding: 0 6px; transform: translateY(-7px); }
.pl-hour:first-child { transform: none; }
.pl-col { flex: 1; min-width: 150px; position: relative; border-left: 1px solid var(--line); }
.pl-col.target { background: var(--accent-bg); }
.pl-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line2); }
.pl-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--red); z-index: 2; }
.pl-block { position: absolute; inset: 0; background: repeating-linear-gradient(45deg, #f1f3f6, #f1f3f6 8px, #e8ebf0 8px, #e8ebf0 16px);
            color: var(--muted); font-size: 12px; padding: 4px 6px; cursor: pointer; z-index: 0; }
.pl-ev { position: absolute; border-radius: 5px; padding: 3px 6px; font-size: 12px; overflow: hidden; cursor: pointer; z-index: 1;
         background: #e3f1ff; border: 1px solid #b8d6fb; border-left: 4px solid #1f6feb; line-height: 1.3; user-select: none; }
.pl-ev.w { touch-action: none; cursor: grab; }
.pl-ev.k-installation { background: #f2ecff; border-color: #d6c6fa; border-left-color: #7c4ddb; }
.pl-ev.k-revision { background: #e8f7ed; border-color: #bfe5cb; border-left-color: #1a7f37; }
.pl-ev.k-fault { background: #fdeeee; border-color: #f4c7c7; border-left-color: #d1242f; }
.pl-ev.s-done { opacity: .6; } .pl-ev.s-on_way, .pl-ev.s-on_site { box-shadow: 0 0 0 2px #f2c94c inset; }
.pl-ev.dragging { opacity: .85; box-shadow: 0 6px 20px rgba(20,30,50,.25); z-index: 5; }
.pl-ev.ghost { background: var(--accent-bg); border: 2px dashed var(--accent); }
.pl-ev .t { font-weight: 600; } .pl-ev .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-ev .c { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-ev .rs { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.pl-tip { position: fixed; z-index: 70; background: #1c2330; color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 4px; pointer-events: none; }

.pl-week-wrap { overflow-x: auto; }
table.pl-week { border-collapse: collapse; width: 100%; min-width: 760px; table-layout: fixed; }
.pl-week th, .pl-week td { border: 1px solid var(--line2); vertical-align: top; padding: 4px; font-size: 13px; }
.pl-week thead th { background: #fafbfc; font-weight: 600; text-align: left; }
.pl-week tbody th { width: 120px; text-align: left; background: #fafbfc; }
.pl-week td { height: 70px; }
.pl-week .today { background: #f5f9ff; }
.wchip { border-radius: 4px; padding: 2px 5px; margin-bottom: 3px; background: #e3f1ff; border-left: 3px solid #1f6feb; cursor: pointer; font-size: 12px; overflow: hidden; }
.wchip.k-installation { background: #f2ecff; border-left-color: #7c4ddb; } .wchip.k-revision { background: #e8f7ed; border-left-color: #1a7f37; }
.wchip.k-fault { background: #fdeeee; border-left-color: #d1242f; } .wchip.s-done { opacity: .6; }
.wblock { font-size: 12px; color: var(--muted); background: #eef0f4; border-radius: 4px; padding: 1px 5px; margin-bottom: 3px; cursor: pointer; }

.pl-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.pl-month .mh { padding: 6px; font-size: 12px; font-weight: 600; color: var(--muted); background: #fafbfc; border-bottom: 1px solid var(--line); }
.pl-month .md { min-height: 92px; border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); padding: 3px; overflow: hidden; }
.pl-month .md.other { background: #fafbfc; } .pl-month .md.other .dn { color: var(--faint); }
.pl-month .md.today { background: #f5f9ff; } .pl-month .dn { font-size: 12px; font-weight: 600; color: var(--text); }
.mchip { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 3px; padding: 0 4px; margin-top: 2px;
         background: #e3f1ff; cursor: pointer; }
.mchip.k-installation { background: #f2ecff; } .mchip.k-revision { background: #e8f7ed; } .mchip.k-fault { background: #fdeeee; }
.pl-agenda h3.today { color: var(--accent); }
.ag { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line2); cursor: pointer; }
.ag:last-child { border-bottom: 0; }
.ag-t { font-weight: 700; width: 92px; flex-shrink: 0; font-size: 14px; }
.appt-job { background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; }
