/* === Design System === */
:root {
    --font: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Fira Code', 'SF Mono', 'Consolas', monospace;

    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-soft: #f1f5f9;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-light: #94a3b8;

    --accent: #0369a1;
    --accent-hover: #075985;
    --accent-soft: #e0f2fe;

    --success: #0f6e56;
    --success-soft: #e1f5ee;
    --warning: #854f0b;
    --warning-soft: #faeeda;
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --indigo: #4338ca;
    --indigo-soft: #eef2ff;
    --purple: #3c3489;
    --purple-soft: #eee9fe;

    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --ring: 0 0 0 3px rgba(3, 105, 161, 0.15);

    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 240px;
    --topbar-height: 62px;
}

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

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* === Sidebar === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
    background: var(--bg-soft);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.nav-item.active .nav-icon {
    color: var(--accent);
}

.nav-icon {
    font-size: 19px;
    width: 22px;
    text-align: center;
    line-height: 1;
    color: var(--text-light);
}

.nav-label {
    line-height: 1;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.version {
    font-size: 11px;
    color: var(--text-light);
}

/* === Main === */
.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.city-selector {
    padding: 9px 34px 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    min-width: 190px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.city-selector:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}

/* === User menu === */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-email {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    text-transform: uppercase;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.btn-logout:hover {
    color: var(--danger);
    border-color: #fecaca;
    background: var(--danger-soft);
}

/* === Content === */
.content {
    padding: 24px;
    max-width: 1400px;
}

.view {
    display: none;
    animation: fadeIn 0.2s ease;
}

.view.active {
    display: block;
}

/* === Stat cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.stat-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 14px;
    background: var(--accent-soft);
    color: var(--accent);
}

.stat-card.email .stat-card-icon,
.stat-card.whatsapp .stat-card-icon {
    background: var(--success-soft);
    color: var(--success);
}

.stat-card.website .stat-card-icon {
    background: var(--indigo-soft);
    color: var(--indigo);
}

.stat-card .stat-value {
    font-size: 25px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* === Tables row (dashboard) === */
.tables-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
}

.table-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.table-card table {
    width: 100%;
    border-collapse: collapse;
}

.table-card th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}

.table-card td {
    padding: 9px 10px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    font-variant-numeric: tabular-nums;
}

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

.table-card tbody tr:hover td {
    background: var(--bg-page);
}

/* === Data table === */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.data-table th {
    background: var(--bg-page);
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 11px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.data-table tbody tr:hover {
    background: var(--bg-page);
}

.data-table td a {
    color: var(--accent);
    text-decoration: none;
}

.data-table td a:hover {
    text-decoration: underline;
}

.data-table .cell-mono {
    font-family: var(--font-mono);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.data-table .cell-name {
    font-weight: 500;
    color: var(--text-primary);
    max-width: 260px;
}

.data-table .cell-muted {
    color: var(--text-light);
}

/* === Source badges === */
.source-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
}

.source-badge.badge-2gis {
    background: var(--success-soft);
    color: var(--success);
}

.source-badge.badge-yandex {
    background: var(--warning-soft);
    color: var(--warning);
}

.source-badge.badge-google {
    background: #e6f1fb;
    color: #185fa5;
}

.source-badge.badge-enrich {
    background: var(--purple-soft);
    color: var(--purple);
}

.topbar .source-badge {
    padding: 5px 12px;
    font-size: 12px;
    cursor: default;
}

/* === Pagination === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
}

.pagination .page-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
}

.pagination .page-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.pagination .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-info {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 0 8px;
    font-variant-numeric: tabular-nums;
}

/* === Toolbar / search / filters === */
.agencies-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.search-wrapper {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 11px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}

.search-input::placeholder {
    color: var(--text-light);
}

.filter-chips {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.chip {
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #991b1b;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #0b5744;
}

.btn-outline {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 13px 24px;
    font-size: 15px;
    font-weight: 600;
}

/* === Parse view === */
.parse-controls {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.parse-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.parse-header h2 {
    font-size: 17px;
    font-weight: 600;
}

.source-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.source-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.source-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.source-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.source-card-name {
    font-weight: 600;
    font-size: 14px;
}

.source-card-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-light);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
}

.status-dot.available {
    background: #16a34a;
}

.source-card .btn {
    width: 100%;
}

/* === Jobs === */
.jobs-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.jobs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.job-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.job-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.job-card-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.job-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}

.job-status-badge.running {
    background: var(--accent-soft);
    color: var(--accent);
}

.job-status-badge.completed,
.job-status-badge.done {
    background: var(--success-soft);
    color: var(--success);
}

.job-status-badge.failed,
.job-status-badge.error {
    background: var(--danger-soft);
    color: var(--danger);
}

.job-status-badge.stopped {
    background: var(--warning-soft);
    color: var(--warning);
}

.progress-bar-wrap {
    width: 100%;
    height: 7px;
    background: var(--bg-soft);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.progress-bar.running {
    background: repeating-linear-gradient(
        -45deg,
        var(--accent),
        var(--accent) 8px,
        #38bdf8 8px,
        #38bdf8 16px
    );
    background-size: 22.63px 100%;
    animation: progress-stripe 0.6s linear infinite;
}

.progress-bar.completed {
    background: #16a34a;
}

.progress-bar.failed {
    background: var(--danger);
}

.job-card-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.job-card-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
    font-variant-numeric: tabular-nums;
}

.job-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.job-card-time {
    font-size: 12px;
    color: var(--text-light);
}

.job-error {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--danger-soft);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--danger);
}

.job-query {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 400;
}

/* === Export === */
.export-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px;
    max-width: 560px;
}

.export-card h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 20px;
}

.export-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.export-count {
    padding: 12px 16px;
    background: var(--accent-soft);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* === Forms === */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-checkboxes {
    flex-direction: row;
    gap: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

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

.query-presets .chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* === Settings === */
.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 20px;
}

.settings-section h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
}

.sources-status {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.source-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.source-status-row:last-child {
    border-bottom: none;
}

.source-status-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.source-status-left .status-dot {
    flex-shrink: 0;
}

.source-status-name {
    font-size: 14px;
    font-weight: 500;
}

.source-status-hint {
    font-size: 12px;
    color: var(--text-light);
}

.add-city-form {
    margin-bottom: 22px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.add-city-form h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
}

.add-city-form .form-row {
    margin-bottom: 12px;
}

.cities-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.city-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-light);
}

.city-row:last-child {
    border-bottom: none;
}

.city-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.city-row-name {
    font-size: 14px;
    font-weight: 500;
}

.city-row-slug {
    font-size: 12px;
    color: var(--text-light);
    font-family: var(--font-mono);
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 90%;
    max-width: 420px;
    overflow: hidden;
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

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

.modal-body {
    padding: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

/* === Toast === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 400px;
    pointer-events: auto;
    animation: slideIn 0.25s ease;
    border-left: 3px solid var(--accent);
}

.toast.success {
    border-left-color: #16a34a;
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.info {
    border-left-color: var(--accent);
}

.toast.fade-out {
    animation: fadeOut 0.2s ease forwards;
}

/* === Empty state === */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    display: block;
    font-size: 34px;
    line-height: 1;
    margin-bottom: 12px;
    opacity: 0.6;
    color: var(--text-light);
}

.empty-state-text {
    font-size: 14px;
}

/* === Category tag === */
.category-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--purple-soft);
    color: var(--purple);
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
}

/* === Animations === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

@keyframes progress-stripe {
    0% { background-position: 0 0; }
    100% { background-position: 22.63px 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === Responsive === */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .tables-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-logo {
        border-bottom: none;
        border-right: 1px solid var(--border);
        padding: 12px 16px;
    }

    .sidebar-nav {
        flex-direction: row;
        padding: 8px;
        gap: 4px;
        overflow-x: auto;
    }

    .nav-item {
        padding: 9px 12px;
        white-space: nowrap;
        font-size: 13px;
    }

    .nav-label { display: none; }
    .sidebar-footer { display: none; }

    .main {
        margin-left: 0;
        margin-top: 56px;
    }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .agencies-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row { grid-template-columns: 1fr; }

    .topbar {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 10px;
        align-items: stretch;
    }

    .source-cards { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .content { padding: 16px; }
    .user-email { display: none; }
}
