* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #f5f6f8;
    color: #1f2933;
}

.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

.site-header {
    padding: 1.5rem 0 0.5rem;
    text-align: center;
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-logo {
    width: 72px;
    height: auto;
    display: block;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.18);
}

.site-title-group {
    text-align: left;
}

.site-header h1 {
    margin: 0;
    font-size: 1.8rem;
}

.site-nav {
    position: sticky;
    top: 0;
    background: #0f172a;
    z-index: 10;
    padding: 0.5rem 0;
}

.site-nav .container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.site-nav-inner {
    align-items: center;
    justify-content: flex-start;
}

.blog-switcher {
    margin-left: auto;
}

.blog-switcher form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #cbd5f5;
}

.blog-switcher label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: inherit;
}

.blog-switcher select {
    border-radius: 999px;
    border: none;
    padding: 0.3rem 0.9rem;
    background: #1d4ed8;
    color: #fff;
}

.nav-link {
    color: #cbd5f5;
    text-decoration: none;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.95rem;
}

.nav-link.active,
.nav-link:hover {
    background: #1d4ed8;
    color: #fff;
}

main {
    padding: 1rem 0 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

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

.card.nested {
    margin-top: 1.5rem;
    background: #f8fafc;
}

form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

label {
    font-weight: 600;
    color: #334155;
    display: flex;
    flex-direction: column;
    font-size: 0.95rem;
    gap: 0.3rem;
}

input[type="text"],
input[type="number"],
textarea {
    padding: 0.6rem 0.8rem;
    border: 1px solid #cbd5f5;
    border-radius: 8px;
    font: inherit;
    background: #fff;
}

select,
input[type="time"],
input[type="url"] {
    padding: 0.6rem 0.8rem;
    border: 1px solid #cbd5f5;
    border-radius: 8px;
    font: inherit;
    background: #fff;
}

textarea {
    resize: vertical;
}

.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.primary-btn,
button {
    border: none;
    border-radius: 999px;
    padding: 0.7rem 1.6rem;
    background: #1d4ed8;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background: #1a3fb5;
}

button:disabled,
button[disabled] {
    background: #94a3b8;
    cursor: not-allowed;
}

.btn-error {
    background: #ef4444;
    color: #fff;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    font-weight: 600;
}

.btn-error:hover {
    background: #dc2626;
}

.primary-btn {
    align-self: flex-start;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

th,
td {
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    padding: 0.6rem;
    font-size: 0.95rem;
}

th {
    background: #f8fafc;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.status-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.status-grid,
.expertise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.status-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 0.9rem;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

.badge.green {
    background: #dcfce7;
    color: #166534;
}

.badge.red {
    background: #fee2e2;
    color: #b91c1c;
}

.log-output {
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.85rem;
    padding: 1rem;
    border-radius: 10px;
    max-height: 320px;
    overflow: auto;
}

.log-output.small {
    font-size: 0.78rem;
    max-height: 200px;
}

.manual-result {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.event-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.event-row > div {
    flex: 1 1 220px;
}

.alert {
    padding: 0.9rem 1.1rem;
    border-radius: 8px;
    font-weight: 600;
}

.alert.success {
    background: #dcfce7;
    color: #14532d;
}

.alert.error {
    background: #fee2e2;
    color: #7f1d1d;
}

.alert.info {
    background: #e0f2fe;
    color: #075985;
}

.alert.warning {
    background: #fef3c7;
    color: #92400e;
}

.button-link {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.inline-form input[type="number"] {
    width: 70px;
}

.style-profile-grid,
.quality-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.style-guidelines,
.data-list,
.action-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.9rem;
}

.style-guidelines li,
.action-list li {
    margin-bottom: 0.25rem;
}

.data-list {
    list-style: none;
    padding-left: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.data-list li {
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.post-card__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
}

.post-card__meta p {
    margin: 0;
    font-size: 0.85rem;
    color: #475569;
}

.post-form textarea[disabled],
.post-form input[disabled] {
    background: #f1f5f9;
    color: #94a3b8;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.pagination-card {
    text-align: center;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
}

.pagination .btn {
    text-decoration: none;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    background: #e0e7ff;
    color: #1d4ed8;
    font-weight: 600;
}

.test-payload {
    margin-top: 1rem;
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 10px;
}

.test-payload summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.test-payload pre {
    max-height: 320px;
    overflow: auto;
    background: transparent;
    color: inherit;
    font-size: 0.85rem;
}

.quality-summary {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.quality-actions {
    margin-bottom: 1rem;
}

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

.muted {
    color: #64748b;
    font-size: 0.9rem;
}

.hint {
    color: #475569;
    font-size: 0.85rem;
}

.insights {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.insights li {
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #e2e8f0;
}

.excerpt {
    background: #f8fafc;
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    max-height: 220px;
    overflow-y: auto;
}

.readonly-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    padding: 0.5rem 0;
}

.table-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.topic-description-cell {
    min-width: 220px;
}

.topic-description-text {
    font-size: 0.9rem;
    white-space: pre-line;
}

.topic-description-editor {
    margin-top: 0.4rem;
}

.topic-description-editor summary {
    cursor: pointer;
    color: #1d4ed8;
    font-weight: 600;
}

.topic-description-form {
    margin-top: 0.4rem;
}

.topic-description-form textarea {
    width: 100%;
}

.global-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #0f172a;
    color: #f8fafc;
    padding: 0.85rem 1.1rem;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.3);
    max-width: 280px;
    font-size: 0.9rem;
    transform: translateY(120%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s ease-out, opacity 0.25s ease-out, visibility 0.25s;
    z-index: 100;
}

.global-toast.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.global-toast strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.global-toast span {
    display: block;
    font-size: 0.82rem;
    color: #cbd5f5;
}

.site-footer {
    text-align: center;
    padding: 2rem 0;
    font-size: 0.85rem;
    color: #475569;
}

@media (min-width: 800px) {
    .card {
        padding: 2rem;
    }

    .quality-summary {
        flex-direction: row;
    }

    .quality-summary > div {
        flex: 1;
    }
}

@media (max-width: 600px) {
    .site-title-group {
        text-align: center;
    }
}
