/* ============================================================
   SUPPLIES DASHBOARD v4.1 — CSS
   Premium dark/light, Inter + JetBrains Mono, glassmorphism
   ============================================================ */

:root {
    --bg: #0b0d14;
    --bg-card: #151825;
    --bg-card-hover: #1c2035;
    --bg-header: rgba(11, 13, 20, 0.92);
    --bg-input: #1e2236;
    --text: #e8eaf0;
    --text-secondary: #9096ad;
    --text-muted: #5a6080;
    --border: #252a3e;
    --border-light: #313756;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.12);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.08);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.08);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.06);
    --wb-color: #a855f7;
    --wb-bg: rgba(168, 85, 247, 0.08);
    --ozon-color: #3b82f6;
    --ozon-bg: rgba(59, 130, 246, 0.06);
    --ozon-rfc-color: #10b981;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --transition: 0.2s ease;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    /* Chart colors for dark theme */
    --chart-label: #9096ad;
    --chart-tick: #5a6080;
    --chart-grid: rgba(255, 255, 255, 0.05);
    --chart-grid-x: rgba(255, 255, 255, 0.03);
    /* MP text labels */
    --wb-text: #c084fc;
    --ozon-text: #60a5fa;
}

[data-theme="light"] {
    --bg: #f3f4f6;
    --bg-card: #ffffff;
    --bg-card-hover: #f9fafb;
    --bg-header: rgba(255, 255, 255, 0.92);
    --bg-input: #f0f1f4;
    --text: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --border-light: #d1d5db;
    --accent-glow: rgba(99, 102, 241, 0.06);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --danger-bg: rgba(239, 68, 68, 0.04);
    --success-bg: rgba(16, 185, 129, 0.04);
    --warning-bg: rgba(245, 158, 11, 0.04);
    --wb-bg: rgba(168, 85, 247, 0.04);
    --ozon-bg: rgba(59, 130, 246, 0.04);
    /* Chart colors for light theme */
    --chart-label: #4b5563;
    --chart-tick: #6b7280;
    --chart-grid: rgba(0, 0, 0, 0.06);
    --chart-grid-x: rgba(0, 0, 0, 0.04);
    /* MP text labels — darker for light bg */
    --wb-text: #7c3aed;
    --ozon-text: #2563eb;
}

/* ===== Reset ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Auth ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b0d14 0%, #151040 50%, #0b0d14 100%);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.auth-card {
    background: rgba(21, 24, 37, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    text-align: center;
    width: min(420px, 90vw);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-logo {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
}

.auth-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #818cf8, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.auth-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font);
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.auth-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-btn {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    letter-spacing: 0.5px;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.auth-status {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    min-height: 1.5rem;
}

.auth-status.error {
    color: var(--danger);
}

/* ===== Fixed top wrapper (header + nav) ===== */
.sticky-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* ===== Dashboard wrapper — offset for fixed header + nav ===== */
.dashboard {
    padding-top: 96px;
    /* header ~52px + tab-nav ~44px */
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-center {
    flex: 1;
    text-align: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.version-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.last-updated {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.last-updated-bold {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--font-main);
    letter-spacing: 0.2px;
}

.last-updated-bold .update-date {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 1px;
}

/* Per-column filters in table headers */
.filter-header-row th {
    padding: 2px 3px !important;
}

.col-filter {
    width: 100%;
    padding: 3px 6px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    outline: none;
    box-sizing: border-box;
}

.col-filter:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.col-filter::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.55rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text);
}

.icon-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: scale(1.05);
}

/* ===== User Panel ===== */
.user-panel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
}

.user-avatar {
    font-size: 1.1rem;
}

.user-name {
    font-weight: 600;
    color: var(--accent-light);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Tab Navigation ===== */
.tab-nav {
    display: flex;
    gap: 0.35rem;
    padding: 0.35rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    padding: 0.5rem 1.1rem;
    background: none;
    border: none;
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    font-family: var(--font);
}

.tab-btn:hover {
    color: var(--text);
    background: var(--bg-card-hover);
}

.tab-btn.active {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.tab-content {
    display: none;
    padding: 1rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Summary Bar ===== */
.summary-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.85rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.summary-divider {
    color: var(--text-muted);
}

.summary-date {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-left: auto;
}

.text-danger {
    color: var(--danger);
    font-weight: 700;
}

/* ===== Panel ===== */
.panel {
    background: rgba(21, 24, 37, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    margin-bottom: 0.85rem;
    transition: all 0.25s ease;
    position: relative;
}

[data-theme="light"] .panel {
    background: rgba(255, 255, 255, 0.85);
}

.panel:hover {
    border-color: var(--border-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.panel-title {
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: -0.3px;
}

.panel-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: -0.3rem;
    margin-bottom: 0.75rem;
}

.sub-title {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.2px;
}

/* ===== Search ===== */
.panel-search {
    border-left: 3px solid var(--accent);
    margin-bottom: 1.25rem;
}

.route-search-inline {
    display: flex;
    gap: 0.75rem;
}

.route-input {
    flex: 1;
    padding: 0.65rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: var(--font-mono);
}

.route-input:focus {
    border-color: var(--accent);
    outline: none;
}

.route-result {
    padding: 1rem;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    white-space: pre-wrap;
    margin-top: 0.75rem;
}

/* ===== Grids ===== */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.news-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

/* ===== Alerts ===== */
.panel-alerts {
    border-left: 3px solid var(--warning);
}

.alerts-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    background: var(--danger);
    color: white;
    border-radius: 20px;
    min-width: 1.4rem;
    text-align: center;
}

.alerts-list {
    max-height: 320px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    border-radius: 6px;
}

.alert-item:hover {
    background: var(--bg-card-hover);
}

.alert-item:last-child {
    border-bottom: none;
}

.alert-info {
    flex: 1;
}

.alert-msg {
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

.alert-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    font-family: var(--font-mono);
}

.alert-source {
    font-size: 0.72rem;
    color: var(--ozon-color);
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.alert-level {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.alert-level-error {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-level-warn {
    background: var(--warning-bg);
    color: var(--warning);
}

.alert-level-info {
    background: var(--accent-glow);
    color: var(--accent-light);
}

/* ===== Monitoring ===== */
.panel-monitoring {
    border-left: 3px solid var(--success);
}

.monitoring-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.monitoring-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.monitoring-item:hover {
    background: var(--bg-card-hover);
}

.monitoring-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.monitoring-dot.ok {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.monitoring-dot.warn {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.monitoring-dot.err {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.monitoring-label {
    font-size: 0.82rem;
    font-weight: 600;
}

.monitoring-value {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-left: auto;
    font-family: var(--font-mono);
}

.monitoring-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 100%;
    margin-top: -0.3rem;
    padding-left: 2rem;
}

/* ===== News ===== */
.link-portal {
    font-size: 0.78rem;
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 600;
}

.link-portal:hover {
    text-decoration: underline;
}

.news-feed {
    max-height: 300px;
    overflow-y: auto;
}

.news-item {
    padding: 0.7rem 0.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    border-radius: 4px;
    cursor: default;
}

.news-item:hover {
    background: var(--bg-card-hover);
}

.news-item:last-child {
    border-bottom: none;
}

.news-date {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: 0.15rem;
}

.news-title {
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.4;
}

.news-body {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
    line-height: 1.4;
}

.news-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-light);
    margin-left: 4px;
    vertical-align: middle;
}

.news-link {
    font-size: 0.75rem;
    color: var(--accent-light);
    text-decoration: none;
    margin-top: 0.25rem;
    display: inline-block;
}

.news-link:hover {
    text-decoration: underline;
}

/* ===== Hero Buttons ===== */
.hero-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.hero-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.85rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.hero-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 120%, rgba(255, 255, 255, 0.05), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hero-btn:hover {
    transform: translateY(-3px);
}

.hero-btn:hover::after {
    opacity: 1;
}

.hero-btn:active {
    transform: translateY(-1px);
}

.hero-icon {
    font-size: 1.5rem;
    position: relative;
    z-index: 1;
}

.hero-label {
    font-size: 0.92rem;
    font-weight: 800;
    z-index: 1;
    color: var(--text);
    letter-spacing: -0.3px;
}

.hero-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
    z-index: 1;
}

.hero-btn-wb {
    border-color: var(--wb-color);
    background: var(--wb-bg);
}

.hero-btn-wb:hover {
    box-shadow: 0 8px 30px rgba(168, 85, 247, 0.25);
}

.hero-btn-ozon {
    border-color: var(--ozon-color);
    background: var(--ozon-bg);
}

.hero-btn-ozon:hover {
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.25);
}

.hero-btn-ozon-rfc {
    border-color: var(--ozon-rfc-color);
    background: var(--success-bg);
}

.hero-btn-ozon-rfc:hover {
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.25);
}

.hero-btn-ax {
    border-color: var(--warning);
    background: var(--warning-bg);
}

.hero-btn-ax:hover {
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.25);
}

/* AX badge (floating pill on hero-btn) */
.ax-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    animation: ax-pulse 2s ease-in-out infinite;
    line-height: 1;
}

.ax-badge.zero {
    background: var(--success);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    animation: none;
}

@keyframes ax-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* ===== Stats Row ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.stats-row-compact {
    margin-bottom: 0.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.5rem;
    text-align: center;
    transition: all 0.25s ease;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--accent-light);
    font-family: var(--font);
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-hint {
    font-size: 0.55rem;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 0.15rem;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.ax-ok-hint {
    font-size: 0.6rem;
    color: #43a047;
    margin-top: 0.2rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    min-height: 0.8rem;
}

.stat-card-danger .stat-value {
    color: var(--danger);
}

.stat-card-danger {
    border-color: rgba(239, 68, 68, 0.25);
    background: var(--danger-bg);
}

.stat-card-time .stat-value {
    font-size: 1.2rem;
    color: var(--warning);
    font-family: var(--font-mono);
}

/* ===== Clickable Stat Cards: Accepted Today/Yesterday ===== */
.stat-card-clickable {
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.stat-card-clickable:hover {
    border-color: var(--success, #10b981);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

.stat-card-clickable .stat-label::after {
    content: ' ▼';
    font-size: 0.6rem;
    opacity: 0.5;
}

.stat-card-yesterday .stat-value {
    color: var(--warning, #f59e0b);
}

.stat-card-yesterday:hover {
    border-color: var(--warning, #f59e0b);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}

/* Dropdown List */
.accepted-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    margin-top: 0;
    text-align: left;
}

.accepted-list.open {
    max-height: 300px;
    overflow-y: auto;
    opacity: 1;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.accepted-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.35rem;
    border-radius: 4px;
    font-size: 0.72rem;
    transition: background 0.15s;
}

.accepted-list-item:hover {
    background: var(--bg-input, rgba(255, 255, 255, 0.05));
}

.accepted-list-item:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.accepted-num {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-light);
    font-size: 0.73rem;
}

.accepted-wh {
    color: var(--text-muted);
    font-size: 0.65rem;
    max-width: 50%;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.accepted-list-empty {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0.4rem 0;
    font-style: italic;
}

.accepted-list::-webkit-scrollbar {
    width: 4px;
}

.accepted-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ===== OZON Stats Split ===== */
.ozon-stats-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.stats-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
}

.stats-group-label {
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.3px;
}

.stats-group-full {
    grid-column: 1 / -1;
}

.stats-group .stats-row {
    margin-bottom: 0;
}

.stats-group .stat-card {
    background: var(--bg-input);
}

/* ===== Analytics Grid ===== */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.analytics-grid-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.chart-container-sm {
    position: relative;
    height: 180px;
    width: 100%;
}

/* ===== OZON Split ===== */
.ozon-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.ozon-sc-panel {
    border-left: 3px solid var(--ozon-color);
}

.ozon-rfc-panel {
    border-left: 3px solid var(--ozon-rfc-color);
}

/* ===== Tables ===== */
.panel-attention {
    border-left: 3px solid var(--warning);
}

.panel-problems {
    border-left: 3px solid var(--danger);
}

.attention-table-wrap,
.results-table-wrap {
    max-height: 350px;
    overflow-y: auto;
}

.mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.mini-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.mini-table th {
    padding: 0.5rem 0.6rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-card);
    border-bottom: 2px solid var(--border);
}

.mini-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font);
}

.mini-table tr:hover td {
    background: var(--bg-card-hover);
}

.loading-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

/* DaysLeft подсветка */
.days-critical {
    color: #fff;
    background: var(--danger);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.days-warning {
    color: #fff;
    background: var(--warning);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.days-caution {
    color: #000;
    background: #fde68a;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.days-ok {
    color: var(--success);
    font-weight: 600;
    font-family: var(--font-mono);
}

/* ===== Filter Input ===== */
.filter-input {
    padding: 0.35rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.82rem;
    font-family: var(--font);
    width: 200px;
    transition: var(--transition);
}

.filter-input:focus {
    border-color: var(--accent);
    outline: none;
    width: 250px;
}

.filter-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ===== Count badges ===== */
.count-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.15rem 0.55rem;
    background: var(--accent);
    color: white;
    border-radius: 20px;
}

.count-badge-danger {
    background: var(--danger);
}

/* ===== Buttons ===== */
.btn-primary {
    padding: 0.65rem 1.25rem;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.78rem;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
}

.btn-sm:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

.btn-resolve {
    padding: 0.3rem 0.65rem;
    background: var(--success-bg);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-size: 0.73rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-resolve:hover {
    background: var(--success);
    color: white;
}

.btn-admin {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent-light);
}

/* ===== Training ===== */
.training-progress {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.progress-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 0.75rem;
}

.progress-stat {
    text-align: center;
}

.progress-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: block;
    font-weight: 500;
}

.progress-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-light);
}

.progress-bar-wrap {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 4px;
    transition: width 0.6s ease;
}

.training-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.training-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.training-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--success));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.training-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
}

.training-card:hover::before {
    opacity: 1;
}

.training-card-icon {
    font-size: 2rem;
    margin-bottom: 0.4rem;
}

.training-card-title {
    font-weight: 700;
    margin-bottom: 0.35rem;
    flex: 1;
    font-size: 0.92rem;
    letter-spacing: -0.2px;
}

.training-card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: auto;
}

.training-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.training-card-actions .btn-sm {
    flex: 1;
    text-align: center;
    font-weight: 600;
}

.btn-instruction {
    background: var(--accent-glow);
    color: var(--accent-light);
    border-color: var(--accent);
}

.btn-test {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

.btn-test:hover {
    background: var(--success);
    color: white;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    padding: 2rem;
    overflow-y: auto;
    align-items: flex-start;
    justify-content: center;
}

.modal.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: min(600px, 95vw);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    margin: auto;
}

.modal-lg {
    width: min(850px, 95vw);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 1.25rem;
}

.modal-body .training-content {
    font-size: 0.9rem;
    line-height: 1.85;
    white-space: pre-wrap;
}

/* ===== Help ===== */
.help-content h4 {
    font-size: 1rem;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
    color: var(--accent-light);
}

.help-content h4:first-child {
    margin-top: 0;
}

.help-content ul {
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
}

.help-content li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    line-height: 1.5;
}

.help-content b {
    color: var(--text);
}

/* ===== Footer ===== */
.footer {
    display: flex;
    justify-content: space-between;
    padding: 1rem 2rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
    font-family: var(--font-mono);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}




/* ============ Новые виджеты ============ */

/* Карточки сравнения */
.comparison-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.stat-card-comparison {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    text-align: center;
    transition: all 0.25s ease;
}

.stat-card-comparison:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stat-card-comparison .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    font-family: var(--font-mono);
}

.stat-card-comparison .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.stat-card-comparison .stat-delta {
    font-size: 0.72rem;
    margin-top: 0.3rem;
    color: var(--text-muted);
}

.delta-up {
    color: #10b981;
    font-weight: 600;
}

.delta-down {
    color: #ef4444;
    font-weight: 600;
}

.delta-neutral {
    color: var(--text-muted);
}

/* Тренд-график */
.panel-trend .chart-container-lg {
    height: 220px;
}

.trend-toggle {
    display: flex;
    gap: 0.4rem;
}

.trend-toggle .btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
    border-radius: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.trend-toggle .btn-sm.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Два столбца */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

/* Лента изменений */
.changes-feed {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.change-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.change-item:last-child {
    border-bottom: none;
}

.change-platform {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 32px;
    text-align: center;
}

.change-platform.wb {
    background: #a855f722;
    color: #a855f7;
}

.change-platform.ozon {
    background: #f59e0b22;
    color: #f59e0b;
}

.change-body {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text);
}

.change-body strong {
    color: var(--accent-light);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.change-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* SLA */
.sla-summary {
    text-align: center;
    margin-top: 0.5rem;
}

.sla-pct {
    font-size: 1.5rem;
    font-weight: 800;
    color: #10b981;
    font-family: var(--font-mono);
}

.sla-pct-sub {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.sla-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Товары */
.goods-summary {
    padding: 0.5rem 0;
}

.goods-total {
    text-align: center;
    margin-bottom: 0.75rem;
}

.goods-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-light);
    font-family: var(--font-mono);
}

.goods-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Сводка активных поставок */
.active-breakdown-total {
    margin-bottom: 0.8rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.active-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ab-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.ab-label {
    flex: 0 0 140px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
}

.ab-bar-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 22px;
}

.ab-bar {
    height: 100%;
    border-radius: 4px;
    min-width: 4px;
    transition: width 0.5s ease;
}

.ab-count {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    min-width: 24px;
}

/* Компактная таблица */
.mini-table-compact th,
.mini-table-compact td {
    padding: 0.35rem 0.5rem !important;
    font-size: 0.75rem;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem;
    font-size: 0.85rem;
}

/* Большой chart container */
.chart-container-lg {
    position: relative;
    height: 180px;
}

/* Проблемные панели */
.panel-problems {
    border-left: 3px solid var(--danger);
}

.count-badge-danger {
    background: var(--danger-bg) !important;
    color: var(--danger) !important;
}

/* ============ ПОЛНАЯ МОБИЛЬНАЯ АДАПТАЦИЯ ============ */

/* Запрет горизонтального скролла */
html,
body {
    overflow-x: hidden;
}

/* Tablet: 1024px */
@media (max-width: 1024px) {

    .main-grid,
    .news-grid,
    .ozon-split-grid,
    .ozon-stats-split {
        grid-template-columns: 1fr;
    }

    .analytics-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stats-group-full {
        grid-column: auto;
    }

    .comparison-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .two-col-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile: 768px */
@media (max-width: 768px) {

    /* === Контент === */
    .tab-content {
        padding: 0.6rem;
    }

    .dashboard {
        padding-top: 120px;
        /* header taller on mobile due to wrap */
    }

    /* === Header — мобильный === */
    .header {
        padding: 0.5rem 0.6rem;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .header-left {
        gap: 0.35rem;
    }

    .logo {
        font-size: 0.95rem;
    }

    .version-badge {
        font-size: 0.5rem;
        padding: 0.12rem 0.35rem;
    }

    .header-center {
        order: 3;
        flex-basis: 100%;
        text-align: left;
        margin-top: 0.15rem;
    }

    .header-center span {
        font-size: 0.7rem;
    }

    .header-right {
        gap: 0.25rem;
    }

    .user-panel {
        display: none;
    }

    .icon-btn {
        font-size: 0.85rem;
        padding: 0.3rem 0.45rem;
        min-height: 36px;
        min-width: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* === Навигация — горизонтальный скролл === */
    .tab-nav {
        padding: 0 0.4rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0;
    }

    .tab-nav::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        padding: 0.55rem 0.75rem;
        font-size: 0.78rem;
        white-space: nowrap;
        min-width: fit-content;
    }

    /* === Summary bar — стек на мобильном === */
    .summary-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        padding: 0.65rem 0.8rem;
        font-size: 0.8rem;
    }

    .summary-divider {
        display: none;
    }

    .summary-date {
        margin-left: 0;
        font-size: 0.72rem;
    }

    /* === Поиск маршрута === */
    .route-search-inline {
        flex-direction: column;
        gap: 0.5rem;
    }

    .route-input {
        width: 100%;
        font-size: 0.9rem;
        padding: 0.6rem 0.8rem;
    }

    .route-result {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.6rem;
        font-size: 0.8rem;
    }

    .route-result table {
        min-width: 500px;
    }

    .route-result th,
    .route-result td {
        padding: 4px 6px !important;
        font-size: 0.72rem !important;
    }

    /* === Карточки сравнения === */
    .comparison-cards {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .stat-card-comparison {
        padding: 0.75rem;
        display: flex;
        align-items: center;
        gap: 0.6rem;
        flex-direction: row;
        text-align: left;
    }

    .stat-card-comparison .stat-value {
        font-size: 1.5rem;
        margin: 0;
    }

    .stat-card-comparison .stat-label {
        font-size: 0.75rem;
    }

    /* === Панели === */
    .panel {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        border-radius: 10px;
    }

    .panel-title {
        font-size: 0.85rem;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    /* === Графики === */
    .analytics-grid,
    .analytics-grid-inner {
        grid-template-columns: 1fr;
    }

    .chart-container-sm {
        height: 170px;
    }

    .chart-container-lg {
        height: 170px;
    }

    .panel-trend .chart-container-lg {
        height: 190px;
    }

    /* === Hero кнопки (WB/OZON экспорт) === */
    .hero-actions {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .hero-btn {
        padding: 0.7rem 0.8rem;
        font-size: 0.82rem;
        min-height: 52px;
    }

    .hero-icon {
        font-size: 1.2rem;
    }

    /* === Сводка + Stats === */
    .summary-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .summary-card .summary-value {
        font-size: 1.4rem;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }

    .stat-item {
        padding: 0.5rem;
    }

    .stat-item .stat-value {
        font-size: 1.15rem;
    }

    .stat-item .stat-label {
        font-size: 0.65rem;
    }

    /* === Таблицы === */
    .panel {
        overflow-x: hidden;
        max-width: 100%;
    }

    .attention-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    .mini-table {
        min-width: 480px;
    }

    .mini-table th,
    .mini-table td {
        padding: 0.35rem 0.45rem;
        font-size: 0.7rem;
    }

    /* === Два столбца -> один === */
    .two-col-grid {
        grid-template-columns: 1fr;
    }

    /* === Лента изменений === */
    .changes-feed {
        max-height: 280px;
    }

    .change-item {
        padding: 0.45rem 0;
        gap: 0.5rem;
    }

    .change-body {
        font-size: 0.76rem;
    }

    /* === SLA / Товары === */
    .sla-pct {
        font-size: 1.35rem;
    }

    .goods-num {
        font-size: 1.25rem;
    }

    /* === Trend toggle === */
    .trend-toggle .btn-sm {
        padding: 0.4rem 0.85rem;
        font-size: 0.76rem;
        min-height: 34px;
    }

    /* === Модалки === */
    .modal {
        padding: 0.5rem;
    }

    .modal-content {
        width: 95vw;
        max-height: none;
        overflow: visible;
        margin: 0.5rem auto;
        padding: 0;
    }

    .modal-lg {
        width: 95vw;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-body {
        padding: 0.75rem;
    }

    /* Таблицы внутри модалок — горизонтальный скролл */
    .modal-body table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        width: 100%;
    }

    .modal-body table td,
    .modal-body table th {
        padding: 0.35rem 0.5rem;
        font-size: 0.78rem;
    }

    .modal-title {
        font-size: 1.05rem;
    }

    /* === Новости === */
    .news-grid {
        grid-template-columns: 1fr;
    }

    .news-item {
        padding: 0.6rem;
    }

    .news-title {
        font-size: 0.82rem;
    }

    .news-body {
        font-size: 0.75rem;
    }

    /* === Алерты === */
    .alert-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    /* === OZON split === */
    .ozon-split-grid {
        grid-template-columns: 1fr;
    }

    /* === Мониторинг === */
    .monitoring-grid {
        grid-template-columns: 1fr;
    }

    .monitoring-item {
        padding: 0.45rem;
    }

    .monitoring-label {
        font-size: 0.78rem;
    }

    .monitoring-value {
        font-size: 0.72rem;
    }

    /* === Обучение === */
    .training-grid {
        grid-template-columns: 1fr;
    }

    .training-card {
        min-height: 150px;
    }

    /* === Footer === */
    .footer {
        font-size: 0.7rem;
        padding: 0.5rem;
    }

    /* === Кнопки === */
    .btn-primary,
    .btn-sm {
        font-size: 0.8rem;
        min-height: 36px;
    }

    /* === Accepted list (принятые поставки) === */
    .accepted-list-item {
        font-size: 0.7rem;
        padding: 0.3rem;
    }

    /* === Filter inputs === */
    .filter-input {
        width: 100%;
        font-size: 0.8rem;
    }

    .filter-input:focus {
        width: 100%;
    }

    .filter-row {
        flex-direction: column;
        gap: 0.4rem;
    }

    .col-filter {
        width: 100%;
    }
}

/* Small phone: 480px */
@media (max-width: 480px) {
    .tab-content {
        padding: 0.4rem;
    }

    .header {
        padding: 0.35rem 0.4rem;
    }

    .logo {
        font-size: 0.85rem;
    }

    .summary-bar {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
        gap: 0.3rem;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .stat-item .stat-value {
        font-size: 1.3rem;
    }

    .panel {
        padding: 0.55rem;
        border-radius: 8px;
        margin-bottom: 0.6rem;
    }

    .panel-title {
        font-size: 0.8rem;
    }

    .chart-container-sm {
        height: 140px;
    }

    .chart-container-lg {
        height: 150px;
    }

    .panel-trend .chart-container-lg {
        height: 170px;
    }

    .stat-card-comparison .stat-value {
        font-size: 1.25rem;
    }

    .stat-card-comparison .stat-label {
        font-size: 0.7rem;
    }

    .mini-table {
        min-width: 400px;
    }

    .mini-table th,
    .mini-table td {
        padding: 0.25rem 0.35rem;
        font-size: 0.65rem;
    }

    .route-result table {
        min-width: 420px;
    }

    .route-result th,
    .route-result td {
        padding: 3px 5px !important;
        font-size: 0.68rem !important;
    }

    .changes-feed {
        max-height: 220px;
    }

    .change-platform {
        font-size: 0.58rem;
    }

    .change-body {
        font-size: 0.7rem;
    }

    .sla-pct {
        font-size: 1.15rem;
    }

    .goods-num {
        font-size: 1rem;
    }

    .modal-content {
        width: 98vw;
        max-height: none;
        overflow: visible;
        border-radius: 8px;
        padding: 0;
    }

    .modal {
        padding: 0.25rem;
    }

    .modal-body {
        padding: 0.5rem;
    }

    /* Touch friendly buttons */
    .btn-sm,
    .icon-btn {
        min-height: 38px;
        min-width: 38px;
    }

    .tab-btn {
        padding: 0.5rem 0.6rem;
        font-size: 0.72rem;
    }

    .hero-btn {
        padding: 0.6rem;
        min-height: 48px;
    }

    .hero-label {
        font-size: 0.82rem;
    }

    .hero-desc {
        font-size: 0.65rem;
    }

    .comparison-cards {
        gap: 0.5rem;
    }

    .training-card {
        min-height: 120px;
        padding: 0.85rem;
    }

    /* Авторизация на маленьком экране */
    .auth-card {
        padding: 1.5rem 1.25rem;
        border-radius: 14px;
    }

    .auth-logo {
        font-size: 2.5rem;
    }

    .auth-title {
        font-size: 1.35rem;
    }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
    .panel-trend .chart-container-lg {
        height: 150px;
    }

    .chart-container-sm {
        height: 140px;
    }

    .changes-feed {
        max-height: 200px;
    }

    .header {
        padding: 0.3rem 0.6rem;
    }

    .tab-nav {
        padding: 0 0.3rem;
    }

    .tab-btn {
        padding: 0.35rem 0.6rem;
    }
}

/* ===== Inline Spinner ===== */
.spinner-inline {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(0, 0, 0, 0.15);
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

button:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* ===== Acceptance Coefficients — Traffic Light ===== */
.coeff-free {
    color: var(--success);
}

.coeff-paid {
    color: var(--warning);
}

.coeff-closed {
    color: var(--danger);
}

#coeff-table tbody tr:hover {
    background: var(--bg-hover);
}

.coeff-free,
.coeff-paid,
.coeff-closed {
    font-weight: 600;
    font-size: 0.85rem;
}

/* ============ Аналитика ============ */

/* Баннер аномалий */
.anomaly-banner {
    background: linear-gradient(135deg, #ff6b3520, #ff3b3020);
    border: 1px solid #ff6b3540;
    border-radius: var(--radius);
    padding: 0.65rem 1rem;
    margin-bottom: 0.85rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.anomaly-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.anomaly-item.spike {
    color: #e74c3c;
}

.anomaly-item.drop {
    color: #e67e22;
}

/* Скорость приёмки по складам */
.analytics-speed-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.speed-panel .speed-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    padding: 0.35rem 0;
}

.speed-card {
    text-align: center;
    padding: 0.65rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}

.speed-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.speed-card.best {
    background: linear-gradient(135deg, #00b89420, #2ecc7120);
    border-color: #00b89440;
}

.speed-card.worst {
    background: linear-gradient(135deg, #e74c3c15, #ff6b3515);
    border-color: #e74c3c30;
}

.speed-icon {
    font-size: 1.3rem;
    margin-bottom: 0.15rem;
}

.speed-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.speed-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.25rem 0 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.speed-value {
    font-size: 1.2rem;
    font-weight: 800;
    font-family: var(--font-mono);
}

.speed-card.best .speed-value {
    color: #00b894;
}

.speed-card.worst .speed-value {
    color: #e74c3c;
}

/* Загруженность складов */
.warehouse-load-container {
    padding: 0.5rem 0;
}

.wh-load-section {
    margin-bottom: 1rem;
}

.wh-load-section:last-child {
    margin-bottom: 0;
}

.wh-load-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.wh-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.wh-bar-name {
    font-size: 0.82rem;
    width: 140px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.wh-bar-track {
    flex: 1;
    height: 20px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
}

.wh-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 2px;
}

.wh-bar-fill.wb {
    background: linear-gradient(90deg, #a855f7, #7c3aed);
}

.wh-bar-fill.ozon {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.wh-bar-count {
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-mono);
    width: 30px;
    text-align: right;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .analytics-speed-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Gradient Top Accent Border ===== */
.panel-trend::before,
.panel-alerts::before,
.panel-monitoring::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: var(--radius) var(--radius) 0 0;
    opacity: 0.7;
}

/* ===== Quality Acceptance Tab ===== */
.quality-warning-banner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(239, 68, 68, 0.08));
    border: 2px solid rgba(245, 158, 11, 0.4);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    animation: warningPulse 3s ease-in-out infinite;
}

@keyframes warningPulse {

    0%,
    100% {
        border-color: rgba(245, 158, 11, 0.4);
    }

    50% {
        border-color: rgba(245, 158, 11, 0.7);
    }
}

.quality-warning-icon {
    font-size: 2rem;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.3));
}

.quality-warning-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
}

.quality-warning-text strong {
    color: var(--warning);
    font-weight: 800;
}

.quality-warning-text a {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 600;
}

.quality-warning-text a:hover {
    text-decoration: underline;
}

[data-theme="light"] .quality-warning-banner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(239, 68, 68, 0.04));
    border-color: rgba(245, 158, 11, 0.5);
}

.quality-block {
    border-left: 3px solid var(--accent);
}

.quality-block:nth-of-type(2) {
    border-left-color: var(--warning);
}

.quality-block:nth-of-type(3) {
    border-left-color: var(--ozon-rfc-color);
}

.quality-search-wrap {
    flex-shrink: 0;
}

.quality-search {
    padding: 0.45rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    font-size: 0.82rem;
    font-family: var(--font);
    min-width: 230px;
    transition: var(--transition);
}

.quality-search:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.quality-search::placeholder {
    color: var(--text-muted);
}

.quality-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    font-family: var(--font);
}

.quality-download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.quality-download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media (max-width: 768px) {
    .quality-warning-banner {
        flex-direction: column;
        gap: 0.5rem;
    }

    .quality-search {
        min-width: 160px;
        font-size: 0.78rem;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===== Quality: Controls row ===== */
.quality-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== Quality: Rejected cell highlight ===== */
.quality-rejected {
    color: #ef4444 !important;
    font-weight: 700;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
}

.quality-negative {
    color: #f59e0b !important;
    font-weight: 700;
    background: rgba(245, 158, 11, 0.12);
    border-radius: 4px;
}

.quality-deperson {
    color: #6366f1 !important;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.10);
    border-radius: 4px;
}

/* ===== Quality: Expand cell ===== */
.quality-expand-cell {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s;
    user-select: none;
}

tr[data-supply]:hover {
    background: rgba(99, 102, 241, 0.06);
}

/* ===== Quality: Detail row (expanded) ===== */
.quality-block .attention-table-wrap {
    max-height: 80vh;
}

.quality-detail-row td {
    padding: 0 !important;
    background: var(--bg-secondary);
}

.quality-detail-row:hover td {
    background: var(--bg-secondary) !important;
}

.quality-detail-wrap {
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--accent);
    margin: 0.25rem 0;
    max-height: 400px;
    overflow-y: auto;
}

.quality-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.quality-detail-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.quality-detail-table th {
    background: rgba(99, 102, 241, 0.08);
    padding: 0.35rem 0.6rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.quality-detail-table td {
    padding: 0.3rem 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* ===== Quality: Date input ===== */
.quality-date-input {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: var(--font);
    cursor: pointer;
}

.quality-date-input::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

.quality-detail-total td {
    border-top: 2px solid var(--border);
    padding-top: 0.5rem;
}

.quality-detail-loading,
.quality-detail-empty {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Quality: Color filter button group ===== */
.quality-color-filter {
    display: inline-flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
}

.qf-btn {
    padding: 0.3rem 0.7rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font);
    white-space: nowrap;
    border-right: 1px solid var(--border);
}

.qf-btn:last-child {
    border-right: none;
}

.qf-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text);
}

.qf-btn.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
}

.qf-btn.qf-red.active {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.qf-btn.qf-orange.active {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

/* ===== Quality: Legend ===== */
.quality-legend {
    display: flex;
    gap: 1.2rem;
    padding: 0.4rem 0.8rem;
    margin-bottom: 0.5rem;
    font-size: 0.76rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.ql-item {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.ql-red {
    color: #ef4444;
}

.ql-orange {
    color: #f59e0b;
}

.ql-zero {
    color: var(--text-muted);
    opacity: 0.7;
}

/* ===== Quality: Date select ===== */
.quality-date-select {
    padding: 0.35rem 0.7rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    font-size: 0.82rem;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
}

.quality-date-select:focus {
    border-color: var(--accent);
    outline: none;
}

/* ===== Quality: Preload progress bar ===== */
.quality-preload-bar {
    position: relative;
    height: 22px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.quality-preload-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #8b5cf6);
    border-radius: var(--radius-sm);
    transition: width 0.5s ease;
    animation: preloadPulse 2s ease-in-out infinite;
}

@keyframes preloadPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.quality-preload-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

/* ============================================================
   AX PENDING WIDGET
   ============================================================ */
.ax-pending-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ax-pending-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.ax-pending-card:hover {
    border-color: var(--accent);
}

.ax-pending-icon {
    font-size: 1.6rem;
}

.ax-pending-info {
    flex: 1;
    min-width: 0;
}

.ax-pending-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ax-pending-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.ax-pending-value.zero {
    color: var(--success);
}

.ax-pending-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.btn-download {
    padding: 6px 10px;
    font-size: 1.1rem;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s;
}

.btn-download:hover {
    transform: scale(1.1);
    background: var(--accent-light);
}

.ax-pending-details {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

.ax-pending-details table {
    width: 100%;
    border-collapse: collapse;
}

.ax-pending-details th {
    text-align: left;
    padding: 4px 8px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.ax-pending-details td {
    padding: 4px 8px;
    border-top: 1px solid var(--border);
}

/* AX inline in tabs */
.ax-pending-inline {
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    margin-bottom: 4px;
}

.ax-inline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.ax-inline-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.ax-inline-count {
    font-size: 1rem;
    font-weight: 700;
}

.ax-inline-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

@media (max-width: 600px) {
    .ax-pending-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Claims Tab ===== */

/* Section headers */
.section-header {
    margin-bottom: 8px;
    margin-top: 16px;
}

.section-header:first-child {
    margin-top: 0;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 3px 0;
    letter-spacing: -0.01em;
}

.section-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Workflow steps */
.claims-workflow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px 20px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(168, 85, 247, 0.05), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 14px;
    backdrop-filter: blur(8px);
}

.workflow-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(4px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.workflow-step:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.1);
}

.workflow-step-num {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.workflow-step:nth-child(3) .workflow-step-num {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.workflow-step:nth-child(5) .workflow-step-num {
    background: linear-gradient(135deg, #10b981, #3b82f6);
}

.workflow-step-text {
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
    line-height: 1.35;
}

.workflow-step-text strong {
    font-size: 0.88rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.workflow-step-text span {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.workflow-arrow {
    font-size: 1.4rem;
    color: rgba(99, 102, 241, 0.4);
    font-weight: 700;
    animation: arrowPulse 2s ease-in-out infinite;
}

@keyframes arrowPulse {

    0%,
    100% {
        opacity: 0.4;
        transform: translateX(0);
    }

    50% {
        opacity: 1;
        transform: translateX(3px);
    }
}

/* Status pipeline */
.claims-pipeline {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.pipeline-item {
    text-align: center;
    padding: 16px 8px 12px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    position: relative;
    overflow: hidden;
}

.pipeline-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 12px 12px 0 0;
}

.pipeline-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.pipeline-detected::before {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.pipeline-ready::before {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.pipeline-expired::before {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.pipeline-closed::before {
    background: linear-gradient(90deg, #6b7280, #9ca3af);
}

.pipeline-shortage::before {
    background: linear-gradient(90deg, #a855f7, #c084fc);
}

.pipeline-detected:hover {
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.12);
}

.pipeline-ready:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12);
}

.pipeline-expired:hover {
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.12);
}

.pipeline-count {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: var(--font-mono);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.pipeline-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.pipeline-detected .pipeline-count {
    color: #f59e0b;
}

.pipeline-ready .pipeline-count {
    color: #3b82f6;
}

.pipeline-expired .pipeline-count {
    color: #ef4444;
}

.pipeline-closed .pipeline-count {
    color: var(--text-muted);
}

.pipeline-shortage .pipeline-count {
    color: #a855f7;
}

/* Claims Info Banner */
.claims-info-banner {
    background: var(--card-bg);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.06);
}

.claims-info-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.claims-info-header:hover {
    background: rgba(59, 130, 246, 0.04);
}

.claims-info-icon {
    font-size: 1rem;
}

.claims-info-title {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.claims-info-chevron {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
    display: inline-block;
}

.claims-info-chevron.open {
    transform: rotate(90deg);
}

.claims-info-body {
    padding: 0 16px 16px;
}

.claims-info-body.hidden {
    display: none;
}

.claims-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.claims-info-card {
    background: rgba(100, 116, 139, 0.06);
    border: 1px solid rgba(100, 116, 139, 0.12);
    border-radius: 10px;
    padding: 12px 14px;
}

.claims-info-card-primary {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.2);
}

.claims-info-card-title {
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.claims-info-card-desc {
    font-size: 0.73rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.claims-info-rules {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.claims-info-rule {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 6px 10px;
    background: rgba(100, 116, 139, 0.04);
    border-radius: 8px;
}

.claims-info-rule-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .claims-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Engine panel */
.engine-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.engine-panel-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.04), transparent);
}

.engine-run-btn {
    font-size: 0.85rem;
    padding: 10px 22px;
    white-space: nowrap;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25);
}

.engine-run-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.engine-run-btn:active:not(:disabled) {
    transform: translateY(0);
}

.engine-run-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.engine-test-badge {
    font-size: 0.72rem;
    padding: 3px 10px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.08));
    color: #f59e0b;
    border-radius: 20px;
    font-weight: 600;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.engine-info {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.engine-log {
    max-height: 200px;
    overflow-y: auto;
    padding: 10px 18px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.8;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.12));
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.engine-log-empty {
    color: var(--text-muted);
    padding: 12px 0;
    text-align: center;
    font-family: var(--font-main);
    font-size: 0.82rem;
}

.engine-log-entry {
    display: flex;
    gap: 10px;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.engine-log-entry:last-child {
    border-bottom: none;
}

.engine-log-time {
    color: rgba(148, 163, 184, 0.7);
    white-space: nowrap;
    flex-shrink: 0;
}

.log-type-success {
    color: #10b981;
}

.log-type-error {
    color: #ef4444;
}

.log-type-warning {
    color: #f59e0b;
}

.log-type-engine {
    color: #3b82f6;
}

.log-type-info {
    color: var(--text-secondary);
}

/* Filters row */
.claims-filters-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.claims-search-input {
    font-size: 0.78rem;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    width: 180px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.claims-search-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Filter select */
.claims-filter-select {
    font-size: 0.78rem;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s;
}

.claims-filter-select:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

/* Sortable table headers */
.sortable-th {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    position: relative;
    white-space: nowrap;
}

.sortable-th:hover {
    background: rgba(99, 102, 241, 0.08);
}

.sortable-th .sort-icon {
    font-size: 0.7rem;
    opacity: 0.35;
    margin-left: 3px;
    transition: opacity 0.15s;
}

.sortable-th:hover .sort-icon {
    opacity: 0.7;
}

.sortable-th.sorted-asc .sort-icon,
.sortable-th.sorted-desc .sort-icon {
    opacity: 1;
    color: var(--primary);
}

/* Claim row hover */
#claims-tbody tr[data-status]:hover {
    background: rgba(99, 102, 241, 0.04);
}

/* Detail card notes */
.claim-detail-notes {
    padding: 8px 12px;
    margin: 8px 0;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Download button in detail */
.claim-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.claim-download-btn:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.08);
}

/* Package link in table */
.claim-pkg-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 6px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
}

.claim-pkg-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.claim-pkg-pending {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

.claim-status-expired {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.stat-card-warning {
    border-left: 3px solid var(--warning);
}

/* ===== Analytics Section ===== */

/* Period toggle buttons */
.analytics-controls {
    margin-bottom: 14px;
}

.analytics-period-btns {
    display: inline-flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.period-btn {
    padding: 8px 18px;
    font-size: 0.78rem;
    font-weight: 600;
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.period-btn:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
}

.period-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Analytics totals - 5 cards */
.analytics-totals {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.analytics-totals .stat-card {
    text-align: center;
    padding: 14px 8px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.analytics-totals .stat-card:hover {
    transform: translateY(-2px);
}

.analytics-totals .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1.3;
}

.analytics-totals .stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Top-5 bars */
.analytics-top5 {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top5-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top5-rank {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.top5-name {
    width: 200px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.top5-bar-wrap {
    flex: 1;
    height: 28px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.top5-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #ef4444, #f97316);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    min-width: 50px;
}

.top5-bar-item:nth-child(1) .top5-bar-fill {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.top5-bar-item:nth-child(2) .top5-bar-fill {
    background: linear-gradient(90deg, #f97316, #ea580c);
}

.top5-bar-item:nth-child(3) .top5-bar-fill {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.top5-bar-item:nth-child(4) .top5-bar-fill {
    background: linear-gradient(90deg, #eab308, #ca8a04);
}

.top5-bar-item:nth-child(5) .top5-bar-fill {
    background: linear-gradient(90deg, #84cc16, #65a30d);
}

.top5-bar-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.top5-bar-extra {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 80px;
    text-align: right;
    flex-shrink: 0;
}

/* Rating badges */
.analytics-rating {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

/* Trend indicators */
.trend-improving {
    color: #22c55e;
    font-weight: 700;
    font-size: 1rem;
}

.trend-stable {
    color: var(--text-muted);
    font-size: 1rem;
}

.trend-worsening {
    color: #ef4444;
    font-weight: 700;
    font-size: 1rem;
}

.trend-spark {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 22px;
    margin-left: 6px;
    vertical-align: middle;
}

.trend-spark-bar {
    width: 5px;
    min-height: 2px;
    border-radius: 1px;
    transition: height 0.3s;
}

.rating-green {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.rating-yellow {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.rating-orange {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.rating-red {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Status badges */
.claim-status {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.claim-status-detected {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.claim-status-ready {
    background: rgba(59, 130, 246, 0.15);
    color: var(--ozon-color);
}

.claim-status-submitted {
    background: rgba(168, 85, 247, 0.15);
    color: var(--wb-color);
}

.claim-status-responded {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.claim-status-closed {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
}

/* Deadline warning */
.claim-deadline-ok {
    color: var(--success);
    font-weight: 600;
}

.claim-deadline-warn {
    color: var(--warning);
    font-weight: 700;
}

.claim-deadline-expired {
    color: var(--danger);
    font-weight: 700;
}

/* Toggle switch */
.claim-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    display: inline-block;
}

.claim-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.claim-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.claim-toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition);
}

.claim-toggle input:checked+.claim-toggle-slider {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
}

.claim-toggle input:checked+.claim-toggle-slider::before {
    transform: translateX(16px);
    background: var(--success);
}

/* Shortage cell highlight */
.claim-shortage-cell {
    color: var(--danger);
    font-weight: 700;
    font-family: var(--font-mono);
}

.claim-surplus-cell {
    color: var(--warning);
    font-family: var(--font-mono);
}

.claim-id-cell {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.claim-row-closed {
    opacity: 0.5;
}

/* Expandable claim detail */
.claim-detail-row td {
    padding: 0 !important;
    border-top: none !important;
}

.claim-detail-content {
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: 0 0 var(--radius) var(--radius);
    animation: fadeIn 0.2s ease;
}

.claim-detail-loading {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
}

.claim-detail-warn {
    padding: 12px;
    color: var(--warning);
    font-size: 0.85rem;
}

.claim-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.claim-detail-card {
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.claim-detail-card-diff {
    border-color: rgba(239, 68, 68, 0.3);
    background: var(--danger-bg);
}

.claim-detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.claim-detail-value {
    font-size: 1.3rem;
    font-weight: 800;
    font-family: var(--font-mono);
}

.claim-detail-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.claim-detail-transfers {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.claim-detail-transfers code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 1px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.claim-detail-items-title {
    font-size: 0.82rem;
    font-weight: 600;
    margin: 8px 0 4px;
}

.claim-detail-items-table {
    font-size: 0.78rem !important;
}

@media (max-width: 600px) {
    .claim-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Claim prepare button & preview */
.claim-detail-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.claim-prepare-btn {
    font-size: 0.82rem;
    padding: 6px 14px;
    white-space: nowrap;
}

.claim-prepare-status {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.claim-preview-container {
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--card-bg);
}

.claim-preview-header {
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.08));
    border-bottom: 1px solid var(--border);
}

.claim-preview-header h4 {
    margin: 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.claim-test-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.claim-preview-summary {
    padding: 10px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border);
}

.claim-preview-file {
    padding: 6px 14px;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.claim-preview-file code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.claim-preview-files {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.claim-files-title {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.claim-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 0.78rem;
}

.claim-file-item a {
    color: var(--primary);
    text-decoration: none;
}

.claim-file-item a:hover {
    text-decoration: underline;
}

.claim-file-zip {
    margin-top: 8px;
}

.claim-download-zip-btn {
    display: inline-block;
    padding: 6px 16px;
    font-size: 0.82rem;
    text-decoration: none;
    border-radius: 8px;
}

.claim-preview-text {
    margin: 0;
    padding: 14px;
    font-size: 0.78rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-secondary);
    max-height: 400px;
    overflow-y: auto;
    font-family: var(--font-mono);
}

.claim-preview-footer {
    padding: 8px 14px;
    font-size: 0.75rem;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.06);
    text-align: center;
    font-weight: 600;
}

/* ===== Analytics Section ===== */

/* Period toggle buttons */
.analytics-controls {
    margin-bottom: 14px;
}

.analytics-period-btns {
    display: inline-flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.period-btn {
    padding: 8px 18px;
    font-size: 0.78rem;
    font-weight: 600;
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.period-btn:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
}

.period-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Analytics totals — 5 cards */
.analytics-totals {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.analytics-totals .stat-card {
    text-align: center;
    padding: 14px 10px 10px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.analytics-totals .stat-card:hover {
    transform: translateY(-2px);
}

.analytics-totals .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1.3;
}

.analytics-totals .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Visible hint under each card */
.stat-hint {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.35;
    opacity: 0.7;
}

/* Info note about data scope */
.analytics-data-note {
    margin-top: 10px;
    padding: 10px 14px;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-secondary);
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 10px;
    border-left: 3px solid #3b82f6;
}

/* Top-5 bars */
.analytics-top5 {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top5-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top5-rank {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.top5-name {
    width: 200px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.top5-bar-wrap {
    flex: 1;
    height: 28px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.top5-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #ef4444, #f97316);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    min-width: 50px;
}

.top5-bar-item:nth-child(1) .top5-bar-fill {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.top5-bar-item:nth-child(2) .top5-bar-fill {
    background: linear-gradient(90deg, #f97316, #ea580c);
}

.top5-bar-item:nth-child(3) .top5-bar-fill {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.top5-bar-item:nth-child(4) .top5-bar-fill {
    background: linear-gradient(90deg, #eab308, #ca8a04);
}

.top5-bar-item:nth-child(5) .top5-bar-fill {
    background: linear-gradient(90deg, #84cc16, #65a30d);
}

.top5-bar-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.top5-bar-extra {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 100px;
    text-align: right;
    flex-shrink: 0;
}

/* Legend block before table */
.analytics-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 24px;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.legend-item strong {
    color: var(--text-primary);
}

/* Rating badges */
.analytics-rating {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.rating-green {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.rating-yellow {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.rating-orange {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.rating-red {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

@media (max-width: 600px) {
    .analytics-totals {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-legend {
        grid-template-columns: 1fr;
    }

    .claims-stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .claims-metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Quality → Claims Badges ===== */

.quality-claim-cell {
    text-align: center;
    padding: 4px 2px;
}

.quality-claim-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    white-space: nowrap;
    line-height: 1.4;
    transition: transform 0.15s;
}

.quality-claim-badge:hover {
    transform: scale(1.05);
}

.qc-detected {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.qc-manual {
    background: rgba(249, 115, 22, 0.15);
    color: #ea580c;
    border: 1px dashed #f97316;
}

.qc-ready {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.qc-submitted {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}

.qc-responded {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.qc-eligible {
    background: rgba(156, 163, 175, 0.12);
    color: #6b7280;
}

.qc-expired {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    opacity: 0.6;
}

.qc-closed {
    color: #9ca3af;
}

.claim-status-manual-check {
    background: rgba(249, 115, 22, 0.15);
    color: #ea580c;
    border: 1px dashed #f97316;
}

/* ===== Claims Statistics Panel ===== */

.claims-stats-panel {
    margin-bottom: 16px;
}

.claims-stats-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.claims-stats-cards .stat-card {
    text-align: center;
    padding: 14px 10px 10px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.claims-stats-cards .stat-card:hover {
    transform: translateY(-2px);
}

.claims-stats-cards .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1.3;
}

.claims-stats-cards .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 2px;
}

.claims-stat.positive {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.04);
}

.claims-stat.positive .stat-value {
    color: #10b981;
}

.claims-stat.negative {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.04);
}

.claims-stat.negative .stat-value {
    color: #ef4444;
}

/* Metrics grid */
.claims-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 14px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    border-right: 1px solid var(--border);
}

.metric-item:last-child {
    border-right: none;
}

.metric-item:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.metric-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* Notifications banner */
.claims-notifications {
    margin-bottom: 14px;
}

.claims-notification-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-left: 3px solid #f59e0b;
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 0.8rem;
    animation: notifPulse 2s ease-in-out 1;
}

@keyframes notifPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
        background: rgba(245, 158, 11, 0.15);
    }
}

.notif-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.notif-text {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.notif-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Additional acceptance list */
.claims-additional-list {
    margin-bottom: 14px;
}

.additional-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
}

.additional-item:last-child {
    border-bottom: none;
}

.additional-claim {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
}

.additional-supply {
    color: var(--text-secondary);
}

.additional-wh {
    color: var(--text-muted);
}

.additional-amount {
    font-weight: 700;
    color: #10b981;
}

.additional-via {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}