/* shadcn/ui-inspired Zinc design system (no Node/React build required) */
:root {
    --background: #ffffff;
    --foreground: #09090b;
    --card: #ffffff;
    --card-foreground: #09090b;
    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --accent: #f4f4f5;
    --accent-foreground: #18181b;
    --border: #e4e4e7;
    --input: #e4e4e7;
    --ring: #18181b;
    --primary: #18181b;
    --primary-foreground: #fafafa;
    --secondary: #f4f4f5;
    --secondary-foreground: #18181b;
    --destructive: #dc2626;
    --destructive-foreground: #fafafa;
    --radius: 0.5rem;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #fafafa;
    color: var(--foreground);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Top Navigation Bar */
header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
}

.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    height: 60px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--foreground);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    background: var(--muted);
    padding: 4px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.nav-links a {
    color: var(--muted-foreground);
    text-decoration: none;
    padding: 5px 12px;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-links a:hover {
    color: var(--foreground);
}

.nav-links a.active {
    background: var(--background);
    color: var(--foreground);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

main {
    max-width: 1280px;
    margin: 28px auto;
    padding: 0 24px 56px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
}

h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

h2 {
    margin: 28px 0 12px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

h3 {
    margin: 18px 0 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

/* shadcn Card */
.card {
    background: var(--card);
    color: var(--card-foreground);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(9, 9, 11, 0.04);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    padding: 18px 20px;
    box-shadow: 0 1px 2px rgba(9, 9, 11, 0.04);
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--muted-foreground);
    margin-top: 6px;
}

/* shadcn Alert */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid;
    font-size: 0.9rem;
    line-height: 1.45;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-warn {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

/* shadcn Table */
.table-wrap {
    overflow-x: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    margin-bottom: 22px;
    box-shadow: 0 1px 2px rgba(9, 9, 11, 0.04);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

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

th {
    background: #fafafa;
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--muted-foreground);
    white-space: nowrap;
}

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

tbody tr {
    transition: background-color 0.12s ease;
}

tbody tr:hover td {
    background: rgba(244, 244, 245, 0.55);
}

/* shadcn Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1.25;
    transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.btn-primary:hover {
    background: #27272a;
}

.btn-secondary {
    background: var(--background);
    color: var(--secondary-foreground);
    border-color: var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.btn-secondary:hover {
    background: var(--accent);
}

.btn-danger {
    background: var(--destructive);
    color: var(--destructive-foreground);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.78rem;
    border-radius: calc(var(--radius) - 2px);
}

.actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}

/* shadcn Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 9999px;
    font-size: 0.73rem;
    font-weight: 500;
    border: 1px solid transparent;
    background: var(--secondary);
    color: var(--secondary-foreground);
    white-space: nowrap;
}

.badge-blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-green { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.badge-red { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge-amber { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-purple { background: #faf5ff; color: #7e22ce; border-color: #e9d5ff; }
.badge-gray { background: #f4f4f5; color: #3f3f46; border-color: #e4e4e7; }

/* shadcn Inputs & Form Controls */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-group label {
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--foreground);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--background);
    color: var(--foreground);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.12);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 12px;
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.subcard {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: #fafafa;
    margin-bottom: 16px;
}

.muted {
    color: var(--muted-foreground);
    font-size: 0.84rem;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.82em;
    background: var(--muted);
    padding: 2px 5px;
    border-radius: 4px;
}

.author-row {
    display: grid;
    grid-template-columns: 2fr 100px 140px auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

@media (max-width: 700px) {
    .author-row {
        grid-template-columns: 1fr;
    }
    .nav-inner {
        height: auto;
        padding: 12px 0;
    }
}

/* Top navigation progress bar & shadcn-style loading pill */
#nav-loader-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: var(--primary);
    z-index: 100;
    opacity: 0;
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.15s ease;
}

#nav-loader-bar.active {
    opacity: 1;
    width: 82%;
}

#nav-loader-pill {
    position: fixed;
    top: 72px;
    right: 24px;
    z-index: 99;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(9, 9, 11, 0.08);
}

#nav-loader-pill.active {
    display: inline-flex;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

body.is-loading main {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

