:root {
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f6f8fb;
    color: #1f2937;
}

.container {
    width: min(720px, 92%);
    margin: 0 auto;
}

.site-header,
.site-footer {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.site-footer {
    border-top: 1px solid #e5e7eb;
    border-bottom: none;
    margin-top: 3rem;
    padding: 1rem 0;
    color: #6b7280;
}

.nav {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.db-health {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    border: 2px solid transparent;
    line-height: 1;
}

.db-health-dot {
    display: inline-block;
    width: 0.52rem;
    height: 0.52rem;
    border-radius: 999px;
    background: #9ca3af;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.db-health-pending {
    color: #374151;
    background: #f3f4f6;
    border-color: #d1d5db;
}

.db-health-pending .db-health-dot {
    background: #9ca3af;
}

.db-health-ok {
    color: #064e3b;
    background: #bbf7d0;
    border-color: #10b981;
}

.db-health-ok .db-health-dot {
    background: #059669;
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.25);
}

.db-health-error {
    color: #7f1d1d;
    background: #fecaca;
    border-color: #ef4444;
}

.db-health-error .db-health-dot {
    background: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25);
}

.nav-lab-select {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.nav-lab-label {
    font-size: 0.85rem;
    color: #6b7280;
    white-space: nowrap;
}

.nav-lab-select select {
    width: auto;
    padding: 0.35rem 0.6rem;
    font-size: 0.875rem;
    border-radius: 6px;
    margin: 0;
}

.brand {
    color: #111827;
    font-weight: 600;
    text-decoration: none;
}

.card {
    margin-top: 2rem;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
}

.wip-banner {
    margin-top: 2rem;
    padding: 1.1rem 1.25rem;
    border: 2px solid #f59e0b;
    border-radius: 10px;
    background: #fffbeb;
}

.wip-banner h2 {
    margin: 0 0 0.35rem 0;
    font-size: 2rem;
    letter-spacing: 0.08em;
    color: #92400e;
}

.wip-banner p {
    margin: 0.25rem 0;
}

.form-grid {
    display: grid;
    gap: 0.6rem;
}

input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
}

.nav-right .button {
    margin-top: 0;
}

.button {
    margin-top: 0.7rem;
    padding: 0.65rem 0.95rem;
    border: none;
    border-radius: 8px;
    background: #1d4ed8;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
}

.button-secondary {
    background: #374151;
}

.button-link {
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.65rem;
    margin-top: 1rem;
}

.field-list {
    margin: 0.65rem 0 0 0;
    padding-left: 1.2rem;
}

.field-list li {
    margin: 0.35rem 0;
}

.status {
    margin-top: 0.75rem;
    color: #065f46;
    background: #d1fae5;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
}

.error {
    color: #b91c1c;
    background: #fee2e2;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
}

.muted {
    color: #6b7280;
}

.error-page {
    text-align: center;
    padding: 3rem 1.25rem;
}

.error-code {
    font-size: 4rem;
    font-weight: 700;
    color: #b91c1c;
    margin: 0 0 0.5rem 0;
}

.error-message {
    color: #6b7280;
    margin: 0 0 1.5rem 0;
}

/* Nav links */
.nav-links {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.nav-links a {
    color: #374151;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.2rem 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
}

/* Data tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.data-table th {
    background: #f9fafb;
    padding: 0.55rem 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    color: #374151;
    white-space: nowrap;
}

.data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background: #f9fafb;
}

/* Meta table (key/value pairs) */
.meta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.meta-table th {
    text-align: left;
    font-weight: 600;
    padding: 0.4rem 0.75rem 0.4rem 0;
    color: #374151;
    width: 180px;
    vertical-align: top;
    border-bottom: 1px solid #f3f4f6;
}

.meta-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #7f1d1d; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gray   { background: #f3f4f6; color: #374151; }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.stat-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.9rem 1rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1d4ed8;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.3rem;
}

/* Page header */
.page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.page-header h1,
.page-header h2 {
    margin: 0;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 1.5rem;
    margin-bottom: 0;
}

.breadcrumb a {
    color: #3b82f6;
    text-decoration: none;
}

/* Filter bar */
.filter-bar {
    margin: 0;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-row select {
    width: auto;
    padding: 0.45rem 0.65rem;
    font-size: 0.875rem;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

/* Form layout */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

/* Button variants */
.button-danger {
    background: #dc2626;
}

.button-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    margin-top: 0;
}

/* Inline form (for delete buttons inside table cells) */
.inline-form {
    display: inline;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #9ca3af;
    font-size: 0.95rem;
}
