/* ============================================================
   CreatorSignals v2 - Complete Stylesheet
   Clean White Design | Inter Font | #3b82f6 Accent
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Primary palette */
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-primary-light: #eff6ff;
    --color-primary-ring: rgba(59, 130, 246, 0.1);

    /* Neutrals */
    --color-bg: #fafafa;
    --color-bg-alt: #f3f4f6;
    --color-white: #fff;
    --color-text: #1a1a1a;
    --color-text-dark: #0f172a;
    --color-text-secondary: #374151;
    --color-text-muted: #6b7280;
    --color-text-light: #737373;
    --color-text-lighter: #9ca3af;
    --color-text-faint: #a3a3a3;
    --color-text-disabled: #cbd5e1;

    /* Borders */
    --color-border: #e5e5e5;
    --color-border-light: #f0f0f0;
    --color-border-medium: #d4d4d4;
    --color-border-strong: #d1d5db;
    --color-border-subtle: #e2e8f0;
    --color-border-hover: #a3a3a3;
    --color-border-section: #e5e7eb;

    /* Status colors */
    --color-success: #16a34a;
    --color-success-bg: #f0fdf4;
    --color-success-border: #bbf7d0;
    --color-success-dark: #059669;
    --color-success-light: #d1fae5;

    --color-danger: #dc2626;
    --color-danger-bg: #fef2f2;
    --color-danger-border: #fecaca;
    --color-danger-dark: #b91c1c;
    --color-danger-light: #fee2e2;
    --color-danger-text: #991b1b;

    --color-warning: #d97706;
    --color-warning-bg: #fefce8;
    --color-warning-border: #fde68a;
    --color-warning-text: #a16207;
    --color-warning-dark: #b45309;

    --color-info: #2563eb;
    --color-info-bg: #eff6ff;
    --color-info-border: #bfdbfe;
    --color-info-dark: #1d4ed8;

    --color-purple: #7c3aed;
    --color-purple-bg: #f5f3ff;
    --color-purple-border: #ddd6fe;
    --color-purple-text: #6d28d9;

    --color-pink: #db2777;

    /* Grays for charts / UI */
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06);

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-2xl: 12px;
    --radius-3xl: 16px;
    --radius-full: 999px;

    /* Fonts */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

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

/* --- Base --- */
body {
    font-family: var(--font-family);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
    background: var(--color-white);
    border-bottom: 1px solid #e8e8e8;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    max-width: 100vw;
    overflow: hidden;
}

.header-inner {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
    min-width: 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text-dark);
    text-decoration: none;
    letter-spacing: -0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-brand img {
    display: block;
    width: 166px;
    height: 49px;
    object-fit: contain;
}

.header-brand:hover {
    color: var(--color-primary);
}

/* --- Navigation --- */
.header-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    justify-content: flex-start;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-family);
    flex: 0 0 auto;
}

.nav-link svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.nav-link:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.nav-link.active {
    color: #1e293b;
    background: #f0f4ff;
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary), #6366f1);
    border-radius: 2px;
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: var(--color-border-subtle);
    margin: 0 6px;
    flex-shrink: 0;
}

.nav-link-logout {
    color: #94a3b8;
}

.nav-link-logout:hover {
    color: #ef4444;
    background: var(--color-danger-bg);
}

.nav-link-disabled {
    color: var(--color-text-disabled) !important;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.5;
}

/* --- Nav Dropdown Menus --- */
.nav-dropdown-menu.show {
    display: block !important;
}

/* --- Influencer selector in header --- */
.header-inf-selector {
    flex-shrink: 0;
}

.header-inf-selector select {
    padding: 6px 12px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-subtle);
    background: #f8fafc;
    font-size: 13px;
    font-family: inherit;
    color: #334155;
    min-width: 180px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.header-inf-selector select:hover {
    border-color: #94a3b8;
}

.header-inf-selector select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

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


/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--color-border-medium);
    background: var(--color-white);
    color: #404040;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    gap: 6px;
    text-decoration: none;
}

.btn:hover {
    background: #f5f5f5;
    border-color: var(--color-border-hover);
}

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

.btn-primary:hover {
    background: #333;
}

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

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: var(--radius-sm);
}

.btn-danger {
    background: #ef4444;
    color: var(--color-white);
    border-color: #ef4444;
}

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

.btn-success {
    background: var(--color-success) !important;
    color: var(--color-white) !important;
    border-color: var(--color-success) !important;
}

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    color: var(--color-gray-700);
}

.btn-export:hover {
    background: var(--color-gray-100);
    border-color: var(--color-gray-400);
}


/* ============================================================
   MAIN LAYOUT
   ============================================================ */
main {
    max-width: 100%;
    margin: 0 auto;
    padding: 24px 32px;
    min-width: 0;
}

/* --- Page Container --- */
.page-container {
    max-width: 100%;
    margin: 0 auto;
    min-width: 0;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text-dark);
    margin-bottom: 4px;
}

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

/* --- Stats Grid (Dashboard KPI Cards) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.dashboard-stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-stats-grid .stat-card {
    min-width: 0;
}

.dashboard-stats-grid .stat-value {
    white-space: normal;
    overflow-wrap: anywhere;
}

.stat-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: box-shadow 0.15s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.stat-content .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text-dark);
    line-height: 1.2;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.stat-content .stat-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    overflow-wrap: anywhere;
}

/* --- Card Grid (2-column layout for cards) --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* --- Cards --- */
.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border-light);
}

.card-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-dark);
}

.card-body {
    padding: 18px;
}

/* --- Info Rows (Key-Value pairs) --- */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border-light);
}

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

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

/* --- Action Links (Quick Access) --- */
.action-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.action-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-white);
    transition: all 0.15s ease;
}

.action-link:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.action-icon {
    display: flex;
    align-items: center;
    color: var(--color-primary);
}

.action-icon svg {
    width: 14px;
    height: 14px;
}

/* --- User Role Badge --- */
.user-role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.role-admin {
    background: var(--color-purple-bg);
    color: var(--color-purple-text);
    border: 1px solid var(--color-purple-border);
}

.role-amazon {
    background: var(--color-info-bg);
    color: var(--color-info);
    border: 1px solid var(--color-info-border);
}

.role-agency {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
}

.role-influencer {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-text-secondary);
}

.empty-state p {
    font-size: 13px;
    color: var(--color-text-muted);
}

.empty-icon {
    margin-bottom: 12px;
    color: var(--color-text-lighter);
}

.empty-icon svg {
    width: 32px;
    height: 32px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border-medium);
    color: var(--color-text-secondary);
}

.btn-outline:hover {
    background: var(--color-bg);
    border-color: var(--color-border-hover);
}

.mt-2 { margin-top: 8px; }
.text-secondary { color: var(--color-text-muted); }


/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash-container {
    margin-bottom: 16px;
}

.flash {
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flash-error, .flash-danger {
    background: var(--color-danger-light);
    color: var(--color-danger-text);
    border: 1px solid var(--color-danger-border);
}

.flash-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

.flash-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border: 1px solid var(--color-warning-border);
}

.flash-info {
    background: var(--color-info-bg);
    color: var(--color-info);
    border: 1px solid var(--color-info-border);
}


/* ============================================================
   ERROR PAGE
   ============================================================ */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.error-card {
    background: var(--color-white);
    border-radius: var(--radius-3xl);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    max-width: 400px;
}

.error-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
}

.error-card p {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 20px;
}


/* (stat-card, stat-label, stat-value etc. are now defined in MAIN LAYOUT section above) */



/* ============================================================
   TABS
   ============================================================ */
.tabs {
    background: var(--color-white);
    padding: 4px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border-subtle);
    display: inline-flex;
    margin-bottom: 24px;
}

.tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.tab:hover {
    color: var(--color-text-dark);
}

.tab.active {
    background: var(--color-text-dark);
    color: var(--color-white);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.tab .badge {
    margin-left: 6px;
    vertical-align: middle;
}

/* Tab content */
.tab-content {
    display: none;
}

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


/* ============================================================
   FILTERS
   ============================================================ */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.filters select,
.filters input {
    padding: 7px 12px;
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: inherit;
    background: var(--color-white);
    color: var(--color-text);
    outline: none;
}

.filters select:focus,
.filters input:focus {
    border-color: var(--color-border-hover);
}

.filters input {
    width: 240px;
}


/* ============================================================
   TABLES
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-size: 13px;
}

thead {
    background: var(--color-bg);
}

th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: #525252;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.global-sortable-th {
    cursor: pointer;
    user-select: none;
}

.global-sortable-th::after {
    content: " ↕";
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 700;
}

.global-sortable-th.sorted-asc::after {
    content: " ↑";
    color: var(--color-primary);
}

.global-sortable-th.sorted-desc::after {
    content: " ↓";
    color: var(--color-primary);
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

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

tr:hover {
    background: var(--color-bg);
}

/* Data table variant (store sales) */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: var(--color-gray-50);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--color-gray-500);
    border-bottom: 2px solid var(--color-gray-200);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-gray-100);
    color: var(--color-gray-700);
}

.data-table tr:hover td {
    background: var(--color-gray-50);
}


/* ============================================================
   PRICE STYLING
   ============================================================ */
.price {
    font-weight: 600;
    white-space: nowrap;
}

.price-old, .old-price {
    text-decoration: line-through;
    color: var(--color-text-faint);
    font-size: 12px;
}

.price-discount {
    color: var(--color-danger);
    font-weight: 600;
}

.price-cheaper {
    color: var(--color-success);
    font-weight: 600;
}

.price-higher {
    color: var(--color-danger);
    font-weight: 500;
    font-size: 12px;
}

.price-lower {
    color: var(--color-success);
    font-weight: 500;
    font-size: 12px;
}


/* ============================================================
   TAGS & BADGES
   ============================================================ */
.badge {
    background: #ef4444;
    color: var(--color-white);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    min-width: 20px;
    text-align: center;
}

.badge.hidden {
    display: none;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    margin-right: 4px;
    margin-bottom: 2px;
}

.tag-discount {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid var(--color-danger-border);
}

.tag-badge {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border: 1px solid var(--color-warning-border);
}

.tag-coupon {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

.tag-prime {
    background: var(--color-info-bg);
    color: var(--color-info);
    border: 1px solid var(--color-info-border);
}

.discount-badge {
    display: inline-block;
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid var(--color-danger-border);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-gray-200);
    font-size: 11px;
    font-weight: 700;
    color: var(--color-gray-600);
}

.rank-badge.top3 {
    background: var(--color-gray-800);
    color: var(--color-white);
}


/* ============================================================
   ALERT TYPES
   ============================================================ */
.alert-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
}

.alert-type-indirim {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.alert-type-rakip_ucuz {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.alert-type-fiyat_dustu {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.alert-actions {
    margin-bottom: 12px;
}


/* ============================================================
   PRODUCT ELEMENTS
   ============================================================ */
.product-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.product-link {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    max-width: 320px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-link:hover {
    color: var(--color-info);
    text-decoration: underline;
}

.product-title {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-text {
    color: var(--color-text-light);
    font-size: 13px;
    margin-bottom: 12px;
}

.icon-sm {
    width: 14px;
    height: 14px;
    display: inline-block;
    vertical-align: middle;
}


/* ============================================================
   SCORE BADGE
   ============================================================ */
.score-badge {
    display: inline-block;
    background: var(--color-text);
    color: var(--color-white);
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-md);
    min-width: 28px;
    text-align: center;
}

/* Reason tags */
.reasons-cell {
    max-width: 280px;
}

.reason-tag {
    display: inline-block;
    background: var(--color-purple-bg);
    color: var(--color-purple-text);
    border: 1px solid var(--color-purple-border);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    margin: 1px;
    white-space: nowrap;
}


/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-sold {
    display: inline-block;
    background: #dbeafe;
    color: var(--color-info-dark);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    margin: 1px;
}

.status-cheap {
    display: inline-block;
    background: var(--color-success-light);
    color: var(--color-success-dark);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    margin: 1px;
}

.status-multi {
    display: inline-block;
    background: #fef3c7;
    color: var(--color-warning-dark);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    margin: 1px;
}

/* Stars cell */
.stars-cell {
    white-space: nowrap;
    font-size: 13px;
    text-align: center;
}


/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--color-text-faint);
}

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

.loading {
    text-align: center;
    padding: 40px;
    color: var(--color-gray-400);
}


/* ============================================================
   INLINE STORE ROWS (Akakce)
   ============================================================ */
.akakce-stores-row td {
    padding: 0 !important;
    background: var(--color-gray-50);
}

.stores-subtable {
    border: none !important;
    background: var(--color-gray-50) !important;
}

.stores-subtable td {
    padding: 6px 14px !important;
    border-bottom: 1px solid var(--color-border-light) !important;
    font-size: 12px;
}

.store-row:hover {
    background: #f0f4ff !important;
}


/* ============================================================
   INFLUENCER PANELS
   ============================================================ */
.inf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.inf-panel {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

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


/* ============================================================
   ALARM FORM
   ============================================================ */
.alarm-form-container {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
}

.alarm-form-container h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text);
}

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

.alarm-form input,
.alarm-form select {
    padding: 7px 12px;
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: inherit;
    background: var(--color-white);
    color: var(--color-text);
    outline: none;
}

.alarm-form input:focus,
.alarm-form select:focus {
    border-color: var(--color-border-hover);
}

.alarm-form input[type="number"] {
    width: 110px;
}


/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 0;
    flex-wrap: wrap;
}

.pagination .page-info {
    font-size: 12px;
    color: var(--color-text-light);
    margin-right: 8px;
}

.pagination .btn {
    min-width: 30px;
    text-align: center;
}

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


/* ============================================================
   MODEL SELECTOR (Segmented Control)
   ============================================================ */
.model-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 0;
}

.model-label {
    font-weight: 700;
    color: #404040;
    font-size: 13px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.model-selector .model-btn-group {
    display: inline-flex;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
}

.model-btn {
    padding: 9px 22px;
    border: none;
    background: var(--color-white);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    transition: all 0.25s ease;
    border-right: 1px solid #e8e8e8;
    position: relative;
    letter-spacing: 0.2px;
    font-family: inherit;
}

.model-btn:last-child {
    border-right: none;
}

.model-btn:hover {
    background: #f0f4ff;
    color: var(--color-primary);
}

.model-btn.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}


/* ============================================================
   FAVORITE BUTTON
   ============================================================ */
.fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--color-gray-300);
    transition: color 0.2s, transform 0.2s;
    vertical-align: middle;
    margin-left: 4px;
}

.fav-btn:hover {
    color: #f59e0b;
    transform: scale(1.2);
}

.fav-btn.active {
    color: #f59e0b;
}


/* ============================================================
   PROMOTIONS CAROUSEL
   ============================================================ */
.promo-carousel {
    margin: 0 0 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--color-success-bg), #ecfdf5);
    border: 1px solid var(--color-success-border);
    border-radius: var(--radius-2xl);
}

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

.promo-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
}

.promo-scroll::-webkit-scrollbar { height: 4px; }
.promo-scroll::-webkit-scrollbar-track { background: transparent; }
.promo-scroll::-webkit-scrollbar-thumb { background: #86efac; border-radius: var(--radius-sm); }

.promo-card {
    flex: 0 0 220px;
    background: var(--color-white);
    border: 1px solid var(--color-border-section);
    border-radius: var(--radius-xl);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.promo-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.promo-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.promo-card .promo-info {
    padding: 10px 12px;
}

.promo-card .promo-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-gray-800);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.promo-card .promo-desc {
    font-size: 11px;
    color: var(--color-gray-500);
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.promo-new-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #10b981;
    color: var(--color-white);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}


/* ============================================================
   CAMPAIGNS GRID
   ============================================================ */
.campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 16px;
}

.campaign-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--color-white);
    border: 1px solid var(--color-border-section);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.campaign-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: var(--color-primary);
}

.campaign-img-wrap {
    width: 100%;
    overflow: hidden;
    background: #f8fafc;
    min-height: 60px;
}

.campaign-img-wrap img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.campaign-info {
    padding: 12px 16px;
}

.campaign-name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 6px;
}

.campaign-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #94a3b8;
}

.campaign-source {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    text-transform: capitalize;
}

.campaign-date {
    font-size: 11px;
}


/* ============================================================
   PREMIUM INFLUENCER BANNER
   ============================================================ */
.inf-welcome-banner {
    background: linear-gradient(135deg, var(--color-gray-800) 0%, var(--color-gray-900) 100%);
    border-radius: var(--radius-3xl);
    padding: 32px 40px;
    margin-bottom: 24px;
    color: var(--color-white);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.inf-welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.banner-text h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, var(--color-white), #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.banner-text p {
    color: #94a3b8;
    font-size: 15px;
}

.banner-widgets {
    display: flex;
    gap: 24px;
}

.banner-widget {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 24px;
    border-radius: var(--radius-2xl);
    min-width: 160px;
    transition: transform 0.2s, border-color 0.2s;
}

.banner-widget:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.3);
}

.widget-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.widget-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-white);
}


/* ============================================================
   BRAND / TAG FILTER DROPDOWNS (from index)
   ============================================================ */
.brand-filter-wrap {
    position: relative;
    display: inline-block;
}

.brand-filter-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.brand-filter-drop {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border-section);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 10px;
    z-index: 50;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
}

.brand-filter-drop.show {
    display: block;
}

.brand-filter-drop label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px;
    font-size: 13px;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.brand-filter-drop label:hover {
    background: var(--color-gray-100);
}

.brand-filter-drop input {
    accent-color: var(--color-primary);
}

.brand-filter-actions {
    border-top: 1px solid var(--color-border-section);
    margin-top: 6px;
    padding-top: 6px;
    display: flex;
    gap: 8px;
}


/* ============================================================
   STORE SALES (from store_sales.html inline styles)
   ============================================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 20px;
}

/* Filter Bar */
.filter-bar {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 14px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    box-shadow: var(--shadow-md);
    margin-bottom: 16px;
}

.filter-bar label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.filter-bar input,
.filter-bar select {
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    background: var(--color-white);
}

.filter-bar select {
    min-width: 120px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.btn-filter {
    background: var(--color-gray-800);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-md);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    font-family: inherit;
}

.btn-filter:hover {
    background: var(--color-gray-700);
}

.btn-report {
    background: var(--color-white);
    color: var(--color-gray-800);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
    font-family: inherit;
}

.btn-report:hover {
    background: var(--color-gray-50);
    border-color: var(--color-gray-400);
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.sales-source-note {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-left: 3px solid #b45309;
    background: #fff7ed;
    color: #7c2d12;
    font-size: 13px;
    line-height: 1.45;
}

.kpi-card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
}

.kpi-card .kpi-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.kpi-card .kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-gray-800);
    margin-top: 4px;
}

.kpi-card .kpi-sub {
    font-size: 11px;
    color: var(--color-gray-400);
    margin-top: 2px;
}

/* Chart Grid */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
    align-items: start;
}

.chart-card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 18px;
    box-shadow: var(--shadow-card);
    resize: none;
    overflow: hidden;
    min-width: 0;
    min-height: 150px;
}

.chart-card.full {
    grid-column: 1 / -1;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gray-700);
    margin-bottom: 12px;
}

.chart-container {
    position: relative;
    width: 100%;
}

.chart-container canvas {
    width: 100% !important;
    max-width: 100% !important;
}

.sales-daily-chart {
    height: clamp(280px, 42vh, 440px);
    min-width: 0;
}

.sales-share-intensity-chart {
    height: 340px;
    min-width: 0;
}

.versus-category-chart {
    height: clamp(420px, 58vh, 680px);
}

/* Dashboard section tabs */
.tab-btn {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-gray-500);
    cursor: pointer;
    position: relative;
    font-family: inherit;
}

.tab-btn.active {
    color: var(--color-gray-800);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-gray-800);
}

.dashboard-section {
    display: none;
}

.dashboard-section.active {
    display: block;
}

/* Month pills (Versus) */
.month-pill {
    padding: 6px 14px;
    background: var(--color-border-subtle);
    color: #475569;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s;
    user-select: none;
    border: 2px solid transparent;
}

.month-pill:hover {
    background: #cbd5e1;
}

.month-pill.selected {
    background: var(--color-purple);
    color: var(--color-white);
    box-shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.3);
}

/* Daily Grid Heatmap */
.daily-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.daily-cell {
    text-align: center;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

.daily-cell .day-num {
    font-size: 12px;
    font-weight: 700;
}

.daily-cell .day-val {
    font-size: 10px;
    margin-top: 2px;
}


/* ============================================================
   INFLUENCER TRACKER (from influencer_tracker.html inline styles)
   ============================================================ */
.tracker-container {
    padding: 20px 24px;
    max-width: 100%;
}

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

.tracker-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-gray-800);
    display: flex;
    align-items: center;
    gap: 10px;
}

.tracker-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.tracker-controls input,
.tracker-controls select {
    padding: 7px 12px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-family: inherit;
    background: var(--color-white);
    outline: none;
}

.tracker-controls input:focus,
.tracker-controls select:focus {
    border-color: var(--color-primary);
}

.tracker-controls input {
    width: 220px;
}

.table-scroll-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    border: 1px solid var(--color-border-section);
    border-radius: var(--radius-2xl);
    background: var(--color-white);
    box-shadow: var(--shadow-card);
    -webkit-overflow-scrolling: touch;
}

.tracker-table {
    border-collapse: separate !important;
    border-spacing: 0;
    font-size: 12px;
    white-space: nowrap;
    table-layout: fixed;
    width: 4245px;
    overflow: visible !important;
}

.tracker-table td,
.tracker-table th {
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 8px 10px;
}

.tracker-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.tracker-table thead tr:nth-child(2) th {
    background: #f8fafc;
    font-size: 10px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--color-border-subtle);
}

.tracker-table tbody tr {
    transition: background 0.15s;
}

.tracker-table tbody tr:hover {
    background: #f0f7ff !important;
}

.tracker-table tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--color-gray-700);
}

/* Tracker cell states */
.cell-active { color: var(--color-success-dark); font-weight: 600; }
.cell-inactive { color: var(--color-danger); font-weight: 600; }
.cell-good { color: var(--color-success-dark); font-weight: 600; }
.cell-warn { color: var(--color-warning); font-weight: 600; }
.cell-zero { color: var(--color-gray-400); }

.table-responsive,
.table-wrap,
.report-table-wrap,
.auto-table-responsive {
    position: relative;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.has-table-info,
.surface-info-host-table {
    padding-top: 28px;
}

.surface-info {
    position: absolute;
    top: 6px;
    right: 8px;
    z-index: 30;
    display: inline-flex;
    justify-content: flex-end;
}

.surface-info-btn {
    width: 22px;
    height: 22px;
    border: 1px solid var(--color-border-strong, #cbd5e1);
    border-radius: 999px;
    background: #ffffff;
    color: var(--color-text-secondary, #475569);
    font-size: 13px;
    font-weight: 900;
    line-height: 20px;
    text-align: center;
    cursor: help;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.surface-info .surface-info-tooltip {
    position: absolute;
    top: 28px;
    right: 0;
    display: none;
    width: min(320px, 78vw);
    max-height: min(300px, 55vh);
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 8px;
    background: #ffffff;
    color: var(--color-text-dark, #172033);
    font-size: 12px;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.surface-info-line {
    display: block;
    margin-bottom: 7px;
}

.surface-info-line:last-child {
    margin-bottom: 0;
}

.surface-info-line strong {
    color: var(--color-text-dark, #172033);
    font-weight: 800;
}

.surface-info.is-open .surface-info-tooltip {
    display: block !important;
    position: fixed;
    top: 72px;
    right: 16px;
    bottom: auto;
    left: auto;
    z-index: 5001;
}

.surface-info.is-open {
    z-index: 5000;
}

.has-surface-info {
    position: relative;
}

.stat-card.has-surface-info,
.kpi-card.has-surface-info,
.metric-card.has-surface-info,
.chart-card.has-surface-info,
.signals-card.has-surface-info,
.panel360.has-surface-info,
.card.has-surface-info,
.offer-card.has-surface-info,
.target-card.has-surface-info,
.ops-card.has-surface-info,
.trend-card.has-surface-info,
.notification-card.has-surface-info,
.rec-card-horizontal.has-surface-info,
.kpi360.has-surface-info,
.ops-panel.has-surface-info,
.map-panel.has-surface-info,
.operations-panel.has-surface-info,
.offer-form-panel.has-surface-info,
.operations-kpi.has-surface-info {
    padding-right: 38px;
}

.surface-info-panel .surface-info-tooltip {
    width: min(340px, 82vw);
}

.surface-info-host-chart {
    position: relative;
}

.surface-info-chart .surface-info-tooltip {
    width: min(340px, 82vw);
}

.surface-info-panel + .surface-info-chart {
    top: 34px;
}

@media print {
    .surface-info {
        display: none !important;
    }
}

@media (max-width: 1500px) {
    .dashboard-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .dashboard-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .dashboard-stats-grid {
        grid-template-columns: 1fr;
    }

    .surface-info.is-open .surface-info-tooltip {
        top: 64px;
        right: 8px;
        width: calc(100vw - 16px);
        max-height: calc(100vh - 80px);
    }
}

.table-responsive > table,
.table-wrap > table,
.report-table-wrap > table,
.auto-table-responsive > table {
    width: 100%;
    min-width: max-content;
}

@media (max-width: 900px) {
    .table-responsive > table,
    .table-wrap > table,
    .report-table-wrap > table,
    .auto-table-responsive > table {
        font-size: 12px;
    }

    .table-responsive th,
    .table-responsive td,
    .table-wrap th,
    .table-wrap td,
    .report-table-wrap th,
    .report-table-wrap td,
    .auto-table-responsive th,
    .auto-table-responsive td {
        padding: 6px 8px;
    }
}

/* Column Resizer */
.tracker-table th {
    position: relative;
}

.resizer {
    width: 5px;
    height: 100%;
    position: absolute;
    right: 0;
    top: 0;
    cursor: col-resize;
    user-select: none;
    z-index: 20;
}

.resizer:hover,
.resizer.resizing {
    background-color: var(--color-primary);
}

/* Sticky columns */
.tracker-table tbody td:nth-child(1),
.tracker-table thead tr:nth-child(2) th:nth-child(1),
.tracker-table tbody td:nth-child(2),
.tracker-table thead tr:nth-child(2) th:nth-child(2),
.tracker-table tbody td:nth-child(3),
.tracker-table thead tr:nth-child(2) th:nth-child(3),
.tracker-table tbody td:nth-child(4),
.tracker-table thead tr:nth-child(2) th:nth-child(4),
.tracker-table tbody td:nth-child(5),
.tracker-table thead tr:nth-child(2) th:nth-child(5),
.tracker-table tbody td:nth-child(6),
.tracker-table thead tr:nth-child(2) th:nth-child(6) {
    position: sticky !important;
    z-index: 5;
}

.tracker-table tbody td:nth-child(7),
.tracker-table thead tr:nth-child(2) th:nth-child(7) {
    position: sticky !important;
    z-index: 5;
    box-shadow: 3px 0 6px rgba(0,0,0,0.08);
}

.tracker-table thead tr:nth-child(2) th:nth-child(-n+7) {
    z-index: 11;
    background: #f8fafc !important;
}

.tracker-table tbody tr:nth-child(even) td:nth-child(-n+7) {
    background: #fafbfc !important;
}

.tracker-table tbody tr:nth-child(odd) td:nth-child(-n+7) {
    background: var(--color-white) !important;
}

.tracker-table tbody tr:hover td:nth-child(-n+7) {
    background: #f0f7ff !important;
}

.tracker-table td:nth-child(4) {
    font-weight: 600;
    color: var(--color-gray-800);
}

/* Tracker stats */
.tracker-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

/* Scroll nav pills */
.scroll-nav {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.scroll-pill {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.scroll-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.sp-pink   { background: #F1CEEE; color: #7a1f6e; }
.sp-green  { background: #D9F2D0; color: #2d6a1e; }
.sp-orange { background: #FAE2D5; color: #8c4a1a; }
.sp-blue   { background: #83CAEB; color: #1a4971; }
.sp-gray   { background: #D0D0D0; color: #333; }

.scroll-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-gray-400);
    margin-bottom: 8px;
}


/* ============================================================
   TRACKER PASSWORD OVERLAY
   ============================================================ */
.pw-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15,23,42,0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.pw-box {
    background: var(--color-white);
    border-radius: var(--radius-3xl);
    padding: 40px 36px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 420px;
    width: 90%;
}

.pw-box h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-gray-800);
    margin: 0 0 8px;
}

.pw-box p {
    font-size: 14px;
    color: var(--color-gray-500);
    margin: 0 0 24px;
    line-height: 1.5;
}

.pw-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--color-border-section);
    border-radius: var(--radius-xl);
    font-size: 15px;
    outline: none;
    text-align: center;
    letter-spacing: 2px;
    transition: border-color 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.pw-box input:focus {
    border-color: var(--color-primary);
}

.pw-box input.pw-error {
    border-color: #ef4444;
    animation: pwShake 0.4s;
}

.pw-box button {
    margin-top: 16px;
    width: 100%;
    padding: 12px;
    background: var(--color-gray-800);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-xl);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.pw-err-msg {
    color: #ef4444;
    font-size: 13px;
    margin-top: 8px;
    display: none;
    font-weight: 500;
}


/* ============================================================
   TRACKER CRUD MODALS
   ============================================================ */
.btn-crud {
    padding: 6px 16px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-add {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-white);
}

.btn-add:hover {
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.btn-edit,
.btn-del {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.btn-edit:hover { background: #e0f2fe; }
.btn-del:hover  { background: var(--color-danger-light); }

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--color-white);
    border-radius: var(--radius-3xl);
    padding: 28px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-box h3 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-gray-800);
}

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

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-gray-500);
    text-transform: uppercase;
}

.modal-field input,
.modal-field select {
    padding: 8px 12px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-family: inherit;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-actions button {
    padding: 10px 24px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.modal-save {
    background: var(--color-gray-800);
    color: var(--color-white);
}

.modal-cancel {
    background: var(--color-gray-100);
    color: var(--color-gray-700);
}

.confirm-box {
    text-align: center;
}

.confirm-box p {
    margin: 0 0 20px;
    font-size: 15px;
    color: var(--color-gray-700);
}

.confirm-del {
    background: var(--color-danger) !important;
    color: var(--color-white) !important;
}


/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-card {
    background: var(--color-white);
    border-radius: var(--radius-3xl);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 400px;
    max-width: 95vw;
    border: 1px solid var(--color-border);
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    margin-bottom: 6px;
}

.login-logo {
    display: block;
    width: min(300px, 100%);
    height: auto;
    margin: 0 auto 10px;
}

.login-card p.subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 24px;
}

.error-msg {
    background: var(--color-danger-light);
    color: var(--color-danger-text);
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Login toggle */
.toggle-row {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: var(--color-gray-100);
    border-radius: var(--radius-xl);
    padding: 3px;
}

.toggle-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gray-500);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}

.toggle-btn.active {
    background: var(--color-white);
    color: var(--color-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toggle-btn svg {
    width: 16px;
    height: 16px;
}

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

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

.form-group select,
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-xl);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--color-white);
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--color-text);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

/* Checkbox */
.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

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

.check-row label {
    font-size: 13px;
    color: var(--color-gray-600);
    cursor: pointer;
}

/* Login button */
.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--color-text);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-xl);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    font-family: inherit;
}

.login-btn:hover {
    opacity: 0.85;
}

.login-btn:active {
    transform: scale(0.98);
}


/* ============================================================
   FOOTER
   ============================================================ */
footer {
    text-align: center;
    padding: 16px;
    color: var(--color-text-faint);
    font-size: 12px;
    border-top: 1px solid var(--color-border);
    margin-top: 40px;
}


/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes alarmPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
    50% { box-shadow: 0 0 16px 4px rgba(220, 38, 38, 0.35); }
}

@keyframes alarmBell {
    0% { transform: rotate(-8deg); }
    100% { transform: rotate(8deg); }
}

@keyframes pwShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .inf-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 768px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    header,
    main {
        overflow-x: hidden;
    }

    .header-inner {
        gap: 8px;
        min-width: 0;
    }

    .header-nav {
        gap: 1px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        max-width: 100%;
        min-width: 0;
    }

    .header-nav::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 12px;
    }

    .nav-link svg {
        display: none;
    }

    .header-inf-selector {
        display: none;
    }

    .header-brand {
        font-size: 15px;
    }

    .header-brand img {
        width: 132px;
        height: 39px;
    }

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

    .card,
    .chart-card,
    .table-responsive,
    .table-wrap {
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
    }

    .card-grid,
    .stats-grid,
    .target-grid {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    main {
        padding: 12px;
    }

    .filters {
        flex-direction: column;
    }

    .filters input {
        width: 100%;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 8px 10px;
    }

    .inf-welcome-banner {
        padding: 24px;
    }

    .banner-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .banner-widgets {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .banner-widget {
        min-width: 0;
        padding: 12px 16px;
    }

    .widget-value {
        font-size: 20px;
    }

    .tracker-container {
        padding: 12px;
    }

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

    .modal-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 10px 12px;
    }

    .filter-bar {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }

    .filter-group {
        width: 100%;
    }

    .filter-bar input,
    .filter-bar select {
        width: 100%;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .kpi-card {
        padding: 12px 14px;
    }

    .kpi-card .kpi-value {
        font-size: 18px;
    }

    .chart-card {
        padding: 12px;
    }

    .chart-title {
        font-size: 13px;
    }

    .data-table {
        font-size: 11px;
    }

    .data-table th,
    .data-table td {
        padding: 6px 8px;
    }

    .daily-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 2px;
    }

    .daily-cell {
        padding: 4px 2px;
        font-size: 9px;
    }

    .daily-cell .day-num {
        font-size: 10px;
    }

    .campaigns-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══ Recommendation Card — Brand, Seller, Discount ═══ */
.rec-card-brand {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.brand-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-primary, #6366f1);
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.seller-tag {
    display: inline-block;
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
}

.rec-card-category {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 6px;
}

.rec-discount-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 6px;
}

.rec-old-price {
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
    text-decoration: line-through;
    margin-right: 4px;
}

.rec-deal-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 4px;
}

/* CSP-safe state and layout helpers. */
[hidden] { display: none !important; }
.text-right { text-align: right; }
.import-error-count { color: var(--color-danger); font-weight: 600; }
.chart-container-adaptive { height: clamp(300px, 65vh, 900px); }

.goal-progress { width: 100%; height: 8px; border: 0; appearance: none; }
.goal-progress::-webkit-progress-bar { background: var(--color-gray-200); border-radius: 4px; }
.goal-progress::-webkit-progress-value { background: var(--color-primary); border-radius: 4px; }
.goal-progress::-moz-progress-bar { background: var(--color-primary); border-radius: 4px; }

.flash { transition: opacity 0.3s, transform 0.3s; }
.flash.is-dismissing { opacity: 0; transform: translateY(-10px); }
.is-loading-control { cursor: wait !important; opacity: 0.8; }
.table-section-start { border-top: 2px solid var(--color-gray-200); }
.growth-positive { color: #10b981; }
.growth-negative { color: #ef4444; }

.daily-cell.heat-level-0 { background: #f9fafb; color: #374151; }
.daily-cell.heat-level-1 { background: rgba(30, 58, 95, 0.19); color: #374151; }
.daily-cell.heat-level-2 { background: rgba(30, 58, 95, 0.28); color: #374151; }
.daily-cell.heat-level-3 { background: rgba(30, 58, 95, 0.37); color: #374151; }
.daily-cell.heat-level-4 { background: rgba(30, 58, 95, 0.46); color: #374151; }
.daily-cell.heat-level-5 { background: rgba(30, 58, 95, 0.55); color: #fff; }
.daily-cell.heat-level-6 { background: rgba(30, 58, 95, 0.64); color: #fff; }
.daily-cell.heat-level-7 { background: rgba(30, 58, 95, 0.73); color: #fff; }
.daily-cell.heat-level-8 { background: rgba(30, 58, 95, 0.82); color: #fff; }
.daily-cell.heat-level-9 { background: rgba(30, 58, 95, 0.91); color: #fff; }
.daily-cell.heat-level-10 { background: #1e3a5f; color: #fff; }

.chart-height-600 { height: 600px !important; }
.chart-height-700 { height: 700px !important; }
.chart-height-800 { height: 800px !important; }
.chart-height-900 { height: 900px !important; }
.chart-height-1000 { height: 1000px !important; }
.chart-height-1100 { height: 1100px !important; }
.chart-height-1200 { height: 1200px !important; }
.chart-height-1300 { height: 1300px !important; }
.chart-height-1400 { height: 1400px !important; }
.chart-height-1500 { height: 1500px !important; }
.chart-height-1600 { height: 1600px !important; }
.chart-height-1700 { height: 1700px !important; }
.chart-height-1800 { height: 1800px !important; }
.chart-height-1900 { height: 1900px !important; }
.chart-height-2000 { height: 2000px !important; }

/* Agency analysis and responsive application header */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

header {
    height: 64px;
    overflow: visible;
}

.header-inner {
    max-width: 1880px;
    gap: 12px;
}

.header-brand {
    letter-spacing: 0;
}

.header-brand img {
    width: 182px;
    height: 54px;
}

.header-nav {
    overflow: visible;
    scrollbar-width: none;
}

.header-nav::-webkit-scrollbar {
    display: none;
}

.header-nav .nav-link {
    padding: 8px 9px;
    font-size: 12.5px;
}

.header-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-white);
    color: var(--color-text-dark);
    cursor: pointer;
    flex: 0 0 auto;
}

.header-menu-icon {
    display: grid;
    gap: 4px;
    width: 18px;
}

.header-menu-icon span {
    display: block;
    height: 2px;
    width: 18px;
    background: currentColor;
    border-radius: 1px;
}

.analysis-filter-band {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 0;
    border-top: 1px solid var(--color-border-subtle);
    border-bottom: 1px solid var(--color-border-subtle);
    margin-bottom: 18px;
}

.analysis-filter-band .filter-group {
    min-width: 168px;
}

.analysis-filter-band input,
.analysis-filter-band select {
    width: 100%;
}

.agency-filter-panel {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: var(--color-white);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.agency-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.agency-selector-field {
    grid-column: span 2;
}

.filter-label {
    display: block;
    margin-bottom: 6px;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.agency-option-list {
    display: flex;
    min-height: 38px;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.agency-option-list label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-white);
    font-size: 12px;
    font-weight: 700;
}

.agency-option-list input {
    width: 15px;
    height: 15px;
}

.agency-filter-grid input,
.agency-filter-grid select {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--color-border-strong, #cbd5e1);
    border-radius: 6px;
    background: #fff;
    color: var(--color-text-dark);
    font: inherit;
}

.agency-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.agency-overview-wide {
    grid-column: 1 / -1;
}

.agency-overview-grid .agency-chart-frame {
    height: 300px;
}

.agency-channel-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border-subtle);
}

.agency-primary-channel {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: 8px;
    align-items: baseline;
    min-width: 225px;
}

.agency-primary-channel strong {
    color: var(--color-text-dark);
    font-size: 15px;
}

.agency-primary-channel > span:last-child {
    grid-column: 1 / -1;
    margin-top: 2px;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.agency-channel-kicker {
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.agency-comparison-switches {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    margin: 0;
    padding: 0;
    border: 0;
}

.agency-comparison-switches legend {
    margin-right: 4px;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.agency-comparison-switches label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-white);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.agency-comparison-switches input {
    width: 15px;
    height: 15px;
    accent-color: var(--color-primary);
}

.agency-filter-panel .analysis-load-status {
    display: block;
    margin-top: 8px;
}

.agency-platform-detail {
    margin-top: 16px;
}

.agency-filter-field {
    min-width: 220px !important;
}

.recommendation-scope-tool {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 2fr) auto;
    gap: 12px;
    align-items: center;
    margin: 0 0 16px;
    padding: 14px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: var(--color-white);
}

.recommendation-scope-tool > div {
    display: grid;
    gap: 3px;
}

.recommendation-scope-tool > div span,
.recommendation-scope-tool > span {
    color: var(--color-text-secondary);
    font-size: 12px;
}

.recommendation-scope-tool select {
    width: 100%;
    min-height: 104px;
}

.analysis-load-status {
    min-height: 20px;
    color: var(--color-text-secondary);
    font-size: 13px;
    align-self: center;
}

.analysis-load-status.is-error {
    color: var(--color-danger);
}

.agency-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    margin-bottom: 22px;
}

.agency-summary-card-groups {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.agency-summary-card-group {
    min-width: 0;
    padding-top: 14px;
    border-top: 1px solid var(--color-border-subtle);
}

.agency-summary-card-group:first-child {
    padding-top: 0;
    border-top: 0;
}

.agency-summary-card-group > h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

.agency-summary-card-group .agency-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin-bottom: 0;
}

.agency-analysis-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.agency-report-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.agency-month-report-field {
    display: grid;
    gap: 4px;
    min-width: 150px;
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 700;
}

.agency-month-report-field input {
    width: 100%;
    min-width: 0;
    min-height: 36px;
}

.agency-analysis-page,
.agency-analysis-page > *,
.agency-filter-panel fieldset,
.agency-kpi-grid .stat-card {
    min-width: 0;
}

.agency-kpi-grid .stat-value,
.agency-analysis-page h1,
.agency-analysis-page h2,
.agency-analysis-page h3,
.agency-analysis-page p {
    overflow-wrap: normal;
    word-break: normal;
}

.agency-analysis-page .data-table th,
.agency-analysis-page .data-table td {
    text-align: center;
    vertical-align: middle;
}

.agency-analysis-page .data-table th.is-sortable {
    cursor: pointer;
    user-select: none;
}

.agency-analysis-page .data-table th.is-sortable::after {
    content: " ↕";
    color: #64748b;
    font-size: 0.75em;
}

.agency-analysis-page .data-table th[data-sort-direction="asc"]::after { content: " ↑"; }
.agency-analysis-page .data-table th[data-sort-direction="desc"]::after { content: " ↓"; }

.agency-chart-frame canvas {
    max-width: 100% !important;
}

.analysis-view-switches {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 18px;
    padding: 0;
    border: 0;
}

.analysis-view-switches legend {
    margin-right: 8px;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.analysis-view-switches label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 7px 11px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-white);
    color: var(--color-text-dark);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.analysis-view-switches input {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.analysis-definition-badge {
    flex: 0 0 auto;
    padding: 5px 8px;
    border: 1px solid #f4c58d;
    border-radius: 4px;
    background: #fff8ee;
    color: #8a4b08;
    font-size: 12px;
    font-weight: 700;
}

.analysis-section {
    padding: 20px 0;
    border-top: 1px solid var(--color-border-subtle);
}

.analysis-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.analysis-section-heading h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.analysis-section-heading p,
.analysis-footnote {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.agency-chart-frame {
    position: relative;
    width: 100%;
    height: 360px;
    min-height: 280px;
}

.agency-wide-table {
    min-width: 1180px;
}

.agency-ranking-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.agency-ranking-grid h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

.analysis-quality-band {
    padding: 16px 0 28px;
    border-top: 1px solid var(--color-border-subtle);
}

.analysis-quality-band strong {
    display: block;
    margin-bottom: 6px;
}

.analysis-quality-band p {
    margin: 4px 0;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.agency-table-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid var(--color-border-light);
    background: #fff;
}

.agency-page-button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text-dark);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.agency-page-button:disabled {
    opacity: .4;
    cursor: default;
}

.agency-page-label {
    min-width: 92px;
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.numeric-cell {
    text-align: right;
    white-space: nowrap;
}

.empty-table-cell {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 24px !important;
}

.status-ahead,
.status-ok {
    color: #087b59;
    font-weight: 700;
}

.status-risk {
    color: #a65b00;
    font-weight: 700;
}

.status-behind {
    color: #c02a3b;
    font-weight: 700;
}

.status-no_target {
    color: var(--color-text-secondary);
}

.analysis-footnote {
    padding: 12px 0 24px;
}

.module-permission-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

@media (max-width: 1850px) {
    .header-menu-toggle {
        display: inline-flex;
        order: 3;
        margin-left: auto;
    }

    .header-nav {
        display: none;
        position: fixed;
        top: 70px;
        right: 12px;
        width: min(390px, calc(100vw - 24px));
        max-height: calc(100vh - 82px);
        overflow-x: hidden;
        overflow-y: auto;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 10px;
        background: var(--color-white);
        border: 1px solid var(--color-border);
        border-radius: 6px;
        box-shadow: var(--shadow-lg);
        z-index: 1100;
    }

    .header-nav.is-open {
        display: flex;
    }

    .header-nav .nav-link,
    .header-nav form,
    .header-nav .nav-dropdown {
        width: 100%;
    }

    .header-nav .nav-link {
        justify-content: flex-start;
        padding: 10px 12px;
        font-size: 13px;
    }

    .header-nav .nav-link.active::after {
        display: none;
    }

    .header-nav .nav-dropdown-menu,
    .header-nav.is-open .nav-dropdown:hover .nav-dropdown-menu {
        position: static;
        display: block !important;
        min-width: 0;
        margin: 0 0 4px 18px;
        border: 0;
        border-left: 2px solid var(--color-border-subtle);
        border-radius: 0;
        box-shadow: none;
    }

    .header-nav .nav-divider {
        width: 100%;
        height: 1px;
        margin: 6px 0;
    }

    .header-nav .lang-switcher select,
    .header-nav .nav-link-logout {
        width: 100%;
    }

    .header-inf-selector {
        order: 2;
    }
}

@media (max-width: 900px) {
    header {
        padding: 0 12px;
    }

    .header-inf-selector {
        display: none;
    }

    .header-brand img {
        width: 158px;
        height: 47px;
    }

    .analysis-filter-band {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: end;
    }

    .agency-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .agency-overview-grid {
        grid-template-columns: 1fr;
    }

    .agency-overview-wide {
        grid-column: auto;
    }

    .agency-channel-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .agency-comparison-switches {
        flex: 1 1 100%;
    }

    .analysis-filter-band .filter-group,
    .agency-filter-field {
        min-width: 0 !important;
    }

    .analysis-load-status {
        grid-column: 1 / -1;
    }

    .agency-analysis-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .agency-report-actions {
        flex: 1 1 100%;
        justify-content: flex-start;
    }

    .agency-ranking-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .header-brand img {
        width: 148px;
        height: 44px;
    }

    .analysis-filter-band {
        grid-template-columns: 1fr;
    }

    .agency-filter-grid {
        grid-template-columns: 1fr;
    }

    .agency-channel-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .agency-comparison-switches {
        display: grid;
        grid-template-columns: 1fr;
    }

    .agency-comparison-switches legend {
        margin-bottom: 4px;
    }

    .agency-filter-panel .btn {
        width: 100%;
        justify-content: center;
    }

    .analysis-filter-band .btn {
        width: 100%;
        justify-content: center;
    }

    .agency-chart-frame {
        height: 280px;
    }

    .analysis-section-heading h2 {
        font-size: 16px;
    }

    .agency-analysis-header {
        flex-direction: column;
    }

    .agency-report-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .agency-month-report-field {
        width: 100%;
    }

    .agency-analysis-header .btn,
    .agency-report-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .analysis-view-switches {
        display: grid;
        grid-template-columns: 1fr;
    }

    .analysis-view-switches legend {
        margin-bottom: 4px;
    }

    .analysis-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}
.trend-product-cell {
    align-items: center;
    display: flex;
    gap: 10px;
    min-width: 260px;
    text-align: left;
}

.trend-product-image {
    background: #f7f8fa;
    border: 1px solid #e3e7ee;
    height: 48px;
    object-fit: contain;
    width: 48px;
}

.amazon-revenue-warning {
    align-items: center;
    background: #fff1f2;
    border: 1px solid #e11d48;
    border-radius: 6px;
    color: #881337;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin: 12px auto;
    max-width: min(1840px, calc(100% - 32px));
    padding: 12px 14px;
}

.amazon-revenue-warning[hidden] { display: none; }
.amazon-revenue-warning details { flex: 1; min-width: 0; }
.amazon-revenue-warning summary { cursor: pointer; font-weight: 700; }
.amazon-revenue-warning p { margin: 8px 0 0; }
.amazon-revenue-warning .btn { flex: 0 0 auto; }

@media (max-width: 640px) {
    .amazon-revenue-warning { align-items: stretch; flex-direction: column; }
}
