* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 12px;
    background: #f0f2f5;
    color: #1f2937;
}
h1 { font-size: 1.35em; margin: 0 0 4px; }
h2 { font-size: 1.05em; margin: 0 0 10px; }
.top { max-width: 1400px; margin: 0 auto 14px; }
.top p { margin: 0; color: #6b7280; font-size: .9em; }
.muted { color: #6b7280; }
.small { font-size: .8em; line-height: 1.5; }

.layout { max-width: 1400px; margin: 0 auto; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1050px) {
    .layout { grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); align-items: start; }
    .right { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; border-radius: 10px; }
}
.left > .card + .card { margin-top: 14px; }
.card { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.1); padding: 16px 18px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.cal-head h2 { margin: 0 0 6px; }
.count { font-weight: 400; color: #6b7280; font-size: .85em; }

/* Formulář */
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .85em; font-weight: 600; color: #374151; }
.req { color: #dc2626; }
input[type=text], input[type=email], input[type=url], textarea, select {
    font: inherit; font-weight: 400; font-size: .95rem; color: #111827;
    padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff; width: 100%;
}
select { width: auto; padding: 5px 8px; font-size: .85rem; }
input:focus, textarea:focus, select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px #bfdbfe; }
input.invalid { border-color: #dc2626; box-shadow: 0 0 0 2px #fecaca; }
.checks { margin-top: 12px; }
.section-label { font-weight: 700; font-size: .9em; color: #374151; margin-bottom: 6px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: .92em; padding: 3px 0; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; }
.check.notify { margin-top: 10px; }
.status { min-height: 1.4em; margin-top: 10px; font-size: .85em; font-weight: 600; }
.status.ok { color: #15803d; } .status.busy { color: #b45309; }
.status.warn { color: #b45309; } .status.err { color: #dc2626; }
.device { margin-top: 10px; font-size: .88em; border-top: 1px solid #e5e7eb; padding-top: 8px; }
.device summary { cursor: pointer; color: #4b5563; font-weight: 600; }
.recover { margin: 10px 0; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.row input { flex: 1 1 200px; width: auto; }
.btn {
    font: inherit; font-size: .85rem; font-weight: 600; padding: 7px 14px; border-radius: 7px; cursor: pointer;
    border: 1px solid #2563eb; background: #2563eb; color: #fff; touch-action: manipulation;
}
.btn:hover { background: #1d4ed8; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: #fff; color: #374151; border-color: #d1d5db; }
.btn.ghost:hover { background: #f3f4f6; }
.btn.danger { color: #b91c1c; border-color: #fca5a5; }
.btn.danger:hover { background: #fef2f2; }
.btn.small { padding: 3px 9px; font-size: .78rem; }

/* Kalendář (podle leto.php) */
.hint {
    font-size: .8em; color: #6b7280; background: #f8fafc; border: 1px solid #e5e7eb;
    border-radius: 7px; padding: 8px 12px; margin-bottom: 12px; line-height: 1.5;
}
.hint strong { color: #374151; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; align-items: center; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: .8em; color: #555; }
.legend-dot { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0,0,0,.1); flex-shrink: 0; }
.l-none { background: #e5e7eb; } .l-nevim { background: #fde68a; }
.l-nemuzu { background: #fca5a5; } .l-muzu { background: #86efac; }

.months-wrapper { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; user-select: none; -webkit-user-select: none; }
.month-block { background: #fafafa; border: 1px solid #eef0f3; border-radius: 10px; padding: 12px; flex: 0 0 auto; max-width: 100%; }
.month-title { text-align: center; font-weight: bold; font-size: .95em; margin-bottom: 8px; color: #333; }
.month-grid { display: grid; grid-template-columns: repeat(7, 38px); gap: 3px; }
.day-header { text-align: center; font-size: .72em; font-weight: bold; color: #9ca3af; padding: 3px 0 5px; }
.day-cell {
    width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    border-radius: 7px; font-size: .85em; border: 2px solid transparent; color: #374151;
    transition: border-color .08s; -webkit-tap-highlight-color: transparent;
}
.day-cell.active { cursor: pointer; background: #e5e7eb; touch-action: none; }
.day-cell.active:hover { border-color: #93c5fd; }
.day-cell.out-of-range { opacity: .15; pointer-events: none; }
.day-cell.weekend .day-num { color: #6b7280; font-style: italic; }
.day-cell.active.s-nevim { background: #fde68a; }
.day-cell.active.s-nemuzu { background: #fca5a5; }
.day-cell.active.s-muzu { background: #86efac; }
.day-cell.selected { border-color: #2563eb !important; box-shadow: 0 0 0 1px #2563eb; }
.day-cell.press-hint { border-color: #2563eb; opacity: .7; }
@media (max-width: 420px) { .month-grid { grid-template-columns: repeat(7, 34px); } .day-cell { width: 34px; height: 34px; } }

#toolbar {
    position: fixed; background: #fff; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.18);
    padding: 8px 12px; display: none; flex-direction: column; gap: 6px; z-index: 300; min-width: 200px; max-width: 95vw;
}
#toolbar.visible { display: flex; }
.toolbar-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tlabel { font-size: .75em; color: #9ca3af; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.toolbar-count { font-size: .75em; color: #6b7280; background: #f3f4f6; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.toolbar-close { background: none; border: none; cursor: pointer; font-size: 1em; color: #9ca3af; padding: 3px 5px; border-radius: 5px; }
.toolbar-close:hover { background: #f3f4f6; color: #374151; }
.toolbar-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.state-btn {
    flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 10px;
    border: 2px solid transparent; border-radius: 8px; cursor: pointer; font: inherit; font-size: .82rem; font-weight: 600;
    color: #374151; white-space: nowrap; touch-action: manipulation; transition: border-color .1s, transform .08s;
}
.state-btn:hover { border-color: #6b7280; transform: translateY(-1px); }
.b-none { background: #e5e7eb; } .b-nevim { background: #fde68a; } .b-nemuzu { background: #fca5a5; } .b-muzu { background: #86efac; }
.kbd { font-size: .72em; background: rgba(0,0,0,.12); padding: 1px 5px; border-radius: 4px; font-weight: bold; }

/* Přehled */
.ov-toggle {
    padding: 5px 13px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff; cursor: pointer;
    font: inherit; font-size: .8rem; color: #374151; white-space: nowrap;
}
.ov-toggle:hover { background: #f3f4f6; }
.ov-toggle.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.ov-scroll { overflow-x: auto; border: 1px solid #eef0f3; border-radius: 10px; }
.ov-table { border-collapse: collapse; table-layout: fixed; font-size: .78em; }
.ov-table th, .ov-table td { padding: 0; margin: 0; }
.ov-sticky { position: sticky; left: 0; z-index: 3; background: #fff; }
.ov-th-name, .ov-name { width: 96px; min-width: 96px; max-width: 96px; }
.ov-name { padding: 4px 8px; font-weight: 600; color: #374151; border-right: 2px solid #e5e7eb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-name.me { color: #2563eb; }
.ov-th-date { width: 28px; min-width: 28px; max-width: 28px; text-align: center; padding: 4px 0 3px; color: #6b7280; border-bottom: 2px solid #e5e7eb; vertical-align: bottom; }
.ov-th-date.ov-weekend { background: #fafafa; color: #9ca3af; }
.ov-dow { font-size: .85em; font-weight: 700; line-height: 1.2; }
.ov-daynum { font-size: .95em; line-height: 1.3; }
.ov-cell { width: 28px; height: 26px; border: 1px solid rgba(255,255,255,.6); }
.ov-cell.ov-weekend { opacity: .85; }
.ov-month-start { border-left: 2px solid #2563eb !important; }
.ov-foot-label { padding: 4px 8px; font-weight: 700; font-size: .9em; color: #374151; border-right: 2px solid #e5e7eb; border-top: 2px solid #e5e7eb; background: #fff; }
.ov-count { width: 28px; height: 26px; text-align: center; vertical-align: middle; font-weight: 700; font-size: .85em; border: 1px solid rgba(255,255,255,.4); border-top: 2px solid #e5e7eb; }
.ov-month-label { text-align: left; padding: 5px 6px 3px; font-size: .8em; font-weight: 700; color: #2563eb; background: #eff6ff; border-bottom: 1px solid #bfdbfe; }

.best { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.best h3 { font-size: .85em; margin: 0 0 6px; color: #374151; }
.best ol { margin: 0; padding: 0; list-style: none; }
.best li { display: flex; justify-content: space-between; gap: 10px; font-size: .88em; padding: 4px 8px; border-radius: 6px; }
.best li:nth-child(odd) { background: #f8fafc; }
.best li b { color: #15803d; white-space: nowrap; }

/* Komentáře */
.composer { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px; margin: 10px 0 14px; }
.composer.dragover { border-color: #2563eb; background: #eff6ff; }
.composer textarea { min-height: 70px; resize: vertical; }
.composer .drop {
    margin-top: 8px; border: 2px dashed #cbd5e1; border-radius: 8px; padding: 8px 10px; font-size: .8em;
    color: #6b7280; text-align: center; cursor: pointer;
}
.composer.dragover .drop { border-color: #2563eb; color: #2563eb; }
.composer .drop u { color: #2563eb; }
.composer .actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.composer .msg { font-size: .8em; color: #dc2626; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 10px; border-radius: 16px;
    background: #fff; border: 1px solid #d1d5db; font-size: .8em; color: #1f2937; text-decoration: none;
}
a.chip:hover { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
.chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.chip .sz { color: #9ca3af; }
.chip button { border: none; background: none; cursor: pointer; color: #9ca3af; font-size: 1em; padding: 0 0 0 2px; }
.chip button:hover { color: #dc2626; }
.chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }

.comment { border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.comment.mine { border-left: 3px solid #2563eb; }
.c-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.c-author { font-weight: 700; font-size: .92em; }
.c-date { font-size: .75em; color: #9ca3af; white-space: nowrap; }
.c-text { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; font-size: .92em; line-height: 1.5; }
.c-text a { color: #2563eb; }
.c-foot { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.like {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 16px; cursor: pointer;
    border: 1px solid #d1d5db; background: #fff; font: inherit; font-size: .82rem; color: #374151; touch-action: manipulation;
}
.like:hover:not(:disabled) { border-color: #2563eb; }
.like.on { background: #dbeafe; border-color: #2563eb; color: #1d4ed8; font-weight: 700; }
.like:disabled { opacity: .6; cursor: default; }
.spacer { flex: 1; }
.empty { text-align: center; color: #9ca3af; font-size: .9em; padding: 18px 0; }

#toast {
    position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); background: #1f2937; color: #fff;
    padding: 9px 16px; border-radius: 8px; font-size: .88em; opacity: 0; pointer-events: none; z-index: 500;
    transition: opacity .2s, transform .2s; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.field .btn.small { align-self: flex-start; }
.admin-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff7ed; border: 1px solid #fdba74; }
.admin-bar select { max-width: 260px; }
.foot { max-width: 1400px; margin: 18px auto 6px; text-align: right; font-size: .8em; }
.foot a { color: #9ca3af; }
.foot form { display: inline-flex; gap: 6px; align-items: center; margin-left: 8px; }
.foot input { width: 170px; padding: 4px 8px; font-size: .85rem; }
.foot .msg { color: #dc2626; font-weight: 600; }

.stats { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut-n { font-size: 24px; font-weight: 700; fill: #111827; }
.donut-s { font-size: 9px; fill: #6b7280; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 180px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: .9em; padding: 4px 0; }
.legend li span { flex: 1; }
.legend li i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
#stats-kids { margin-top: 16px; padding-top: 16px; border-top: 1px solid #eee; }

.stats-side { flex: 1; min-width: 200px; }
.who { margin-top: 8px; font-size: .9em; }
.who summary { cursor: pointer; color: #2563eb; font-weight: 600; }
.who-g { margin-top: 8px; }
.who-h { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.who-h i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.who-g p { margin: 2px 0 0 20px; }
