:root {
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --gray: #6b7280;
  --black: #171717;
  --surface: #ffffff;
  --background: #f8fafc;
  --line: #e5e7eb;
  --sidebar-width: 220px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--background);
  color: var(--black);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}
a { color: inherit; }
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #eef0f3;
  padding: 24px 16px 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 24px;
  color: var(--black);
  text-decoration: none;
  font-weight: 700;
  line-height: 1.15;
}
.brand img { width: 34px; height: 34px; object-fit: contain; }
.brand small { display: block; color: var(--gray); font-weight: 400; font-size: 11px; }
.global-search { position: relative; margin-bottom: 18px; }
.global-search .form-control {
  border: 1px solid #edf0f3;
  border-radius: 10px;
  padding: 9px 42px 9px 34px;
  font-size: 13px;
  background: #f9fafb;
}
.global-search > .bi-search {
  position: absolute;
  left: 12px;
  top: 10px;
  color: var(--gray);
}
.search-shortcut {
  position: absolute;
  right: 10px;
  top: 9px;
  color: #9ca3af;
  font-size: 11px;
}
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  z-index: 1100;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .14);
  padding: 8px;
}
.search-results.show { display: block; }
.search-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
}
.search-item:hover { background: var(--primary-soft); color: var(--primary); }
.search-item span { color: var(--gray); font-size: 12px; }
.search-empty { padding: 12px 10px; color: var(--gray); font-size: 13px; }
.badge-soft { background: #f3f4f6; color: #374151; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge { font-weight: 600; padding: 5px 9px; border-radius: 999px; font-size: 12px; }
.demo-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.demo-toast-item {
  opacity: 0;
  transform: translateY(8px);
  transition: .2s ease;
  background: #111827;
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  font-size: 13px;
}
.demo-toast-item.show { opacity: 1; transform: none; }
.demo-toast-item.err { background: #991b1b; }
.kanban-card[draggable="true"] { cursor: grab; }
.side-nav { overflow-y: auto; overflow-x: hidden; }
.side-nav .nav-link,
.side-nav .nav-group-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #4b5563;
  text-align: left;
  text-decoration: none;
}
.side-nav .nav-link i,
.side-nav .nav-group-toggle i { color: var(--gray); font-size: 17px; }
.side-nav .nav-link:hover,
.side-nav .nav-group-toggle:hover { color: var(--black); background: #f9fafb; }
.side-nav .nav-link.active {
  color: var(--black);
  background: #f8fafc;
  font-weight: 600;
}
.side-nav .nav-link.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--primary);
}
.side-nav .nav-submenu { padding: 2px 0 6px 32px; }
.side-nav .nav-submenu .nav-link { min-height: 34px; padding: 7px 10px; font-size: 13px; }
.sidebar-footer { margin-top: auto; padding-top: 14px; }
.sidebar-create {
  width: 100%;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 600;
}
.app-main { min-height: 100vh; margin-left: var(--sidebar-width); }
.content-wrap { max-width: 1400px; padding: 34px 36px 52px; }
.quiet-card {
  background: var(--surface);
  border: none;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
  padding: 1.5rem;
}
.card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}
.form-control, .form-select { border-color: #e5e7eb; border-radius: 10px; }
.section-title { font-size: 16px; font-weight: 650; margin-bottom: 18px; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.muted-label { color: var(--gray); font-size: .875rem; }
.kpi-value { font-size: 2rem; line-height: 1.2; font-weight: 600; letter-spacing: -.025em; }
.kpi-label { font-size: .875rem; color: var(--gray); margin-bottom: 12px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.progress { height: 8px; border-radius: 999px; background: #edf0f4; }
.progress-bar { border-radius: 999px; background: var(--primary); }
.quiet-task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid #f0f1f3;
  text-decoration: none;
}
.quiet-task:last-child { border-bottom: 0; }
.quiet-task:hover { color: var(--primary); }
.task-check {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  border: 1.5px solid #9ca3af;
  border-radius: 4px;
  flex: 0 0 auto;
}
.process-card {
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(170px, 1.2fr) minmax(150px, 1fr) 110px 1.3fr auto;
  gap: 18px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #f0f1f3;
}
.process-card:last-child { border-bottom: 0; }
.timeline { position: relative; margin: 0; padding: 0 0 0 22px; border: 0; }
.timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 8px;
  left: 5px;
  width: 1px;
  background: #dbe2ea;
}
.timeline-item {
  position: relative;
  margin: 0 0 20px;
  padding: 0;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 5px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.timeline-time { color: var(--gray); font-size: 12px; }
.entity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.entity-card {
  display: flex;
  flex-direction: column;
  min-height: 215px;
  background: #fff;
  border: none;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
  padding: 20px;
}
.entity-card .card-action { margin-top: auto; }
.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-new { color: #374151; background: #f3f4f6; }
.status-reserved, .status-pending { color: #92400e; background: #fef3c7; }
.status-partial { color: #1d4ed8; background: #dbeafe; }
.status-completed, .status-confirmed { color: #166534; background: #dcfce7; }
.status-cancelled, .status-rejected { color: #991b1b; background: #fee2e2; }
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 22px;
}
.filter-bar .form-select { min-width: 180px; border-radius: 10px; border-color: #e5e7eb; }
.lifecycle {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 18px 0 4px;
}
.lifecycle-step { position: relative; flex: 1; text-align: center; color: #9ca3af; font-size: 12px; }
.lifecycle-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 55%;
  right: -45%;
  top: 7px;
  height: 1px;
  background: #dbe1e8;
}
.lifecycle-dot {
  display: block;
  width: 15px;
  height: 15px;
  margin: 0 auto 8px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: #fff;
  position: relative;
  z-index: 1;
}
.lifecycle-step.done, .lifecycle-step.active { color: var(--black); }
.lifecycle-step.done .lifecycle-dot { border-color: #10b981; background: #10b981; }
.lifecycle-step.active .lifecycle-dot { border-color: var(--primary); box-shadow: 0 0 0 4px #dbeafe; }
.nav-tabs { border-bottom-color: #e5e7eb; }
.nav-tabs .nav-link { color: var(--gray); border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--black); font-weight: 600; border-bottom-color: var(--primary); background: transparent; }
.mobile-sidebar-toggle { display: none; }
.kanban-board { display: grid; grid-template-columns: repeat(5, minmax(230px, 1fr)); gap: 16px; overflow-x: auto; }
.kanban-column { min-height: 320px; border-radius: 14px; padding: 14px; background: #f0f3f7; }
.kanban-card { margin-bottom: 10px; border-radius: 12px; padding: 14px; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .04); }
.kanban-card a { color: inherit; text-decoration: none; }

@media (max-width: 1100px) {
  .entity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process-card { grid-template-columns: 120px 1fr 1fr auto; }
  .process-product, .process-volume { display: none; }
}
@media (max-width: 767px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 12px 0 30px rgba(0, 0, 0, .08); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .content-wrap { padding: 76px 16px 34px; }
  .mobile-sidebar-toggle { display: inline-flex; position: fixed; top: 16px; left: 16px; z-index: 1035; }
  .entity-grid { grid-template-columns: 1fr; }
  .process-card { grid-template-columns: 1fr auto; }
  .process-client, .process-product, .process-volume, .process-progress { display: none; }
  .search-results { width: min(340px, calc(100vw - 32px)); }
}
