:root {
  --c-bg: #fdfbf5;
  --c-card: #ffffff;
  --c-text: #2a2118;
  --c-muted: #6b5d4f;
  --c-border: #e3d9c7;
  --c-primary: #c69a1e;          /* junácká žlutá → tmavší */
  --c-primary-soft: #f5e9b8;
  --c-accent: #5a4632;            /* skautská hnědá */
  --c-success: #2e7d32;
  --c-danger: #c62828;
  --c-warning: #ef6c00;
  --c-info: #1565c0;
  --shadow: 0 2px 6px rgba(50, 40, 30, 0.08);
  --radius: 6px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

a { color: var(--c-accent); }
a:hover { color: var(--c-primary); }

.container { max-width: 1100px; margin: 0 auto; padding: 1rem; }

/* ===== HEADER ===== */
header.site {
  background: var(--c-accent);
  color: #fff;
  padding: 0.6rem 1rem;
  position: sticky; top: 0; z-index: 10;
  box-shadow: var(--shadow);
}
header.site .container {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  padding: 0;
}
header.site a { color: #fff; text-decoration: none; }
header.site .brand {
  font-weight: 700; font-size: 1.05rem;
  border-left: 4px solid var(--c-primary); padding-left: .6rem;
}
nav.main { display: flex; flex-wrap: wrap; gap: .25rem; }
nav.main a {
  display: inline-block; padding: .35rem .65rem; border-radius: var(--radius);
}
nav.main a:hover { background: rgba(255,255,255,.12); }
nav.main a.active { background: var(--c-primary); color: var(--c-accent); font-weight: 600; }

.user-chip { display: inline-flex; gap: .5rem; align-items: center; }
.user-chip form { display: inline; }
.user-chip button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); padding: .2rem .55rem; border-radius: var(--radius); cursor: pointer; }
.user-chip button:hover { background: rgba(255,255,255,.12); }

/* ===== FLASH ===== */
.flashes { padding: 0; margin: 1rem 0; list-style: none; }
.flash { padding: .65rem .9rem; border-radius: var(--radius); margin-bottom: .5rem; border-left: 4px solid; background: #fff; }
.flash.success { border-color: var(--c-success); }
.flash.danger  { border-color: var(--c-danger); }
.flash.warning { border-color: var(--c-warning); }
.flash.info    { border-color: var(--c-info); }

/* ===== CARDS ===== */
.card {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.card h2, .card h3 { margin-top: 0; }

/* ===== FORMS ===== */
.form-row { margin-bottom: .85rem; }
.form-row label { display: block; font-weight: 600; margin-bottom: .25rem; }
.form-row .help { font-size: .85rem; color: var(--c-muted); }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=search], textarea, select {
  width: 100%; padding: .5rem .65rem; border: 1px solid var(--c-border);
  border-radius: var(--radius); background: #fff; font-size: 1rem; font-family: inherit;
}
textarea { min-height: 6rem; resize: vertical; }
.errors { color: var(--c-danger); font-size: .9rem; margin-top: .25rem; list-style: disc; padding-left: 1rem; }

button, .btn {
  display: inline-block; cursor: pointer; padding: .5rem 1rem;
  background: var(--c-primary); color: var(--c-accent); border: 1px solid var(--c-primary);
  border-radius: var(--radius); font-weight: 600; font-size: .95rem; text-decoration: none;
}
button:hover, .btn:hover { background: #b9881a; border-color: #b9881a; color: #fff; }
.btn-secondary { background: transparent; color: var(--c-accent); border-color: var(--c-border); }
.btn-secondary:hover { background: var(--c-primary-soft); color: var(--c-accent); }
.btn-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #a31f1f; border-color: #a31f1f; color: #fff; }
.btn-sm { padding: .3rem .55rem; font-size: .85rem; }

/* ===== MENTOR GRID ===== */
.mentor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.mentor-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.mentor-card-link:hover .mentor-card__title { text-decoration: underline; }
.mentor-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: .9rem;
  display: flex; flex-direction: column; gap: .5rem;
  box-shadow: var(--shadow);
  transition: box-shadow .15s ease;
}
.mentor-card-link:hover .mentor-card { box-shadow: 0 4px 14px rgba(50,40,30,.15); }
.mentor-card--unavailable { background: #f0ebe2; opacity: .85; }
.mentor-card--unavailable img.photo { filter: grayscale(1); }
.mentor-card--hidden { background: repeating-linear-gradient(45deg, #fff, #fff 8px, #f4eedf 8px, #f4eedf 16px); }
.mentor-card__top { display: flex; gap: .65rem; align-items: center; }
.mentor-card__top img.photo {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: #eee;
}
.mentor-card__top .placeholder {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--c-primary-soft);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--c-accent); font-size: 1.5rem;
}
.mentor-card__title { font-weight: 700; font-size: 1.05rem; line-height: 1.2; margin: 0; }
.mentor-card__sub { color: var(--c-muted); font-size: .85rem; }
.chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.chip { background: var(--c-primary-soft); color: var(--c-accent); padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; }
.chip--muted { background: #ece6d9; color: var(--c-muted); }
.badges { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.badge-event {
  display: inline-flex; align-items: center; justify-content: center;
  /* Width follows the image's natural aspect ratio; height is fixed so a
     row of mixed-shape logos lines up. Cap width so a wide banner can't
     hog the whole card. */
  height: 32px; width: auto; max-width: 96px;
  padding: 2px;
  border-radius: 6px; overflow: hidden; background: #fff;
  border: 1px solid var(--c-border);
}
.badge-event img { height: 100%; width: auto; max-width: 100%; object-fit: contain; display: block; }
.badge-event .small { padding: 0 .35rem; }
.actions { margin-top: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.status { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .78rem; }
.status--ok { background: #e1f1e1; color: var(--c-success); }
.status--warn { background: #fde6cf; color: var(--c-warning); }
.status--off { background: #ece6d9; color: var(--c-muted); }
.status--bad { background: #f8d6d6; color: var(--c-danger); }

/* ===== TABLES ===== */
table.data { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
table.data th, table.data td {
  padding: .55rem .7rem; border-bottom: 1px solid var(--c-border); text-align: left; vertical-align: top;
}
table.data th { background: var(--c-primary-soft); color: var(--c-accent); font-weight: 700; }
table.data th .sort-link { color: inherit; text-decoration: none; }
table.data th .sort-link:hover { text-decoration: underline; }
table.data th .sort-link.is-active { color: var(--c-accent); }

.competence-area { margin: .9rem 0 .25rem; font-size: 1rem; color: var(--c-accent); }
.competence-area:first-child { margin-top: .25rem; }
.competence-list { margin: 0 0 .25rem 1.2rem; padding: 0; }
.competence-list li { margin: .15rem 0; }
table.data tr:last-child td { border-bottom: 0; }

/* ===== FILTERS ===== */
.filters {
  display: grid; gap: .5rem; align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.filters .submit { grid-column: span 1; }

/* ===== PAGE TITLE ===== */
h1.page { margin: .5rem 0 1rem; font-size: 1.5rem; }
.subtitle { color: var(--c-muted); }

/* ===== TAXONOMY GROUPS ===== */
.taxonomy-area {
  border: 1px solid var(--c-border); border-radius: var(--radius); margin-bottom: .75rem; background: #fff;
}
.taxonomy-area > h3 {
  margin: 0; padding: .65rem .85rem; background: var(--c-primary-soft); color: var(--c-accent);
  font-size: 1rem; border-bottom: 1px solid var(--c-border);
}
.taxonomy-area ul.competencies { list-style: none; padding: 0; margin: 0; }
.taxonomy-area ul.competencies li { padding: .45rem .85rem; border-bottom: 1px dashed var(--c-border); }
.taxonomy-area ul.competencies li:last-child { border-bottom: none; }
.cov-not-covered { color: var(--c-danger); }
.cov-covered { color: var(--c-success); }

/* ===== MISC ===== */
.muted { color: var(--c-muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.inline { display: inline; }
hr.thin { border: 0; border-top: 1px solid var(--c-border); margin: 1rem 0; }

/* responsive tweaks */
@media (max-width: 600px) {
  header.site .container { flex-direction: column; align-items: flex-start; gap: .35rem; }
  nav.main { width: 100%; }
}

/* ===== /me PROFILE EDITOR ===== */
.profile-sticky {
  position: sticky; top: 0; z-index: 5;
  background: var(--c-bg);
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem 0 .75rem;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 1rem;
}
.profile-sticky .btn { box-shadow: var(--shadow); }

.photo-row .photo-preview-wrap {
  margin-top: .5rem; display: flex; gap: .75rem; align-items: center;
}
.photo-row .photo-preview-wrap img {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
  background: var(--c-primary-soft); border: 1px solid var(--c-border);
}
#bio-counter.over { color: var(--c-danger); font-weight: 700; }

/* --- Crop modal --- */
.crop-modal { position: fixed; inset: 0; z-index: 9000; }
.crop-modal[hidden] { display: none; }
.crop-modal__backdrop {
  position: absolute; inset: 0; background: rgba(20, 16, 10, .55);
}
body.crop-open { overflow: hidden; }
.crop-modal__body {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(640px, 92vw);
  background: #fff; border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  padding: 1rem 1.1rem 1.1rem;
  display: flex; flex-direction: column; gap: .7rem;
}
.crop-modal__body h2 { margin: 0; font-size: 1.1rem; }
.crop-image-wrap {
  background: #1f1d1a; border-radius: 6px;
  height: min(60vh, 420px);
}
.crop-image-wrap img { display: block; max-width: 100%; }
.crop-modal__hint { margin: -.25rem 0 0; }
.crop-modal__actions {
  display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; align-items: center;
}
.crop-modal__ratios { display: flex; gap: .25rem; }
.crop-modal__ratios button {
  background: #f4eedf; border: 1px solid var(--c-border); border-radius: 4px;
  padding: .25rem .55rem; font: inherit; cursor: pointer;
}
.crop-modal__ratios button.is-active {
  background: var(--c-accent); color: #fff; border-color: var(--c-accent);
}
.crop-modal__buttons { display: flex; gap: .5rem; }

/* --- Feedback bubble & modal --- */
#fb-bubble {
  position: fixed; right: 1rem; bottom: 1rem;
  z-index: 8000;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--c-accent); color: #fff;
  border: none; cursor: pointer; font-size: 1.4rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  display: inline-flex; align-items: center; justify-content: center;
}
#fb-bubble:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0,0,0,.25); }
#fb-bubble:active { transform: translateY(0); }

.fb-modal { position: fixed; inset: 0; z-index: 9100; }
.fb-modal[hidden] { display: none; }
.fb-modal__backdrop { position: absolute; inset: 0; background: rgba(20,16,10,.55); }
body.fb-open { overflow: hidden; }
.fb-modal__body {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(720px, 94vw); max-height: 92vh; overflow: auto;
  background: #fff; border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
  padding: 1rem 1.1rem 1.1rem;
  display: flex; flex-direction: column; gap: .75rem;
}
.fb-modal__head { display: flex; justify-content: space-between; align-items: center; }
.fb-modal__head h2 { margin: 0; font-size: 1.1rem; }
.fb-modal__x {
  background: transparent; border: none; font-size: 1.6rem; line-height: 1;
  color: var(--c-muted); cursor: pointer; padding: 0 .25rem;
}
.fb-modal__choose { display: flex; gap: .6rem; flex-wrap: wrap; }
.fb-modal__choose .fb-mode { flex: 1 1 0; min-width: 180px; padding: .9rem 1rem; }

.fb-pane textarea {
  width: 100%; box-sizing: border-box;
  font: inherit; padding: .55rem .65rem;
  border: 1px solid var(--c-border); border-radius: 6px;
}
.fb-pane label { display: block; margin-bottom: .25rem; font-weight: 600; }

.fb-actions { display: flex; gap: .5rem; justify-content: flex-end; }

.fb-shot-toolbar { display: flex; gap: .35rem; flex-wrap: wrap; }
.fb-shot-stage {
  position: relative; background: #1f1d1a; border-radius: 6px;
  max-height: min(60vh, 480px); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.fb-shot-base, .fb-shot-draw {
  display: block; max-width: 100%; max-height: min(60vh, 480px);
  width: auto; height: auto;
}
.fb-shot-draw {
  position: absolute; inset: 0; margin: auto;
  cursor: crosshair; touch-action: none;
}
.fb-crop-target { display: block; max-width: 100%; max-height: min(60vh, 480px); }
.fb-crop-bar { display: flex; gap: .35rem; padding: .4rem .25rem 0; justify-content: center; }

.fb-toast {
  position: fixed; right: 1rem; bottom: 5.5rem; z-index: 9300;
  background: #2c2823; color: #fff; padding: .55rem .9rem;
  border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  max-width: 320px;
}
.fb-toast--ok { background: #2f7a2f; }
.fb-toast--danger { background: #a3342d; }

/* --- Akce / family rows --- */
.event-families { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.event-family-row {
  display: flex; align-items: center; gap: .75rem; padding: .4rem .55rem;
  border: 1px solid var(--c-border); border-radius: var(--radius); background: #fff;
  flex-wrap: wrap;
}
.event-family-icon {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius); background: #fff; border: 1px solid var(--c-border); overflow: hidden;
  flex-shrink: 0;
}
.event-family-icon img { width: 100%; height: 100%; object-fit: contain; }
.event-family-icon .placeholder {
  font-weight: 700; color: var(--c-accent);
}
.event-family-name { font-weight: 700; min-width: 8rem; }
.event-family-years { display: flex; flex-wrap: wrap; gap: .35rem; }

.year-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .6rem;
  background: var(--c-primary-soft); color: var(--c-accent);
  border-radius: 999px; font-size: .85rem; cursor: pointer;
  user-select: none; border: 1px solid transparent;
}
.year-chip:hover { border-color: var(--c-primary); }
.year-chip input { margin: 0; }
.year-chip:has(input:checked) { background: var(--c-primary); color: #fff; }

#selected-events {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .55rem;
}
.event-detail-card {
  border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: .55rem .6rem; background: #fff;
  display: flex; flex-direction: column; gap: .35rem;
}
.event-detail-head {
  display: flex; align-items: center; gap: .45rem;
}
.event-detail-head img { width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; }
.event-detail-head strong { font-size: .92rem; }
.event-detail-card textarea {
  width: 100%; min-height: 2.6rem; font-size: .9rem; padding: .35rem .45rem;
}

/* contact: e-mail + telefon vedle sebe na širším displeji */
.contact-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .contact-row { grid-template-columns: 1fr; }
}
.contact-row .form-row { margin-bottom: 0; }
input[type=email]:invalid:not(:placeholder-shown),
input[type=tel]:invalid:not(:placeholder-shown) {
  border-color: var(--c-danger);
  background: #fff7f7;
}

/* --- Kompetence tree --- */
.comp-tree { display: flex; flex-direction: column; gap: .35rem; }
details.comp-area {
  background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius);
}
details.comp-area > summary {
  list-style: none; cursor: pointer;
  padding: .55rem .75rem;
  display: flex; align-items: center; gap: .65rem;
  background: var(--c-primary-soft); color: var(--c-accent);
  border-radius: var(--radius);
}
details.comp-area[open] > summary { border-bottom: 1px solid var(--c-border); border-radius: var(--radius) var(--radius) 0 0; }
details.comp-area > summary::-webkit-details-marker { display: none; }
details.comp-area > summary::before {
  content: "▸"; display: inline-block; transition: transform .12s ease;
  font-size: .8rem;
}
details.comp-area[open] > summary::before { transform: rotate(90deg); }
.comp-area-id { font-weight: 700; min-width: 2.6rem; }
.comp-area-name { font-weight: 600; flex: 1 1 auto; }
.comp-area-count {
  font-size: .8rem; padding: .1rem .55rem; border-radius: 999px;
  background: rgba(255,255,255,.55); color: var(--c-muted);
}
.comp-area-count.has-selected {
  background: var(--c-success); color: #fff;
}
.comp-list { list-style: none; padding: .25rem 0; margin: 0; }
.comp-item { padding: .35rem .9rem; border-bottom: 1px dashed var(--c-border); }
.comp-item:last-child { border-bottom: 0; }
.comp-item--checked { background: #faf6e8; }
.comp-label { display: flex; align-items: flex-start; gap: .5rem; cursor: pointer; }
.comp-label .comp-id { font-weight: 700; min-width: 3.2rem; }
.comp-detail {
  margin: .4rem 0 .3rem 1.6rem; padding: .5rem .65rem;
  background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--radius);
}
.comp-detail .form-row { margin-bottom: .5rem; }
.comp-detail textarea { min-height: 3rem; }

/* --- Mentor card bio snippet --- */
.mentor-card__bio { margin: .15rem 0 .25rem; line-height: 1.3; }
