/* CRM v2 — drill-down style */

.app { display: flex; min-height: 100vh; background: var(--c-bg); }

/* ===== Sidebar ===== */
.sidenav {
  width: 220px; flex-shrink: 0;
  background: var(--c-sidebar-bg); color: var(--c-sidebar-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidenav-brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidenav-logo { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, #3B82F6, #1D4ED8); color: white; font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(37,99,235,0.4); }
.sidenav-brand-title { color: #fff; font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.sidenav-brand-sub { color: #64748B; font-size: 11px; margin-top: 2px; }
.sidenav-list { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; }
.sidenav-item { display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 36px; border-radius: 6px; background: transparent; border: 0; color: var(--c-sidebar-text); font-size: 13px; font-weight: 500; text-align: left; position: relative; transition: all 0.15s; }
.sidenav-item:hover { background: rgba(255,255,255,0.04); color: #E2E8F0; }
.sidenav-item.active { background: var(--c-sidebar-active-bg); color: var(--c-sidebar-active-text); }
.sidenav-active-dot { position: absolute; right: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--c-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.25); }
.sidenav-foot { padding: 10px 8px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidenav-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,0.03); }
.sidenav-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #F59E0B, #DC2626); color: #fff; font-weight: 600; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidenav-user-name { color: #E2E8F0; font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidenav-user-sub { color: #64748B; font-size: 11px; margin-top: 1px; }

/* ===== Top bar ===== */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 52px; background: #fff; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 5; }
.topbar-tabs { display: flex; gap: 4px; height: 100%; align-items: center; }
.topbar-tab { height: 100%; padding: 0 14px; background: transparent; border: 0; font-size: 13.5px; font-weight: 500; color: #64748B; border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0; }
.topbar-tab:hover:not(.disabled) { color: var(--c-text-1); }
.topbar-tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }
.topbar-tab.disabled { color: #CBD5E1; cursor: not-allowed; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-search { display: flex; align-items: center; gap: 8px; background: #F1F5F9; border: 1px solid transparent; border-radius: 8px; padding: 0 10px; height: 32px; width: 260px; }
.topbar-search:focus-within { background: #fff; border-color: var(--c-primary); }
.topbar-search input { border: 0; background: transparent; flex: 1; outline: none; font-size: 13px; }
.topbar-search kbd { font-family: inherit; font-size: 11px; color: #94A3B8; background: #fff; padding: 1px 5px; border-radius: 4px; border: 1px solid #E2E8F0; }
.topbar-icon { width: 32px; height: 32px; }
.topbar-icon svg { width: 16px; height: 16px; }

/* ===== Page ===== */
.page { padding: 16px; }
.page-body-v2 { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }

/* ===== Tree panel v2 ===== */
.tree-panel-v2 {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  position: sticky; top: 68px;
  max-height: calc(100vh - 84px);
  overflow: hidden;
}
.filter-bar { padding: 12px 12px 0; }
.fb-row { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; height: 26px;
  background: #F1F5F9;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  color: var(--c-text-1);
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-pill > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-pill:hover { background: var(--c-primary-50); border-color: var(--c-primary); color: var(--c-primary); }
.fb-pill-label { color: #94A3B8; margin-right: 2px; }

.tree-toolbar { padding: 10px 12px; display: flex; gap: 6px; }
.tree-search-v2 {
  flex: 1; display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  background: #F8FAFC;
  border: 1px solid var(--c-border);
  border-radius: 6px;
}
.tree-search-v2:focus-within { background: #fff; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.tree-search-v2 input { border: 0; background: transparent; flex: 1; outline: none; font-size: 13px; min-width: 0; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }

.troot-row {
  display: flex; align-items: center; gap: 8px;
  margin: 0 8px 4px; padding: 6px 10px;
  background: transparent; border: 0;
  border-radius: 6px;
  font-size: 12.5px; font-weight: 500;
  color: #475569;
  text-align: left;
  transition: all 0.12s;
  cursor: pointer;
  white-space: nowrap;
}
.troot-row > span:not(.troot-count) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.troot-count { flex-shrink: 0; }
.troot-row:hover { background: var(--c-row-hover); color: var(--c-text-1); }
.troot-row.selected { background: var(--c-row-selected); color: var(--c-primary); }
.troot-count { margin-left: auto; font-size: 11px; padding: 1px 7px; background: rgba(37,99,235,0.1); color: var(--c-primary); border-radius: 999px; font-weight: 500; }

.tree-list-v2 {
  flex: 1; overflow-y: auto;
  padding: 0 8px 8px;
  min-height: 200px;
}

.trow {
  display: flex; align-items: center; gap: 4px;
  height: 30px;
  padding-right: 6px;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  user-select: none;
  font-size: 13px;
  color: var(--c-text-1);
  transition: background 0.12s;
}
.trow:hover { background: var(--c-row-hover); }
.trow.selected { background: var(--c-row-selected); color: var(--c-primary); font-weight: 500; }
.trow.selected::before { content: ''; position: absolute; left: -8px; top: 4px; bottom: 4px; width: 3px; background: var(--c-primary); border-radius: 0 2px 2px 0; }

.tchevron { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; background: transparent; border: 0; color: #64748B; flex-shrink: 0; border-radius: 3px; padding: 0; }
.tchevron:hover { background: rgba(0,0,0,0.06); }

.tkind { display: flex; align-items: center; justify-content: center; width: 16px; flex-shrink: 0; }
.tkind.kind-empty { color: #CBD5E1; }
.tkind.kind-category { color: #2563EB; }
.tkind.kind-sales { color: #DB2777; }

.tlabel { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hl { background: rgba(245, 158, 11, 0.25); color: inherit; padding: 0 1px; border-radius: 2px; }

.trename { flex: 1; height: 22px; padding: 0 6px; font-size: 13px; border: 1px solid var(--c-primary); border-radius: 4px; background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }

.tbadge { font-size: 10.5px; padding: 1px 6px; background: #FCE7F3; color: #BE185D; border-radius: 999px; font-weight: 500; flex-shrink: 0; }

.tmore { opacity: 0; transition: opacity 0.12s; flex-shrink: 0; }
.trow:hover .tmore, .trow.selected .tmore { opacity: 1; }

.tree-legend {
  display: flex; gap: 12px; padding: 10px 14px;
  border-top: 1px solid var(--c-border);
  background: #FAFBFC;
  font-size: 11px;
  color: #94A3B8;
}
.legend-item { display: inline-flex; align-items: center; gap: 4px; }
.kind-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.kind-dot.kind-empty { background: #CBD5E1; }
.kind-dot.kind-category { background: #2563EB; }
.kind-dot.kind-sales { background: #DB2777; }

/* ===== Context Menu ===== */
.ctx-menu {
  position: fixed; z-index: 100;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: 4px;
  animation: fadeIn 0.12s ease;
}
.ctx-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 7px 10px;
  background: transparent; border: 0;
  border-radius: 5px;
  font-size: 13px;
  color: var(--c-text-1);
  text-align: left;
  cursor: pointer;
}
.ctx-item:hover:not(.disabled) { background: var(--c-primary-50); color: var(--c-primary); }
.ctx-item.danger { color: var(--c-required); }
.ctx-item.danger:hover { background: #FEF2F2; }
.ctx-item.disabled { color: #CBD5E1; cursor: not-allowed; }
.ctx-hint { margin-left: auto; font-size: 11px; color: #94A3B8; }
.ctx-divider { height: 1px; background: var(--c-border); margin: 4px 6px; }

/* ===== Detail shell ===== */
.detail-shell {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: calc(100vh - 84px);
}

/* ===== Drill header ===== */
.drill-header { padding: 18px 28px 14px; border-bottom: 1px solid var(--c-border); }
.drill-breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 12.5px; margin-bottom: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; background: transparent; border: 0; border-radius: 4px; font-size: 12.5px; color: #64748B; cursor: pointer; transition: all 0.15s; white-space: nowrap; flex-shrink: 0; }
.crumb:hover { background: var(--c-primary-50); color: var(--c-primary); }
.crumb.current { color: var(--c-text-1); font-weight: 500; }
.crumb.current:hover { background: transparent; cursor: default; }

.drill-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.drill-title-block { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: 1; min-width: 0; }
.drill-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* InlineEdit */
.inline-display {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; margin-left: -8px;
  border-radius: 5px;
  cursor: text;
  transition: background 0.12s;
  font-weight: 600;
  font-size: 14px;
}
.inline-display.lg { font-size: 22px; line-height: 1.3; letter-spacing: -0.01em; padding: 4px 10px; margin-left: -10px; }
.inline-display:hover { background: var(--c-primary-50); }
.edit-pencil { color: #94A3B8; opacity: 0; transition: opacity 0.12s; }
.inline-display:hover .edit-pencil { opacity: 1; color: var(--c-primary); }
.inline-edit { font-family: inherit; font-weight: 600; font-size: 14px; padding: 2px 8px; margin-left: -8px; border: 1px solid var(--c-primary); border-radius: 5px; background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.inline-edit.lg { font-size: 22px; line-height: 1.3; padding: 4px 10px; margin-left: -10px; }

/* Kind pill */
.kind-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.kind-pill.empty { background: #F1F5F9; color: #64748B; }
.kind-pill.empty svg { color: #94A3B8; }
.kind-pill.category { background: #EFF6FF; color: #1D4ED8; }
.kind-pill.sales { background: #FCE7F3; color: #BE185D; }

/* ===== Drill content ===== */
.drill-content { padding: 24px 28px; }

/* ===== Empty Decision ===== */
.empty-decision { max-width: 880px; margin: 30px auto; }
.ed-header { text-align: center; margin-bottom: 30px; }
.ed-step { display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--c-primary); background: var(--c-primary-50); padding: 3px 10px; border-radius: 999px; letter-spacing: 0.04em; margin-bottom: 12px; }
.ed-title { font-size: 22px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
.ed-sub { color: #64748B; font-size: 13.5px; margin: 0; }

.ed-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ed-card {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 24px;
  background: #fff;
  border: 1.5px solid var(--c-border);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.ed-card:hover { border-color: var(--c-primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.ed-card-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.ed-card-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.ed-card-desc { font-size: 13px; color: #64748B; line-height: 1.55; margin-bottom: 18px; }
.ed-card-foot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--c-primary); margin-top: auto; }
.ed-card:hover .ed-card-foot { gap: 10px; }

.ed-tips { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 22px; font-size: 12px; color: #94A3B8; }
.ed-tips svg { color: #FBBF24; }

/* ===== Category view ===== */
.cat-view, .sales-view { animation: fadeIn 0.22s ease; }
.cat-header, .sv-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; gap: 16px; }
.cat-title, .sv-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.cat-sub, .sv-sub { font-size: 12.5px; color: #94A3B8; margin: 0; }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.cat-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.16s;
  text-align: left;
  font-family: inherit;
  display: flex; flex-direction: column; gap: 10px;
}
.cat-card:hover { border-color: var(--c-primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.cat-card-head { display: flex; align-items: center; gap: 10px; }
.cat-card-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cat-card-icon.kind-empty { background: #F1F5F9; color: #94A3B8; }
.cat-card-icon.kind-category { background: #EFF6FF; color: #1D4ED8; }
.cat-card-icon.kind-sales { background: #FCE7F3; color: #BE185D; }
.cat-card-title { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0; word-break: break-word; }
.cat-card-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.cat-card-meta .tag, .cat-card-meta > span { white-space: nowrap; flex-shrink: 0; }

.cat-card-add {
  background: transparent;
  border: 1.5px dashed var(--c-border-strong);
  display: flex; flex-direction: row; align-items: center; justify-content: center;
  gap: 6px;
  color: #64748B;
  font-size: 13px; font-weight: 500;
  min-height: 86px;
}
.cat-card-add:hover { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-50); transform: none; box-shadow: none; }
.cat-card.adding { padding: 10px; }

/* ===== Meta bar (chips) ===== */
.meta-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px;
  background: linear-gradient(180deg, #FAFBFC, #F8FAFC);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  margin-bottom: 20px;
}
.meta-bar-label { font-size: 11.5px; font-weight: 600; color: #94A3B8; letter-spacing: 0.04em; margin-right: 4px; }
.meta-bar-spacer { flex: 1; }
.meta-bar-hint { font-size: 11.5px; color: #94A3B8; }
.meta-chip { position: relative; display: inline-flex; align-items: stretch; }
.meta-chip-label {
  display: inline-flex; align-items: center;
  padding: 0 8px; height: 28px;
  background: #F1F5F9; color: #475569;
  font-size: 12px; font-weight: 500;
  border-radius: 6px 0 0 6px;
}
.meta-chip-value {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 10px; height: 28px;
  background: #fff; border: 1px solid var(--c-border); border-left: 0;
  font-size: 12.5px; font-weight: 500;
  color: var(--c-text-1);
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  transition: all 0.12s;
}
.meta-chip-value:hover { border-color: var(--c-primary); color: var(--c-primary); }

.meta-chip-backdrop { position: fixed; inset: 0; z-index: 50; }
.meta-chip-menu {
  position: absolute; top: calc(100% + 4px); left: 0;
  z-index: 51;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 130px;
  animation: fadeIn 0.12s ease;
}
.meta-chip-opt {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 6px 10px;
  background: transparent; border: 0;
  border-radius: 5px;
  font-size: 13px;
  color: var(--c-text-1);
  text-align: left;
}
.meta-chip-opt:hover { background: var(--c-primary-50); color: var(--c-primary); }
.meta-chip-opt.active { color: var(--c-primary); font-weight: 500; }
.meta-chip-opt svg { color: var(--c-primary); }

/* ===== Sales view list ===== */
.sv-list { display: flex; flex-direction: column; gap: 10px; }
.sv-empty { padding: 50px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; background: #FAFBFC; border: 1px dashed var(--c-border); border-radius: 10px; }
.sv-empty-title { font-size: 13.5px; font-weight: 500; color: #475569; margin-top: 6px; }
.sv-empty-sub { font-size: 12px; color: #94A3B8; }

/* ===== Quick add row ===== */
.quick-add-row {
  display: grid;
  grid-template-columns: auto 1fr 160px auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--c-primary-50);
  border: 1.5px solid var(--c-primary-100);
  border-radius: 10px;
  margin-bottom: 12px;
}
.quick-add-leading {
  width: 28px; height: 28px;
  background: var(--c-primary); color: #fff;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.quick-add-price { display: flex; align-items: center; gap: 6px; }
.quick-add-price input { flex: 1; }
.quick-add-hint { grid-column: 2 / -1; font-size: 11.5px; color: #64748B; }

/* ===== Sale class row ===== */
.sc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  transition: all 0.16s;
  cursor: default;
}
@media (max-width: 1180px) {
  .sc-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .sc-row-price { border-left: 0; border-top: 1px dashed var(--c-border); padding: 8px 0 0 0; align-items: flex-start; flex-direction: row; align-items: baseline; gap: 10px; }
  .sc-row-actions { flex-direction: row; align-items: center; justify-content: space-between; }
}
.sc-row:hover { border-color: var(--c-primary-100); box-shadow: var(--shadow-md); }
.sc-row.unlisted { background: #FAFBFC; opacity: 0.85; }
.sc-row-main { min-width: 0; }
.sc-row-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.sc-row-name { font-size: 14px; font-weight: 600; color: var(--c-text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sc-row.unlisted .sc-row-name { color: #94A3B8; }
.sc-row-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.sc-row-meta { display: flex; gap: 16px; flex-wrap: wrap; }
.sc-row-meta-item { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #64748B; white-space: nowrap; flex-shrink: 0; }
.sc-row-price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 0 8px; border-left: 1px dashed var(--c-border); padding-left: 16px; }
.sc-row-discount { font-size: 11px; color: #C2410C; background: #FFF7ED; padding: 1px 6px; border-radius: 4px; font-weight: 500; }
.sc-row-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.sc-row-listed { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: #64748B; }
.sc-row-btns { display: flex; gap: 6px; }

.price-tag { display: flex; align-items: baseline; color: var(--c-required); font-family: 'Inter', sans-serif; }
.price-tag.large .price-currency { font-size: 13px; font-weight: 600; margin-right: 1px; }
.price-tag.large .price-amount { font-size: 22px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.sc-row.unlisted .price-amount, .sc-row.unlisted .price-currency { color: #94A3B8; }

.capacity-bar { display: inline-block; width: 50px; height: 4px; background: #F1F5F9; border-radius: 999px; overflow: hidden; margin-left: 4px; vertical-align: middle; }
.capacity-bar.mini { width: 40px; height: 3px; }
.capacity-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--c-primary), #60A5FA); border-radius: 999px; }

/* ===== Drawer ===== */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, 0.4);
  animation: fadeIn 0.18s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 100vw;
  z-index: 61;
  background: #fff;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(15,23,42,0.12);
  animation: slideIn 0.22s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-header { padding: 18px 24px 16px; border-bottom: 1px solid var(--c-border); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-eyebrow { font-size: 11px; color: var(--c-primary); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; }
.drawer-title { font-size: 16px; font-weight: 600; margin: 0; line-height: 1.3; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.drawer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drawer-footer { padding: 14px 24px; border-top: 1px solid var(--c-border); display: flex; gap: 10px; align-items: center; background: #FAFBFC; }

.d-field { display: flex; flex-direction: column; gap: 6px; }
.d-label { font-size: 12.5px; color: #475569; font-weight: 500; }
.upload-slot.small { height: 60px; }

/* ===== Root dashboard ===== */
.root-dash { padding: 8px 0; animation: fadeIn 0.22s ease; }
.root-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.rs-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.rs-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c-primary); }
.rs-card.success::before { background: var(--c-success); }
.rs-card.warning::before { background: var(--c-warning); }
.rs-num { font-size: 24px; font-weight: 700; line-height: 1; font-family: 'Inter', sans-serif; }
.rs-card.success .rs-num { color: var(--c-success); }
.rs-card.warning .rs-num { color: var(--c-warning); }
.rs-label { font-size: 12px; color: #64748B; margin-top: 6px; }

.root-section-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.root-section-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.root-section-sub { font-size: 12.5px; color: #94A3B8; margin: 0; }

/* upload */
.upload-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 84px; border: 1.5px dashed var(--c-border-strong); border-radius: 8px; background: #fff; font-size: 12.5px; color: #64748B; cursor: pointer; transition: all 0.18s; }
.upload-slot:hover { border-color: var(--c-primary); background: var(--c-primary-50); color: var(--c-primary); }

/* density */
.app[data-density="compact"] .drill-content { padding: 16px 20px; }
.app[data-density="compact"] .drill-header { padding: 14px 20px 10px; }
.app[data-density="compact"] .sc-row { padding: 10px 14px; }
.app[data-density="compact"] .cat-card { padding: 11px; }
.app[data-density="compact"] .root-stats { gap: 10px; margin-bottom: 18px; }
