:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Glass Header */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-radius: 1rem;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    background: var(--primary);
    color: white;
    padding: 0.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
}

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

.btn-icon {
    padding: 0.625rem;
    background: white;
    border: 1px solid var(--border);
    color: var(--secondary);
}

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

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-text:hover {
    text-decoration: underline;
}

.btn-text-secondary {
    color: var(--secondary);
    text-decoration: none;
    font-size: 0.875rem;
}

/* Progress Card */
.status-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.progress-container {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.4s ease;
}

/* Table */
.card {
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-container {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 1rem;
    background: var(--bg-main);
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.title-cell {
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

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

.badge-orange {
    background: #ffedd5;
    color: #9a3412;
}

.badge-gray {
    background: #f1f5f9;
    color: #475569;
}

.keyword-tag {
    background: #f1f5f9;
    color: #475569;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.pagination {
    display: flex;
    gap: 0.5rem;
}

.page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

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

.page-btn:hover:not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 5vh auto;
    padding: 0;
    width: 90%;
    max-width: 500px;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-content.wide {
    max-width: 900px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.close {
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.close:hover {
    color: var(--text-main);
}

pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 0.9375rem;
    color: #334155;
    line-height: 1.7;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

input,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
}

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

select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
}

input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary);
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.full-width {
    width: 100%;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Loading */
.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: var(--primary);
    font-weight: 600;
}

/* Tabs in Settings Modal */
.settings-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}


/* Filter Bar */
.filter-bar {
    background: #f8fafc;
    padding: 1.25rem 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.filter-date-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    font-size: 0.875rem;
    background: white;
    outline: none;
    height: 40px;
    width: auto;
    transition: all 0.2s;
}

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

.filter-sep {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    margin-left: auto;
}

.filter-actions .btn-primary,
.filter-actions .btn-secondary {
    padding: 0.5rem 1.25rem;
    height: 40px;
}

/* Picker UI Helpers */
.picker-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.picker-item:hover {
    border-color: var(--primary);
    background-color: #f0f9ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.1);
}

.picker-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 1rem;
    cursor: pointer;
}

.tree-section {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    background: white;
}

.tree-header {
    background: #f1f5f9;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tree-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
}