:root {
  --bg: #161b26;
  --bg-mesh: #1c2230;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-highlight: rgba(255, 255, 255, 0.12);
  --widget: rgba(255, 255, 255, 0.05);
  --widget-border: rgba(255, 255, 255, 0.08);
  --blur-glass: blur(32px);
  /* сайдбар — 30% */
  --blur-sidebar: blur(12px);
  /* блок «Пачки сварщиков» — 20% */
  --blur-stage: blur(8px);
  --panel-bg: rgba(22, 27, 38, 0.22);
  --text: #f8f9fc;
  --muted: #9ca6bb;
  --dim: #6b7488;
  --pink: #ff5c8d;
  --pink-soft: #ff7aa3;
  --orange: #ff9f5a;
  --purple: #8b6cff;
  --blue: #4d9aff;
  --green: #4ae89a;
  --warn: #ffbe5c;
  --danger: #ff7088;
  --grad-btn: linear-gradient(135deg, #ff5c8d 0%, #ff9f5a 100%);
  --grad-brand: linear-gradient(135deg, #ff5c8d, #ff9f5a);
  --grad-avatar: linear-gradient(145deg, #8b6cff, #ff5c8d);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.32);
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

/* Titlebar */
.titlebar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 32px;
  display: flex;
  align-items: center;
  z-index: 10002;
  background: rgba(10, 12, 18, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  -webkit-app-region: drag;
  app-region: drag;
}

.titlebar-drag {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
  min-width: 0;
}

.titlebar-title {
  font: 600 0.72rem var(--font);
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.titlebar-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}

.titlebar-avatar {
  display: none;
}

.tb-update {
  color: #7ef0b4;
  background: none;
  border: none;
  box-shadow: none;
  margin-right: 2px;
  overflow: visible;
}

.tb-update::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(72, 214, 138, 0.5) 0%, transparent 72%);
  animation: tb-update-glow 1.4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.tb-update::after {
  display: none;
}

.tb-update .tb-update-icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: tb-update-bounce 0.85s ease-in-out infinite;
}

.tb-update .tb-update-icon svg {
  display: block;
  filter:
    drop-shadow(0 0 6px rgba(72, 214, 138, 0.95))
    drop-shadow(0 0 14px rgba(72, 214, 138, 0.45));
}

.tb-update:hover {
  background: none;
  color: #b8ffd8;
}

.tb-btn {
  width: 36px; height: 26px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  cursor: pointer;
  transition: 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.tb-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.tb-close:hover { background: rgba(255, 80, 110, 0.4); color: #fff; }

.hidden { display: none !important; }

.tb-update.hidden { display: none; }

@keyframes tb-update-bounce {
  0%, 100% { transform: translateY(-1px); opacity: 0.85; }
  50% { transform: translateY(3px); opacity: 1; }
}

@keyframes tb-update-glow {
  0%, 100% { opacity: 0.45; transform: translate(-50%, -50%) scale(0.92); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
}

/* Background — только мягкие свечения, без линий */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 70% at 75% -5%, rgba(139, 108, 255, 0.22), transparent 58%),
    radial-gradient(ellipse 70% 55% at 5% 85%, rgba(255, 92, 141, 0.16), transparent 55%),
    radial-gradient(ellipse 55% 45% at 92% 65%, rgba(77, 154, 255, 0.14), transparent 52%),
    radial-gradient(ellipse 50% 40% at 40% 30%, rgba(255, 159, 90, 0.08), transparent 50%),
    var(--bg);
}

.bg-blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
}

.blob-purple {
  width: 580px; height: 500px;
  top: -140px; right: 0;
  background: var(--purple);
  opacity: 0.28;
}

.blob-pink {
  width: 500px; height: 440px;
  bottom: -60px; left: -10%;
  background: var(--pink);
  opacity: 0.22;
}

.blob-blue {
  width: 420px; height: 380px;
  bottom: 5%; right: 10%;
  background: var(--blue);
  opacity: 0.18;
}

.blob-orange {
  width: 340px; height: 300px;
  top: 15%; left: 32%;
  background: var(--orange);
  opacity: 0.14;
}

/* Glass */
.glass {
  background: var(--glass);
  backdrop-filter: var(--blur-glass) saturate(160%);
  -webkit-backdrop-filter: var(--blur-glass) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--glass-highlight);
}

body.frameless-app .app {
  margin-top: 32px;
}

body.legacy-chrome .app {
  margin-top: 0;
}

/* Layout */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  margin-top: 32px;
  padding: 14px 16px 16px;
  gap: 14px;
  overflow: hidden;
}

/* Прозрачные панели: меню слева и «Пачки сварщиков»
   Узор только на .bg-mesh сзади — backdrop-filter размывает его */
.sidebar.glass,
.main .stage.glass {
  position: relative;
  overflow: hidden;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--glass-highlight);
}

.sidebar.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--panel-bg);
  backdrop-filter: var(--blur-sidebar) saturate(160%);
  -webkit-backdrop-filter: var(--blur-sidebar) saturate(160%);
  z-index: 0;
  pointer-events: none;
}

.main .stage.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--panel-bg);
  backdrop-filter: var(--blur-stage) saturate(160%);
  -webkit-backdrop-filter: var(--blur-stage) saturate(160%);
  z-index: 0;
  pointer-events: none;
}

.sidebar.glass > *,
.main .stage.glass > * {
  position: relative;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  border-radius: var(--radius-xl);
  padding: 16px 10px 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

.sidebar-foot {
  margin-top: auto;
  flex-shrink: 0;
  padding: 10px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.version-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
  letter-spacing: 0.01em;
  user-select: text;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  padding: 2px 4px 16px;
}

.brand-mark {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  background: var(--grad-brand);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 6px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 92, 141, 0.35);
  border: none;
  cursor: pointer;
  font: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.brand-mark:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(255, 92, 141, 0.45);
}

.brand-mark:active {
  transform: scale(0.98);
}

.brand-mark::after {
  content: "главная";
  font-size: 0.52rem;
  opacity: 0.85;
  letter-spacing: 0.04em;
}

.brand-mark-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand-mark-sub {
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  opacity: 0.92;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 10px 8px 4px;
}

.nav-section-label:not(:first-child) {
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  font: 500 0.78rem var(--font);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item > span:last-child {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.nav-icon-wrap {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  transition: 0.2s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.nav-item:hover .nav-icon-wrap {
  background: rgba(255, 255, 255, 0.08);
}

.nav-view.active {
  background: linear-gradient(135deg, rgba(255, 92, 141, 0.22), rgba(255, 159, 90, 0.12));
  color: var(--text);
  border-color: rgba(255, 92, 141, 0.25);
  box-shadow: 0 4px 20px rgba(255, 92, 141, 0.12);
}

.nav-view.active .nav-icon-wrap {
  background: var(--grad-btn);
  border: none;
  box-shadow: 0 4px 14px rgba(255, 92, 141, 0.35);
}

.nav-action:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.06);
}

/* Main stage */
.main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stage {
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-xl);
  padding: 12px 16px 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: 1fr;
  gap: 10px;
  overflow: hidden;
}

.stage > .topbar {
  grid-row: 1;
}

.stage > .view {
  grid-row: 2;
  min-height: 0;
  overflow: hidden;
}

.stage > .footer {
  grid-row: 3;
  flex-shrink: 0;
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-left {
  min-width: 0;
  flex: 1;
}

.topbar h1 {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-text { text-align: right; }

.profile-hi {
  display: block;
  font-size: 0.72rem;
  color: var(--dim);
}

.profile-name {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: 2px;
  transition: color 0.2s ease;
}

.profile-name.ready { color: var(--green); }
.profile-name.warn { color: var(--warn); }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(72, 210, 130, 0.35),
    0 6px 20px rgba(46, 170, 95, 0.28);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pill {
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
}

.pill.ok { background: rgba(74, 232, 154, 0.12); color: var(--green); border-color: rgba(74, 232, 154, 0.2); }
.pill.accent { background: rgba(255, 92, 141, 0.12); color: var(--pink-soft); border-color: rgba(255, 92, 141, 0.22); }
.pill.warn { background: rgba(255, 190, 92, 0.12); color: var(--warn); border-color: rgba(255, 190, 92, 0.2); }
.pill.bad { background: rgba(255, 112, 136, 0.12); color: var(--danger); border-color: rgba(255, 112, 136, 0.2); }
.pill.default { background: rgba(255,255,255,0.04); color: var(--muted); }

.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-packs .grid {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(260px, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.grid > * {
  min-height: 0;
  min-width: 0;
}

.view-progress {
  flex: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-progress .progress-widget {
  flex: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.progress-widget .widget-head {
  flex-shrink: 0;
}

.progress-widget .widget-body {
  flex: 1 1 auto;
  height: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  padding: 8px 6px 8px 10px;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}

.progress-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: min-content;
  padding-right: 4px;
}

.prog-card {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 10px;
  flex-shrink: 0;
}

.prog-card.complete {
  border-color: rgba(72, 214, 138, 0.35);
  background: rgba(72, 214, 138, 0.06);
}

.prog-card-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin: 0 0 4px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.prog-card-toggle:hover .prog-card-title {
  color: #fff;
}

.prog-chevron {
  flex-shrink: 0;
  width: 12px;
  font-size: 0.65rem;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.prog-card:not(.collapsed) .prog-chevron {
  transform: rotate(90deg);
}

.prog-card-title {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.prog-card-meta {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.prog-card.collapsed .prog-lines {
  display: none;
}

.prog-card.collapsed .prog-card-toggle {
  margin-bottom: 3px;
}

.prog-bar-row {
  margin-bottom: 0;
}

.prog-card:not(.collapsed) .prog-bar-row {
  margin-bottom: 5px;
}

.right-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.right-col > .widget {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  flex: 1;
}

.right-col > .widget.check-widget {
  flex: 1.35;
}

.right-col > .widget.sk-widget:not(.hidden) {
  flex: 0 0 auto;
  max-height: 200px;
}

.right-col > .widget > .widget-head {
  grid-row: 1;
}

.right-col > .widget > .widget-body {
  grid-row: 2;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

/* Widgets */
.widget {
  border-radius: var(--radius-lg);
  background: var(--widget);
  backdrop-filter: var(--blur-glass) saturate(150%);
  -webkit-backdrop-filter: var(--blur-glass) saturate(150%);
  border: 1px solid var(--widget-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* виджеты внутри stage не дублируют blur — размывает только сам блок */
.main .stage.glass .widget {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.legacy-chrome .app {
  margin-top: 0;
}

.packs-widget {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.packs-widget > .widget-head {
  grid-row: 1;
  min-height: 0;
}

.packs-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 6px 12px;
  align-items: center;
}

.packs-head-title {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

.packs-toolbar {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.packs-hint {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 0;
}

.packs-toolbar .btn-pill-ghost,
.packs-toolbar .btn-gradient {
  white-space: nowrap;
  flex-shrink: 0;
}

#btn-delete:not(.has-selection) {
  opacity: 0.45;
}

#btn-delete.has-selection {
  opacity: 1;
  box-shadow: 0 4px 16px rgba(255, 92, 141, 0.35);
}

.packs-widget > .widget-body {
  grid-row: 2;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 8px 4px 6px 10px;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}

.packs-widget > .widget-foot {
  grid-row: 3;
  min-height: 0;
}

.pack-list {
  display: block;
  min-height: min-content;
}

.packs-widget > .widget-body::-webkit-scrollbar {
  width: 8px;
}

.packs-widget > .widget-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}

.packs-widget > .widget-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}

.packs-widget > .widget-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 92, 141, 0.45);
}

.right-col > .widget > .widget-body::-webkit-scrollbar,
.progress-widget .widget-body::-webkit-scrollbar {
  width: 8px;
}

.right-col > .widget > .widget-body::-webkit-scrollbar-track,
.progress-widget .widget-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}

.right-col > .widget > .widget-body::-webkit-scrollbar-thumb,
.progress-widget .widget-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}

.right-col > .widget > .widget-body::-webkit-scrollbar-thumb:hover,
.progress-widget .widget-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 92, 141, 0.45);
}

.topbar-left.pywebview-drag-region {
  -webkit-app-region: drag;
  app-region: drag;
}

.topbar-left.pywebview-drag-region .pills,
.topbar-left.pywebview-drag-region h1 {
  pointer-events: none;
}

.right-col .widget.sk-widget {
  flex: 0 0 auto;
  max-height: 220px;
}

.sk-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px 10px;
  overflow-y: auto;
  max-height: 160px;
}

.sk-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
}

.sk-row label {
  font-size: 11px;
  color: var(--muted);
  grid-column: 1 / -1;
}

.sk-row input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-size: 12px;
}

.sk-row .sk-qty {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.check-body {
  display: flex;
  flex-direction: column;
  min-height: min-content;
  padding: 0;
}

.check-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px 10px;
  min-height: min-content;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}

.check-result * {
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.check-summary {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.check-line {
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text);
}

.check-line.err { color: #ff8a9a; }
.check-line.warn { color: #ffd28a; }

.check-orders-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.check-order-block {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.check-order-head {
  padding: 6px 10px;
  font: 700 0.78rem var(--font);
  color: var(--accent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 92, 141, 0.06);
}

.check-order-lines {
  margin: 0;
  padding: 6px 10px 8px 22px;
  list-style: disc;
}

.check-order-lines li {
  font-size: 0.7rem;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 3px;
}

.check-weight {
  flex-shrink: 0;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  color: var(--muted);
}

.empty-muted {
  color: var(--dim);
  font-size: 0.8rem;
  padding: 12px 4px;
}

.right-col .widget {
  flex: 1;
  min-height: 0;
}

.widget-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 10px;
  min-height: 0;
}

.widget-head.compact {
  padding: 7px 12px 6px;
}

.widget-head h2 {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.widget-sub {
  color: var(--dim);
  font-size: 0.72rem;
  margin-top: 2px;
}

.widget-body {
  flex: 1;
  min-height: 0;
  padding: 8px 10px;
  overflow: hidden;
}

.widget-body.flush {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.widget-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.pack-totals {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.pack-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: all 0.18s ease;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}

.pack-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.pack-item.active {
  border-color: rgba(255, 92, 141, 0.45);
  background: linear-gradient(135deg, rgba(139, 108, 255, 0.14), rgba(255, 92, 141, 0.1));
  box-shadow: 0 4px 20px rgba(255, 92, 141, 0.1);
}

.pack-item.checked {
  border-color: rgba(139, 108, 255, 0.35);
}

.pack-item.pack-error {
  border-color: rgba(255, 112, 136, 0.4);
  background: rgba(255, 80, 100, 0.08);
}

.pack-check-btn {
  width: 22px;
  height: 22px;
  margin-left: 4px;
  padding: 0;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  transition: 0.15s ease;
  flex-shrink: 0;
  cursor: pointer;
  color: inherit;
  -webkit-app-region: no-drag;
  app-region: no-drag;
  position: relative;
  z-index: 2;
}

.pack-check-btn:hover {
  border-color: rgba(255, 92, 141, 0.5);
}

.pack-check-btn.on {
  background: var(--grad-btn);
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(255, 92, 141, 0.35);
}

.pack-check-btn.on::after {
  content: "✓";
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.pack-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.pack-meta { flex: 1; min-width: 0; }

.pack-title {
  font-weight: 600;
  font-size: 0.84rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.status-dot.ok { background: var(--green); color: var(--green); }
.status-dot.bad { background: var(--danger); color: var(--danger); }
.status-dot.idle { background: var(--dim); color: var(--dim); box-shadow: none; }

.pack-preview {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 5px;
  line-height: 1.4;
}

.pack-err-hint {
  color: var(--danger);
  font-size: 0.74rem;
  margin-top: 5px;
}

.pack-badges {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-shrink: 0;
  max-width: 42%;
}

.badge-err {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 112, 136, 0.2);
  color: var(--danger);
  white-space: nowrap;
}

.badge-done {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(74, 232, 154, 0.15);
  color: var(--green);
}

.empty {
  color: var(--dim);
  text-align: center;
  padding: 48px 20px;
  font-size: 0.88rem;
}

/* Text panels */
.text-panel {
  display: block;
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  resize: none;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: 0.72rem/1.45 var(--font);
  padding: 8px 10px;
  outline: none;
  overflow: visible;
}

/* Buttons */
.btn-gradient {
  border: none;
  border-radius: 999px;
  padding: 8px 20px;
  font: 700 0.82rem var(--font);
  color: #fff;
  cursor: pointer;
  background: var(--grad-btn);
  box-shadow: 0 6px 22px rgba(255, 92, 141, 0.38);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(255, 92, 141, 0.48);
}

.btn-gradient:disabled, .btn-pill-ghost:disabled, .nav-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-gradient.sm { padding: 9px 18px; font-size: 0.8rem; }

.btn-pill-ghost, .btn-ghost {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 6px 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: 600 0.76rem var(--font);
  cursor: pointer;
  transition: 0.15s ease;
}

.btn-pill-ghost:hover, .btn-ghost:hover {
  background: rgba(255,255,255,0.09);
}

.btn-pill-ghost.sm, .btn-ghost.sm { padding: 7px 14px; font-size: 0.76rem; }

/* Footer */
.footer {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

/* Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.overlay.hidden { display: none; }

.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 101;
  border: none;
  border-radius: var(--radius-lg);
  padding: 30px;
  width: min(440px, 92vw);
  color: var(--text);
}

.modal.wide { width: min(540px, 94vw); }
.modal::backdrop { background: transparent; }
.modal h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }
.modal-sub { color: var(--muted); font-size: 0.86rem; margin-bottom: 18px; }

.modal label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin: 14px 0 7px;
}

.modal input[type="text"],
.modal input[type="number"],
.modal input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  font: 0.9rem var(--font);
  outline: none;
  transition: border-color 0.15s;
}

.modal input:focus { border-color: rgba(255, 92, 141, 0.45); }

.modal .chk {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.88rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.row-btns { display: flex; gap: 8px; margin-top: 10px; }

.chat-list {
  margin: 12px 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.28);
  font-size: 0.8rem;
  color: var(--muted);
  max-height: 110px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.05);
}

.chat-line { padding: 6px 8px; cursor: pointer; border-radius: 8px; }
.chat-line:hover { background: rgba(255,255,255,0.05); }
.chat-line.selected { color: var(--pink-soft); background: rgba(255, 92, 141, 0.08); }

/* Toast & busy */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  z-index: 200;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  background: rgba(24, 28, 40, 0.92);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
}

.toast.error { border-color: rgba(255,112,136,0.4); color: #ffc4cf; }
.toast.hidden { display: none; }

.busy {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(8, 10, 16, 0.55);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.busy.hidden { display: none; }

.busy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 36px 24px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45), 0 0 40px rgba(255, 92, 141, 0.12);
  animation: busy-card-in 0.35s ease;
}

@keyframes busy-card-in {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.busy-spinner {
  position: relative;
  width: 56px;
  height: 56px;
}

.busy-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--pink);
  border-right-color: rgba(255, 92, 141, 0.35);
  animation: spin 1.1s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
}

.busy-ring-2 {
  inset: 8px;
  border-top-color: var(--orange);
  border-right-color: rgba(255, 159, 90, 0.3);
  animation-duration: 0.85s;
  animation-direction: reverse;
}

.busy-core {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--pink-soft), var(--purple));
  box-shadow: 0 0 18px rgba(255, 92, 141, 0.55);
  animation: busy-pulse 1.6s ease-in-out infinite;
}

@keyframes busy-pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.85; }
  50% { transform: scale(1.08); opacity: 1; }
}

.busy-label {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.busy-dots {
  display: inline-flex;
  gap: 5px;
  height: 6px;
}

.busy-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pink);
  opacity: 0.35;
  animation: busy-dot 1.2s ease-in-out infinite;
}

.busy-dots span:nth-child(2) { animation-delay: 0.15s; }
.busy-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes busy-dot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-4px); }
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
}

/* Resize handles (frameless window) */
.resize-handles {
  position: fixed;
  inset: 0;
  z-index: 10001;
  pointer-events: none;
}

.resize-edge, .resize-corner {
  position: absolute;
  pointer-events: auto;
  -webkit-app-region: no-drag;
  app-region: no-drag;
  touch-action: none;
}

.resize-top { top: 0; left: 0; right: 0; height: 10px; cursor: n-resize; }
.resize-bottom { bottom: 0; left: 0; right: 0; height: 14px; cursor: s-resize; }
.resize-left { left: 0; top: 0; bottom: 0; width: 10px; cursor: w-resize; }
.resize-right { right: 0; top: 0; bottom: 0; width: 10px; cursor: e-resize; }
.resize-tl { top: 0; left: 0; width: 18px; height: 18px; cursor: nw-resize; }
.resize-tr { top: 0; right: 0; width: 18px; height: 18px; cursor: ne-resize; }
.resize-bl { bottom: 0; left: 0; width: 18px; height: 18px; cursor: sw-resize; }
.resize-br { bottom: 0; right: 0; width: 22px; height: 22px; cursor: se-resize; }

.view.hidden { display: none !important; }

.prog-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.prog-badge.done {
  background: rgba(72, 214, 138, 0.2);
  color: #6ee7a8;
}

.prog-badge.carry {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
}

.prog-badge.idle { opacity: 0.7; }

.prog-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.prog-summary b { color: var(--text); }

.prog-bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.prog-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff5c8d, #ff9f5a);
  transition: width 0.25s ease;
}

.prog-bar.done > i,
.prog-bar.partial.done > i {
  background: linear-gradient(90deg, #34d399, #48d68a);
}

.prog-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prog-line {
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
}

.prog-line.line-done {
  background: rgba(72, 214, 138, 0.08);
}

.prog-line-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.74rem;
  font-weight: 600;
}

.prog-code { color: #ff9f5a; }

.prog-qty { color: var(--text); }

.prog-line-name {
  font-size: 0.68rem;
  color: var(--muted);
  margin: 2px 0 4px;
  line-height: 1.25;
}

.prog-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; padding: 12px; }
  .sidebar { display: none; }
  .grid { grid-template-columns: 1fr; }
}
