:root {
    color-scheme: light dark;

    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #d1d5db;
    --border-soft: #e5e7eb;
    --table-head: #f9fafb;
    --primary: #2563eb;
    --primary-text: #ffffff;
    --link: #2563eb;
    --tag-open: #15803d;
    --tag-closed: #b91c1c;
    --tag-unknown: #6b7280;
    --shadow: 0 10px 30px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --card: #111827;
        --text: #f3f4f6;
        --muted: #9ca3af;
        --border: #374151;
        --border-soft: #1f2937;
        --table-head: #1f2937;
        --primary: #3b82f6;
        --primary-text: #ffffff;
        --link: #60a5fa;
        --tag-open: #4ade80;
        --tag-closed: #f87171;
        --tag-unknown: #9ca3af;
        --shadow: 0 10px 30px rgba(0,0,0,0.35);
    }
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg);
    margin: 0;
    padding: 0;
    color: var(--text);
}

.container {
    max-width: 1200px;
    margin: 40px auto;
    background: var(--card);
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.nav {
    margin-bottom: 20px;
}

.nav a {
    margin-right: 16px;
    text-decoration: none;
    color: var(--link);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 24px;
}

th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: top;
}

th {
    background: var(--table-head);
}

th .header-title {
    font-weight: bold;
    margin-bottom: 8px;
}

th input,
th select,
th button {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-sizing: border-box;
    background: var(--card);
    color: var(--text);
    font-size: 14px;
}

th button {
    cursor: pointer;
    background: var(--primary);
    color: var(--primary-text);
    border: none;
}

.header-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.action-link {
    text-decoration: none;
    color: var(--link);
    font-size: 14px;
}

.muted {
    color: var(--muted);
}

.status-open {
    color: var(--tag-open);
    font-weight: bold;
}

.status-closed {
    color: var(--tag-closed);
    font-weight: bold;
}

.status-unknown {
    color: var(--tag-unknown);
    font-weight: bold;
}

.hidden-row {
    display: none;
}

.result-count {
    margin-top: 12px;
    color: var(--muted);
    font-size: 14px;
}

.park-status-block {
    margin: 16px 0 20px 0;
    display: grid;
    gap: 8px;
}

.park-status-item {
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--table-head);
}

.row-updated {
    animation: flashUpdate 1.5s ease;
}

@keyframes flashUpdate {
    0% {
        background-color: rgba(34, 197, 94, 0.45);
    }
    100% {
        background-color: transparent;
    }
}

.powered-by {
    margin-top: 18px;
}

.panel-card {
    margin: 20px 0;
    padding: 18px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--table-head);
}

.stack-form {
    display: grid;
    gap: 10px;
}

.stack-form input,
.stack-form select,
.stack-form textarea,
.stack-form button {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    box-sizing: border-box;
    background: var(--card);
    color: var(--text);
    font-size: 14px;
}

.stack-form textarea {
    resize: vertical;
    min-height: 96px;
}

.stack-form button,
.button-danger {
    cursor: pointer;
    background: var(--primary);
    color: var(--primary-text);
    border: none;
}

.button-danger {
    background: var(--tag-closed);
    padding: 10px 12px;
    border-radius: 10px;
}

.inline-edit-form {
    display: contents;
}

.inline-delete-form {
    margin-top: 8px;
}

.site-shell {
    padding: 24px 0 40px;
}

.site-hero {
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.18), transparent 35%),
        linear-gradient(180deg, var(--card), var(--table-head));
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 24px;
    align-items: start;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    color: var(--muted);
    font-weight: bold;
}

.hero-title {
    font-size: 48px;
    line-height: 1.05;
    margin: 10px 0 14px;
}

.hero-copy {
    font-size: 18px;
    max-width: 680px;
}

.hero-panel {
    display: grid;
    gap: 14px;
}

.site-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--primary);
    color: var(--primary-text);
    text-decoration: none;
}

.site-button-secondary {
    background: var(--table-head);
    color: var(--text);
    border: 1px solid var(--border);
}

.site-button-disabled {
    background: var(--border-soft);
    color: var(--muted);
    border: 1px solid var(--border);
    cursor: default;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.article-grid,
.article-manage-list {
    display: grid;
    gap: 18px;
}

.article-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.article-card,
.article-row {
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--card);
    padding: 18px;
}

.article-card h3,
.article-row h2 {
    margin: 8px 0 10px;
}

.article-card a,
.article-row a {
    color: var(--text);
    text-decoration: none;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

.article-category,
.article-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: bold;
}

.article-category {
    background: rgba(37, 99, 235, 0.12);
    color: var(--link);
}

.article-badge {
    background: rgba(21, 128, 61, 0.12);
    color: var(--tag-open);
}

.article-page {
    max-width: 860px;
}

.article-excerpt {
    font-size: 18px;
    color: var(--muted);
}

.article-cover {
    width: 100%;
    border-radius: 14px;
    margin: 18px 0;
    border: 1px solid var(--border-soft);
}

.article-body {
    line-height: 1.7;
    font-size: 16px;
}

.rich-content p,
.rich-content div,
.rich-content ul,
.rich-content ol,
.rich-content h1,
.rich-content h2,
.rich-content h3,
.rich-content blockquote,
.rich-content pre {
    margin: 0 0 16px;
}

.rich-content h1,
.rich-content h2,
.rich-content h3 {
    line-height: 1.2;
}

.rich-content ul,
.rich-content ol {
    padding-left: 22px;
}

.rich-content a {
    color: var(--link);
}

.rich-content blockquote {
    border-left: 4px solid var(--border);
    padding-left: 16px;
    color: var(--muted);
}

.rich-content pre {
    overflow-x: auto;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.08);
}

.wysiwyg-field {
    display: grid;
    gap: 8px;
}

trix-toolbar .trix-button-group {
    border-color: var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--card);
}

trix-toolbar .trix-button {
    background: var(--card);
    border-bottom-color: var(--border);
    color: var(--text);
}

trix-toolbar .trix-button.trix-active {
    background: var(--table-head);
}

trix-toolbar .trix-button:hover {
    background: var(--table-head);
}

trix-toolbar .trix-button-group--file-tools {
    display: none;
}

trix-editor {
    width: 100%;
    min-height: 220px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-sizing: border-box;
    background: var(--card);
    color: var(--text);
    font-size: 15px;
}

trix-editor:focus {
    outline: 2px solid rgba(37, 99, 235, 0.25);
    border-color: var(--primary);
}

trix-editor a {
    color: var(--link);
}

trix-editor blockquote {
    border-left: 4px solid var(--border);
    margin-left: 0;
    padding-left: 16px;
    color: var(--muted);
}

trix-editor pre {
    overflow-x: auto;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.08);
}

.article-source {
    margin-top: 24px;
    color: var(--muted);
    word-break: break-word;
}

.editor-help {
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: var(--card);
    color: var(--muted);
    padding: 12px 14px;
    font-size: 13px;
}

.social-box {
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--card);
    padding: 14px;
    display: grid;
    gap: 10px;
}

.social-box h3 {
    margin: 0;
}

.social-toggle-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.social-toggle-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 14px;
}

.social-queue-list {
    display: grid;
    gap: 18px;
    margin-top: 20px;
}

.social-queue-card {
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--card);
    padding: 20px;
}

.social-queue-main {
    display: grid;
    gap: 16px;
}

.social-channel-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.social-preview-box {
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: var(--table-head);
    padding: 14px;
}

.social-queue-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.social-queue-actions form {
    margin: 0;
}

.social-queue-actions button {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
}

@media (max-width: 768px) {
    .container {
        margin: 16px;
        padding: 20px;
    }

    table {
        min-width: 900px;
    }

    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 36px;
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-card {
    background: var(--table-head);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 16px;
}

.stat-card-wide {
    grid-column: span 2;
}

.stat-label {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
}

.dashboard-actions {
    margin: 20px 0;
}

@media (max-width: 768px) {
    .stat-card-wide {
        grid-column: span 1;
    }
}

.filters-scroll {
    overflow-x: auto;
    margin: 16px 0 20px 0;
    padding-bottom: 6px;
}

.filters-row {
    display: flex;
    gap: 12px;
    min-width: max-content;
}

.filter-box {
    min-width: 170px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-box label {
    font-size: 13px;
    color: var(--muted);
}

.mobile-cards {
    display: none;
    margin-top: 20px;
    gap: 12px;
}

.ride-card {
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 14px;
    background: var(--card);
    box-shadow: var(--shadow);
}

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

.ride-card-title {
    font-weight: bold;
    font-size: 16px;
}

.ride-card-wait {
    font-weight: bold;
    white-space: nowrap;
}

.ride-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

.ride-card-status {
    margin-top: 10px;
    font-weight: bold;
}

.override-form,
.override-form-mobile {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-form-stack table {
    width: 100%;
}

@media (max-width: 900px) {
    .desktop-table {
        display: none;
    }

    .mobile-cards {
        display: grid;
    }

    .container {
        margin: 12px;
        padding: 16px;
    }

    .nav {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
    }

    .header-actions {
        margin-top: 12px;
    }
}

html, body {
    overflow-x: hidden;
    max-width: 100%;
}

.container {
    max-width: 100%;
    box-sizing: border-box;
}

.admin-create-form {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
    gap: 10px;
    margin-bottom: 20px;
}

.admin-create-form input,
.admin-create-form select,
.admin-create-form button {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.desktop-table {
    display: block;
}

.mobile-cards {
    display: none;
}

.ride-card {
    width: 100%;
    box-sizing: border-box;
}

.filters-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.filters-row {
    display: flex;
    gap: 12px;
    min-width: max-content;
}

.filter-box {
    min-width: 150px;
    max-width: 180px;
    flex: 0 0 auto;
}

.filter-box input,
.filter-box select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.override-form-mobile {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.override-form-mobile select,
.override-form-mobile button {
    width: 100%;
    box-sizing: border-box;
}

.hidden-row {
    display: none !important;
}

@media (max-width: 900px) {
    .container {
        margin: 10px;
        padding: 14px;
    }

    .desktop-table {
        display: none !important;
    }

    .mobile-cards {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .admin-create-form {
        grid-template-columns: 1fr;
    }

    .ride-card-top {
        align-items: flex-start;
    }

    .ride-card-wait {
        font-size: 18px;
    }

    .nav {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    table {
        min-width: 0 !important;
    }
}
