:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}

body {
    margin: 0;
    background: #f5f6f8;
    color: #1b1f24;
}

.topbar {
    background: #1b1f24;
    color: #fff;
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logout-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-name {
    color: #c9ccd1;
    font-size: 0.9rem;
}

.link-button {
    background: none;
    border: none;
    color: #8fb8ff;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.link-button:hover {
    text-decoration: underline;
}

.sidebar {
    position: fixed;
    top: 48px;
    left: 0;
    bottom: 0;
    width: 200px;
    background: #fff;
    border-right: 1px solid #dfe2e6;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar a {
    display: block;
    padding: 0.5rem 1.25rem;
    color: #1b1f24;
    text-decoration: none;
    font-size: 0.92rem;
}

.sidebar a:hover {
    background: #f0f2f5;
}

.container {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1.25rem;
}

.container.with-sidebar {
    margin-left: 220px;
    max-width: 1000px;
}

code {
    background: #e9ebee;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-bottom: 1.5rem;
}

th, td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e9ebee;
    font-size: 0.92rem;
}

th {
    background: #f0f2f5;
}

.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    min-width: 160px;
}

.card .value {
    font-size: 1.6rem;
    font-weight: 600;
}

.card .label {
    color: #6b7280;
    font-size: 0.85rem;
}

form.inline {
    display: inline;
}

form.stacked label {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.88rem;
    color: #374151;
}

form.stacked input, form.stacked select, form.stacked textarea {
    width: 100%;
    max-width: 420px;
    padding: 0.4rem 0.5rem;
    margin-top: 0.2rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    box-sizing: border-box;
}

button, .btn {
    background: #1b1f24;
    color: #fff;
    border: none;
    padding: 0.45rem 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    display: inline-block;
}

button.danger, .btn.danger {
    background: #b91c1c;
}

button.secondary, .btn.secondary {
    background: #6b7280;
}

.filters {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    background: #e5e7eb;
    font-size: 0.8rem;
}

.flash {
    background: #d1fae5;
    border: 1px solid #10b981;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.section {
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.flash.error {
    background: #fee2e2;
    border-color: #ef4444;
}

.muted {
    color: #6b7280;
    font-size: 0.85rem;
}

.row-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

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

table input[type="text"], table input[type="number"], table select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.3rem 0.4rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
}

.filters label {
    font-size: 0.8rem;
    color: #374151;
    display: block;
}

.filters input, .filters select {
    padding: 0.35rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
}

.kv td:first-child {
    color: #6b7280;
    width: 220px;
}

.right { text-align: right; }

.bar {
    background: #1b1f24;
    height: 10px;
    border-radius: 3px;
}

.fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 0.8rem;
    align-items: end;
}

.fld {
    display: block;
    font-size: 0.8rem;
    color: #374151;
}

.fld input[type="text"], .fld select, .fld textarea {
    display: block;
    margin-top: 0.15rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    box-sizing: border-box;
}

.fld.chk {
    padding-bottom: 0.45rem;
}

.w-xs { width: 5rem; }
.w-sm { width: 8rem; }
.w-md { width: 12rem; }
.w-lg { width: 20rem; }
.w-xl { width: 100%; min-width: 24rem; }

.edit-card {
    background: #fff;
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid #1b1f24;
}

.edit-card.inactive {
    border-left-color: #9ca3af;
    opacity: 0.8;
}

pre.json {
    background: #f0f2f5;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.matrix td, .matrix th {
    vertical-align: top;
}
