:root {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #e2e8f0;
    background: #0f172a;
    font-size: 14px;
    line-height: 1.5;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

h1, h2, p {
    margin-top: 0;
}

h1 {
    font-size: 22px;
}

h2 {
    font-size: 17px;
}

a {
    color: #a5b4fc;
}

header {
    margin-left: 220px;
    padding: 15px 28px;
    background: #0b1120;
    border-bottom: 1px solid #ffffff12;
}

main {
    margin: 0 0 0 220px;
    padding: 28px;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 220px;
    padding: 20px 14px;
    background: #0b1120;
    border-right: 1px solid #ffffff12;
}

.sidebar .brand {
    display: block;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    color: #e2e8f0;
}

.sidebar p {
    margin: 8px 0 28px;
    color: #94a3b8;
    overflow-wrap: anywhere;
}

.sidebar nav a {
    display: block;
    padding: 8px 14px;
    border-radius: 6px;
    margin-top: 4px;
    background: transparent;
    text-decoration: none;
}

.sidebar nav a[aria-current="page"] {
    background: #6366f126;
}

.form-card .settings-section-title {
    margin: 0 0 20px;
}

.form-card.settings-navigation {
    max-width: 1100px;
}

.settings-menu {
    border: 1px solid #ffffff1f;
    border-radius: 8px;
    padding: 20px;
    margin: 24px 0;
    min-width: 0;
}

.settings-menu legend {
    padding: 0 8px;
    color: #cbd5e1;
    font-weight: 600;
}

.settings-menu > .check-label {
    margin-bottom: 16px;
}

.settings-menu-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(150px, 1.4fr) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 12px;
}

.settings-menu-row label {
    font-size: 13px;
    color: #94a3b8;
}

.settings-menu-actions {
    display: flex;
    gap: 4px;
    padding-bottom: 4px;
}

.settings-menu-actions[hidden], [data-menu-add][hidden] {
    display: none;
}

.settings-menu input:disabled {
    opacity: .55;
}

.settings-menu .hint {
    margin-top: 12px;
}

.settings-save .form-hint {
    margin-bottom: 16px;
}

@media (max-width: 760px) {
    .settings-menu-row {
        grid-template-columns: 1fr;
        padding: 12px 0;
        border-bottom: 1px solid #ffffff12;
    }

    .settings-menu {
        padding: 12px;
    }
}

form, label {
    display: grid;
    gap: 8px;
}

form {
    gap: 20px;
}

label {
    font-weight: 500;
}

input, button, select, textarea {
    width: 100%;
    padding: 12px 15px;
    font: inherit;
    border-radius: 5px;
}

input, select, textarea {
    border: 2px solid #e0e0e0;
    background: #fff;
    color: #333;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-color: #667eea;
}

button {
    border: 0;
    color: #fff;
    background: #6366f1;
    cursor: pointer;
    font-weight: 600;
}

button:focus-visible, a:focus-visible {
    outline: 3px solid #a5b4fc;
    outline-offset: 3px;
}

.secondary {
    width: auto;
    padding: 8px 16px;
}

.error {
    color: #c33;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 5px;
    padding: 12px 15px;
}

.eyebrow, small {
    display: block;
    color: #94a3b8;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #1e293b;
}

th, td {
    padding: 12px;
    border-bottom: 1px solid #ffffff12;
    text-align: left;
    overflow-wrap: anywhere;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
}

.auth-page main {
    width: 100%;
    margin: 0;
    padding: 0;
}

.card {
    width: 100%;
    max-width: 400px;
    margin: auto;
    padding: 40px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px #0003;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    margin-bottom: 0;
}

.login-header .site-name {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

.auth-page button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-size: 16px;
}

.auth-page button:hover {
    box-shadow: 0 5px 15px #667eea66;
}

.form-card {
    display: block;
    padding: 28px;
    margin-bottom: 24px;
    background: #1e293b;
    border: 1px solid #ffffff12;
    border-radius: 8px;
    max-width: 760px;
}

.form-card h2 {
    margin: 8px 0 0;
}

.form-card input, .form-card textarea, .form-card select {
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #475569;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.form-group {
    display: flex;
    flex: 1;
    min-width: 180px;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.form-group-lg {
    flex: 2;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
}

.form-group input, .form-group select, .form-group textarea {
    padding: 8px 12px;
    border-color: #ffffff1f;
    border-radius: 6px;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px #6366f126;
}

.form-card--rich-text {
    width: min(100%, 1400px);
    max-width: 1400px;
}

.form-card .rich-text-code-editor {
    min-height: 65vh;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.55;
    tab-size: 4;
    white-space: pre;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    width: auto;
    color: #fff;
    background: #6366f1;
    border: 0;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    background: #4f46e5;
}

.btn-ghost {
    color: #94a3b8;
    background: #253047;
    border: 1px solid #ffffff12;
}

.btn-ghost:hover {
    color: #e2e8f0;
    background: #334155;
}

.btn-sm {
    font-size: 12px;
    padding: 4px 10px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0;
    font-size: 20px;
}

.form-hint {
    color: #94a3b8;
    font-size: 12.5px;
    margin: 0 0 16px;
}

.form-actions {
    margin-top: 16px;
}

.form-checks {
    margin: 0 0 20px;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    cursor: pointer;
}

.check-label input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #6366f1;
}

.req {
    color: #ef4444;
}

.breadcrumbs {
    font-size: 12.5px;
    margin: 3px 0 0;
}

.breadcrumbs a, .muted {
    color: #94a3b8;
    font-weight: 400;
}

.block-list-section {
    padding: 0;
}

.block-list-section h2 {
    font-size: 16px;
    margin: 0 0 12px;
}

.block-list {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.block-row {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #1e293b;
    border: 1px solid #ffffff12;
    border-radius: 8px;
}

.block-order {
    color: #94a3b8;
    min-width: 20px;
    font-size: 13px;
}

.block-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.block-summary strong {
    font-size: 15px;
}

.block-excerpt {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #a8b5c7;
    font-size: 13px;
}

[data-block-order-form] {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
}

[data-block-order-actions][hidden] {
    display: none;
}

.block-position-controls:not([hidden]) {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.block-position-controls .btn {
    padding: 5px 8px;
}

[data-block-drag] {
    cursor: grab;
}

.block-dragging {
    opacity: 0.45;
}

@media (max-width: 600px) {
    .block-row {
        gap: 10px;
        padding: 12px;
    }

    .block-position-controls:not([hidden]) {
        flex-direction: column;
    }
}

code {
    background: #ffffff12;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12.5px;
    color: #a5b4fc;
    overflow-wrap: anywhere;
}

.badge {
    padding: 2px 8px;
    background: #475569;
    border-radius: 4px;
    font-size: 11px;
}

.empty-state {
    background: #1e293b;
    border: 1px solid #ffffff12;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    color: #94a3b8;
    margin-bottom: 16px;
}

.block-type-picker {
    margin-bottom: 16px;
}

.code-field {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 13px;
}

.link-card-section {
    border: 1px solid #ffffff12;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 0 0 20px;
}

.link-card-section legend {
    padding: 0 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #94a3b8;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.button {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    background: #6366f1;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.button.secondary {
    background: #253047;
}

.compact {
    width: auto;
    justify-self: start;
}

.page-heading {
    margin-bottom: 20px;
}

.page-heading h1, .page-heading h2 {
    margin-bottom: 0;
}

.page-heading .hint {
    margin-top: 8px;
}

.hint {
    color: #94a3b8;
    font-size: 13px;
    margin: 0;
}

.notice {
    color: #bbf7d0;
    background: #14532d;
    padding: 12px 16px;
    border-radius: 6px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
}

.checkbox input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.danger {
    background: #b91c1c;
}

.danger-zone {
    border-color: #ef444466;
}

.table-scroll {
    overflow-x: auto;
}

.add-block {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
}

.add-block label {
    flex: 1;
    min-width: 180px;
}

@media (max-width: 640px) {
    .sidebar {
        position: static;
        width: 100%;
        border-right: 0;
    }

    .sidebar p {
        margin-bottom: 12px;
    }

    header, main {
        margin-left: 0;
    }

    main {
        padding: 20px;
    }

    .card {
        padding: 28px 24px;
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .form-card {
        padding: 18px;
    }

}
.media-toolbar, .media-pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin: 24px 0;
}

.media-search {
    flex: 1 1 280px;
}

.media-search label {
    display: block;
    margin-bottom: 8px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: 18px;
}

.media-card {
    padding: 16px;
    border: 1px solid var(--border, #ffffff1f);
    border-radius: 10px;
    min-width: 0;
}

.media-card a, .media-name {
    overflow-wrap: anywhere;
}

.media-card img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: contain;
    background: #252936;
    border-radius: 6px;
    margin-bottom: 12px;
}

.media-detail-image {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 420px;
    object-fit: contain;
    margin-bottom: 20px;
    background: #252936;
}

.media-picker-dialog {
    width: min(1100px, 94vw);
    height: 90vh;
    max-width: 94vw;
    max-height: 94vh;
    padding: 16px;
    border: 1px solid var(--border, #ffffff1f);
    border-radius: 12px;
    background: #171a24;
    color: #fff;
}

.media-picker-dialog::backdrop {
    background: rgb(0 0 0 / 65%);
}

.media-picker-dialog iframe {
    display: block;
    width: 100%;
    height: calc(100% - 56px);
    border: 0;
    margin-top: 12px;
}
.page-tree-table {
    min-width: 800px;
}

.page-tree-table td:first-child {
    min-width: 280px;
}

.page-tree-table td:nth-child(3) {
    white-space: nowrap;
}
.page-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid #64748b;
    border-radius: 999px;
    background: #334155;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.page-state--published {
    background: #123c2a;
    border-color: #2e8051;
    color: #b6f5cf;
}

.page-state--draft {
    background: #493514;
    border-color: #aa7b25;
    color: #ffe1a3;
}

.page-state--internal {
    background: #312651;
    border-color: #7655ae;
    color: #dfd2ff;
}

.page-public-title {
    color: #e2e8f0;
    font-weight: 500;
    text-decoration: none;
}

.page-public-title:hover {
    color: #fff;
    text-decoration: underline;
}

.page-public-route {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border: 1px solid #475569;
    border-radius: 6px;
    background: #0f172a;
    color: #c7d2fe;
    text-decoration: none;
}

.page-public-route code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.page-public-route:hover {
    background: #273449;
    border-color: #94a3b8;
}

.page-public-title:focus-visible, .page-public-route:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 3px;
}

.page-order-controls {
    display: inline-flex;
    gap: 3px;
    vertical-align: middle;
    margin-right: 8px;
}
.page-order-controls button {
    width: auto;
    padding: 4px 7px;
    background: #334155;
    color: #e2e8f0;
}
[data-page-drag] { cursor: grab; }
.page-dragging { opacity: 0.5; }
[data-page-order-form] { margin-bottom: 12px; }

.block-repeater {
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid #475569;
    border-radius: 8px;
}
.block-repeater .form-card {
    width: 100%;
    min-width: 0;
    padding: 14px;
    margin-bottom: 12px;
}
.block-repeater .block-repeater {
    padding: 10px;
}
.block-repeater legend,
.block-repeater label,
.block-repeater summary {
    overflow-wrap: anywhere;
}
@media (max-width: 768px) {
    .block-repeater,
    .block-repeater .block-repeater {
        padding: 6px;
    }
    .block-repeater .form-card {
        padding: 8px;
    }
}
