:root {
  /* Neumorphism base */
  --base: #F3F3F2;
  --base-deep: #E6E6E4;
  /* Dual-shadow system (soft UI) */
  --nm-light: rgba(255, 255, 255, 1);
  --nm-dark: rgba(158, 157, 152, 0.72);
  --nm-dark-strong: rgba(142, 141, 135, 0.8);
  --nm-raise:
    -12px -12px 26px var(--nm-light),
    12px 12px 30px var(--nm-dark);
  --nm-raise-sm:
    -6px -6px 14px var(--nm-light),
    6px 6px 16px var(--nm-dark);
  --nm-raise-lg:
    -18px -18px 42px var(--nm-light),
    20px 20px 48px var(--nm-dark);
  --nm-inset:
    inset -6px -6px 13px var(--nm-light),
    inset 6px 6px 15px var(--nm-dark);
  --nm-inset-sm:
    inset -4px -4px 8px var(--nm-light),
    inset 4px 4px 10px var(--nm-dark);
  /* Glass panels */
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.7);
  --glass-edge: rgba(255, 255, 255, 0.95);
  --glass-stroke: rgba(181, 180, 174, 0.34);
  /* Text */
  --text: #262624;
  --text-muted: #666664;
  --text-subtle: #989792;
  /* Accent */
  --accent: #ECAA2E;
  --accent-deep: #DE9414;
  --accent-soft: rgba(236, 170, 46, 0.18);
  /* Status */
  --status-discuss: #C08F2E;
  --status-discuss-bg: #F2E4C4;
  --status-approved: #4E8A54;
  --status-approved-bg: #D3E8D2;
  --status-replaced: #8C8272;
  --status-replaced-bg: #E2DCD1;
  --status-rejected: #B05252;
  --status-rejected-bg: #F0D4D2;
  --status-new: #4A6BA8;
  --status-new-bg: #D2DFF2;
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;
  --blur: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--base);
  position: relative;
  overflow: hidden;
}

/* ===== BG: soft neumorphic field with faint tint zones so glass reads ===== */
.bg-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 900px 700px at 15% -5%, rgba(255,255,255,0.96), transparent 55%),
    radial-gradient(ellipse 800px 650px at 88% 12%, rgba(228, 214, 192, 0.09), transparent 55%),
    radial-gradient(ellipse 750px 700px at 82% 92%, rgba(255,255,255,0.72), transparent 55%),
    radial-gradient(ellipse 850px 600px at 6% 94%, rgba(222, 210, 190, 0.07), transparent 58%),
    linear-gradient(155deg, #F7F7F6 0%, #F3F3F2 50%, #ECECEA 100%);
}
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
}
.orb-1 { width: 420px; height: 420px; top: 10%; left: 32%; background: rgba(232, 222, 204, 0.13); }
.orb-2 { width: 340px; height: 340px; bottom: 12%; right: 20%; background: rgba(255, 255, 255, 0.7); }
.orb-3 { width: 300px; height: 300px; top: 55%; left: 6%; background: rgba(228, 218, 200, 0.10); }
.orb-4 { width: 250px; height: 250px; top: 3%; right: 6%; background: rgba(255, 255, 255, 0.6); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ===== SURFACE PRIMITIVES ===== */
.glass {
  background: linear-gradient(150deg, #F9F9F8, #EEEEEC);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: var(--nm-raise-lg);
}
.glass-strong {
  background: var(--glass-strong);
  backdrop-filter: blur(var(--blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.3);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.95),
    -14px -14px 34px rgba(255,255,255,0.85),
    14px 14px 38px var(--nm-dark);
}
.card.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.3);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    -12px -12px 30px rgba(255,255,255,0.8),
    12px 12px 34px var(--nm-dark);
}
.ingredient-group.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.3);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    -12px -12px 30px rgba(255,255,255,0.8),
    12px 12px 34px var(--nm-dark);
}
.cost-card.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.3);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    -10px -10px 24px rgba(255,255,255,0.8),
    10px 10px 26px var(--nm-dark);
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 276px 1fr;
  gap: 24px;
  height: 100vh;
  padding: 24px;
  overflow: hidden;
}

/* ===== SIDEBAR (neumorphic shell) ===== */
.sidebar {
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.brand { padding: 26px 24px 18px; }
.brand-logo { font-size: 11px; letter-spacing: 0.26em; font-weight: 700; }
.brand-logo::before { content: "."; opacity: 0.4; }
.brand-sub {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-subtle);
  text-transform: uppercase;
  margin-top: 3px;
}

.sidebar-section { padding: 14px 16px 6px; }
.sidebar-title {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 0 10px 10px;
  font-weight: 600;
}

/* Product items: pressed-in wells; active = raised pill */
.product-item {
  display: block;
  padding: 13px 15px;
  border-radius: var(--r-md);
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  background: transparent;
  transition: all 0.2s ease;
}
.product-item:hover { box-shadow: var(--nm-inset-sm); }
.product-item.active {
  background: linear-gradient(150deg, #FBFBFA, #F0F0EE);
  box-shadow: var(--nm-raise);
}
.product-item-line {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--text-subtle);
  text-transform: uppercase;
  margin-bottom: 3px;
  font-weight: 700;
}
.product-item-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.product-item-desc { font-size: 11px; color: var(--text-muted); }
.product-item-progress { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--base-deep);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: var(--nm-inset-sm);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #F6C453, var(--accent-deep));
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(222, 148, 20, 0.42);
}
.progress-label { font-size: 10px; color: var(--text-subtle); font-weight: 700; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  width: 100%;
  text-align: left;
  transition: all 0.18s;
  margin-bottom: 4px;
}
.nav-item:hover { box-shadow: var(--nm-inset-sm); color: var(--text); }
.nav-item .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-subtle); }

.sidebar-footer {
  margin-top: auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(145deg, #F6C453, var(--accent-deep));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  box-shadow:
    -3px -3px 8px var(--nm-light),
    3px 3px 8px var(--nm-dark),
    inset 0 1px 0 rgba(255,255,255,0.3);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ===== MAIN ===== */
.main { display: flex; flex-direction: column; gap: 20px; overflow: hidden; min-width: 0; }

.topbar {
  border-radius: var(--r-lg);
  height: 66px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}
.breadcrumb-sep { color: var(--text-subtle); }
.breadcrumb-current { color: var(--text); font-weight: 600; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

/* Search: inset well */
.search {
  display: flex;
  align-items: center;
  background: var(--base);
  border: none;
  border-radius: 14px;
  padding: 9px 16px;
  gap: 8px;
  width: 250px;
  box-shadow: var(--nm-inset);
  transition: all 0.15s;
}
.search input { border: none; background: none; outline: none; flex: 1; font-size: 13px; }
.search input::placeholder { color: var(--text-subtle); }
.search-icon { color: var(--text-subtle); }

/* Buttons: raised; press = inset */
.btn {
  padding: 9px 18px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: linear-gradient(150deg, #FAFAF8, #EEEEEB);
  color: var(--text);
  transition: all 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--nm-raise-sm);
}
.btn:hover { color: var(--accent-deep); }
.btn:active { box-shadow: var(--nm-inset-sm); }
.btn-primary {
  background: linear-gradient(150deg, #F6C453, var(--accent-deep));
  color: white;
  box-shadow:
    -5px -5px 12px var(--nm-light),
    8px 8px 20px rgba(222, 148, 20, 0.5),
    inset 0 1px 0 rgba(255,255,255,0.45);
}
.btn-primary:hover { background: linear-gradient(150deg, #F9CD66, #E9A31C); color: white; }
.btn-primary:active {
  box-shadow:
    inset 3px 3px 9px rgba(178, 118, 8, 0.55),
    inset -2px -2px 7px rgba(250, 216, 140, 0.6);
}
.btn-danger { color: var(--status-rejected); }
.btn-danger:hover { color: var(--status-rejected); box-shadow: var(--nm-inset-sm); }
.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: 10px; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { box-shadow: var(--nm-inset-sm); }
.btn[disabled] { opacity: .5; cursor: default; }

/* ===== CONTENT ===== */
.content { flex: 1; overflow-y: auto; padding: 6px 6px 44px; border-radius: var(--r-lg); }

.page-header {
  margin-bottom: 18px;
  padding: 0 4px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.page-title-block h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 4px; }
.page-title-block .sub { font-size: 13px; color: var(--text-muted); }

/* Tabs: inset track + raised active pill */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 6px;
  border-radius: 17px;
  margin-bottom: 22px;
  background: var(--base);
  box-shadow: var(--nm-inset);
  overflow-x: auto;
  max-width: 100%;
}
.tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 12px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.16s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent-deep);
  background: linear-gradient(150deg, #FCFCFB, #F0F0ED);
  font-weight: 600;
  box-shadow: var(--nm-raise-sm);
}
.tab-count {
  background: var(--base-deep);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
}
.tab.active .tab-count { background: var(--accent); color: white; }

/* ===== CARDS (glass) ===== */
.card { border-radius: var(--r-lg); margin-bottom: 18px; overflow: hidden; }
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--glass-stroke);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-title .sub { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-left: 8px; }
.card-body { padding: 24px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  font-weight: 700;
  margin-bottom: 6px;
}
.field-value { font-size: 14px; line-height: 1.6; white-space: pre-line; }
.field-value.mono { font-family: "SF Mono", Menlo, monospace; font-size: 12px; }

/* ===== PRODUCT HERO (glass) ===== */
.product-hero {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 26px;
  border-radius: var(--r-lg);
  padding: 28px;
  margin-bottom: 20px;
}
.product-visual {
  aspect-ratio: 1;
  border-radius: var(--r-md);
  background:
    linear-gradient(150deg, rgba(255,255,255,0.55), rgba(255,255,255,0.05)),
    linear-gradient(135deg, #ECE4D6 0%, #D9C6A4 60%, #C4AB82 100%);
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 22px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.65),
    -10px -10px 24px rgba(255,255,255,0.85),
    12px 12px 30px var(--nm-dark-strong);
}
.product-visual::before {
  content: "";
  position: absolute;
  top: 18%; left: 22%; right: 22%; bottom: 14%;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.12));
  border-radius: 8px;
  box-shadow: 0 5px 16px rgba(140, 104, 56, 0.28);
}
.product-visual-label {
  position: relative;
  color: white;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(120, 84, 36, 0.42);
}
.product-info h2 { font-size: 23px; margin-bottom: 8px; letter-spacing: -0.015em; }
.product-line-badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 8px;
}
.product-tagline { font-size: 14px; color: var(--text-muted); max-width: 540px; line-height: 1.6; }
.product-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.meta-item {
  padding: 11px 17px;
  border-radius: var(--r-sm);
  background: rgba(245, 245, 243, 0.82);
  box-shadow: var(--nm-inset-sm);
}
.meta-item .meta-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
  font-weight: 700;
}
.meta-item .meta-value { font-size: 15px; font-weight: 600; margin-top: 2px; }

/* ===== BADGES: soft raised pills ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow:
    -3px -3px 7px rgba(255,255,255,0.95),
    3px 3px 9px rgba(158, 157, 152, 0.5);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.badge-discuss { color: var(--status-discuss); background: var(--status-discuss-bg); }
.badge-discuss::before { background: var(--status-discuss); }
.badge-approved { color: var(--status-approved); background: var(--status-approved-bg); }
.badge-approved::before { background: var(--status-approved); }
.badge-replaced { color: var(--status-replaced); background: var(--status-replaced-bg); }
.badge-replaced::before { background: var(--status-replaced); }
.badge-rejected { color: var(--status-rejected); background: var(--status-rejected-bg); }
.badge-rejected::before { background: var(--status-rejected); }
.badge-new { color: var(--status-new); background: var(--status-new-bg); }
.badge-new::before { background: var(--status-new); }

/* ===== COMPOSITION ===== */
.table-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-group {
  display: flex;
  gap: 3px;
  background: var(--base);
  border-radius: 14px;
  padding: 5px;
  box-shadow: var(--nm-inset);
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 13px;
  font-size: 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.14s;
}
.filter-btn.active {
  background: linear-gradient(150deg, #FCFCFB, #F0F0ED);
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: var(--nm-raise-sm);
}
.filter-btn:not(.active):hover { color: var(--text); }

.ingredient-group { border-radius: var(--r-lg); margin-bottom: 16px; overflow: hidden; }
.group-header {
  padding: 15px 22px;
  border-bottom: 1px solid var(--glass-stroke);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.group-header:hover { background: rgba(255,255,255,0.35); }
.group-title { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.group-caret { color: var(--text-muted); transition: transform 0.18s; }
.group-header.collapsed .group-caret { transform: rotate(-90deg); }
.group-meta { font-size: 11px; color: var(--text-muted); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.group-body { overflow-x: auto; }
.group-header.collapsed + .group-body { display: none; }

.ingredient-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ingredient-table th {
  text-align: left;
  padding: 11px 14px;
  color: var(--text-subtle);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--glass-stroke);
  background: rgba(255,255,255,0.25);
}
.ingredient-table td {
  padding: 14px;
  border-bottom: 1px solid rgba(181, 180, 174, 0.28);
  vertical-align: top;
}
.ingredient-table tr:last-child td { border-bottom: none; }
.ingredient-table tbody tr { cursor: pointer; transition: background 0.12s; }
.ingredient-table tbody tr:hover td { background: rgba(255,255,255,0.4); }

.col-name { min-width: 180px; }
.name-primary { font-weight: 600; margin-bottom: 2px; }
.name-inci { font-size: 11px; color: var(--text-muted); font-style: italic; }
.col-fn { max-width: 220px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.col-narrow { width: 74px; }
.col-status { width: 118px; }
.col-cost { width: 84px; font-family: "SF Mono", Menlo, monospace; font-size: 11px; text-align: right; }
.col-actions { width: 40px; text-align: right; }

.attach-icons { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.attach-icon {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--base);
  border-radius: 7px;
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: var(--nm-inset-sm);
}
.attach-icon.pdf { color: var(--status-rejected); }
.attach-icon.img { color: var(--status-new); }
.attach-icon.link { color: var(--status-approved); }
.attach-icon.cmt { color: var(--text-muted); }

.comment-preview {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 7px;
  padding: 8px 11px;
  background: rgba(245, 245, 243, 0.86);
  border-radius: 9px;
  box-shadow: var(--nm-inset-sm);
  line-height: 1.45;
}

.change-reason {
  display: inline-block;
  padding: 2px 9px;
  background: var(--status-discuss-bg);
  color: var(--status-discuss);
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
  margin-top: 6px;
  box-shadow:
    -2px -2px 5px rgba(255,255,255,0.95),
    2px 2px 6px rgba(158, 157, 152, 0.46);
}

.btn-icon {
  width: 30px; height: 30px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.14s;
}
.btn-icon:hover { box-shadow: var(--nm-inset-sm); color: var(--text); }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(126, 124, 116, 0.30);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.modal-backdrop.open { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: rgba(248, 248, 246, 0.9);
  backdrop-filter: blur(36px) saturate(1.3);
  -webkit-backdrop-filter: blur(36px) saturate(1.3);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: var(--r-lg);
  max-width: 740px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.95),
    -18px -18px 44px rgba(255,255,255,0.6),
    32px 32px 80px rgba(128, 127, 120, 0.55);
  animation: modalUp 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.modal.modal-sm { max-width: 500px; }
@keyframes modalUp {
  from { transform: translateY(16px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-header {
  padding: 22px 28px;
  border-bottom: 1px solid var(--glass-stroke);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: rgba(248, 248, 246, 0.94);
  backdrop-filter: blur(24px);
  z-index: 1;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-title-wrap .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-style: italic; }
.close-btn {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--base);
  box-shadow: var(--nm-raise-sm);
  transition: all 0.14s;
}
.close-btn:hover { color: var(--text); }
.close-btn:active { box-shadow: var(--nm-inset-sm); }
.modal-body { padding: 28px; }
.modal-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--glass-stroke);
}
.modal-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.modal-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
  font-weight: 700;
  margin-bottom: 14px;
}
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 18px;
  border-top: 1px solid var(--glass-stroke);
  margin-top: 18px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-field { margin-bottom: 14px; }
.form-row .form-field { margin-bottom: 0; }
.form-field label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
/* Inputs: classic neumorphic inset wells */
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background: var(--base);
  outline: none;
  transition: all 0.14s;
  box-shadow: var(--nm-inset-sm);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  box-shadow: var(--nm-inset-sm), 0 0 0 3px var(--accent-soft);
}
.form-field textarea { resize: vertical; min-height: 64px; }

.file-drop {
  border: none;
  border-radius: var(--r-md);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  background: var(--base);
  box-shadow: var(--nm-inset);
  transition: all 0.15s;
  cursor: pointer;
}
.file-drop.dragover { box-shadow: var(--nm-inset), 0 0 0 3px var(--accent-soft); }
.file-list { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 15px;
  background: linear-gradient(150deg, #FAFAF8, #EFEFEB);
  border-radius: var(--r-sm);
  font-size: 12px;
  box-shadow: var(--nm-raise-sm);
}
.file-item-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-size { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

.discussion {
  padding: 16px 20px;
  background: rgba(245, 245, 243, 0.82);
  border-radius: var(--r-md);
  box-shadow: var(--nm-inset-sm);
}
.discussion-item {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(181, 180, 174, 0.3);
}
.discussion-item:last-child { border-bottom: none; }
.discussion-item .avatar { width: 28px; height: 28px; font-size: 10px; }
.discussion-content { flex: 1; font-size: 12px; }
.discussion-author { font-weight: 600; margin-right: 6px; }
.discussion-time { color: var(--text-subtle); font-size: 11px; }

/* ===== PACKAGING ===== */
.pkg-card {
  border-radius: var(--r-lg);
  padding: 26px;
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 26px;
  margin-bottom: 18px;
}
.pkg-visual {
  aspect-ratio: 3/4;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.6), rgba(255,255,255,0.1)),
    linear-gradient(135deg, #EAE2D2, #CDBA98);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  text-align: center;
  padding: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(120, 84, 36, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.6),
    -10px -10px 24px rgba(255,255,255,0.85),
    12px 12px 30px var(--nm-dark-strong);
}
.pkg-spec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }

/* ===== MARKETING ===== */
.strategy-hero {
  padding: 24px 26px;
  border-radius: var(--r-md);
  background: linear-gradient(150deg, #F6C453, var(--accent-deep));
  color: white;
  margin-bottom: 18px;
  box-shadow:
    -6px -6px 16px rgba(255,255,255,0.8),
    10px 10px 26px rgba(222, 148, 20, 0.48),
    inset 0 1px 0 rgba(255,255,255,0.45);
}
.strategy-hero h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.65);
  margin-bottom: 8px;
  font-weight: 700;
}
.strategy-hero p { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }

ul.pill-list { list-style: none; display: flex; flex-wrap: wrap; gap: 9px; }
ul.pill-list li {
  padding: 6px 14px;
  background: linear-gradient(150deg, #FAFAF8, #EFEFEB);
  border-radius: 20px;
  font-size: 12px;
  box-shadow: var(--nm-raise-sm);
}

/* ===== COST ===== */
.cost-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.cost-card { border-radius: var(--r-md); padding: 20px 22px; }
.cost-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  font-weight: 700;
  margin-bottom: 8px;
}
.cost-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.cost-value .unit { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-left: 4px; }
.cost-trend { font-size: 11px; color: var(--status-approved); margin-top: 5px; font-weight: 600; }
.cost-trend.up { color: var(--status-rejected); }

.cost-bar-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; font-size: 12px; }
.cost-bar-label { width: 210px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-bar-track {
  flex: 1;
  height: 10px;
  background: var(--base);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--nm-inset-sm);
}
.cost-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #F6C453, var(--accent-deep));
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(222, 148, 20, 0.34);
}
.cost-bar-value {
  width: 110px;
  text-align: right;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== FILES ===== */
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 16px; }
.file-tile {
  border-radius: var(--r-md);
  padding: 15px;
  background: linear-gradient(150deg, #FBFBF9, #F0F0EC);
  box-shadow: var(--nm-raise-sm);
  transition: all 0.18s;
  position: relative;
}
.file-tile:hover { transform: translateY(-2px); box-shadow: var(--nm-raise); }
.file-preview {
  aspect-ratio: 4/3;
  background: var(--base);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: 0.06em;
  box-shadow: var(--nm-inset-sm);
  overflow: hidden;
  cursor: pointer;
}
.file-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 11px; }
.file-preview.pdf { color: var(--status-rejected); }
.file-preview.img { color: var(--status-new); }
.file-preview.link { color: var(--status-approved); font-size: 14px; }
.file-name { font-size: 12px; font-weight: 600; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 10px; color: var(--text-muted); }
.file-del {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(248, 248, 246, 0.92);
  border-radius: 9px;
  box-shadow: var(--nm-raise-sm);
  z-index: 1;
}

/* ===== HISTORY ===== */
.history-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(181, 180, 174, 0.28);
  font-size: 12px;
}
.history-item:last-child { border-bottom: none; }
.history-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(150deg, #FBFBF9, #EDEDE9);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
  box-shadow: var(--nm-raise-sm);
}
.history-content { flex: 1; }
.history-user { font-weight: 600; }
.history-action { color: var(--text-muted); }
.history-time { color: var(--text-subtle); font-size: 11px; margin-top: 2px; }

/* ===== SUPPLIERS ===== */
.supplier-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.supplier-table th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-subtle);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--glass-stroke);
  background: rgba(255,255,255,0.25);
}
.supplier-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(181, 180, 174, 0.28);
  vertical-align: top;
}
.supplier-table tr:last-child td { border-bottom: none; }

/* ===== TOAST ===== */
#toast-wrap { position: fixed; bottom: 28px; right: 28px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: linear-gradient(150deg, #3A3A38, #262624);
  color: #F3F3F2;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 13px;
  box-shadow: 8px 10px 26px rgba(90, 89, 84, 0.5), inset 0 1px 0 rgba(255,255,255,0.12);
  animation: toast-in .2s ease-out;
  max-width: 380px;
}
.toast.error { background: linear-gradient(150deg, #C06060, var(--status-rejected)); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ===== UTILITY ===== */
.icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.icon-sm { width: 14px; height: 14px; }
.divider { height: 1px; background: var(--glass-stroke); margin: 16px 0; }
.empty { padding: 44px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.spinner {
  width: 34px; height: 34px;
  border: 4px solid var(--base-deep);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 70px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== LOGIN ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.login-card {
  background: linear-gradient(150deg, #F9F9F8, #EEEEEC);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: var(--r-lg);
  padding: 40px 36px;
  width: 380px;
  box-shadow: var(--nm-raise-lg);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-error { color: var(--status-rejected); font-size: 12px; min-height: 18px; margin-bottom: 10px; font-weight: 600; }

/* ===== GLOSSY GLASS refinements ===== */
/* Зеркальный глянец: светлая верхняя половина + резкий перелом блика на ~50% */

/* Топбар — глянцевая стеклянная плашка */
.topbar.glass {
  background:
    linear-gradient(180deg,
      rgba(255,255,255,0.82) 0%,
      rgba(255,255,255,0.46) 46%,
      rgba(255,255,255,0.24) 54%,
      rgba(255,255,255,0.42) 100%);
  backdrop-filter: blur(26px) saturate(1.45);
  -webkit-backdrop-filter: blur(26px) saturate(1.45);
  border: 1px solid rgba(255,255,255,0.95);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(255,255,255,0.35),
    -10px -10px 26px rgba(255,255,255,0.7),
    12px 14px 34px var(--nm-dark);
}

/* Таб-бар продукта (Обзор, Состав, Упаковка…) — глянцевый стеклянный трек */
.tabs {
  background:
    linear-gradient(180deg,
      rgba(255,255,255,0.6) 0%,
      rgba(255,255,255,0.3) 46%,
      rgba(255,255,255,0.16) 54%,
      rgba(255,255,255,0.34) 100%);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.95),
    inset 0 -8px 14px rgba(158, 157, 152, 0.16),
    6px 8px 22px rgba(158, 157, 152, 0.32);
}
.tab.active {
  background:
    linear-gradient(180deg,
      #FFFFFF 0%,
      rgba(255,255,255,0.85) 45%,
      rgba(251,250,247,0.72) 55%,
      rgba(255,255,255,0.92) 100%);
  border: 1px solid rgba(255,255,255,1);
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 6px rgba(158, 157, 152, 0.35),
    0 9px 20px rgba(158, 157, 152, 0.3);
}

/* Фильтры состава — тот же глянцевый трек */
.filter-group {
  background:
    linear-gradient(180deg,
      rgba(255,255,255,0.6) 0%,
      rgba(255,255,255,0.3) 46%,
      rgba(255,255,255,0.16) 54%,
      rgba(255,255,255,0.34) 100%);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.95),
    inset 0 -8px 14px rgba(158, 157, 152, 0.16),
    6px 8px 22px rgba(158, 157, 152, 0.32);
}
.filter-btn.active {
  background:
    linear-gradient(180deg,
      #FFFFFF 0%,
      rgba(255,255,255,0.85) 45%,
      rgba(251,250,247,0.72) 55%,
      rgba(255,255,255,0.92) 100%);
  border: 1px solid rgba(255,255,255,1);
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 6px rgba(158, 157, 152, 0.35),
    0 8px 18px rgba(158, 157, 152, 0.3);
}

/* Поиск — стеклянная лунка с бликом по нижней кромке */
.search {
  background:
    linear-gradient(180deg,
      rgba(233,233,231,0.85) 0%,
      rgba(243,243,241,0.72) 55%,
      rgba(252,252,251,0.85) 100%);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid rgba(255,255,255,0.75);
  box-shadow:
    var(--nm-inset-sm),
    inset 0 -1px 0 rgba(255,255,255,0.9);
}

/* Янтарная кнопка — леденцовый глянец */
.btn-primary {
  background:
    linear-gradient(180deg,
      rgba(255,255,255,0.45) 0%,
      rgba(255,255,255,0.14) 46%,
      rgba(255,255,255,0) 54%,
      rgba(255,255,255,0.18) 100%),
    linear-gradient(150deg, #F6C453, var(--accent-deep));
}
.btn-primary:hover {
  background:
    linear-gradient(180deg,
      rgba(255,255,255,0.5) 0%,
      rgba(255,255,255,0.16) 46%,
      rgba(255,255,255,0) 54%,
      rgba(255,255,255,0.2) 100%),
    linear-gradient(150deg, #F9CD66, #E9A31C);
}

/* Статусные бейджи — глянцевые капсулы */
.badge {
  background-image: linear-gradient(180deg,
    rgba(255,255,255,0.55) 0%,
    rgba(255,255,255,0.18) 48%,
    rgba(255,255,255,0) 52%,
    rgba(255,255,255,0.22) 100%);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    -3px -3px 7px rgba(255,255,255,0.95),
    3px 3px 9px rgba(158, 157, 152, 0.5);
}

/* Активный продукт в сайдбаре — стеклянный глянец поверх подъёма */
.product-item.active {
  background:
    linear-gradient(180deg,
      rgba(255,255,255,0.9) 0%,
      rgba(255,255,255,0.55) 46%,
      rgba(251,251,250,0.4) 54%,
      rgba(255,255,255,0.65) 100%);
  border: 1px solid rgba(255,255,255,0.95);
  box-shadow: var(--nm-raise);
}

/* Заголовок модалки — глянцевая кромка */
.modal-header {
  background:
    linear-gradient(180deg,
      rgba(252,252,250,0.97) 0%,
      rgba(248,248,246,0.9) 55%,
      rgba(250,250,248,0.94) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,1), inset 0 -1px 0 rgba(255,255,255,0.4);
}

/* ===== RESPONSIVE / MOBILE ===== */
.burger { display: none; }
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(126, 124, 116, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 210;
}
.tabs::-webkit-scrollbar { display: none; }

@media (max-width: 960px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; padding: 12px; height: auto; overflow: visible; gap: 14px; }
  .main { overflow: visible; }
  .content { overflow: visible; padding: 2px 2px 40px; }

  /* Сайдбар → выдвижная шторка */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100dvh;
    width: min(320px, 86vw);
    z-index: 220;
    border-radius: 0 var(--r-lg) var(--r-lg) 0;
    transform: translateX(-110%);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
  }
  .sidebar.open { transform: translateX(0); }
  .drawer-overlay.open { display: block; }

  /* Топбар: бургер + поиск + действия */
  .burger {
    display: inline-flex;
    width: 40px; height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--base);
    box-shadow: var(--nm-raise-sm);
    align-items: center; justify-content: center;
    color: var(--text);
  }
  .burger:active { box-shadow: var(--nm-inset-sm); }
  .topbar { flex-wrap: wrap; height: auto; padding: 12px 14px; gap: 10px; }
  .topbar .breadcrumb { display: none; }
  .topbar-actions { margin-left: 0; flex: 1; flex-wrap: wrap; gap: 8px; }
  .search { flex: 1 1 100%; width: auto; }
  .search input { min-width: 0; }
  .btn { padding: 8px 13px; font-size: 12px; }

  .page-title-block h1 { font-size: 20px; }
  .product-hero, .pkg-card { grid-template-columns: 1fr; padding: 18px; gap: 16px; }
  .product-visual { aspect-ratio: auto; height: 150px; }
  .pkg-visual { aspect-ratio: auto; height: 150px; }
  .pkg-spec-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .card-body { padding: 16px; }
  .cost-summary { grid-template-columns: repeat(2, 1fr); }
  .cost-bar-label { width: 105px; font-size: 11px; }
  .cost-bar-value { width: 88px; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .form-row { grid-template-columns: 1fr; }

  /* Модалка → bottom sheet */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    max-height: 94dvh;
    border-radius: 22px 22px 0 0;
  }
  .modal-header { padding: 16px 18px; border-radius: 22px 22px 0 0; }
  .modal-body { padding: 18px; }
  .modal.modal-sm { max-width: 100%; }
}

/* Таблица состава → карточки компонентов */
@media (max-width: 760px) {
  .ingredient-table thead { display: none; }
  .ingredient-table, .ingredient-table tbody { display: block; width: 100%; }
  .ingredient-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 14px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(181, 180, 174, 0.28);
  }
  .ingredient-table tr:last-child { border-bottom: none; }
  .ingredient-table td {
    display: block;
    padding: 0;
    border: none;
    width: auto;
    max-width: none;
    text-align: left;
  }
  .ingredient-table td.col-name, .ingredient-table td.col-fn { grid-column: 1 / -1; }
  .ingredient-table td.col-fn { margin-top: 2px; }
  .ingredient-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-subtle);
    font-weight: 700;
    margin-bottom: 2px;
  }
  .ingredient-table td:empty { display: none; }
  .col-cost { font-size: 12px; }
  .group-header { padding: 13px 16px; }

  /* Таблица поставщиков → карточки */
  .supplier-table thead { display: none; }
  .supplier-table, .supplier-table tbody { display: block; width: 100%; }
  .supplier-table tr {
    display: block;
    padding: 13px 16px;
    border-bottom: 1px solid rgba(181, 180, 174, 0.28);
  }
  .supplier-table tr:last-child { border-bottom: none; }
  .supplier-table td { display: block; padding: 2px 0; border: none; }
  .supplier-table td[data-label]::before {
    content: attr(data-label) ": ";
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
    font-weight: 700;
  }
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #C9C8C4;
  border-radius: 5px;
  border: 2px solid var(--base);
}
::-webkit-scrollbar-thumb:hover { background: #AEADA8; }
