:root {
    --bg: #f4f0e9;
    --ink: #14213d;
    --panel: #fffaf3;
    --line: #d8cfc4;
    --accent: #005f73;
    --accent-2: #ca6702;
    --muted: #5f6b76;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 18% 12%, #fff4d6 0%, transparent 38%),
        radial-gradient(circle at 85% 18%, #d6f3f8 0%, transparent 34%),
        var(--bg);
    font-family: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
    min-height: 100vh;
}

.bg-shape {
    position: fixed;
    z-index: -1;
    border-radius: 999px;
    filter: blur(40px);
    opacity: 0.5;
}

.bg-shape-1 {
    width: 340px;
    height: 340px;
    top: -120px;
    right: -70px;
    background: #ffcc80;
}

.bg-shape-2 {
    width: 280px;
    height: 280px;
    bottom: -80px;
    left: -70px;
    background: #80ced7;
}

.page {
    width: min(1100px, 92vw);
    margin: 2rem auto 3rem;
}

.hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.1rem);
    letter-spacing: 0.02em;
}

.hero-split {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
}

.hero p {
    margin: 0.5rem 0;
    color: var(--muted);
}

.hero .meta {
    font-size: 0.95rem;
}

.logs-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
}

.hero-actions {
    display: flex;
    gap: 0.5rem;
}

.filters {
    margin-top: 1.25rem;
    background: color-mix(in oklab, var(--panel) 90%, white 10%);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 14px 35px rgb(20 33 61 / 9%);
}

.logs-filters {
    margin-top: 0.75rem;
}

.line-form {
    display: flex;
    align-items: end;
    gap: 0.7rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

label {
    display: grid;
    gap: 0.45rem;
    font-weight: 600;
}

input,
select,
button,
.ghost {
    font: inherit;
}

input,
select {
    width: 100%;
    min-height: 2.55rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.actions {
    display: flex;
    align-items: end;
    gap: 0.55rem;
}

button {
    min-height: 2.55rem;
    padding: 0 1rem;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    cursor: pointer;
}

.ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.55rem;
    padding: 0 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
    background: #fff;
}

.ghost-inline {
    min-height: auto;
    padding: 0.35rem 0.65rem;
}

.cards {
    margin-top: 1.1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.9rem;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1rem;
    display: grid;
    gap: 0.6rem;
    box-shadow: 0 10px 24px rgb(20 33 61 / 8%);
    animation: card-enter 220ms ease;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgb(20 33 61 / 12%);
}

.card-main {
    display: grid;
    gap: 0.55rem;
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card h2 {
    margin: 0;
    font-size: 1.06rem;
}

.card-top,
.card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.card-top-right {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.badge {
    background: color-mix(in oklab, var(--accent) 18%, white 82%);
    color: var(--accent);
    border-radius: 999px;
    padding: 0.22rem 0.66rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.town {
    color: var(--muted);
    font-size: 0.86rem;
}

.expand-hint {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.12rem 0.5rem;
    background: #fff;
}

.location {
    margin: 0;
    color: var(--accent-2);
    font-weight: 600;
}

.post-date {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.card-thumb {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #efe8de;
}

.description {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.35;
}

.card-bottom {
    font-size: 0.85rem;
    color: var(--muted);
}

.card-bottom a {
    color: var(--accent);
}

.open-post {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
    text-decoration: none;
    background: #fff;
}

.full-description {
    margin: 0;
    color: var(--muted);
    line-height: 1.4;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.55rem;
}

.gallery-item {
    display: block;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.gallery-item img {
    width: 100%;
    height: 115px;
    object-fit: cover;
    display: block;
}

.has-modal {
    overflow: hidden;
}

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(20 33 61 / 50%);
    backdrop-filter: blur(2px);
}

.modal-dialog {
    position: relative;
    width: min(860px, 94vw);
    max-height: 86vh;
    overflow: auto;
    margin: 5vh auto;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: 0 24px 44px rgb(20 33 61 / 22%);
    padding: 1rem;
}

.modal-content {
    display: grid;
    gap: 0.8rem;
}

.modal-content h2 {
    margin: 0;
}

.modal-close {
    position: sticky;
    top: 0;
    margin-left: auto;
    display: inline-flex;
    border-radius: 8px;
    min-height: 2rem;
    align-items: center;
    padding: 0 0.65rem;
}

.empty {
    background: var(--panel);
    border: 1px dashed var(--line);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
}

.log-panel {
    margin-top: 1rem;
}

.log-output {
    margin: 0;
    padding: 1rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #101925;
    color: #d6e4f1;
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    min-height: 280px;
    max-height: 70vh;
    overflow: auto;
}

.compact-log {
    min-height: 0;
    max-height: 360px;
}

.dashboard-metrics {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
}

.metric-card,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgb(20 33 61 / 8%);
}

.metric-card {
    padding: 0.95rem 1rem;
    display: grid;
    gap: 0.35rem;
}

.metric-label,
.panel-kicker,
.muted {
    color: var(--muted);
}

.metric-label {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-value {
    font-size: 1.35rem;
}

.metric-success {
    border-color: color-mix(in oklab, var(--accent) 35%, white 65%);
}

.metric-warn {
    border-color: color-mix(in oklab, var(--accent-2) 40%, white 60%);
}

.metric-accent {
    background: color-mix(in oklab, var(--panel) 88%, #fff2dc 12%);
}

.dashboard-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 0.9rem;
}

.dashboard-grid-wide {
    grid-template-columns: 1.3fr 0.9fr;
}

.panel {
    padding: 1rem;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.panel-head h2,
.payload-preview h3,
.mini-post h3 {
    margin: 0;
}

.summary-list {
    margin: 0;
    display: grid;
    gap: 0.75rem;
}

.summary-list div {
    display: grid;
    gap: 0.18rem;
}

.summary-list dt {
    color: var(--muted);
    font-size: 0.85rem;
}

.summary-list dd {
    margin: 0;
    font-weight: 600;
}

.payload-preview {
    margin-top: 0.9rem;
}

.payload-preview pre {
    margin: 0.55rem 0 0;
    padding: 0.8rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--line);
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.table-wrap {
    overflow: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.dashboard-table th,
.dashboard-table td {
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.dashboard-table th {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-chip {
    display: inline-flex;
    padding: 0.18rem 0.48rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 0.78rem;
    text-transform: uppercase;
}

.status-ok {
    color: var(--accent);
}

.status-fetch_error,
.status-config_error {
    color: var(--accent-2);
}

.event-list,
.mini-post-list {
    display: grid;
    gap: 0.75rem;
}

.event-card,
.mini-post {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.8rem;
    background: #fff;
}

.event-success {
    border-color: color-mix(in oklab, var(--accent) 30%, white 70%);
}

.event-warn {
    border-color: color-mix(in oklab, var(--accent-2) 40%, white 60%);
}

.event-meta,
.mini-post-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.event-card p,
.mini-post p {
    margin: 0.45rem 0 0;
}

.pagination {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
}

.pagination a,
.pagination .disabled {
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}

.pagination .disabled {
    opacity: 0.5;
}

@media (max-width: 900px) {
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-metrics,
    .dashboard-grid,
    .dashboard-grid-wide {
        grid-template-columns: 1fr 1fr;
    }

    .actions {
        grid-column: span 2;
    }

    .modal-dialog {
        margin: 3vh auto;
        max-height: 92vh;
    }
}

@media (max-width: 620px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .hero-split,
    .dashboard-metrics,
    .dashboard-grid,
    .dashboard-grid-wide {
        grid-template-columns: 1fr;
        align-items: stretch;
        flex-direction: column;
    }

    .actions {
        grid-column: auto;
    }

    .logs-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .line-form {
        flex-direction: column;
        align-items: stretch;
    }
}