*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #2563EB;
    --color-primary-dark: #1D4ED8;
    --color-accent: #F59E0B;
    --color-danger: #DC2626;
    --color-success: #16A34A;
    --color-surface: #FFFFFF;
    --color-surface-2: #F8FAFC;
    --color-border: #E2E8F0;
    --color-text: #0F172A;
    --color-text-muted: #64748B;
    --band-page: #FEE2E2;
    --band-report: #E9D5FF;
    --band-group: #FFFBEB;
    --band-detail: #F0FDF4;
    --band-column: #FEF9C3;
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,.10);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
}

body {
    font-family: var(--font-ui);
    color: var(--color-text);
    background: var(--color-surface-2);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 40px);
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 40px;
    padding: 0 16px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.navbar-brand i {
    font-size: 18px;
    color: var(--color-primary);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--color-text);
    background: var(--color-surface-2);
    text-decoration: none;
}

.nav-link.active {
    color: var(--color-primary);
    background: #EFF6FF;
}

.nav-link i {
    font-size: 15px;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nav-version {
    font-size: 12px;
    color: var(--color-text-muted);
}

.main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Navbar (applied — overwrites the generic .navbar above) */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    padding: 0 16px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
}

.navbar-brand i {
    font-size: 18px;
    color: var(--color-primary);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-version {
    font-size: 12px;
    color: var(--color-text-muted);
}


/* Main Content */
.main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

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

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-ui);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn:hover {
    background: var(--color-surface-2);
    border-color: #CBD5E1;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px;
    border: none;
    background: transparent;
}

.btn-icon:hover {
    background: var(--color-surface-2);
    border-radius: var(--radius-sm);
}

.btn-outline {
    background: transparent;
    border: 1px dashed var(--color-border);
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    background: var(--color-surface-2);
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background: #F1F5F9;
}

.table .actions {
    display: flex;
    gap: 4px;
}

.text-muted {
    color: var(--color-text-muted);
    text-align: center;
    padding: 24px;
}

/* Form */
.form {
    max-width: 640px;
}

.form-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    font-family: var(--font-ui);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: flex;
    gap: 12px;
}

.flex-1 { flex: 1; }
.flex-3 { flex: 3; }

.form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 400 !important;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: #EFF6FF;
    color: var(--color-primary);
    font-size: 24px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--color-text-muted);
}

.dashboard-section {
    margin-top: 24px;
}

.dashboard-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
}

.modal-content {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.modal-header .btn-icon {
    color: rgba(255,255,255,0.8);
}

.modal-header .btn-icon:hover {
    color: #fff;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

/* Loading */
.loading-spinner {
    text-align: center;
    padding: 48px;
    color: var(--color-text-muted);
}

/* Test result */
.test-result {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
}

.test-result.success {
    background: #F0FDF4;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.test-result.error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* Preview */
.preview-params {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    display: none;
}

.preview-params .form-row {
    align-items: flex-end;
}

.preview-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    min-height: 400px;
    overflow: auto;
}

/* Responsive table actions */
.table .actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* Readme page */
.readme-page {
    max-width: 960px;
    margin: 0 auto;
}

.readme-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 32px 40px;
    line-height: 1.7;
    font-size: 15px;
    overflow-x: auto;
}

.readme-content h1 { font-size: 28px; margin: 0 0 24px 0; padding-bottom: 12px; border-bottom: 2px solid var(--color-border); }
.readme-content h2 { font-size: 22px; margin: 32px 0 12px 0; padding-bottom: 8px; border-bottom: 1px solid var(--color-border); }
.readme-content h3 { font-size: 18px; margin: 24px 0 8px 0; }
.readme-content p { margin: 0 0 12px 0; }
.readme-content ul, .readme-content ol { margin: 0 0 12px 0; padding-left: 24px; }
.readme-content li { margin-bottom: 4px; }
.readme-content code { background: #f1f5f9; padding: 2px 6px; border-radius: 3px; font-family: var(--font-mono); font-size: 13px; }
.readme-content pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: var(--radius-md); overflow-x: auto; margin: 12px 0; }
.readme-content pre code { background: none; padding: 0; color: inherit; font-size: 13px; }
.readme-content table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.readme-content th, .readme-content td { border: 1px solid var(--color-border); padding: 8px 12px; text-align: left; }
.readme-content th { background: #f8fafc; font-weight: 600; }
.readme-content a { color: var(--color-primary); text-decoration: none; }
.readme-content a:hover { text-decoration: underline; }
.readme-content hr { border: none; border-top: 1px solid var(--color-border); margin: 24px 0; }
.readme-content blockquote { border-left: 4px solid var(--color-primary); padding: 8px 16px; margin: 12px 0; background: #f8fafc; border-radius: 0 var(--radius-md) var(--radius-md) 0; }

