/* static/style.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: #f5f0eb; display: flex; min-height: 100vh; color: #2d1f1f; }

/* Sidebar */
.sidebar { width: 220px; min-height: 100vh; background: #fff; box-shadow: 2px 0 12px rgba(0,0,0,0.06); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-logo { padding: 18px 20px 16px; border-bottom: 1px solid #f0ebe6; cursor: pointer; transition: background 0.15s; border-radius: 0; }
.sidebar-logo:hover { background: #f5f0eb; }
.logo-text { font-size: 16px; font-weight: 700; }
.logo-sub { font-size: 10px; color: #b0998a; margin-top: 2px; }
.sidebar-search { padding: 12px 14px; border-bottom: 1px solid #f0ebe6; }
.sidebar-search input { width: 100%; background: #f5f0eb; border: none; border-radius: 8px; padding: 7px 10px; font-size: 11px; color: #555; outline: none; }
.sidebar-section-label { padding: 10px 16px 4px; font-size: 9px; font-weight: 700; color: #c0a898; letter-spacing: 1px; text-transform: uppercase; }
.sidebar-item { display: flex; align-items: center; gap: 9px; padding: 9px 16px; font-size: 12px; color: #6b5a52; cursor: pointer; border-radius: 8px; margin: 1px 8px; text-decoration: none; }
.sidebar-item:hover { background: #f5f0eb; color: #3d2b2b; }
.sidebar-item.active { background: #fdecea; color: #c0706a; font-weight: 600; }
.sidebar-bottom { margin-top: auto; padding: 14px 16px; border-top: 1px solid #f0ebe6; display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; background: #e8a09a; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { background: #fff; padding: 0 24px; height: 52px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 1px 6px rgba(0,0,0,0.06); flex-shrink: 0; }
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-badge { background: #f5f0eb; border-radius: 8px; padding: 4px 10px; font-size: 10px; color: #7a6055; font-weight: 500; }
.btn-primary { background: #e8650a; color: #fff; border: none; border-radius: 8px; padding: 6px 14px; font-size: 11px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; box-shadow: 0 2px 8px rgba(232,101,10,0.35); }
.btn-primary:hover { background: #d05a08; }
.btn-primary:disabled { background: #d9c4b8; color: #fff; cursor: not-allowed; box-shadow: none; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }
.btn-export { background: #9ad4b0; color: #1e3d2b; border: none; border-radius: 8px; padding: 6px 14px; font-size: 11px; font-weight: 600; cursor: pointer; text-decoration: none; }
.content { flex: 1; padding: 20px 24px; overflow-y: auto; }

/* Panels */
.panel { background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.panel-label { font-size: 10px; font-weight: 600; color: #aaa; letter-spacing: 0.5px; margin-bottom: 10px; text-transform: uppercase; }
.row-2 { display: flex; gap: 12px; margin-bottom: 14px; }

/* Tabs */
.tabs { display: flex; gap: 2px; margin-bottom: 0; }
.tab { background: #e8e0d8; color: #888; border-radius: 8px 8px 0 0; padding: 7px 16px; font-size: 11px; cursor: pointer; text-decoration: none; }
.tab.active { background: #fff; color: #2d1f1f; font-weight: 600; }

/* Stat blocks */
.stat-block { text-align: center; padding: 10px; border-radius: 10px; margin-bottom: 8px; }
.stat-block .val { font-size: 22px; font-weight: 700; }
.stat-block .lbl { font-size: 10px; margin-top: 2px; }
.stat-green { background: #edf7f2; } .stat-green .val { color: #1e3d2b; } .stat-green .lbl { color: #3a8a5c; }
.stat-yellow { background: #fef6e4; } .stat-yellow .val { color: #7a5a10; } .stat-yellow .lbl { color: #c09040; }
.stat-red { background: #fdecea; } .stat-red .val { color: #8b2020; } .stat-red .lbl { color: #c0706a; }

.stat-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}
.stat-active {
  box-shadow: 0 0 0 2px #e8650a !important;
}

/* Section filter buttons */
.sf-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  background: #f0ebe6;
  color: #7a6055;
  transition: background 0.15s, color 0.15s;
}
.sf-btn:hover { background: #e0d8d0; color: #3d2b2b; }
.sf-btn.f-yellow { background: #fef6e4; color: #7a5a10; box-shadow: 0 0 0 1.5px #e0b868; }
.sf-btn.f-blue   { background: #eaf1fd; color: #1e3a6e; box-shadow: 0 0 0 1.5px #7aade8; }
.sf-btn.f-red    { background: #fdecea; color: #8b2020; box-shadow: 0 0 0 1.5px #e8a09a; }
.sf-btn.active   { background: #edf7f2; color: #1e3d2b; box-shadow: 0 0 0 1.5px #3a8a5c; }

/* Bar chart */
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bar-name { width: 90px; font-size: 10px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; background: #f0ebe6; border-radius: 6px; height: 10px; }
.bar-fill { height: 10px; border-radius: 6px; }
.bar-val { font-size: 10px; font-weight: 600; width: 36px; text-align: right; }
.bar-row-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.bar-row-link:hover {
  background: rgba(232, 101, 10, 0.07);
}

/* Accordion */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.section-title { font-size: 10px; font-weight: 600; color: #3a8a5c; letter-spacing: 0.5px; text-transform: uppercase; }
.section-link { font-size: 10px; color: #3a8a5c; cursor: pointer; text-decoration: underline; }
.accordion-card { border: 1.5px solid #c8ead8; border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.accordion-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #edf7f2; cursor: pointer; user-select: none; }
.photo-slot { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #d0eedd; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #3a8a5c; }
.acc-meta { flex: 1; }
.acc-name { font-weight: 600; color: #222; font-size: 12px; }
.acc-sub { color: #888; font-size: 10px; margin-top: 1px; }
.acc-right { text-align: right; margin-right: 8px; }
.acc-alert { font-size: 10px; color: #c0706a; font-weight: 600; }
.acc-total { font-size: 10px; color: #999; }
.acc-arrow { color: #888; font-size: 14px; }
.accordion-body { background: #fff; padding: 8px 12px 10px; display: none; }
.accordion-body.open { display: block; }

/* Size block */
.size-block { margin-bottom: 8px; }
.size-head { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; background: #f0faf4; border-radius: 8px 8px 0 0; border-bottom: 1px solid #e0f0e8; }
.size-num { font-weight: 700; font-size: 13px; }
.size-stats { display: flex; align-items: center; gap: 8px; }
.fbo-s { font-size: 10px; color: #888; } .fbo-s b { color: #3a8a5c; }
.fbs-s { font-size: 10px; color: #888; } .fbs-s b { color: #c0706a; }
.btn-off { background: #9ad4b0; color: #1e3d2b; border: none; border-radius: 6px; padding: 3px 10px; font-size: 10px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn-off:hover { background: #7ec49a; }
.btn-on  { background: #e8a09a; color: #5a1515; border: none; border-radius: 6px; padding: 3px 10px; font-size: 10px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn-on:hover { background: #d88080; }

/* FBS chip */
.chip-fbs     { background: #e8650a; }
.chip-fbs-off { background: #aaa; }
.fbs-chip-was { font-size: 9px; font-weight: 400; opacity: 0.82; margin-left: 1px; }
.wh-chips { background: #f8fdfb; border-radius: 0 0 8px 8px; padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.chip { border-radius: 6px; padding: 3px 8px; font-size: 10px; color: #fff; font-weight: 500; }
.chip-bar { height: 3px; background: rgba(255,255,255,0.35); border-radius: 2px; margin-top: 3px; }
.chip-fill { height: 3px; background: rgba(255,255,255,0.9); border-radius: 2px; }

/* Table */
.table-wrap { background: #fff; border-radius: 0 14px 14px 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden; }
.filters { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid #f0ebe6; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #ddd transparent; }
.filters::-webkit-scrollbar { height: 4px; }
.filters::-webkit-scrollbar-track { background: transparent; }
.filters::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }
.filter-label { font-size: 10px; color: #aaa; font-weight: 600; }
.filter-select { background: #f5f0eb; border: none; border-radius: 8px; padding: 5px 10px; font-size: 11px; color: #555; outline: none; cursor: pointer; }
.filter-sep { width: 1px; height: 20px; background: #f0ebe6; }
.sf-btn { border: 1.5px solid #e8e0d8; background: #fff; border-radius: 8px; padding: 4px 10px; font-size: 10px; color: #888; cursor: pointer; font-weight: 500; text-decoration: none; }
.sf-btn.active { background: #fdecea; border-color: #e8a09a; color: #e8650a; font-weight: 600; }
.sf-btn.f-yellow { border-color: #f0c98a; background: #fef6e4; color: #c09040; font-weight: 600; }
.sf-btn.f-red { border-color: #e8a09a; background: #fdecea; color: #c0706a; font-weight: 600; }
.sf-btn.f-blue  { border-color: #a0c4e8; background: #e8f4ff; color: #3a6a9c; font-weight: 600; }
.sf-btn.f-green  { border-color: #7ac49a; background: #edf7f2; color: #1e6a3a; font-weight: 600; }
.sf-btn.f-orange { border-color: #e0a060; background: #fff0e0; color: #b85a10; font-weight: 600; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead tr { background: #f8f4f0; }
th { padding: 10px 12px; text-align: left; font-size: 10px; font-weight: 600; color: #aaa; letter-spacing: 0.5px; text-transform: uppercase; border-bottom: 1px solid #f0ebe6; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #f8f4f0; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fdfaf8; }
tr.muted td { opacity: 0.55; }
.product-cell { display: flex; align-items: center; gap: 10px; }
.prod-photo { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #f0ebe6; flex-shrink: 0; }
.prod-name { font-weight: 600; font-size: 11px; }
.prod-sub { font-size: 10px; color: #aaa; margin-top: 1px; }
.size-badge { background: #f0ebe6; color: #7a6055; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.fbo-val { font-weight: 600; }
.fbo-zero { color: #e8a09a; font-weight: 600; }
.transit-val { color: #aaa; font-size: 11px; }
/* FBO warehouse tooltip */
.fbo-tip-wrap { position: relative; display: inline-block; cursor: default; }
.fbo-tip {
  display: none; position: fixed; z-index: 9999;
  background: #2d1f1f; color: #fff; border-radius: 8px;
  padding: 8px 10px; min-width: 180px; max-width: 260px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22); font-size: 11px; line-height: 1.5;
  pointer-events: none;
}
.fbo-tip-wrap:hover .fbo-tip { display: block; }
.fbo-tip-row { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
.fbo-tip-wh  { color: #d0c0b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.fbo-tip-qty { font-weight: 700; color: #fff; flex-shrink: 0; }
.fbs-active { color: #c09040; font-weight: 600; }
.fbs-zero { color: #ccc; }
.status-badge { border-radius: 6px; padding: 3px 8px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.s-ok      { background: #edf7f2; color: #3a8a5c; }
.s-off     { background: #fef6e4; color: #c09040; }
.s-cover   { background: #e8f4ff; color: #3a6a9c; }
.s-none    { background: #fdecea; color: #c0706a; }
.s-missing { background: #fff0e0; color: #b85a10; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid #f0ebe6; }
.pag-info { font-size: 10px; color: #aaa; }
.pag-btns { display: flex; gap: 4px; }
.pag-btn { background: #f0ebe6; border-radius: 6px; padding: 4px 10px; font-size: 11px; color: #888; cursor: pointer; text-decoration: none; }
.pag-btn.active { background: #e8a09a; color: #fff; font-weight: 600; }

/* Upload form */
.upload-form { background: #fff; border-radius: 14px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); max-width: 500px; width: 100%; margin: 0; }
.upload-form h2 { font-size: 16px; margin-bottom: 6px; }
.upload-form p { font-size: 12px; color: #888; margin-bottom: 14px; }
.form-row { margin-bottom: 14px; }
.form-label { font-size: 11px; font-weight: 600; color: #555; margin-bottom: 6px; display: block; }
.form-input { width: 100%; border: 1.5px solid #f0ebe6; border-radius: 8px; padding: 8px 12px; font-size: 12px; outline: none; }
.form-input:focus { border-color: #e8a09a; }

/* Upload instructions */
.upload-instructions { background: #f8f4f0; border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.upload-instruction-item { display: flex; align-items: flex-start; gap: 10px; font-size: 11px; color: #555; line-height: 1.5; }
.upload-instruction-item b { color: #2d1f1f; }
.upload-instruction-item span { color: #888; }
.instruction-num { background: #e8a09a; color: #fff; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: calc(100vh - 120px); text-align: center; }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state-title { font-size: 18px; font-weight: 600; color: #2d1f1f; margin-bottom: 8px; }
.empty-state-sub { font-size: 13px; color: #aaa; max-width: 320px; line-height: 1.6; }

/* Inline qty input (FBS enable) */
.qty-input-group { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1.5px solid #e8650a; border-radius: 8px; padding: 2px 4px 2px 8px; box-shadow: 0 0 0 3px rgba(232,101,10,0.10); }
.qty-input { width: 48px; border: none; outline: none; font-size: 12px; font-weight: 600; color: #2d1f1f; text-align: center; background: transparent; font-family: inherit; }
.qty-input::placeholder { color: #c0a898; font-weight: 400; }
.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input[type=number] { -moz-appearance: textfield; }
.qty-ok { background: #e8650a; color: #fff; border: none; border-radius: 6px; padding: 4px 8px; font-size: 11px; cursor: pointer; font-weight: 700; line-height: 1; flex-shrink: 0; }
.qty-ok:hover { background: #c05008; }
.qty-ok:disabled { background: #d9c4b8; cursor: not-allowed; }
.qty-x  { background: none; color: #c0a898; border: none; padding: 4px 5px; font-size: 13px; cursor: pointer; line-height: 1; flex-shrink: 0; }
.qty-x:hover { color: #888; }

/* Custom select dropdown */
.custom-select { position: relative; background: #f5f0eb; border-radius: 8px; padding: 5px 10px; font-size: 11px; color: #555; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; user-select: none; min-width: 120px; flex-shrink: 0; }
.custom-select-val { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.custom-select-arrow { font-size: 8px; color: #aaa; flex-shrink: 0; transition: transform 0.18s; }
.custom-select.open .custom-select-arrow { transform: rotate(180deg); }
.custom-select-opts { display: none; position: absolute; top: calc(100% + 4px); left: 0; background: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,0.13); min-width: 200px; max-height: 260px; overflow-y: auto; z-index: 9999; padding: 4px; }
.custom-select.open .custom-select-opts { display: block; }
.custom-select-opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 12px; font-size: 11px; color: #555; border-radius: 6px; text-decoration: none; white-space: nowrap; }
.custom-select-opt:hover { background: #f5f0eb; color: #2d1f1f; }
.custom-select-opt.active { background: #fdecea; color: #e8650a; font-weight: 600; }
.cs-count { margin-left: auto; background: #f0ebe6; color: #999; border-radius: 8px; padding: 1px 6px; font-size: 10px; font-weight: 600; flex-shrink: 0; }

/* Search */
.search-wrap { position: relative; display: inline-flex; align-items: center; min-width: 160px; max-width: 260px; flex-shrink: 1; }
.search-input { background: #f5f0eb; border: none; border-radius: 8px; padding: 5px 26px 5px 10px; font-size: 11px; color: #555; outline: none; min-width: 140px; width: 100%; flex: 1; font-family: inherit; }
.search-input:focus { box-shadow: 0 0 0 2px rgba(232,101,10,0.18); }
.search-clear { position: absolute; right: 7px; background: none; border: none; color: #aaa; font-size: 12px; cursor: pointer; padding: 0; line-height: 1; }
.search-clear:hover { color: #666; }

/* Checkbox column */
.cb-th, .cb-td { width: 36px; text-align: center; padding-left: 8px !important; padding-right: 4px !important; }
.row-cb, #select-all-cb { width: 15px; height: 15px; cursor: pointer; accent-color: #e8650a; }

/* Actions column */
.act-th { width: 110px; }
.act-td { white-space: nowrap; }

/* Bulk bar */
.bulk-bar { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #2d1f1f; color: #fff; border-radius: 14px; padding: 10px 16px; display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 28px rgba(0,0,0,0.28); z-index: 300; font-size: 12px; white-space: nowrap; }
.bulk-count { font-weight: 600; color: #f0c98a; padding-right: 4px; }
.bulk-btn { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22); color: #fff; border-radius: 8px; padding: 5px 12px; font-size: 11px; cursor: pointer; font-weight: 600; }
.bulk-btn:hover { background: rgba(255,255,255,0.22); }
.bulk-btn-danger { background: rgba(232,101,10,0.75); border-color: rgba(232,101,10,0.4); }
.bulk-btn-danger:hover { background: rgba(232,101,10,1); }
.bulk-btn-success { background: #3a8a5c; border-color: rgba(58,138,92,0.5); color: #fff; }
.bulk-btn-success:hover { background: #2e7049; }
.bulk-btn-x { background: none; border: none; color: rgba(255,255,255,0.45); cursor: pointer; font-size: 16px; padding: 0 4px; line-height: 1; }
.bulk-btn-x:hover { color: #fff; }

/* ===== TABLE ACCORDION ===== */
.sizes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 2px;
}
.sizes-table th {
  background: #f8f4f0;
  padding: 6px 12px;
  text-align: left;
  font-weight: 600;
  color: #888;
  border-bottom: 1px solid #f0ebe6;
  white-space: nowrap;
}
.sizes-table td {
  padding: 6px 12px;
  border-bottom: 1px solid #f8f4f0;
  vertical-align: middle;
}
.sizes-table tr:last-child td {
  border-bottom: none;
}
.sizes-table tr:hover td {
  background: #faf6f2;
}
.sizes-table .act-td {
  white-space: nowrap;
}

/* Ресайз колонок */
#stock-table {
  table-layout: fixed;
}
#stock-table th {
  position: relative;
  overflow: visible;
  white-space: nowrap;
}
.col-resizer {
  position: absolute;
  right: -4px;
  top: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  background: transparent;
  z-index: 1;
}
.col-resizer:hover, .col-resizer.resizing {
  background: #e8650a66;
  border-radius: 2px;
}
