/* Выбранное направление: Flat Status (вариант 03) — приглушённая
   лавандово-серая база, статусы очереди как плоские заливки. */
:root {
    --bg: #F3F1F7;
    --surface: #FFFFFF;
    --surface-2: #F7F5FA;
    --text: #241F2E;
    --muted: #75708A;
    --border: #E4E0EE;

    --accent: #6D4AFF;
    --on-accent: #FFFFFF;
    --primary: #6D4AFF;
    --on-primary: #FFFFFF;

    --success: #21C55D;
    --on-success: #FFFFFF;
    --warning: #F5A524;
    --on-warning: #FFFFFF;
    --error: #F5455C;
    --on-error: #FFFFFF;
    --pending: #E4E1EC;
    --on-pending: #5B5570;

    --radius: 14px;
    --radius-sm: 9px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-weight: 500;
}

a { color: var(--accent); }

/* ---------- shell: sidebar + content ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 9px;
    font-weight: 700; font-size: 14px; letter-spacing: -0.01em;
    color: var(--text); text-decoration: none; padding: 0 6px;
}
.sidebar .brand .mark {
    width: 22px; height: 22px; border-radius: 9px; flex-shrink: 0;
    background: var(--accent);
}

.shop-switcher { position: relative; }
.shop-switcher summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
    padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface-2); font-size: 13px; font-weight: 600;
}
.shop-switcher summary::-webkit-details-marker { display: none; }
.shop-switcher summary .chev { color: var(--muted); font-size: 10px; }
.shop-switcher .menu {
    margin-top: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); overflow: hidden;
}
.shop-switcher .menu a {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 9px 10px; font-size: 12.5px; color: var(--text); text-decoration: none;
    border-bottom: 1px solid var(--border);
}
.shop-switcher .menu a:last-child { border-bottom: none; }
.shop-switcher .menu a:hover { background: rgba(109,74,255,0.06); }
.shop-switcher .menu a.new { color: var(--muted); }

.nav-section .nav-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
    padding: 0 10px; margin-bottom: 6px;
}
.nav-section a.nav-link {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
    color: var(--muted); text-decoration: none; margin-bottom: 2px;
}
.nav-section a.nav-link:hover { background: rgba(109,74,255,0.06); color: var(--text); }
.nav-section a.nav-link.active { background: rgba(109,74,255,0.1); color: var(--accent); }
.nav-section a.nav-link .badge {
    font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 100px;
    background: var(--error); color: var(--on-error);
}
.nav-section a.nav-link .badge.muted-badge { background: var(--pending); color: var(--on-pending); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sidebar-btn { width: 100%; text-align: center; box-sizing: border-box; }

.content { flex: 1; min-width: 0; padding: 32px 36px 80px; }
.content.content-auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.content-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.content-header h1 { font-size: 1.4rem; margin: 0; letter-spacing: -0.01em; }

/* ---------- cards / tables / forms (shared) ---------- */
.card {
    background: var(--surface);
    border: none;
    box-shadow: 0 1px 3px rgba(36,31,46,0.06);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
}

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { max-width: 400px; width: 100%; }
.auth-card .brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; margin-bottom: 22px; }
.auth-card .brand .mark { width: 22px; height: 22px; border-radius: 9px; background: var(--accent); }

h1, h2 { letter-spacing: -0.01em; }
h1 { font-size: 1.4rem; margin-top: 0; }
.muted { color: var(--muted); font-size: 0.9rem; }

label { display: block; margin-bottom: 14px; font-size: 0.9rem; }
input, select {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}
input:focus, select:focus, a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 1px;
}

button, .btn {
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s ease;
    text-decoration: none;
    display: inline-block;
}
button:hover, .btn:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: rgba(245, 69, 92, 0.1); color: #C81E3B; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
th { color: var(--muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* KPI tiles for overview */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-tile { background: var(--surface); box-shadow: 0 1px 3px rgba(36,31,46,0.06); border-radius: var(--radius); padding: 16px 18px; }
.kpi-tile .kpi-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 8px; font-weight: 700; }
.kpi-tile .kpi-value { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi-tile.warn .kpi-value { color: var(--warning); }
.kpi-tile.err .kpi-value { color: var(--error); }

/* ---------- статусы очереди: плоские заливки без иконок ---------- */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 700;
    transition: background 0.3s ease, color 0.3s ease;
}
.status-pending { background: var(--pending); color: var(--on-pending); }
.status-pending .spin { border-color: rgba(91, 85, 112, 0.25); border-top-color: currentColor; }
.status-filtering_photos, .status-in_progress { background: var(--accent); color: var(--on-accent); }
.status-needs_review { background: var(--warning); color: var(--on-warning); }
.status-done { background: var(--success); color: var(--on-success); }
.status-error { background: var(--error); color: var(--on-error); }
.status-skipped_duplicate { background: var(--surface-2); color: var(--muted); }

.spin {
    display: inline-block;
    width: 10px; height: 10px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: currentColor;
    border-radius: 50%;
    margin-right: 6px;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

tr.job-row { transition: background 0.4s ease; }

.progress-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.6s ease; }
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }

/* ---------- сцена WB -> Ozon: разовая, оверлей на экране запуска переноса ---------- */
.launch-scene {
    display: none;
    position: fixed; inset: 0; z-index: 50;
    flex-direction: column; align-items: center; justify-content: center; gap: 20px;
    background: rgba(36, 31, 46, 0.5);
}
.launch-scene.is-active { display: flex; }
.launch-stage {
    position: relative;
    width: min(420px, 86vw); height: 64px;
    background: var(--surface); border-radius: var(--radius);
    box-shadow: 0 18px 44px rgba(36,31,46,0.28);
}
.launch-station {
    position: absolute; top: 50%; transform: translateY(-50%);
    font-size: 0.76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.launch-station-wb { left: 18px; }
.launch-station-ozon { right: 18px; }
.launch-card {
    position: absolute; top: 50%;
    width: 56px; height: 40px; border-radius: var(--radius-sm);
    background: #6D2FA6; color: #fff; font-size: 0.8rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.launch-caption { color: #fff; font-size: 0.92rem; font-weight: 600; text-shadow: 0 2px 10px rgba(0,0,0,0.35); }
@media (prefers-reduced-motion: reduce) { .launch-scene { display: none !important; } }

/* ---------- mini-launch: тот же образ WB -> Ozon, но компактно внутри бейджа статуса "переносится" ---------- */
.mini-launch {
    position: relative;
    display: inline-flex; align-items: center;
    width: 108px; height: 26px;
    background: var(--surface-2);
    border-radius: 999px;
    vertical-align: middle;
}
.mini-launch-wb, .mini-launch-ozon {
    position: absolute; top: 50%; transform: translateY(-50%);
    font-size: 8.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
.mini-launch-wb { left: 9px; }
.mini-launch-ozon { right: 9px; }
.mini-launch-card {
    position: absolute; top: 50%; left: 9px; transform: translateY(-50%);
    width: 14px; height: 14px; border-radius: 50%;
    background: #6D2FA6;
    box-shadow: 0 2px 6px rgba(0,0,0,0.22);
}

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.photo-grid img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.photo-card { border: 2px solid var(--border); border-radius: 10px; padding: 8px; background: var(--surface-2); }
.photo-card.flagged { border-color: var(--warning); }
.photo-reasons { font-size: 0.8rem; color: #A15C1B; margin: 6px 0; font-weight: 600; }

.empty-state { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty-state .mark-lg { width: 44px; height: 44px; border-radius: 14px; margin: 0 auto 18px; background: var(--accent); }

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; }
}
