* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, "Segoe UI", Roboto, sans-serif; color: #222; background: #f6f4ef; }
header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 1rem; background: #3d4b3a; color: #fff; }
header h1 { margin: 0; font-size: 1.4rem; font-weight: 600; }
.toolbar { display: flex; gap: .4rem; flex-wrap: wrap; }
button, .btn { font: inherit; font-size: .9rem; padding: .35rem .7rem; border: 1px solid #888; border-radius: 4px;
  background: #fff; color: #222; cursor: pointer; display: inline-block; }
button:hover, .btn:hover { background: #eee; }
.danger { border-color: #b33; color: #b33; }

main { display: grid; grid-template-columns: 240px 1fr 380px; height: calc(100vh - 52px); }
aside, section { overflow: auto; padding: .8rem; }
#seznam-panel { border-right: 1px solid #ccc; background: #fff; }
#detail-panel { border-left: 1px solid #ccc; background: #fff; }
#hledat { width: 100%; padding: .4rem; margin-bottom: .5rem; }
#seznam { list-style: none; margin: 0; padding: 0; }
#seznam li { padding: .3rem .4rem; border-radius: 3px; cursor: pointer; font-size: .9rem; }
#seznam li:hover { background: #eef; }
#seznam li.vybrana { background: #dde8d8; font-weight: 600; }
#seznam li small { color: #666; display: block; font-weight: normal; }
.pocet { color: #666; font-size: .8rem; }

.strom-ovladani { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; font-size: .9rem; }
.strom-ovladani input[type=number] { width: 3.5rem; }
.prazdne { color: #666; }

/* Horizontální strom: osoba vlevo, větve vpravo */
.vetev { display: flex; align-items: center; }
.deti { display: flex; flex-direction: column; margin-left: 24px; position: relative; }
.deti > * { position: relative; padding: 4px 0 4px 16px; }
.deti > *::before { content: ""; position: absolute; left: 0; top: 50%; width: 16px; border-top: 1px solid #8a8a8a; }
.deti > *::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px solid #8a8a8a; }
.deti > *:first-child::after { top: 50%; }
.deti > *:last-child::after { bottom: 50%; }
.deti > *:only-child::after { display: none; }
.vetev > .deti::before, .rodina > .deti::before { content: ""; position: absolute; left: -24px; top: 50%; width: 24px; border-top: 1px solid #8a8a8a; }
.rodina { display: flex; align-items: center; }

.karta { min-width: 170px; max-width: 220px; padding: .4rem .6rem; border: 1px solid #999; border-radius: 6px;
  background: #fff; cursor: pointer; font-size: .85rem; line-height: 1.3; }
.karta:hover { box-shadow: 0 0 0 2px #9ab; }
.karta.M { border-left: 5px solid #4a78b0; }
.karta.Z { border-left: 5px solid #b0507a; }
.karta.stred { box-shadow: 0 0 0 3px #6a8a5a; }
.karta strong { display: block; }
.karta small { color: #555; }
.karta.neznamy { border-style: dashed; color: #777; background: #fafafa; min-width: 130px; }
.partner { display: flex; align-items: center; gap: .3rem; }
.partner .znak { color: #777; font-size: 1.1rem; }

form label { display: block; font-size: .8rem; color: #444; margin-bottom: .4rem; flex: 1; }
form input, form select, form textarea { width: 100%; font: inherit; font-size: .9rem; padding: .3rem; margin-top: .15rem; }
form h2 { margin-top: 0; font-size: 1.15rem; }
.radek { display: flex; gap: .5rem; align-items: flex-end; }
fieldset { border: 1px solid #ddd; border-radius: 4px; margin: 0 0 .6rem; padding: .4rem .6rem; }
legend { font-size: .8rem; font-weight: 600; color: #3d4b3a; }
#svazky-seznam { list-style: none; padding: 0; margin: 0 0 .4rem; font-size: .85rem; }
#svazky-seznam li { display: flex; justify-content: space-between; align-items: center; padding: .2rem 0; border-bottom: 1px dotted #ddd; }
#svazky-seznam button { font-size: .75rem; padding: .1rem .4rem; }
.tlacitka { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
#deti-info { margin-top: .8rem; font-size: .85rem; color: #444; }
#detail-prazdny { color: #666; }

@media (max-width: 1000px) {
  main { grid-template-columns: 1fr; height: auto; }
  #seznam-panel, #detail-panel { border: none; }
}
@media print {
  header, #seznam-panel, #detail-panel, .strom-ovladani { display: none; }
  main { display: block; height: auto; }
}
