/* Шрифт как в кабинете WB Seller: ALS Hauss (вариативный) + Inter как fallback */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Inter:wght@300..800&display=swap');
@font-face{
  font-family:'WB Hauss VF';
  src:url('https://static-basket-02.wbbasket.ru/vol20/portal-fonts/latest/assets/als-hauss-vf.b709e7bab16d4dd7d164.ttf') format('truetype-variations');
  font-weight:1 850; font-style:normal; font-display:swap;
}

/* =============================================================================
   IndexoWB — единая дизайн-система (светлая тема)
   Статический CSS без зависимостей. Вшивается в FastAPI-шаблоны.
   Компоненты ссылаются ТОЛЬКО на токены (--*), поэтому 5 «направлений»
   бренда переключаются одним атрибутом [data-brand="1..5"] на :root.
   ============================================================================= */

/* ---------- Базовые токены (направление 1 = эталон из брифа) ---------- */
:root{
  /* поверхности */
  --bg:#EEF1F6;
  --card:#FFFFFF;
  --card-2:#F7F9FC;          /* вложенная панель */
  --card-bd:#E6E9F0;
  --hairline:#EDEFF4;
  --shadow:0 1px 3px rgba(16,24,40,.05), 0 1px 2px rgba(16,24,40,.04);
  --shadow-pop:0 12px 32px -10px rgba(16,24,40,.22), 0 2px 8px rgba(16,24,40,.06);

  /* текст */
  --ink:#1A2233;
  --ink-2:#5B6478;
  --ink-3:#8A93A6;
  --label:#9AA3B5;

  /* акценты */
  --primary:#2F6BED;
  --primary-hover:#255CD6;
  --primary-ink:#FFFFFF;
  --primary-soft:#E9EEFD;    /* пилюля активного таба / мягкий фон */
  --primary-on-soft:#2F6BED;
  --indigo:#5B5BD6;          /* агент / спец-акцент */
  --teal:#0EA5A5;            /* process / прогрев */
  --magenta:#7C3AED;         /* submit / главное действие */
  --success:#22C55E;
  --warning:#F59E0B;
  --danger:#EF4444;
  --purple:#7C5CFC;          /* график area */

  /* семантические подложки бейджей */
  --amber-bg:#FDF0D5; --amber-ink:#9A6700;
  --green-bg:#E6F7EC; --green-ink:#15803D;
  --red-bg:#FDECEC;   --red-ink:#B42318;
  --blue-bg:#E9EEFD;  --blue-ink:#1D4FBF;
  --violet-bg:#EFEBFE;--violet-ink:#5B3FC4;

  /* геометрия */
  --r-card:18px;
  --r-panel:14px;
  --r-ctl:10px;
  --r-pill:999px;
  --pad-card:22px;
  --gap:18px;
  --row-pad:11px;            /* плотность строк таблиц */

  /* бренд-знак */
  --mark-bg:linear-gradient(150deg,#3D78F0,#2F6BED 55%,#2350C8);
  --mark-ink:#FFFFFF;
  --mark-r:11px;

  /* шрифт */
  --sans:'WB Hauss VF','Inter',-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --mono:ui-monospace,"SF Mono","JetBrains Mono",Menlo,Consolas,monospace;
  --ease:cubic-bezier(.2,.7,.2,1);
}

/* ---------- Направление 2 · Slate & Cobalt (плоско, плотно, enterprise) ---------- */
[data-brand="2"]{
  --bg:#EDF0F5; --card:#FFFFFF; --card-bd:#DDE2EC;
  --shadow:0 0 0 1px rgba(20,30,55,.015), 0 1px 1px rgba(20,30,55,.04);
  --shadow-pop:0 10px 26px -12px rgba(20,30,55,.28);
  --ink:#141E37; --ink-2:#566079; --ink-3:#8089A0; --label:#929BB0;
  --primary:#1E51D6; --primary-hover:#1A47BD; --primary-soft:#E4EAFB; --primary-on-soft:#1E51D6;
  --blue-bg:#E4EAFB; --blue-ink:#1A47BD;
  --r-card:13px; --r-panel:10px; --r-ctl:8px; --pad-card:18px; --gap:14px; --row-pad:9px;
  --mark-bg:linear-gradient(150deg,#3361DE,#1E51D6 60%,#163FAE); --mark-r:8px;
}

/* ---------- Направление 3 · Aqua Mint (бирюзовый акцент, воздушно) ---------- */
[data-brand="3"]{
  --bg:#ECF3F4; --card:#FFFFFF; --card-bd:#DCEAEA;
  --shadow:0 1px 3px rgba(12,60,60,.06), 0 1px 2px rgba(12,60,60,.04);
  --ink:#15282C; --ink-2:#4F6469; --ink-3:#86989C; --label:#93A6AA;
  --primary:#0E9C9C; --primary-hover:#0B8585; --primary-ink:#FFFFFF;
  --primary-soft:#DBF3F2; --primary-on-soft:#0B8585;
  --indigo:#0EA5A5; --magenta:#0D9488;
  --blue-bg:#DBF3F2; --blue-ink:#0B7A7A;
  --r-card:20px; --r-panel:16px; --r-ctl:12px; --pad-card:24px; --gap:20px; --row-pad:12px;
  --mark-bg:linear-gradient(150deg,#22BFBA,#0E9C9C 60%,#0B7C7C); --mark-r:14px;
}

/* ---------- Направление 4 · Royal Indigo (индиго-первичный, премиум) ---------- */
[data-brand="4"]{
  --bg:#EFEEF6; --card:#FFFFFF; --card-bd:#E3E1F0;
  --shadow:0 2px 6px rgba(40,30,90,.07), 0 1px 2px rgba(40,30,90,.05);
  --shadow-pop:0 16px 38px -12px rgba(40,30,90,.30);
  --ink:#1E1A33; --ink-2:#5C5778; --ink-3:#8B86A6; --label:#9C97B5;
  --primary:#5B4BD6; --primary-hover:#4B3CC0; --primary-ink:#FFFFFF;
  --primary-soft:#ECE8FD; --primary-on-soft:#5B4BD6;
  --indigo:#5B4BD6; --magenta:#8B3FE0; --purple:#7C5CFC;
  --blue-bg:#ECE8FD; --blue-ink:#4B3CC0; --violet-bg:#ECE8FD; --violet-ink:#4B3CC0;
  --r-card:18px; --r-panel:14px; --r-ctl:11px; --pad-card:22px; --gap:18px; --row-pad:11px;
  --mark-bg:linear-gradient(150deg,#7565E6,#5B4BD6 58%,#473AB8); --mark-r:13px;
}

/* ---------- Направление 5 · Graphite Pro (монохром-графит, синий только для действий, плотно) ---------- */
[data-brand="5"]{
  --bg:#ECEDEF; --card:#FFFFFF; --card-bd:#DEE0E4;
  --shadow:0 0 0 1px rgba(15,20,30,.02); --shadow-pop:0 12px 30px -14px rgba(15,20,30,.35);
  --ink:#11151C; --ink-2:#4B515E; --ink-3:#7A8290; --label:#8B93A1;
  --primary:#2563EB; --primary-hover:#1D54CE; --primary-soft:#E7EDFB; --primary-on-soft:#1D54CE;
  --indigo:#4B5563; --teal:#0F766E;
  --blue-bg:#E7EDFB; --blue-ink:#1D54CE;
  --r-card:12px; --r-panel:9px; --r-ctl:8px; --r-pill:7px; --pad-card:18px; --gap:14px; --row-pad:8px;
  --mark-bg:linear-gradient(150deg,#2B3340,#1C232E 60%,#11161E); --mark-ink:#7FB0FF; --mark-r:9px;
}

/* =============================================================================
   Каркас
   ============================================================================= */
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--bg); color:var(--ink);
  font-family:var(--sans); font-size:15px; line-height:1.5;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
a{color:var(--primary); text-decoration:none;}
:focus-visible{outline:2px solid var(--primary); outline-offset:2px;}

/* центрированные форм-страницы */
.iw-auth-wrap{min-height:100%; display:flex; align-items:flex-start; justify-content:center; padding:48px 18px;}
.iw-form-col{width:100%; max-width:440px; display:flex; flex-direction:column; gap:var(--gap);}

/* Двухколоночная страница входа/регистрации: слева — приветствие, справа — форма */
.iw-auth2{min-height:100vh; display:grid; grid-template-columns:1.05fr .95fr;}
.iw-auth-hero{position:relative; overflow:hidden; padding:62px 56px; display:flex; flex-direction:column; justify-content:center;
  background:linear-gradient(135deg,#3b5bdb 0%,#5b7cfa 52%,#7048e8 100%); color:#fff;}
.iw-auth-hero .iw-wordmark .iw-name{color:#fff;}
.iw-auth-hero .iw-wordmark .iw-name b{color:#dbe4ff;}
.iw-auth-hero .iw-mark{background:rgba(255,255,255,.18); color:#fff;}
.iw-hero-h1{font-size:31px; line-height:1.16; font-weight:800; letter-spacing:-.02em; margin:28px 0 14px; max-width:470px;}
.iw-hero-sub{font-size:15px; line-height:1.55; color:rgba(255,255,255,.88); margin:0 0 28px; max-width:460px;}
.iw-hero-feats{list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:13px;}
.iw-hero-feats li{display:flex; align-items:center; gap:12px; font-size:14.5px; color:rgba(255,255,255,.96);}
.iw-hero-feats .fi{flex:none; width:28px; height:28px; border-radius:9px; background:rgba(255,255,255,.18); display:grid; place-items:center; font-size:14px;}
.iw-hero-foot{margin:30px 0 0; font-size:12.5px; line-height:1.5; color:rgba(255,255,255,.7); max-width:430px;}
.iw-auth-cardcol{display:flex; align-items:center; justify-content:center; padding:40px 22px; background:var(--bg);}
.iw-brand-sm .iw-mark{--mark-size:46px;}
.iw-brand-sm .iw-name{font-size:23px;}
.iw-auth-subtitle{text-align:center; color:var(--ink-3); font-size:13.5px; margin:0 0 20px;}
.iw-auth-tabs{justify-content:center;}
.iw-auth-policy{text-align:center; font-size:12.5px; color:var(--ink-3); margin:18px 0 0;}
@media(max-width:900px){
  .iw-auth2{grid-template-columns:1fr;}
  .iw-auth-hero{padding:32px 24px 26px;}
  .iw-hero-h1{font-size:24px; margin:18px 0 10px;}
  .iw-hero-feats,.iw-hero-foot{display:none;}
}

/* =============================================================================
   Бренд: знак + вордмарк
   ============================================================================= */
.iw-mark{
  width:var(--mark-size,40px); height:var(--mark-size,40px);
  border-radius:var(--mark-r); background:var(--mark-bg); color:var(--mark-ink);
  display:inline-grid; place-items:center; flex:none;
  font-weight:800; letter-spacing:-.04em; line-height:1;
  font-size:calc(var(--mark-size,40px) * .5);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.25);
}
.iw-wordmark{display:inline-flex; align-items:center; gap:11px;}
.iw-wordmark .iw-name{font-size:21px; font-weight:800; letter-spacing:-.02em; color:var(--ink);}
.iw-wordmark .iw-name b{color:var(--primary); font-weight:800;}
.iw-brand-lg{flex-direction:column; gap:12px; text-align:center;}
.iw-brand-lg .iw-mark{--mark-size:60px;}
.iw-brand-lg .iw-name{font-size:27px;}

/* =============================================================================
   Карточка
   ============================================================================= */
.iw-card{
  background:var(--card); border:1px solid var(--card-bd); border-radius:var(--r-card);
  box-shadow:var(--shadow); padding:var(--pad-card);
}
.iw-card-pad-lg{padding:28px;}
.iw-card-head{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px;}
.iw-card-title{display:flex; align-items:center; gap:9px; font-size:17px; font-weight:600; color:var(--ink); margin:0;}
.iw-card-title .ico{font-size:18px; line-height:1;}
.iw-card-daterange{font-size:12.5px; color:var(--ink-3); font-weight:500;}
.iw-kebab{border:0; background:transparent; color:var(--ink-3); font-size:20px; line-height:1; cursor:pointer; padding:2px 6px; border-radius:8px;}
.iw-kebab:hover{background:var(--card-2); color:var(--ink-2);}
.iw-h1{font-size:22px; font-weight:700; letter-spacing:-.01em; margin:0 0 6px;}
.iw-sub{color:var(--ink-2); font-size:14px; margin:0;}
.iw-label{font-size:11.5px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--label);}

/* =============================================================================
   Кнопки (цвет = роль действия; единый набор)
   ============================================================================= */
.iw-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font-family:inherit; font-size:15px; font-weight:600; line-height:1;
  padding:11px 16px; border-radius:var(--r-ctl); border:1px solid transparent;
  cursor:pointer; transition:background .15s var(--ease), transform .12s var(--ease), box-shadow .15s, border-color .15s, color .15s;
  white-space:nowrap;
}
.iw-btn:active{transform:translateY(1px);}
.iw-btn .ico{font-size:15px;}
.iw-btn-block{width:100%; padding:13px 16px;}
.iw-link-danger{border:0; background:none; color:var(--danger); font:inherit; font-size:12.5px; font-weight:600; cursor:pointer; padding:0; text-decoration:underline; text-underline-offset:2px;}
.iw-link{border:0; background:none; color:var(--primary); font:inherit; font-size:12.5px; font-weight:600; cursor:pointer; padding:0; text-decoration:underline; text-underline-offset:2px;}
.iw-link:hover{color:var(--primary-press,#2440c4);}
/* Карточка кабинета WB в настройках (мультикабинет, сворачиваемая) */
.iw-cab{border:1px solid var(--card-bd); border-radius:var(--r-panel); margin-bottom:12px; background:var(--card-2); overflow:hidden;}
.iw-cab.active{border-color:color-mix(in srgb,var(--primary) 45%,var(--card-bd)); box-shadow:0 0 0 1px color-mix(in srgb,var(--primary) 22%,transparent);}
.iw-cab-sum{display:flex; align-items:center; gap:11px; padding:13px 15px; cursor:pointer; list-style:none; user-select:none;}
.iw-cab-sum::-webkit-details-marker{display:none;}
.iw-cab-sum:hover{background:color-mix(in srgb,var(--card-2) 60%,var(--card));}
.iw-cab-chev{color:var(--ink-3); font-size:11px; transition:transform .15s var(--ease); flex:none;}
.iw-cab[open] > .iw-cab-sum .iw-cab-chev{transform:rotate(90deg);}
.iw-cab-meta{flex:1; min-width:0;}
.iw-cab-name{font-weight:700; color:var(--ink); line-height:1.2;}
.iw-cab-body{padding:0 15px 15px 15px;}
.iw-cab-ava{width:40px; height:40px; flex:none; border-radius:50%; display:grid; place-items:center; color:#fff; font-weight:800; font-size:16px; background:linear-gradient(140deg,var(--primary),var(--indigo));}
/* вложенный «Изменить» */
.iw-cab .iw-cab-edit > summary{cursor:pointer;}
.iw-cab .iw-cab-edit > summary::-webkit-details-marker{display:none;}
.iw-link-danger:hover{color:#b91c1c;}
.iw-btn-sm{padding:7px 12px; font-size:13px;}

.iw-btn-primary{background:var(--primary); color:var(--primary-ink); border-color:var(--primary);}
.iw-btn-primary:hover{background:var(--primary-hover); border-color:var(--primary-hover);}
.iw-btn-secondary{background:var(--card); color:var(--ink); border-color:var(--card-bd);}
.iw-btn-secondary:hover{border-color:var(--ink-3); background:var(--card-2);}
.iw-btn-submit{background:var(--magenta); color:#fff; border-color:var(--magenta);}
.iw-btn-submit:hover{filter:brightness(.94);}
.iw-btn-process{background:var(--teal); color:#fff; border-color:var(--teal);}
.iw-btn-process:hover{filter:brightness(.94);}
.iw-btn-danger{background:var(--card); color:var(--danger); border-color:var(--danger);}
.iw-btn-danger:hover{background:var(--red-bg);}
.iw-btn-tg{background:#2AABEE; color:#fff; border-color:#2AABEE;}
.iw-btn-tg:hover{filter:brightness(.95);}

/* пилюли */
.iw-pill{
  display:inline-flex; align-items:center; gap:7px;
  background:var(--card); color:var(--ink); border:1px solid var(--card-bd);
  border-radius:var(--r-pill); padding:8px 14px; font-size:13.5px; font-weight:600; cursor:pointer;
  transition:border-color .15s, background .15s;
}
.iw-pill:hover{border-color:var(--ink-3); background:var(--card-2);}
.iw-pill-agent{background:var(--indigo); color:#fff; border-color:var(--indigo);}
.iw-pill-agent:hover{filter:brightness(.95);}

/* =============================================================================
   Поля ввода
   ============================================================================= */
.iw-field{display:flex; flex-direction:column; gap:7px;}
.iw-field > label{font-size:13px; color:var(--ink-2); font-weight:500;}
.iw-input, .iw-select, .iw-textarea{
  width:100%; font-family:inherit; font-size:14.5px; color:var(--ink);
  background:var(--card); border:1px solid var(--card-bd); border-radius:var(--r-ctl);
  padding:11px 13px; outline:none; transition:border-color .15s, box-shadow .15s;
  -webkit-appearance:none; appearance:none;
}
.iw-input::placeholder, .iw-textarea::placeholder{color:var(--ink-3);}
.iw-input:focus, .iw-select:focus, .iw-textarea:focus{border-color:var(--primary); box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 18%,transparent);}
.iw-select-wrap{position:relative;}
.iw-select{padding-right:38px; cursor:pointer;}
.iw-select-wrap .chev{position:absolute; right:13px; top:50%; transform:translateY(-50%); width:14px; height:14px; pointer-events:none; color:var(--ink-3);}

/* поиск-пилюля + ⌘K */
.iw-search{position:relative; display:inline-flex; align-items:center; min-width:240px;}
.iw-search .mag{position:absolute; left:13px; width:15px; height:15px; color:var(--ink-3); pointer-events:none;}
.iw-search input{
  width:100%; font-family:inherit; font-size:13.5px; color:var(--ink);
  background:var(--card); border:1px solid var(--card-bd); border-radius:var(--r-pill);
  padding:9px 14px 9px 34px; outline:none; transition:border-color .15s, box-shadow .15s;
}
.iw-search input:focus{border-color:var(--primary); box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 16%,transparent);}
.iw-kbd{position:absolute; right:8px; font-size:11px; font-family:var(--mono); color:var(--ink-3); background:var(--card-2); border:1px solid var(--card-bd); border-radius:6px; padding:2px 6px;}

/* =============================================================================
   Бейджи / пилюли-статусы
   ============================================================================= */
.iw-badge{display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:600; padding:3px 10px; border-radius:var(--r-pill); line-height:1.4;}
.iw-badge-amber{background:var(--amber-bg); color:var(--amber-ink);}
.iw-badge-green{background:var(--green-bg); color:var(--green-ink);}
.iw-badge-red{background:var(--red-bg); color:var(--red-ink);}
.iw-badge-blue{background:var(--blue-bg); color:var(--blue-ink);}
.iw-badge-violet{background:var(--violet-bg); color:var(--violet-ink);}
.iw-badge-purple{background:#ede9fe; color:#6d28d9;}
.iw-dot{width:7px; height:7px; border-radius:50%; flex:none;}

/* статус-пилюля привязан/не привязан */
.iw-status-pill{font-size:12px; font-weight:600; padding:3px 10px; border-radius:var(--r-pill);}
.iw-status-pill.on{background:var(--green-bg); color:var(--green-ink);}
.iw-status-pill.off{background:var(--red-bg); color:var(--red-ink);}

/* «актуализировано» */
.iw-actualized{display:inline-flex; align-items:center; gap:7px; font-size:12.5px; font-weight:600; color:var(--green-ink); background:var(--green-bg); border-radius:var(--r-pill); padding:6px 12px;}

/* =============================================================================
   Шапка дашборда
   ============================================================================= */
.iw-shell{display:flex; flex-direction:column; min-height:100%;}
.iw-header{
  position:sticky; top:0; z-index:20; background:var(--card);
  border-bottom:1px solid var(--card-bd);
  display:flex; align-items:center; gap:18px; padding:12px 20px;
}
.iw-nav{display:flex; align-items:center; gap:4px; flex:1; flex-wrap:wrap;}
.iw-tab{
  display:inline-flex; align-items:center; gap:7px;
  font-size:15px; font-weight:600; color:var(--ink-3);
  padding:8px 14px; border-radius:var(--r-pill); border:0; background:transparent; cursor:pointer;
  transition:color .15s, background .15s;
}
.iw-tab:hover{color:var(--ink-2); background:var(--card-2);}
.iw-tab .ico{font-size:15px;}
.iw-tab.active{background:var(--primary-soft); color:var(--primary-on-soft);}
.iw-tab.active::before{content:""; width:6px; height:6px; border-radius:50%; background:var(--primary-on-soft);}
.iw-header-actions{display:flex; align-items:center; gap:8px;}
.iw-icon-btn{width:34px; height:34px; border-radius:9px; border:1px solid transparent; background:transparent; color:var(--ink-2); display:grid; place-items:center; cursor:pointer; font-size:15px;}
.iw-icon-btn:hover{background:var(--card-2); border-color:var(--card-bd);}
.iw-avatar{width:34px; height:34px; border-radius:50%; display:grid; place-items:center; color:#fff; font-size:12.5px; font-weight:700; background:linear-gradient(140deg,var(--primary),var(--indigo));}

/* dropdown «Настройки/Действия» */
.iw-menu-anchor{position:relative;}
.iw-menu{
  position:absolute; right:0; top:calc(100% + 8px); min-width:248px; z-index:40;
  background:var(--card); border:1px solid var(--card-bd); border-radius:var(--r-panel);
  box-shadow:var(--shadow-pop); padding:6px; display:none;
}
.iw-menu.open{display:block;}
.iw-menu-label{font-size:10.5px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--label); padding:8px 12px 4px;}
.iw-menu-item{display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:8px; font-size:14px; color:var(--ink); cursor:pointer;}
.iw-menu-item:hover{background:var(--card-2);}
.iw-menu-sep{height:1px; background:var(--hairline); margin:6px 4px;}

/* содержимое дашборда */
.iw-content{padding:var(--gap); display:flex; flex-direction:column; gap:var(--gap); max-width:1680px; width:100%; margin:0 auto;}
/* Раздел «Остатки» — во всю ширину экрана (full-bleed), вырывается из узкого
   .iw-content; остальные разделы (Распределение и т.д.) остаются 1680px. */
[data-view-panel="ostatki"]{width:98vw; max-width:98vw; margin-left:calc(50% - 49vw); margin-right:calc(50% - 49vw);}
[data-view-panel="ostatki"] .iw-card{padding-left:10px; padding-right:10px;}
.iw-grid{display:grid; gap:var(--gap);}
.iw-grid-2{grid-template-columns:1.5fr 1fr;}
@media (max-width:900px){.iw-grid-2{grid-template-columns:1fr;}}

/* =============================================================================
   Метрики
   ============================================================================= */
.iw-metric-num{font-size:40px; font-weight:700; letter-spacing:-.02em; line-height:1;}
.iw-metric-unit{font-size:16px; font-weight:600; color:var(--ink-3); margin-left:4px;}
.iw-delta{display:inline-flex; align-items:center; gap:3px; font-size:13px; font-weight:700;}
.iw-delta.up{color:var(--success);} .iw-delta.down{color:var(--danger);}
.iw-metric-cap{font-size:12.5px; color:var(--ink-3); margin-top:6px;}

.iw-mini{display:flex; flex-direction:column; gap:4px;}
.iw-mini .iw-label{margin-bottom:2px;}
.iw-mini .v{font-size:22px; font-weight:700; color:var(--ink); line-height:1; white-space:nowrap;}
.iw-mini .v .u{font-size:13px; color:var(--ink-3); font-weight:600;}

/* панель прогресса/уровня */
.iw-level{display:flex; align-items:center; gap:16px;}
.iw-level-badge{width:60px; height:60px; border-radius:50%; flex:none; display:grid; place-items:center; font-size:20px; font-weight:800; color:var(--primary); background:var(--primary-soft);}
.iw-progress{height:8px; border-radius:var(--r-pill); background:var(--card-2); overflow:hidden; border:1px solid var(--hairline);}
.iw-progress > span{display:block; height:100%; border-radius:var(--r-pill); background:var(--primary);}

/* строка статусов (4 колонки) */
.iw-statusrow{display:grid; grid-template-columns:repeat(4,1fr); gap:0;}
.iw-statusrow > div{padding:4px 20px; border-left:1px solid var(--hairline);}
.iw-statusrow > div:first-child{border-left:0; padding-left:4px;}
.iw-stat-label{display:inline-flex; align-items:center; gap:7px; font-size:13px; font-weight:600;}
.iw-stat-num{font-size:30px; font-weight:700; letter-spacing:-.01em; line-height:1.1; margin-top:6px;}
.iw-stat-num .u{font-size:14px; color:var(--ink-3); font-weight:600;}
.iw-stat-sub{font-size:12px; color:var(--ink-3); margin-top:3px;}
@media (max-width:760px){.iw-statusrow{grid-template-columns:repeat(2,1fr); gap:14px;} .iw-statusrow > div{border-left:0; padding:0;}}

/* =============================================================================
   Сегментированные под-вкладки
   ============================================================================= */
.iw-segments{display:flex; gap:4px; border-bottom:1px solid var(--card-bd); margin-bottom:16px; overflow-x:auto;}
.iw-seg{display:inline-flex; align-items:center; gap:6px; white-space:nowrap; font-size:13.5px; font-weight:600; color:var(--ink-3); padding:9px 13px; border:0; background:transparent; cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px;}
.iw-seg:hover{color:var(--ink-2);}
.iw-seg.active{color:var(--primary-on-soft); border-bottom-color:var(--primary);}

/* фильтр-бар */
.iw-toolbar{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:14px;}
.iw-toolbar .spacer{flex:1;}
.iw-toolbar-count{font-size:13px; color:var(--ink-2); font-weight:500;}
.iw-toolbar-count b{color:var(--ink);}

/* =============================================================================
   Таблица данных
   ============================================================================= */
.iw-table-wrap{overflow-x:auto; border:1px solid var(--card-bd); border-radius:var(--r-panel);}
/* Таблицы оформлены как в кабинете WB Seller (замеры с warehouse-remains):
   шапка 13px Lato Bold на #F0F0F3, ячейки 16px Lato, строка 61px,
   линии #D1CFD7, ховер #F0F0F3. Токены: --wbt-*. */
:root{
  --wbt-table-font:'Lato', arial, sans-serif;
  --wbt-head-bg:#F0F0F3;
  --wbt-hover-bg:#F0F0F3;
  --wbt-border:#D1CFD7;
  --wbt-text:#000;
}
.iw-table{width:100%; border-collapse:collapse; font-size:16px; font-family:var(--wbt-table-font);}
.iw-table thead th{
  position:sticky; top:0; z-index:10; text-align:left; background:var(--wbt-head-bg); color:var(--wbt-text);
  font-family:var(--wbt-table-font); font-size:13px; font-weight:700; line-height:16px;
  letter-spacing:normal; text-transform:none;
  padding:18px 12px; border-bottom:1px solid var(--wbt-border); white-space:nowrap; cursor:pointer; user-select:none;
}
.iw-table thead th .sort{color:var(--ink-3); margin-left:4px; font-size:9px;}
.iw-table .filterrow th{position:static; background:var(--card); padding:6px 8px; border-bottom:1px solid var(--card-bd);}
.iw-colfilter{width:100%; font-family:inherit; font-size:12px; color:var(--ink); background:var(--card-2); border:1px solid var(--card-bd); border-radius:7px; padding:5px 8px 5px 24px; outline:none;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A93A6' stroke-width='2.4' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4-4'/></svg>");
  background-repeat:no-repeat; background-position:7px center;}
.iw-colfilter:focus{border-color:var(--primary);}
.iw-table tbody td{font-family:var(--wbt-table-font); font-size:16px; font-weight:400; line-height:20px; padding:20px 16px; border-bottom:1px solid var(--wbt-border); color:var(--wbt-text); white-space:nowrap;}
.iw-table tbody tr:hover{background:var(--wbt-hover-bg);}
.iw-table tbody tr:hover td{background:var(--wbt-hover-bg);}
.iw-table tbody tr:last-child td{border-bottom:0;}
.iw-num{text-align:right; font-variant-numeric:tabular-nums; font-weight:600;}
.iw-mono{font-family:var(--mono); font-size:12.5px; color:var(--ink-2);}
.iw-muted0{color:var(--ink-3);}             /* приглушённые нули */
.iw-table-empty{text-align:center; color:var(--ink-3); padding:34px 12px;}
.iw-table-foot{font-size:11.5px; color:var(--ink-3); padding:10px 4px 0;}

/* heatmap-ячейки (зелёный→жёлтый→красный) */
.hm-hi{background:#DCF5E3; color:#15803D; font-weight:600;}
.hm-mid{background:#FCEFC9; color:#92660A; font-weight:600;}
.hm-lo{background:#FBDDDD; color:#B42318; font-weight:600;}

/* =============================================================================
   Callout / подсказка
   ============================================================================= */
.iw-callout{display:flex; gap:10px; align-items:flex-start; border-radius:var(--r-panel); padding:12px 14px; font-size:13.5px; line-height:1.5;}
.iw-callout .ico{flex:none; font-size:16px; line-height:1.3;}
.iw-callout b{font-weight:700;}
.iw-callout-amber{background:#FCF3D6; color:#7A5B07;}
.iw-callout-info{background:var(--blue-bg); color:var(--blue-ink);}
.iw-callout-success{background:#EAF7EE; color:#15803D;}

/* агент-диалог */
.iw-qa{display:flex; flex-direction:column; gap:12px;}
.iw-qa-block{border-radius:var(--r-panel); padding:13px 15px;}
.iw-qa-q{background:#EEF3FB;}
.iw-qa-a{background:#EAF7EE;}
.iw-qa-block .iw-label{display:block; margin-bottom:6px;}

/* чипы-вкладки (планы) */
.iw-chips{display:flex; gap:8px; overflow-x:auto; padding-bottom:4px;}
.iw-chip{display:inline-flex; align-items:center; gap:8px; white-space:nowrap; font-size:13px; font-weight:600; color:var(--ink-2); background:var(--card-2); border:1px solid var(--card-bd); border-radius:var(--r-pill); padding:7px 12px; cursor:pointer;}
.iw-chip.active{color:var(--primary-on-soft); border-color:var(--primary); background:var(--primary-soft);}
.iw-chip .x{color:var(--ink-3); font-weight:700;}
.iw-chip .x:hover{color:var(--danger);}

/* демо-баннер */
.iw-demo-banner{display:flex; align-items:center; justify-content:center; gap:14px; flex-wrap:wrap; background:#FCF3D6; color:#7A5B07; font-size:13.5px; font-weight:600; padding:10px 16px; border-bottom:1px solid #F0E3B8;}
/* «горящий» флажок в шапке: нет токена → подключите */
.iw-token-flag{display:inline-flex; align-items:center; gap:6px; white-space:nowrap; text-decoration:none;
  font-size:12.5px; font-weight:700; color:#B42318; background:var(--red-bg);
  border:1px solid color-mix(in srgb,#B42318 30%,transparent); border-radius:var(--r-pill);
  padding:6px 12px; animation:iw-flag-pulse 1.6s var(--ease) infinite;}
.iw-token-flag:hover{filter:brightness(.97);}
@keyframes iw-flag-pulse{0%,100%{box-shadow:0 0 0 0 rgba(180,35,24,.0);} 50%{box-shadow:0 0 0 4px rgba(180,35,24,.16);}}

/* модалка */
.iw-modal-scrim{position:absolute; inset:0; background:rgba(20,30,55,.34); display:none; align-items:center; justify-content:center; z-index:60; padding:20px;}
.iw-modal-scrim.open{display:flex;}
.iw-modal{background:var(--card); border-radius:var(--r-card); box-shadow:var(--shadow-pop); padding:26px; max-width:420px; width:100%;}

/* легенда графика */
.iw-legend{display:flex; gap:14px; flex-wrap:wrap; align-items:center;}
.iw-legend-item{display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--ink-2); font-weight:500; white-space:nowrap;}
.iw-legend-item .ln{width:18px; height:0; border-top:2.5px solid currentColor;}
.iw-legend-item .ln.dash{border-top-style:dashed;}

/* подвал графика (4-up) */
.iw-chart-foot{display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-top:14px; padding-top:14px; border-top:1px solid var(--hairline);}
.iw-chart-foot .iw-label{display:block; margin-bottom:3px;}
.iw-chart-foot .v{font-size:17px; font-weight:700; color:var(--ink); line-height:1;}

/* мини-метрика со спарклайном */
.iw-spark-metric{display:flex; flex-direction:column; gap:4px; min-width:0;}
.iw-spark-row{display:flex; align-items:center; gap:8px; flex-wrap:nowrap;}
.iw-spark-mini{width:58px; height:20px; display:block; flex:none;}

/* вложенная панель */
.iw-nested{background:var(--card-2); border:1px solid var(--hairline); border-radius:var(--r-panel); padding:14px 16px;}

/* квадратный бейдж уровня */
.iw-level-sq{align-self:stretch; min-height:46px; aspect-ratio:1/1; flex:none; padding:0 8px; border-radius:var(--mark-r); background:var(--mark-bg); color:var(--mark-ink);
  display:inline-flex; align-items:baseline; justify-content:center; gap:1px; white-space:nowrap; font-weight:800; font-size:23px; line-height:1; box-shadow:inset 0 1px 0 rgba(255,255,255,.25);}
.iw-level-sq small{font-size:13px; font-weight:700; opacity:.85;}

/* tooltip графика */
.iw-tip{position:absolute; z-index:5; pointer-events:none; background:var(--card); border:1px solid var(--card-bd);
  border-radius:10px; box-shadow:var(--shadow-pop); padding:9px 11px; font-size:12px; min-width:140px; transform:translateY(-50%);}
.iw-tip .tip-h{font-weight:700; font-size:12.5px; color:var(--ink); margin-bottom:5px;}
.iw-tip .tip-r{display:flex; align-items:center; gap:6px; color:var(--ink-2); margin:2px 0; white-space:nowrap;}
.iw-tip .tip-r b{color:var(--ink); margin-left:auto; font-variant-numeric:tabular-nums;}
.iw-tip .tip-r .dot{width:8px; height:8px; border-radius:50%; flex:none;}
.iw-tip .tip-d{margin-top:5px; padding-top:5px; border-top:1px solid var(--hairline); font-weight:700; font-size:11.5px;}

/* компактная таблица «Очередь» — без горизонтального скролла */
.iw-table-queue{table-layout:fixed; width:100%;}
.iw-table-queue th, .iw-table-queue td{padding:8px 9px; border-right:1px solid var(--hairline);}
.iw-table-queue th:last-child, .iw-table-queue td:last-child{border-right:0;}
.iw-table-queue th:has(.iw-fbtn){padding-right:22px;}
.iw-table-queue .q-id{width:40px;}
.iw-table-queue .q-art{width:172px;}
.iw-table-queue .q-wb{width:104px; color:var(--ink-2); vertical-align:middle;}
.iw-table-queue .q-size{width:78px; white-space:normal; color:var(--ink-2); vertical-align:middle;}
.iw-table-queue .q-wh{width:158px;}
.iw-table-queue .q-arrow{width:20px; text-align:center; color:var(--ink-3); padding:0;}
.iw-table-queue .q-qty{width:88px;}
.iw-table-queue .q-stepper{display:inline-flex; align-items:center; border:1px solid var(--card-bd); border-radius:8px; overflow:hidden; background:var(--card); height:28px;}
.iw-table-queue .q-stepper.q-changed{border-color:var(--primary); box-shadow:0 0 0 2px color-mix(in srgb,var(--primary) 18%,transparent);}
.iw-table-queue .q-stepper button{width:22px; height:26px; border:0; background:var(--card-2); color:var(--ink-2); font-size:14px; line-height:1; cursor:pointer; display:grid; place-items:center; padding:0;}
.iw-table-queue .q-stepper button:hover{background:var(--primary-soft); color:var(--primary);}
.iw-table-queue .q-qtyinp{width:34px; border:0; text-align:center; font:inherit; font-size:13px; font-weight:600; color:var(--ink); background:transparent; outline:none; -moz-appearance:textfield; padding:0;}
.iw-table-queue .q-qtyinp::-webkit-outer-spin-button, .iw-table-queue .q-qtyinp::-webkit-inner-spin-button{-webkit-appearance:none; margin:0;}
.iw-table-queue .q-status{width:104px; white-space:normal;}
.iw-table-queue .q-when{width:54px; font-size:11.5px; color:var(--ink-2); white-space:nowrap;}
.iw-table-queue .q-avail{width:56px; font-size:11.5px; color:var(--success); white-space:nowrap;}
.iw-table-queue .q-act{width:42px; text-align:center;}
.iw-table-queue .q-art, .iw-table-queue .q-wh{white-space:normal; line-height:1.3;}
.iw-table-queue .q-art b, .iw-table-queue .q-wh b{font-weight:600; display:block; overflow:hidden; text-overflow:ellipsis;}
.iw-table-queue .q-sub{display:block; font-size:11px; color:var(--ink-3); margin-top:2px;}
.iw-table-queue .q-coef{color:var(--ink-2); font-weight:600; font-variant-numeric:tabular-nums;}
.iw-table-queue .q-err{font-size:10.5px; color:var(--danger); margin-top:3px; word-break:break-word; white-space:normal;}
.iw-table-queue .q-act .iw-btn{padding:5px 9px; font-size:14px; line-height:1;}

/* плотность (управляется тумблером Tweaks) */
[data-density="compact"]{--row-pad:6px; --pad-card:16px; --gap:12px;}
[data-density="compact"] .iw-table-queue th, [data-density="compact"] .iw-table-queue td{padding:5px 9px;}
[data-density="compact"] .iw-table{font-size:12.5px;}
[data-density="comfy"]{--row-pad:14px; --pad-card:26px; --gap:22px;}
[data-density="comfy"] .iw-table-queue th, [data-density="comfy"] .iw-table-queue td{padding:11px 12px;}

.iw-datefilter{align-items:flex-end; flex-wrap:wrap;}
.iw-datefilter .iw-field{flex:0 0 auto;}
.iw-datefilter input[type=date]{font-family:inherit; color:var(--ink);}

/* Остатки: компактная матрица «По SKU» без горизонтального скролла */
.iw-table-ost{table-layout:fixed; width:100%;}
.iw-table-ost th, .iw-table-ost td{padding:6px 5px; font-size:12px;}
.iw-table-ost .ost-art{width:96px; white-space:normal; text-align:left; line-height:1.25;}
.iw-table-ost td.ost-art b{font-weight:600; display:block; font-size:12.5px;}
.iw-table-ost .ost-sub{display:block; font-size:10.5px; color:var(--ink-3); margin-top:1px;}
.iw-table-ost .ost-cat{width:66px; white-space:normal; color:var(--ink-2); text-align:left;}
.iw-table-ost .ost-size{width:58px; white-space:normal; color:var(--ink-2);}
.iw-table-ost .ost-total{width:46px; font-weight:700;}
.iw-table-ost .ost-wh{font-size:9.5px; line-height:1.15; white-space:normal; word-break:break-word; vertical-align:bottom; color:var(--ink-2);}
.iw-table-ost th .sort{color:var(--primary); font-size:10px; font-weight:700; margin-left:2px;}
.iw-table-ost thead th{position:sticky; top:0; z-index:10; text-align:center; vertical-align:top; padding-bottom:20px;}
.iw-table-ost .ost-hl{display:block; cursor:pointer; user-select:none;}
.iw-table-ost .ost-hl:hover{color:var(--primary);}
/* Значок фильтра — внизу по центру ячейки заголовка (под названием). */
.iw-table-ost .ost-fbtn{position:absolute; left:50%; bottom:3px; transform:translateX(-50%); margin:0; padding:1px 2px; border:0; background:transparent; color:var(--ink-3); cursor:pointer; border-radius:4px; line-height:0;}
.iw-table-ost .ost-fbtn:hover{background:var(--primary-soft); color:var(--primary);}
.iw-table-ost .ost-fbtn.active{color:var(--primary); background:var(--primary-soft);}
.iw-table-ost .ost-wh .ost-fbtn{display:block; left:50%; bottom:3px;}
/* Числовые показатели — по центру колонок. */
.iw-table-ost td.iw-num, .iw-table-ost td.ost-total{text-align:center;}

/* Excel-меню фильтра */
.ost-fmenu{position:fixed; z-index:600; width:222px; background:var(--card); border:1px solid var(--card-bd);
  border-radius:10px; box-shadow:var(--shadow-pop); padding:6px; font-size:13px; color:var(--ink);}
.ost-fmenu .ost-fm-sort{display:flex; flex-direction:column; gap:1px; margin-bottom:6px;}
.ost-fmenu .ost-fm-sort button{text-align:left; border:0; background:transparent; color:var(--ink); font:inherit; padding:7px 9px; border-radius:6px; cursor:pointer;}
.ost-fmenu .ost-fm-sort button:hover{background:var(--card-2);}
.ost-fmenu .ost-fm-search{padding:0 2px 6px;}
.ost-fmenu .ost-fm-search input{width:100%; font:inherit; font-size:12.5px; padding:7px 9px; border:1px solid var(--card-bd); border-radius:7px; background:var(--card); color:var(--ink); outline:none;}
.ost-fmenu .ost-fm-search input:focus{border-color:var(--primary);}
.ost-fmenu .ost-fm-all{display:flex; align-items:center; gap:7px; padding:6px 9px; border-top:1px solid var(--hairline); cursor:pointer;}
.ost-fmenu .ost-fm-list{max-height:210px; overflow:auto; border-top:1px solid var(--hairline); padding:4px 0;}
.ost-fmenu .ost-fm-row{display:flex; align-items:center; gap:7px; padding:5px 9px; cursor:pointer; border-radius:6px; white-space:nowrap;}
.ost-fmenu .ost-fm-row:hover{background:var(--card-2);}
.ost-fmenu .ost-fm-row span{overflow:hidden; text-overflow:ellipsis;}
.ost-fmenu input[type=checkbox]{accent-color:var(--primary); flex:none;}
.ost-fmenu .ost-fm-foot{display:flex; gap:6px; padding:7px 4px 2px; border-top:1px solid var(--hairline);}
.ost-fmenu .ost-fm-foot button{flex:1; border:1px solid var(--card-bd); background:var(--card); color:var(--ink); font:inherit; font-weight:600; font-size:12.5px; padding:7px; border-radius:7px; cursor:pointer;}
.ost-fmenu .ost-fm-apply{background:var(--primary) !important; color:#fff !important; border-color:var(--primary) !important;}
.ost-fmenu .ost-fm-foot button:hover{filter:brightness(.97);}
.iw-table-ost tbody td{font-variant-numeric:tabular-nums;}
.iw-table-ost .hm-hi, .iw-table-ost .hm-mid{border-radius:4px;}
/* липкие первые 3 колонки матрицы */
.iw-table-ost th.ost-art, .iw-table-ost td.ost-art{position:sticky; left:0; z-index:3; background:var(--card);}
/* Угловая ячейка (шапка липкой колонки) — выше и липкого заголовка, и липкой колонки */
.iw-table-ost thead th.ost-art{background:var(--wbt-head-bg); z-index:13;}
/* Остатки как в кабинете WB: всё выровнено влево (включая числа), по середине
   вертикали. Заголовки крупнее (16px), как значения. */
.iw-table-ost thead th, .iw-table-ost tbody td{text-align:left !important; vertical-align:middle;}
.iw-table-ost thead th{font-size:16px;}

/* Остатки: сводный по складам с долей-баром */
.iw-table-svod .ost-barcell{padding-right:14px;}
.iw-table-svod .ost-bar{height:8px; border-radius:var(--r-pill); background:var(--card-2); overflow:hidden; border:1px solid var(--hairline);}
.iw-table-svod .ost-bar > span{display:block; height:100%; background:var(--primary); border-radius:var(--r-pill);}

/* Сводка по складам: 4 ровных столбца с разделителями */
.iw-table-svodka{table-layout:fixed; width:100%;}
.iw-table-svodka th, .iw-table-svodka td{padding:9px 14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; border-right:1px solid var(--hairline); position:relative;}
.iw-table-svodka th:last-child, .iw-table-svodka td:last-child{border-right:0;}
.iw-table-svodka .sv-art{width:30%;}
.iw-table-svodka .sv-wb{width:18%; color:var(--ink-2);}
.iw-table-svodka .sv-qty, .iw-table-svodka .sv-qty-h{width:18%; text-align:center;}
.iw-table-svodka .sv-qty{font-weight:700;}
.iw-table-svodka .sv-dst{width:34%; color:var(--primary); font-weight:500;}

/* универсальная воронка Excel-фильтра в заголовке */
.iw-table th .iw-hl{cursor:pointer; user-select:none;}
.iw-table th .iw-hl:hover{color:var(--primary);}
.iw-table th .iw-sortar{color:var(--primary); font-size:10px; font-weight:700;}
.iw-table th .iw-fbtn{position:absolute; right:6px; top:50%; transform:translateY(-50%); padding:2px 3px; border:0; background:transparent; color:var(--ink-3); cursor:pointer; border-radius:4px; line-height:0;}
.iw-table th .iw-fbtn:hover{background:var(--primary-soft); color:var(--primary);}
.iw-table th .iw-fbtn.active{color:var(--primary); background:var(--primary-soft);}
.iw-table-svodka th{padding-right:30px;}

/* Склады SKU: ровные столбцы с разделителями */
.iw-table-sku{table-layout:fixed; width:100%;}
.iw-table-sku th, .iw-table-sku td{border-right:1px solid var(--hairline); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.iw-table-sku th:last-child, .iw-table-sku td:last-child{border-right:0;}
.iw-table-sku th:has(.iw-fbtn){padding-right:24px;}
.iw-table-sku .sku-wh{width:50%;}
.iw-table-sku .sku-zab, .iw-table-sku .sku-dov{width:25%;}

/* Тарифы и Локализация: разделители-линии между столбцами */
.iw-table-tarify th, .iw-table-tarify td,
.iw-table-loc th, .iw-table-loc td{border-right:1px solid var(--hairline);}
.iw-table-tarify th:last-child, .iw-table-tarify td:last-child,
.iw-table-loc th:last-child, .iw-table-loc td:last-child{border-right:0;}
.iw-table-tarify th:has(.iw-fbtn), .iw-table-loc th:has(.iw-fbtn){padding-right:26px;}

/* утилиты */
.iw-row{display:flex; align-items:center; gap:10px;}
.iw-row-between{display:flex; align-items:center; justify-content:space-between; gap:12px;}
.iw-stack{display:flex; flex-direction:column;}
.iw-divider{height:1px; background:var(--hairline); margin:16px 0;}
.iw-grid-mini{display:grid; gap:14px;}
/* легенда-переключатель (клик = вкл/выкл серию) */
.iw-legend-toggle{background:none; border:0; cursor:pointer; font:inherit; padding:3px 6px; border-radius:7px; display:inline-flex; align-items:center; gap:6px;}
.iw-legend-toggle .lbl{color:var(--ink-2); font-weight:500; font-size:12px;}
.iw-legend-toggle:hover{background:var(--card-2);}
.iw-legend-item.off{opacity:.38;}
.iw-legend-item.off .ln{border-top-style:dashed;}

/* пивот со «липкой» первой колонкой */
.iw-pivot td:first-child, .iw-pivot th:first-child{position:sticky; left:0; z-index:3; background:var(--card-2); font-weight:600; text-align:left; box-shadow:1px 0 0 var(--card-bd);}
.iw-pivot tbody td:first-child{background:var(--card);}
.iw-pivot th, .iw-pivot td{border-right:1px solid var(--hairline);}
.iw-pivot th:last-child, .iw-pivot td:last-child{border-right:0;}
.iw-zone{font-weight:600; font-size:12px;}

/* аккордеон (Пойманные слоты) */
.iw-acc{border:1px solid var(--card-bd); border-radius:var(--r-panel); margin-bottom:10px; overflow:hidden;}
.iw-acc-head{display:flex; align-items:center; gap:10px; padding:11px 14px; cursor:pointer; font-weight:600; font-size:13.5px; background:var(--card-2);}
.iw-acc-head:hover{filter:brightness(.985);}
.iw-acc-head .meta{color:var(--ink-3); font-weight:500; font-size:12.5px;}
.iw-acc-head .chev{transition:transform .15s; color:var(--ink-3); font-size:11px;}
.iw-acc.open .iw-acc-head .chev{transform:rotate(90deg);}
.iw-acc-body{display:none;}
.iw-acc.open .iw-acc-body{display:block;}

/* столбчатый график (По дням) */
.iw-bars{display:flex; align-items:flex-end; gap:10px; height:150px; padding:20px 6px 0;}
.iw-bars .col{flex:1; display:flex; flex-direction:column; align-items:center; gap:6px; height:100%; justify-content:flex-end;}
.iw-bars .bar{width:100%; max-width:48px; background:var(--success); border-radius:5px 5px 0 0;}
.iw-bars .bval{font-size:12px; font-weight:700; color:var(--ink);}
.iw-bars .blab{font-size:11px; color:var(--ink-3);}
/* инлайн-поля даты «С … По …» */
.iw-daterange{display:inline-flex; align-items:center; gap:7px; white-space:nowrap;}
.iw-daterange > span{font-size:12px; color:var(--ink-3); font-weight:500;}
.iw-daterange > input{width:auto; padding:7px 9px;}

/* плотные графики (часы/минуты/секунды) */
.iw-bars-dense{gap:2px; padding:18px 2px 0;}
.iw-bars-dense .col{gap:3px;}
.iw-bars-dense .bar{max-width:none; border-radius:3px 3px 0 0;}
.iw-bars-dense .bval{font-size:9px; font-weight:600;}
.iw-bars-dense .blab{font-size:9px;}

/* Склады SKU / История слотов: ровные столбцы */
.iw-table-hs{table-layout:fixed; width:100%;}
.iw-table-hs th, .iw-table-hs td{border-right:1px solid var(--hairline); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.iw-table-hs th:last-child, .iw-table-hs td:last-child{border-right:0;}
.iw-table-hs th:has(.iw-fbtn){padding-right:24px;}
.iw-table-hs .hs-wh{width:34%;}
.iw-table-hs .hs-last{width:24%;}

/* Остатки «По SKU»: названия складов целиком в одну строку (не рвать слова).
   Матрица становится шире контейнера → горизонтальная прокрутка (overflow-x
   у .iw-table-wrap). Первые 3 колонки остаются «липкими». */
.iw-table-ost{table-layout:auto;}
/* Компактные колонки складов — чтобы в ширину помещалось как можно больше
   складов (горизонтальная прокрутка минимальна). */
.iw-table-ost .ost-wh{white-space:nowrap; word-break:normal; overflow-wrap:normal; hyphens:none; min-width:40px; font-size:9px;}
.iw-table-ost thead th.ost-wh{vertical-align:top; padding-left:3px; padding-right:3px;}
/* Заголовки складов — ГОРИЗОНТАЛЬНО в одну строку, имя видно полностью.
   Колонка авто-расширяется под текст (таблица не fixed-layout), без обрезки;
   по горизонтали таблица скроллится. */
.iw-table-ost thead th.ost-wh{font-size:16px !important; white-space:nowrap !important; word-break:normal !important; overflow-wrap:normal !important; overflow:visible !important; text-overflow:clip !important; hyphens:none; vertical-align:middle; min-width:max-content; padding-left:14px; padding-right:14px;}
.iw-table-ost td.ost-wh{padding-left:3px; padding-right:3px;}
.iw-table-ost .ost-size{min-width:60px; white-space:normal;}
.iw-table-ost .ost-cat{min-width:56px;}
/* Вертикальные линии-разделители между всеми колонками «По SKU». */
.iw-table-ost th, .iw-table-ost td{border-right:1px solid var(--hairline);}
.iw-table-ost th:last-child, .iw-table-ost td:last-child{border-right:0;}

/* Таблица плана агента: разделители-линии между колонками. */
.iw-table-plan th, .iw-table-plan td{border-right:1px solid var(--hairline);}
.iw-table-plan th:last-child, .iw-table-plan td:last-child{border-right:0;}
/* Значок фильтра — ПОД названием (по центру внизу), а не справа: название
   занимает всю ширину колонки и помещается в одну строку. */
.iw-table-plan thead th{position:sticky; top:0; z-index:2; vertical-align:top; padding:8px 6px 22px; font-size:11.5px; letter-spacing:.2px;}
.iw-table-plan th:has(.iw-fbtn){padding-right:6px;}
.iw-table-plan thead th .iw-fbtn{position:absolute; left:50%; right:auto; top:auto; bottom:4px; transform:translateX(-50%);}
/* Таблица плана вписывается в ширину БЕЗ горизонтальной прокрутки: фиксированная
   раскладка + перенос длинного текста (колонки ужимаются под контейнер).
   overflow:hidden + !important — чтобы длинный текст не наезжал на соседние
   колонки, а переносился внутри своей ячейки. */
.iw-table-plan{width:100%; min-width:0; table-layout:fixed; border-collapse:collapse;}
.iw-table-plan th, .iw-table-plan td{
  white-space:normal !important; word-break:break-word; overflow-wrap:anywhere; overflow:hidden;
  vertical-align:top; font-size:12px; line-height:1.25; padding:8px 8px;}
.iw-table-plan .iw-qty{width:100%; max-width:54px; box-sizing:border-box;}
/* Заголовки колонок — по центру. */
.iw-table-plan thead th{text-align:center;}
/* Доли ширины колонок (14 шт): «Куда»/«Артикул» шире, коэф/Шт/зоны/% — у́же. */
.iw-table-plan th:nth-child(1),.iw-table-plan td:nth-child(1){width:6%;}    /* Категория */
.iw-table-plan th:nth-child(2),.iw-table-plan td:nth-child(2){width:10%;}   /* Артикул */
.iw-table-plan th:nth-child(3),.iw-table-plan td:nth-child(3){width:9%;}    /* Артикул WB */
.iw-table-plan th:nth-child(4),.iw-table-plan td:nth-child(4){width:7%;}    /* Размер */
.iw-table-plan th:nth-child(5),.iw-table-plan td:nth-child(5){width:5%;}    /* Зона откуда */
.iw-table-plan th:nth-child(6),.iw-table-plan td:nth-child(6){width:9%;}    /* Откуда */
.iw-table-plan th:nth-child(7),.iw-table-plan td:nth-child(7){width:5.5%;}  /* Коэф откуда */
.iw-table-plan th:nth-child(8),.iw-table-plan td:nth-child(8){width:5%;}    /* Зона куда */
.iw-table-plan th:nth-child(9),.iw-table-plan td:nth-child(9){width:14%;}   /* Куда */
.iw-table-plan th:nth-child(10),.iw-table-plan td:nth-child(10){width:5.5%;}/* Коэф куда */
.iw-table-plan th:nth-child(11),.iw-table-plan td:nth-child(11){width:4.5%;}/* Шт */
.iw-table-plan th:nth-child(12),.iw-table-plan td:nth-child(12){width:6%;}  /* Заказов */
.iw-table-plan th:nth-child(13),.iw-table-plan td:nth-child(13){width:5%;}  /* Текущая % */
.iw-table-plan th:nth-child(14),.iw-table-plan td:nth-child(14){width:5%;}  /* После % */
/* План-таблицы НЕ получают WB-размеры (16px/61px) — у них жёсткое требование
   вписаться в ширину без горизонтального скролла. Держим компактными. */
.iw-table-plan{font-size:12px;}
.iw-table-plan tbody td{font-size:12px !important; line-height:1.25; padding:8px 8px !important;}
.iw-table-plan thead th{font-size:11.5px !important; padding:8px 6px 22px !important;}
/* Выделение ячеек перекрывает ховер (как в Google Sheets) — голубой, как у WB. */
.iw-cellsel{background:#cfe3ff !important;}
/* Панель итогов по выделенным ячейкам (Остатки/План/Очередь) — плавающий
   статус-бар внизу экрана, всегда виден при выделении (как в Google Sheets). */
.iw-sel-info{position:fixed; left:50%; bottom:18px; transform:translateX(-50%); z-index:90;
  background:var(--ink); color:#fff; border-radius:11px; box-shadow:var(--shadow-pop);
  padding:9px 18px; font-size:13px; font-weight:600; white-space:nowrap; letter-spacing:.2px;}
.iw-sel-info:empty{display:none;}
.iw-cellsel{background:#cfe3ff !important;}
body.iw-noselect{user-select:none; -webkit-user-select:none;}
/* На таблицах с выделением ячеек запрещаем нативное выделение текста, иначе
   браузер выделяет текст вместо диапазона ячеек. */
.iw-table-queue, .iw-table-ost{user-select:none; -webkit-user-select:none;}
/* Заметный итог по выделению (Очередь/Остатки). */
#qSelInfo:not(:empty), #ostSelInfo:not(:empty){display:inline-block; margin-top:8px;
  font-size:13px; font-weight:700; color:var(--ink); background:var(--primary-soft);
  border-radius:8px; padding:8px 13px;}
/* Поповер выбора периода (фильтр графика) */
.iw-rangewrap{position:relative; display:inline-block;}
.iw-rangebtn{display:inline-flex; align-items:center; gap:8px; font:inherit; font-size:13px; font-weight:600;
  color:var(--ink); background:var(--card); border:1px solid var(--card-bd); border-radius:var(--r-ctl);
  padding:8px 13px; cursor:pointer;}
.iw-rangebtn:hover{border-color:var(--ink-3);}
.iw-rangepop{position:absolute; z-index:50; top:calc(100% + 6px); left:0; display:none;
  background:var(--card); border:1px solid var(--card-bd); border-radius:var(--r-panel);
  box-shadow:var(--shadow-pop); padding:14px; min-width:300px;}
.iw-rangepop.open{display:block;}
.iw-rangepop .presets{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px;}
.iw-rangepop .presets button{flex:1 0 30%; border:1px solid var(--card-bd); background:var(--card); color:var(--primary);
  font:inherit; font-weight:600; font-size:13px; padding:8px; border-radius:8px; cursor:pointer;}
.iw-rangepop .presets button:hover{background:var(--primary-soft);}
.iw-rangepop .rng-foot{display:flex; gap:8px; margin-top:12px;}
.iw-rangepop .rng-foot button{flex:1; border:1px solid var(--card-bd); background:var(--card); color:var(--ink);
  font:inherit; font-weight:600; padding:9px; border-radius:8px; cursor:pointer;}
.iw-rangepop .rng-save{background:var(--magenta) !important; color:#fff !important; border-color:var(--magenta) !important;}
/* Календарь-сетка (выбор даты/диапазона, колесо — листание месяцев) */
.iw-cal{user-select:none;margin-bottom:8px;}
.iw-cal .cal-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-size:14px;font-weight:700;color:var(--ink);}
.iw-cal .cal-head button{border:0;background:transparent;cursor:pointer;color:var(--ink-3);font-size:17px;padding:2px 8px;border-radius:6px;}
.iw-cal .cal-head button:hover{background:var(--card-2);color:var(--ink);}
.iw-cal .cal-wd{display:grid;grid-template-columns:repeat(7,1fr);text-align:center;color:var(--ink-3);font-size:11px;font-weight:600;margin-bottom:4px;}
.iw-cal .cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;}
.iw-cal .cal-day{border:0;background:transparent;cursor:pointer;padding:8px 0;border-radius:8px;font:inherit;font-size:13px;color:var(--ink);}
.iw-cal .cal-day:hover{background:var(--card-2);}
.iw-cal .cal-inrange{background:var(--primary-soft);}
.iw-cal .cal-sel{background:var(--primary) !important;color:#fff !important;font-weight:700;}
.iw-cal .cal-empty{padding:8px 0;}
.iw-qty{width:58px;border:1px solid var(--card-bd);border-radius:6px;padding:3px 6px;font:inherit;font-size:13px;text-align:right;color:var(--ink);background:var(--card);}
.iw-qty:focus{outline:none;border-color:var(--primary);}

/* Колокольчик уведомлений */
.iw-bell-badge{position:absolute;top:-4px;right:-4px;min-width:16px;height:16px;padding:0 4px;border-radius:9px;background:var(--danger,#e5484d);color:#fff;font-size:10px;font-weight:700;line-height:16px;text-align:center;}
.iw-bell-panel{position:absolute;top:38px;right:0;width:320px;max-height:420px;overflow-y:auto;background:var(--card,#fff);border:1px solid var(--card-bd,#e5e7eb);border-radius:12px;box-shadow:0 12px 30px rgba(0,0,0,.14);padding:8px;z-index:1000;}
.iw-bell-item{position:relative;padding:10px 26px 10px 10px;border-radius:8px;border:1px solid var(--card-bd,#eee);margin-bottom:8px;}
.iw-bell-item:last-child{margin-bottom:0;}
.iw-bell-x{position:absolute;top:6px;right:6px;border:0;background:transparent;font-size:16px;line-height:1;cursor:pointer;color:var(--ink-3,#999);}
.iw-bell-empty{padding:16px;text-align:center;color:var(--ink-3,#999);font-size:13px;}

/* Убираем декоративные значки (эмодзи-иконки) в навигации и заголовках —
   чистая типографика как в кабинете WB. */
.ico{display:none !important;}

/* Чат с ботом (первая вкладка) */
.iw-chat-card{display:flex; flex-direction:column; max-width:900px;}
.iw-chat-messages{display:flex; flex-direction:column; gap:12px; min-height:340px; max-height:60vh; overflow-y:auto; padding:8px 4px 12px;}
.iw-chat-msg{display:flex;}
.iw-chat-msg.user{justify-content:flex-end;}
.iw-chat-msg.bot{justify-content:flex-start;}
.iw-chat-bubble{max-width:78%; padding:11px 15px; border-radius:14px; font-size:15px; line-height:1.5; white-space:normal; word-break:break-word;}
.iw-chat-msg.user .iw-chat-bubble{background:var(--primary,#3B7AC7); color:#fff; border-bottom-right-radius:5px;}
.iw-chat-msg.bot .iw-chat-bubble{background:var(--card-2,#F0F0F3); color:var(--ink,#1A2233); border-bottom-left-radius:5px;}
.iw-chat-typing{color:var(--ink-3,#999); font-style:italic;}
.iw-chat-chips{display:flex; gap:8px; flex-wrap:wrap; margin:10px 0;}
.iw-chat-input{display:flex; gap:8px; align-items:flex-end;}
.iw-chat-input textarea{flex:1; resize:none; min-height:44px; max-height:160px; padding:11px 14px; border:1px solid var(--card-bd,#E6E9F0); border-radius:12px; font:inherit; font-size:15px; color:var(--ink); background:var(--card); outline:none;}
.iw-chat-input textarea:focus{border-color:var(--primary);}
.iw-chat-input .iw-btn{height:44px;}

[hidden]{display:none !important;}

/* Сетка-линии между столбцами (Квоты складов и др. таблицы с iw-table-grid) */
.iw-table-grid th, .iw-table-grid td{ border-right:1px solid #E6E9F0; }
.iw-table-grid th:last-child, .iw-table-grid td:last-child{ border-right:0; }

/* =============================================================================
   Меню аккаунта в шапке (аватар + имя; hover открывает, клик закрепляет).
   Заменяет старый dropdown «Настройки/Действия». Использует токены тем.
   ============================================================================= */
.iw-account{ position:relative; }
.iw-account-trigger{
  display:inline-flex; align-items:center; gap:9px;
  padding:5px 9px 5px 5px; border-radius:var(--r-pill);
  border:1px solid transparent; background:transparent; cursor:pointer;
  font-family:inherit; transition:background .15s var(--ease), border-color .15s var(--ease);
}
.iw-account-trigger:hover,
.iw-account.open .iw-account-trigger{ background:var(--card-2); border-color:var(--card-bd); }
.iw-account-ava{
  width:30px; height:30px; border-radius:50%; flex:none;
  display:grid; place-items:center; color:#fff; font-size:12px; font-weight:700;
  background:linear-gradient(140deg,var(--primary),var(--indigo));
}
.iw-account-id{ display:flex; flex-direction:column; align-items:flex-start; line-height:1.15; }
.iw-account-id b{ font-size:13px; font-weight:700; color:var(--ink); }
.iw-account-id span{ font-size:11px; font-weight:500; color:var(--ink-3); }
.iw-account-chev{ flex:none; color:var(--ink-3); transition:transform .18s var(--ease); }
.iw-account.open .iw-account-chev{ transform:rotate(180deg); }
.iw-account-panel{
  position:absolute; right:0; top:calc(100% + 10px); width:312px; z-index:40;
  background:var(--card); border:1px solid var(--card-bd); border-radius:16px;
  box-shadow:var(--shadow-pop); padding:7px; overflow:hidden;
  display:none; animation:iw-acct-in .16s var(--ease);
}
.iw-account.open .iw-account-panel{ display:block; }
@keyframes iw-acct-in{ from{opacity:0; transform:translateY(-6px) scale(.985);} to{opacity:1; transform:none;} }
.iw-account-head{
  display:flex; align-items:center; gap:12px; padding:13px 12px 14px;
  background:linear-gradient(180deg,var(--card-2),var(--card));
  border-radius:11px; margin-bottom:5px;
}
.iw-account-head .ava{
  width:44px; height:44px; border-radius:50%; flex:none; display:grid; place-items:center;
  color:#fff; font-size:16px; font-weight:800;
  background:linear-gradient(140deg,var(--primary),var(--indigo));
  box-shadow:0 4px 10px -2px color-mix(in srgb,var(--primary) 50%,transparent);
}
.iw-account-head .name{ font-size:14.5px; font-weight:700; color:var(--ink); line-height:1.2; }
.iw-account-head .mail{
  font-size:12px; color:var(--ink-3); line-height:1.3;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.iw-account-cab{
  display:inline-flex; align-items:center; gap:5px; margin-top:6px;
  font-size:11px; font-weight:600; color:var(--green-ink); background:var(--green-bg);
  border-radius:999px; padding:2px 9px;
}
.iw-account-cab i{ width:6px; height:6px; border-radius:50%; background:currentColor; flex:none; }
.iw-account-grp{
  font-size:10.5px; font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  color:var(--label); padding:8px 12px 4px;
}
.iw-account-grp.row{ display:flex; align-items:center; justify-content:space-between; padding:11px 12px 4px; }
.iw-account-grp .hint{ font-size:10.5px; font-weight:500; letter-spacing:0; text-transform:none; color:var(--ink-3); }
.iw-account-item{
  display:flex; align-items:center; gap:11px; width:100%;
  padding:8px 10px; border-radius:10px; border:0; background:transparent; cursor:pointer;
  font-family:inherit; text-align:left; transition:background .13s;
}
.iw-account-item:hover{ background:var(--card-2); }
.iw-account-item .ic{ width:30px; height:30px; border-radius:8px; flex:none; display:grid; place-items:center; }
.iw-account-item .ic.blue{ background:var(--primary-soft); color:var(--primary); }
.iw-account-item .ic.warm{ background:#FEEFE8; color:#E8590C; }
.iw-account-item .ic.gray{ background:var(--card-2); color:var(--ink-2,#5B6478); }
.iw-account-item .tx{ display:flex; flex-direction:column; line-height:1.25; flex:1; min-width:0; }
.iw-account-item .tx b{ font-size:14px; font-weight:600; color:var(--ink); }
.iw-account-item .tx span{ font-size:11.5px; color:var(--ink-3); }
.iw-account-item .arr{ flex:none; color:#C2C8D4; }
.iw-account-sep{ height:1px; background:var(--hairline); margin:7px 6px; }
.iw-account-item.danger .ic{ background:var(--red-bg); color:var(--danger); }
.iw-account-item.danger .tx b{ color:var(--danger); }
.iw-account-item.danger:hover{ background:var(--red-bg); }

/* Спиннер «идёт поиск» (ответ агента) */
.iw-spin{display:inline-block;width:15px;height:15px;border:2px solid var(--card-bd);
  border-top-color:var(--primary);border-radius:50%;animation:iwspin .7s linear infinite;vertical-align:-3px;}
@keyframes iwspin{to{transform:rotate(360deg);}}
.iw-qa-loading{display:flex;align-items:center;gap:10px;color:var(--ink-2);font-size:13.5px;}
.iw-qa-loading .dots::after{content:'';animation:iwdots 1.2s steps(4,end) infinite;}
@keyframes iwdots{0%{content:'';}25%{content:'.';}50%{content:'..';}75%{content:'...';}100%{content:'';}}
