:root {
    --bg: #f3f4f8;
    --card: #ffffff;
    --ink: #141a24;
    --ink-soft: #5f697c;
    --line: #e5e9f2;
    --brand: #1f4ed6;
    --brand-strong: #193fb0;
    --ok: #1f8b55;
    --warn: #c07617;
    --danger: #cb4335;
    --extra: #2c6fe0;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow: 0 8px 22px rgba(17, 24, 39, 0.045);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
    color: var(--ink);
    background: linear-gradient(180deg, #f7f8fb 0%, var(--bg) 100%);
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

a {
    color: var(--brand);
}

.page-shell {
    width: min(980px, 94vw);
    margin: 16px auto 32px;
}

.hero {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 18px 20px;
    box-shadow: var(--shadow);
}

.hero h1 {
    margin-bottom: 6px;
}

.hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.eyebrow {
    margin: 0 0 6px;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
}

.subline {
    margin: 4px 0 0;
    color: var(--ink-soft);
    font-size: 0.98rem;
    line-height: 1.45;
}

.subline a {
    font-weight: 700;
}

.hero-links {
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.mobile-menu-toggle {
    display: none;
}

.notice-box {
    margin-top: 12px;
    border: 1px solid #f2d8a8;
    background: #fff8ea;
    color: #7c5612;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-size: 0.92rem;
}

.toolbar {
    margin: 12px 0 14px;
    display: grid;
    gap: 10px;
}

.filters {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 10px;
}

.filters.filter-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 8px;
}

.filter-group {
    display: grid;
    gap: 6px;
}

.group-label {
    font-size: 0.74rem;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.filters.filter-form select {
    width: 100%;
}

.chip-row {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.chip {
    text-decoration: none;
    color: #2f405a;
    border: 1px solid #ced7e6;
    border-radius: 999px;
    background: #f7f9fd;
    padding: 6px 11px;
    font-size: 0.84rem;
    font-weight: 600;
    transition: 0.15s ease;
}

.chip:hover {
    border-color: #b9c6dd;
    background: #eff4fc;
}

.chip.active {
    color: #fff;
    border-color: var(--brand);
    background: var(--brand);
}

.feed-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.link-btn,
button {
    appearance: none;
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
    border-radius: 999px;
    padding: 8px 13px;
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: 0.15s ease;
}

.link-btn:hover,
button:hover {
    background: var(--brand-strong);
    transform: translateY(-1px);
}

.link-btn.subtle,
button.secondary {
    color: var(--brand);
    background: #fff;
}

.link-btn.attention {
    background: #f4ede1;
    border-color: #e4c994;
    color: #805118;
}

.link-btn.attention:hover {
    background: #efdfbf;
    border-color: #dcb775;
}

button.small-btn {
    padding: 8px 10px;
    font-size: 0.86rem;
}

button.disabled,
button:disabled {
    background: #a9b5ca;
    border-color: #a9b5ca;
    cursor: not-allowed;
}

.flash-wrap {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.flash {
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid;
    font-size: 0.92rem;
}

.flash.success {
    background: #ecfff4;
    border-color: #9ddcbb;
    color: var(--ok);
}

.flash.error {
    background: #fff1ef;
    border-color: #efb1aa;
    color: var(--danger);
}

.flash.info {
    background: #f1f7ff;
    border-color: #b6cff8;
    color: #1e4f98;
}

.event-grid,
.admin-main {
    display: grid;
    gap: 12px;
}

.event-grid {
    align-items: start;
    grid-template-columns: 1fr;
}

.event-grid.layout-list {
    gap: 24px;
}

.event-grid.layout-list .timeline-month {
    display: grid;
    gap: 12px;
}

.event-grid.layout-list .month-heading {
    margin: 0;
    font-size: 1.72rem;
    line-height: 1.1;
    letter-spacing: -0.01em;
    font-weight: 800;
    color: #101828;
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 12px 0 10px;
    background: #f7f8fb;
    box-shadow: 0 8px 0 #f7f8fb;
}

.event-grid.layout-list .month-heading::before {
    display: none;
}

.event-grid.layout-list .timeline-events {
    position: relative;
    display: grid;
    gap: 14px;
    padding-left: 0;
    overflow: visible;
}

.timeline-item {
    display: grid;
    grid-template-columns: 108px 22px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    scroll-margin-top: 84px;
}

.event-day-header {
    margin: 0;
    text-align: right;
    padding-top: 16px;
    display: grid;
    gap: 1px;
    white-space: nowrap;
}

.event-day-date {
    font-size: 0.86rem;
    color: #374151;
    font-weight: 700;
    line-height: 1;
}

.event-day-weekday {
    font-size: 0.8rem;
    color: #4b5568;
    font-weight: 600;
    line-height: 1;
}

.timeline-item-axis {
    position: relative;
    min-height: 100%;
}

.timeline-item-axis::after {
    content: "";
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #bfcbdf;
    background: #6f819c;
}

.event-grid.layout-list .timeline-events::before {
    content: "";
    position: absolute;
    left: 119px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    border-radius: 999px;
    background: #d2dbea;
}

.event-grid.layout-list .timeline-events .event-card {
    margin: 0;
}

.timeline-item.is-past .timeline-item-axis::after {
    background: #a4afc2;
}

.timeline-item.is-past .event-day-date,
.timeline-item.is-past .event-day-weekday {
    color: #8a95a9;
}

.timeline-item.state-critical .timeline-item-axis::after {
    background: var(--danger);
}

.timeline-item.state-needed .timeline-item-axis::after {
    background: var(--warn);
}

.timeline-item.state-optimal .timeline-item-axis::after {
    background: var(--ok);
}

.timeline-item.state-extra .timeline-item-axis::after {
    background: var(--extra);
}

.event-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 13px;
    box-shadow: var(--shadow);
    transition: transform 180ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.event-card.reveal-on-scroll:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px rgba(20, 30, 50, 0.08);
    border-color: #d4ddec;
}

.event-card.is-past {
    opacity: 0.78;
    background: #f7f9fc;
    border-color: #e1e8f2;
    box-shadow: none;
}

.event-card.is-past:hover {
    transform: none;
    box-shadow: 0 6px 12px rgba(20, 30, 50, 0.05);
    border-color: #d6dfec;
}

.event-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 4px;
    background: #ccd5e3;
}

.event-card.state-critical::before {
    background: var(--danger);
}

.event-card.state-needed::before {
    background: var(--warn);
}

.event-card.state-optimal::before {
    background: var(--ok);
}

.event-card.state-extra::before {
    background: var(--extra);
}

.event-card.is-party {
    overflow: hidden;
    border-color: #f0d9a7;
    background: linear-gradient(180deg, #fffdf9 0%, #ffffff 100%);
}

.event-card.is-party::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 18px;
    padding: 1.5px;
    background: linear-gradient(
        120deg,
        #ff5f57 0%,
        #ffb347 18%,
        #ffe36f 34%,
        #59d98e 50%,
        #5aa8ff 68%,
        #b984ff 84%,
        #ff5f57 100%
    );
    background-size: 260% 260%;
    background-position: 0% 50%;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 0;
    animation: rainbow-wobble 7.5s ease-in-out infinite;
}

.event-card.is-party > * {
    position: relative;
    z-index: 1;
}

.event-card.is-party::before {
    z-index: 2;
}

.timeline-item.is-party .timeline-item-axis::after {
    background: conic-gradient(
        from 0deg,
        #ff6a60,
        #ffc06a,
        #8adf98,
        #74b5ff,
        #caa0ff,
        #ff6a60
    );
    animation: rainbow-hue 6s linear infinite;
}

.event-card.empty {
    text-align: center;
    color: var(--ink-soft);
}

.event-card.priority-high {
    border-color: #f1cc90;
    background: linear-gradient(180deg, #fffdfa 0%, #ffffff 100%);
}

.event-card.is-party.priority-high {
    border-color: #f0d9a7;
    background: linear-gradient(180deg, #fffdf9 0%, #ffffff 100%);
}

.event-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.event-head h2 {
    margin-bottom: 6px;
    font-size: 1.42rem;
    line-height: 1.1;
}

.event-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mini-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d7dfea;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.76rem;
    font-weight: 700;
    color: #294364;
    background: #f6f9ff;
}

.mini-priority {
    background: #fff3de;
    border-color: #f0d1a2;
    color: #8e5c10;
}

.mini-food {
    background: #eef8ff;
    border-color: #cfe4f4;
}

.event-meta {
    margin: 0 0 6px;
}

.event-time {
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0;
    color: #6b7385;
}

.event-time-top {
    margin: 1px 0 0 auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.event-location {
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.event-detail-content {
    display: grid;
}

.progress-wrap {
    margin: 10px 0 8px;
    border: 1px solid #dce3ef;
    border-radius: 12px;
    padding: 8px;
    background: #f9fbff;
}

.progress-track {
    position: relative;
    height: 16px;
    border-radius: 999px;
    overflow: visible;
    background: #ffffff;
    border: 1px solid #d3dced;
}

.progress-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    background: transparent;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1;
}

.state-critical .progress-fill {
    background: linear-gradient(90deg, #df5a48 0%, #e9785a 100%);
}

.state-needed .progress-fill {
    background: linear-gradient(90deg, #df8450 0%, #ebb65a 100%);
}

.state-optimal .progress-fill {
    background: linear-gradient(90deg, #37a46b 0%, #247f52 100%);
}

.state-extra .progress-fill {
    background: linear-gradient(90deg, #3f84de 0%, #2c6ecd 100%);
}

.progress-slot-line {
    position: absolute;
    top: 1px;
    bottom: 1px;
    width: 1px;
    background: #c8d2e3;
    opacity: 0.95;
    pointer-events: none;
    z-index: 2;
}

.progress-slot-line.end {
    transform: translateX(-100%);
}

.progress-marker {
    position: absolute;
    top: -2px;
    width: 2px;
    height: 20px;
    border-radius: 999px;
    z-index: 3;
}

.progress-plus {
    position: absolute;
    right: -34px;
    top: -31px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid #c8d4e8;
    background: #fff;
    color: var(--extra);
    font-size: 0.78rem;
    font-weight: 700;
}

.progress-current {
    position: absolute;
    right: 0;
    top: -29px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid #c8d4e8;
    background: #fff;
    color: #111827;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0 10px;
}

.marker-min {
    background: #82332c;
}

.marker-opt-min,
.marker-opt-max {
    background: #2f5e43;
}

.marker-opt-max {
    transform: translateX(-100%);
}

.progress-legend {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.progress-legend.compact span {
    border: 1px solid #d9e1ee;
    background: #fff;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.78rem;
    color: #314866;
}

.progress-scale {
    position: relative;
    height: 36px;
    margin-top: 10px;
}

.progress-scale.circles {
    height: 40px;
}

.scale-circle {
    position: absolute;
    top: 2px;
    transform: translateX(-50%);
    width: auto;
    height: 24px;
    min-width: 44px;
    max-width: 96px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid #bcc9dd;
    background: #fff;
    color: #9099aa;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scale-circle.filled {
    border-width: 2px;
    border-color: #2f5f43;
    color: #1f2a3d;
    font-weight: 800;
}

.scale-circle.is-min {
    box-shadow: 0 0 0 1px #8b3028 inset;
}

.scale-circle.is-optimal {
    background: #f5fbf8;
}

.scale-circle.has-name {
    font-size: 0.72rem;
    font-weight: 700;
    color: #1f2a3d;
    background: #ffffff;
    border-color: #2f5f43;
}

.scale-circle.has-name.is-optimal {
    background: #f5fbf8;
}

.scale-circle.is-open {
    color: #a6afbe;
    border-style: dashed;
    border-color: #c5ccda;
    background: #fbfcfe;
}

.scale-circle.end {
    transform: translateX(-100%);
}

.scale-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 0.72rem;
    color: #8b97ad;
    line-height: 1;
}

.scale-tick::before {
    content: "";
    display: block;
    width: 1px;
    height: 7px;
    background: #d2dbea;
    margin: 0 auto 3px;
}

.scale-tick.key {
    color: #111827;
    font-weight: 700;
}

.scale-tick.key::before {
    height: 10px;
    background: #111827;
}

.scale-tick.start {
    transform: none;
}

.scale-tick.end {
    transform: translateX(-100%);
}

.progress-legend.slim {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #111827;
    gap: 10px;
}

.progress-legend.slim span {
    font-weight: 700;
}

.progress-meta-list {
    margin-top: 8px;
    display: grid;
    gap: 6px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-item.names {
    align-items: flex-start;
}

.meta-label {
    font-size: 0.98rem;
    font-weight: 700;
    color: #243248;
    min-width: 74px;
}

.meta-value {
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
}

.meta-item.requirements .meta-value {
    color: #253246;
    font-size: 0.92rem;
}

.name-bubbles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.name-bubble {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d5dfec;
    border-radius: 999px;
    background: #fff;
    color: #1f2a3d;
    font-size: 0.82rem;
    padding: 4px 10px;
    font-weight: 600;
}

.participants-empty-inline {
    font-size: 0.85rem;
    color: #6b7280;
}

.event-desc {
    margin: 0 0 12px;
    line-height: 1.45;
    color: #2e3e58;
}

.participants {
    margin-top: 2px;
}

.participants-title {
    margin: 0 0 7px;
    font-size: 0.84rem;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.participant-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.participant-list li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #d8e0ee;
    border-radius: 999px;
    padding: 5px 9px;
    background: #f8faff;
}

.participant-list.inline {
    margin: 0;
}

.participant-list.inline li {
    background: #fff;
}

.participant-comment {
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.muted {
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.event-actions {
    margin-top: 8px;
    display: grid;
    gap: 8px;
}

.event-actions .primary {
    background: #eef2fb;
    border-color: #dbe3f5;
    color: #344d87;
}

.event-actions .primary:hover {
    background: #dce6fb;
    border-color: #c1d2ef;
}

.my-state-line {
    margin: 2px 0 0;
    font-size: 0.86rem;
    color: var(--ok);
    font-weight: 700;
}

.action-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.action-main {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.btn-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 10px;
    border: 1px solid var(--brand);
    color: var(--brand);
    background: #fff;
    text-decoration: none;
    padding: 9px 11px;
    font-size: 0.86rem;
    font-weight: 700;
    transition: 0.15s ease;
}

.icon-btn.with-label {
    white-space: nowrap;
}

.icon-btn.icon-only {
    min-width: auto;
    padding: 9px 10px;
    gap: 5px;
}

.icon-btn.icon-only svg {
    width: 15px;
    height: 15px;
}

.icon-btn .download-glyph {
    opacity: 0.72;
}

.icon-btn:hover {
    background: #f5f8ff;
    border-color: #2d56ba;
    transform: translateY(-1px);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.form-panel {
    display: none;
    gap: 8px;
    border: 1px solid #dce3ef;
    border-radius: 12px;
    background: #fafcff;
    padding: 9px;
}

.form-panel.visible {
    display: grid;
}

.event-grid.is-compact-mode .event-card {
    cursor: pointer;
}

.event-grid.is-compact-mode .event-card .event-detail-content,
.event-grid.is-compact-mode .event-card .my-state-line {
    display: none;
}

.event-grid.is-compact-mode .event-card.compact-open .event-detail-content,
.event-grid.is-compact-mode .event-card.compact-open .my-state-line {
    display: grid;
}

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 420ms ease, transform 460ms ease;
}

.reveal-on-scroll.in-view {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top {
    display: none;
}

.back-to-top.visible {
    display: inline-grid;
    place-items: center;
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 40;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: rgba(15, 23, 40, 0.08);
    color: #223248;
    border-radius: 999px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.back-to-top.visible:hover {
    background: rgba(15, 23, 40, 0.14);
    transform: none;
    box-shadow: none;
}

.thanks-overlay {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    z-index: 80;
    background: rgba(16, 24, 40, 0.9);
    color: #fff;
    border-radius: 999px;
    padding: 12px 22px;
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms ease, transform 320ms ease;
}

.thanks-overlay.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

@keyframes rainbow-hue {
    from {
        filter: hue-rotate(0deg);
    }
    to {
        filter: hue-rotate(360deg);
    }
}

@keyframes rainbow-wobble {
    0% {
        background-position: 0% 50%;
        filter: hue-rotate(0deg) saturate(1.02);
    }
    50% {
        background-position: 100% 50%;
        filter: hue-rotate(16deg) saturate(1.08);
    }
    100% {
        background-position: 0% 50%;
        filter: hue-rotate(0deg) saturate(1.02);
    }
}

.meta-blocks {
    display: grid;
    gap: 12px;
    margin-top: 6px;
}

.meta-card {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    padding: 14px;
    box-shadow: var(--shadow);
}

.meta-card h2 {
    margin: 0 0 8px;
}

.meta-card p {
    margin: 0 0 8px;
    color: #34435a;
}

.party-card {
    background: linear-gradient(135deg, #fff6ea 0%, #fffef8 100%);
    border-color: #f0d8b1;
}

.party-card h2 {
    color: #6d3f05;
}

.my-state {
    margin: 0;
    font-weight: 700;
    color: var(--ok);
    font-size: 0.9rem;
}

.inline-form,
.stack-form,
.compact-form {
    display: grid;
    gap: 8px;
}

.inline-form label,
.stack-form label,
.join-form label {
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #c8d3e5;
    border-radius: 10px;
    background: #fff;
    padding: 9px 10px;
    font-size: 0.95rem;
    color: var(--ink);
}

input[type="checkbox"] {
    width: auto;
    border: 0;
    padding: 0;
    accent-color: var(--brand);
}

.checkbox-line {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
}

textarea {
    resize: vertical;
}

.inline-danger button {
    border-color: var(--danger);
    background: var(--danger);
}

.admin-card {
    display: grid;
    gap: 12px;
}

.admin-sync-primary {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.admin-advanced {
    margin-top: 10px;
}

.admin-advanced-body {
    display: grid;
    gap: 8px;
    padding: 0 12px 12px;
}

.admin-debug-log {
    margin-top: 8px;
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 10px;
    max-height: 280px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.35;
}

.admin-backup-row {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
}

.admin-backup-row .muted {
    overflow-wrap: anywhere;
}

.admin-events-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.admin-events-head h2 {
    margin: 0;
}

.admin-events-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-events-note {
    margin: 6px 0 12px;
}

.link-btn.compact {
    padding: 7px 12px;
    font-size: 0.84rem;
}

.admin-main .event-card::before {
    display: none;
}

.admin-disclosure {
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}

.admin-disclosure + .admin-disclosure {
    margin-top: 10px;
}

.admin-disclosure > summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    font-weight: 700;
    display: block;
    position: relative;
    padding-right: 34px;
}

.admin-disclosure > summary::-webkit-details-marker {
    display: none;
}

.admin-disclosure > summary::after {
    content: "▾";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #6a7588;
    transition: transform 0.18s ease;
}

.admin-disclosure[open] > summary::after {
    transform: translateY(-50%) rotate(180deg);
}

.create-disclosure > summary {
    color: #1f4ed6;
}

.admin-event-disclosure > summary {
    color: #182237;
}

.admin-event-summary {
    display: grid;
    gap: 8px;
}

.admin-event-main {
    display: grid;
    gap: 3px;
}

.admin-event-main strong {
    font-size: 1rem;
}

.admin-event-main span {
    font-size: 0.86rem;
    color: #5f6a7f;
}

.admin-event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.admin-event-disclosure .event-card {
    border: 0;
    box-shadow: none;
    border-top: 1px solid #e4e9f2;
    border-radius: 0 0 14px 14px;
}

.admin-participants ul {
    list-style: none;
    padding: 0;
}

.admin-participants li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: start;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--line);
}

/* Admin mobile/tablet tuning */
@media (max-width: 860px) {
    .admin-shell {
        width: min(100%, 97vw);
        margin: 10px auto 22px;
    }

    .admin-shell .hero h1 {
        font-size: 1.48rem;
    }

    .admin-shell .subline {
        font-size: 0.92rem;
    }

    .admin-main {
        gap: 10px;
    }

    .admin-shell .event-card,
    .admin-shell .admin-disclosure {
        border-radius: 12px;
    }

    .admin-disclosure > summary {
        padding: 12px 38px 12px 12px;
    }

    .admin-event-summary {
        gap: 7px;
    }

    .admin-event-main strong {
        font-size: 1.02rem;
        line-height: 1.25;
    }

    .admin-event-main span {
        font-size: 0.83rem;
    }

    .admin-event-meta {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .admin-event-meta .mini-badge {
        justify-content: center;
        min-height: 28px;
        font-size: 0.74rem;
        padding: 5px 8px;
    }

    .admin-shell input,
    .admin-shell select,
    .admin-shell textarea,
    .admin-shell button {
        min-height: 44px;
        font-size: 16px;
    }

    .admin-shell textarea {
        min-height: 96px;
    }

    .admin-sync .inline-form button,
    .admin-create .stack-form button,
    .admin-card .stack-form button,
    .admin-card .inline-form button {
        width: 100%;
    }

    .admin-participants li {
        grid-template-columns: 1fr;
    }

    .admin-participants .inline-form button {
        width: 100%;
    }

    .admin-sync code {
        display: inline-block;
        max-width: 100%;
        white-space: normal;
        word-break: break-all;
    }

    .admin-events-head {
        align-items: flex-start;
    }

    .admin-events-tools {
        width: 100%;
        justify-content: space-between;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

code {
    background: #f3f6fb;
    border: 1px solid #d7e1ef;
    padding: 1px 5px;
    border-radius: 6px;
    font-size: 0.83rem;
}

@media (min-width: 1040px) {
    .event-grid.layout-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .event-grid.layout-list {
        grid-template-columns: 1fr;
    }

    .toolbar {
        grid-template-columns: 1fr auto;
        align-items: start;
    }

    .meta-blocks {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .page-shell {
        width: min(100%, 96vw);
        margin-top: 10px;
    }

    .hero,
    .event-card {
        padding: 12px;
    }

    .event-head h2 {
        font-size: 1.4rem;
        margin-bottom: 4px;
    }

    .event-time {
        font-size: 0.74rem;
    }

    .event-meta {
        margin-bottom: 4px;
    }

    .event-grid.layout-list .month-heading {
        font-size: 1.42rem;
        top: 0;
        padding: 8px 0 8px;
        box-shadow: 0 6px 0 #f7f8fb;
    }

    .event-grid.layout-list .month-heading::before {
        display: none;
    }

    .filters.filter-form {
        grid-template-columns: 1fr;
    }

    .event-grid.layout-list .timeline-events::before {
        display: none;
    }

    .timeline-item {
        grid-template-columns: 1fr;
        gap: 6px;
        scroll-margin-top: 64px;
    }

    .timeline-item-axis {
        display: none;
    }

    .event-day-header {
        text-align: left;
        padding-top: 0;
        display: inline-flex;
        gap: 6px;
        align-items: baseline;
    }

    .event-day-date,
    .event-day-weekday {
        font-size: 0.84rem;
    }

    .back-to-top.visible {
        top: 10px;
        right: 10px;
    }

    .feed-links {
        display: grid;
    }

    .icon-btn.with-label {
        min-width: 104px;
    }

    .hero-links {
        display: none;
        position: fixed;
        top: 56px;
        right: 10px;
        z-index: 70;
        width: min(240px, calc(100vw - 20px));
        background: #ffffff;
        border: 1px solid #d9e1ef;
        border-radius: 12px;
        box-shadow: 0 10px 24px rgba(20, 30, 50, 0.12);
        padding: 10px;
        gap: 8px;
    }

    .hero-links.is-open {
        display: grid;
        grid-template-columns: 1fr;
    }

    .mobile-menu-toggle {
        display: inline-grid;
        place-items: center;
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 72;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 1px solid #d0d8e7;
        border-radius: 10px;
        background: #fff;
        color: #223248;
        font-size: 1.05rem;
        line-height: 1;
        box-shadow: 0 8px 18px rgba(20, 30, 50, 0.12);
    }

    .mobile-menu-toggle:hover {
        background: #f6f8fc;
        transform: none;
    }

    .hero-links .link-btn {
        width: 100%;
        justify-content: center;
    }

    .hero-top {
        display: grid;
        gap: 8px;
    }

    .admin-disclosure > summary {
        padding: 10px 12px;
    }

    .admin-shell .hero h1 {
        font-size: 1.32rem;
    }

    .admin-shell .subline {
        font-size: 0.88rem;
    }

    .admin-event-meta {
        grid-template-columns: 1fr;
    }

    .admin-event-meta .mini-badge {
        justify-content: flex-start;
    }

    .admin-shell .feed-links {
        grid-template-columns: 1fr;
    }

    .admin-shell .feed-links .inline-form button,
    .admin-shell .feed-links .link-btn {
        width: 100%;
    }

    .meta-label {
        min-width: 66px;
        font-size: 0.92rem;
    }

    .meta-value,
    .name-bubble {
        font-size: 0.8rem;
    }

    .scale-circle.has-name {
        max-width: 72px;
        font-size: 0.68rem;
        padding: 0 6px;
    }

    .scale-circle {
        min-width: 40px;
        max-width: 72px;
        font-size: 0.64rem;
        padding: 0 6px;
    }
}
