* { box-sizing: border-box; }
body {
    margin: 0; font-family: "Segoe UI", Arial, sans-serif;
    background: #f6f1ea; color: #2d2a26;
}
.container { max-width: 1000px; margin: 0 auto; padding: 24px 16px; }
.container.narrow { max-width: 440px; text-align: center; }
h1 { color: #b3261e; margin-top: 0; }
h2 { margin-top: 0; font-size: 1.2rem; }
h3 { margin: 0; font-size: 1.05rem; }
.top { display: flex; justify-content: space-between; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card {
    background: #fff; border-radius: 12px; padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06); margin-bottom: 16px;
}
.grid .card { margin-bottom: 0; }
input, select {
    width: 100%; padding: 10px 12px; margin-bottom: 10px;
    border: 1px solid #d8d2c8; border-radius: 8px; font-size: 1rem;
}
button {
    background: #1f6f43; color: #fff; border: 0; border-radius: 8px;
    padding: 10px 16px; font-size: 1rem; cursor: pointer;
}
button:hover { opacity: .9; }
button.big { font-size: 1.2rem; padding: 14px 28px; }
button.danger { background: #b3261e; }
button.small { padding: 4px 10px; font-size: .8rem; }
button.link-btn { background: none; color: #b3261e; }
.link { color: #1f6f43; }
.muted { color: #7a736a; font-size: .9rem; }
.alert { padding: 10px 14px; border-radius: 8px; }
.alert.success { background: #e3f3e8; color: #1f6f43; }
.alert.error { background: #fbe4e2; color: #b3261e; }
.family-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.family ul { list-style: none; padding: 0; margin: 0; }
.family li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px solid #f0ebe3;
}
.family li form, .family-head form { margin: 0; }
.badge { background: #f0ebe3; border-radius: 10px; padding: 2px 8px; font-size: .8rem; }
.tag { background: #f5c542; color: #4a3b00; border-radius: 6px; padding: 1px 6px; font-size: .75rem; margin-left: 4px; }
table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid #f0ebe3; }
code { background: #f6f1ea; padding: 3px 8px; border-radius: 6px; font-size: 1rem; letter-spacing: 2px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: .9rem; }
.check input { width: auto; margin: 0; }
input[type=file] { padding: 8px; background: #faf8f4; }
code.plain { letter-spacing: 0; font-size: .85rem; }
.progress { background: #f0ebe3; border-radius: 10px; height: 14px; overflow: hidden; margin-bottom: 16px; }
.progress div { background: #1f6f43; height: 100%; transition: width .3s; }
.pending-title { color: #b3261e; }
tr.pending td { background: #fff7f6; }
.status { font-weight: 600; font-size: .9rem; }
.status.ok { color: #1f6f43; }
.status.wait { color: #b3261e; }
.lead { font-size: 1.05rem; }
.rsvp { display: inline-block; font-size: .75rem; font-weight: 600; border-radius: 6px; padding: 1px 7px; margin-top: 3px; }
.rsvp.yes  { background: #e3f3e8; color: #1f6f43; }
.rsvp.no   { background: #fbe4e2; color: #b3261e; }
.rsvp.none { background: #f0ebe3; color: #7a736a; }
.rsvp-btns { display: flex; gap: 6px; margin: 0; flex-shrink: 0; }
.rsvp-btns button { padding: 6px 10px; font-size: .85rem; background: #fff; border: 1.5px solid; }
.rsvp-btns button.yes { color: #1f6f43; border-color: #1f6f43; }
.rsvp-btns button.no  { color: #b3261e; border-color: #b3261e; }
.rsvp-btns button.yes.active { background: #1f6f43; color: #fff; }
.rsvp-btns button.no.active  { background: #b3261e; color: #fff; }
.rsvp-btns.compact button { padding: 2px 7px; font-size: .75rem; }
.row-actions { display: flex; align-items: center; gap: 6px; }
.nav a { margin-left: 14px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input { width: auto; flex: 1 1 220px; margin: 0; }
.draw-link { text-align: center; padding: 22px; }
.draw-link .btn-big {
    display: inline-block; background: #b3261e; color: #fff; text-decoration: none;
    font-size: 1.2rem; font-weight: 600; padding: 14px 28px; border-radius: 10px;
}
.draw-link.locked { background: #faf8f4; border: 2px dashed #d8d2c8; box-shadow: none; }
.draw-link.locked .btn-big { background: #c9c2b8; cursor: not-allowed; }
/* Readable text when a background picture is used */
.has-bg .container > h1,
.has-bg .container > h2,
.has-bg .container > p:not(.alert),
.has-bg .top {
    background: rgba(255,255,255,.9); border-radius: 10px; padding: 8px 14px;
}
.has-bg .container > h1 { display: inline-block; }
.has-bg .top h1 { background: none; padding: 0; }
.has-bg .card { background: rgba(255,255,255,.95); }
.has-bg .draw-link.locked { background: rgba(250,248,244,.95); }
.bg-preview { width: 100%; max-height: 160px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; display: block; }
.code-box { text-align: center; border: 2px solid #1f6f43; }
.big-code {
    font-family: Consolas, monospace; font-size: 2.2rem; font-weight: bold; letter-spacing: 6px;
    color: #1f6f43; background: #e3f3e8; border-radius: 10px; padding: 10px; margin: 10px auto; max-width: 320px;
}
/* Events */
.event-bar { border-top: 4px solid #b3261e; }
.event-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.event-title { margin: 2px 0; font-size: 1.4rem; color: #b3261e; }
.switcher select { margin: 0; min-width: 220px; }
details { margin-top: 14px; border-top: 1px solid #f0ebe3; padding-top: 10px; }
summary { cursor: pointer; font-weight: 600; color: #1f6f43; padding: 4px 0; }
.grid.tight { margin: 12px 0 0; gap: 20px; }
.field-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.new-event { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-top: 10px; }
.new-event input, .new-event select { margin: 0; }
.summary { margin: 0 0 16px; }
.section-title { margin-top: 8px; }
.event-list { list-style: none; padding: 0; margin: 0; }
.event-list a { display: block; padding: 14px; border-radius: 10px; text-decoration: none; color: inherit; border: 1px solid #f0ebe3; margin-bottom: 10px; background: #fff; }
.event-list a:hover { border-color: #1f6f43; }
.event-list strong { color: #b3261e; font-size: 1.1rem; }
textarea {
    width: 100%; padding: 10px 12px; margin-bottom: 10px; border: 1px solid #d8d2c8;
    border-radius: 8px; font: inherit; font-size: .95rem; resize: vertical;
}
.new-event textarea { margin: 0; }
.span-all { grid-column: 1 / -1; }
.event-note { border-left: 4px solid #f5c542; line-height: 1.5; text-align: left; }
.event-note.small-note { margin-top: 8px; padding: 6px 10px; background: #fffaf0; border-radius: 6px; font-size: .9rem; }
.event-note.inline { margin: 14px 0; padding: 10px 12px; background: #fffaf0; border-radius: 8px; font-size: .95rem; }
/* ---------- Organizer left menu ---------- */
html { scroll-behavior: smooth; }
.admin-layout { display: flex; align-items: flex-start; min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; width: 250px; flex-shrink: 0; overflow-y: auto;
    background: #1f3d2c; color: #f6f1ea; padding: 18px 12px 24px;
}
.has-bg .sidebar { background: rgba(22, 52, 36, .95); }
.sb-brand { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 1.1rem; padding: 4px 10px 6px; }
.sb-toggle { display: none; }
.sb-label { font-size: .72rem; text-transform: uppercase; letter-spacing: 1.2px; color: #a9c4b2; margin: 18px 10px 6px; }
.sb-nav a {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    color: #f6f1ea; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; margin-bottom: 2px;
}
.sb-nav a:hover { background: rgba(255, 255, 255, .09); }
.sb-nav a.active { background: rgba(255, 255, 255, .14); box-shadow: inset 3px 0 0 #f5c542; }
.sb-nav a.sb-event { flex-direction: column; align-items: flex-start; gap: 0; }
.sb-event small { color: #a9c4b2; font-size: .75rem; }
.sb-nav a.sb-event.current { background: #b3261e; }
.sb-event.current small { color: #ffd9d6; }
.sb-count { background: rgba(255, 255, 255, .16); border-radius: 10px; padding: 0 8px; font-size: .75rem; }
.sb-ext { opacity: .6; font-size: .85rem; }
.admin-main { flex: 1; min-width: 0; }
[id^="sec-"] { scroll-margin-top: 16px; }

@media (max-width: 900px) {
    .admin-layout { display: block; }
    .sidebar { position: sticky; top: 0; z-index: 50; height: auto; width: auto; padding: 10px 16px; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
    .sb-brand { padding: 0; }
    .sb-toggle { display: inline-block; background: rgba(255, 255, 255, .14); padding: 7px 14px; font-size: .95rem; }
    .sb-nav { display: none; max-height: 75vh; overflow-y: auto; padding: 6px 0 4px; }
    .sidebar.open .sb-nav { display: block; }
    [id^="sec-"] { scroll-margin-top: 70px; }
}

.flash-details { margin: 8px 0 0; padding-left: 20px; font-size: .9rem; color: #4a453f; }
.flash-details li { margin: 2px 0; }
button.star { color: #c99a00; font-size: 1rem; }
.reveal { font-size: 2rem; font-weight: bold; color: #b3261e; margin: 10px 0; }
