:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #d8dee6;
  --primary: #0f766e;
  --primary-dark: #0b4f4a;
  --accent: #f59e0b;
  --danger: #b91c1c;
  --warn: #b45309;
  --ink: #0b1020;
  --hero: #eff3f6;
  --control-height: 40px;
  --control-pad-x: 16px;
  --control-radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 12% -5%, #e4edf2, transparent 60%),
    radial-gradient(780px 460px at 95% -10%, #f2eadf, transparent 55%),
    linear-gradient(135deg, #f6f8fb, #f9f7f4);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  overflow-x: hidden;
}
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}
h1, h2, h3 { margin-top: 0; }
nav {
  background: #0b3d3a;
  color: #fff;
}
nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}
nav .nav-left,
nav .nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
nav .nav-left {
  flex-wrap: nowrap;
}
nav .nav-right {
  margin-left: auto;
  white-space: nowrap;
}
nav a { color: #dff8f6; text-decoration: none; margin-right: 0; white-space: nowrap; }
nav a:hover { text-decoration: underline; }
.nav-dropdown {
  position: relative;
}
.nav-dropdown summary {
  list-style: none;
  color: #dff8f6;
  cursor: pointer;
  white-space: nowrap;
}
.nav-dropdown summary::-webkit-details-marker {
  display: none;
}
.nav-dropdown summary:hover {
  text-decoration: underline;
}
.nav-dropdown summary.is-active {
  text-decoration: underline;
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  z-index: 20;
}
.nav-dropdown-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: #0f172a;
  text-decoration: none;
}
.nav-dropdown-menu a:hover {
  background: #f1f5f9;
  text-decoration: none;
}
form.inline { display: inline; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.products-filter-row {
  grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(140px, 1fr)) minmax(120px, auto) minmax(140px, auto);
  align-items: end;
}
label { display: block; margin-bottom: 6px; font-weight: 600; }
input, select, textarea, button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-width: 16px;
  height: 16px;
  margin: 0 8px 0 0;
  vertical-align: middle;
}
.check-label {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: 0;
}
.multi-check-dropdown {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: #fff;
}
.multi-check-summary {
  list-style: none;
  cursor: pointer;
  min-height: var(--control-height);
  padding: 9px 36px 9px 10px;
  position: relative;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}
.multi-check-summary::-webkit-details-marker {
  display: none;
}
.multi-check-summary::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
}
.multi-check-dropdown[open] .multi-check-summary::after {
  content: "▴";
}
.multi-check-list {
  border-top: 1px solid var(--border);
  max-height: 220px;
  overflow-y: auto;
  padding: 6px 8px;
}
.multi-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 4px;
  font-weight: 400;
}
.multi-check-item input[type="checkbox"] {
  margin-right: 0;
}
textarea { min-height: 90px; }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  max-width: 200px;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: .01em;
  border-radius: var(--control-radius);
  padding: 0 var(--control-pad-x);
  height: var(--control-height);
  line-height: 1;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.2);
}
button.primary {
  background: linear-gradient(135deg, var(--primary), #0e5f5a);
}
button.secondary { background: #475569; }
button.danger { background: var(--danger); }
button.warn { background: var(--warn); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--control-radius);
  padding: 0 var(--control-pad-x);
  height: var(--control-height);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
  text-decoration: none;
  line-height: 1;
  border: 1px solid var(--border);
  background: #fff;
  color: #0f172a;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}
.btn.primary {
  background: linear-gradient(135deg, var(--primary), #0e5f5a);
  color: #fff;
  border: none;
}
.btn.secondary {
  background: #475569;
  color: #fff;
  border: none;
}
.btn.warn {
  background: var(--warn);
  color: #fff;
  border: none;
}
.btn.danger {
  background: var(--danger);
  color: #fff;
  border: none;
}
.btn.ghost {
  background: #fff;
  color: #0f172a;
  border: 1px solid var(--border);
}
.actions a,
.modal-actions a,
.hero-actions a,
.card-header-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  padding: 0 var(--control-pad-x);
  height: var(--control-height);
  line-height: 1;
  text-decoration: none;
  color: #0f172a;
  background: #fff;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .01em;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.actions a:hover,
.modal-actions a:hover,
.hero-actions a:hover,
.card-header-row a:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
  background: #f1f5f9;
}
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  padding: 0 var(--control-pad-x);
  height: var(--control-height);
  line-height: 1;
  text-decoration: none;
  color: #0f172a;
  background: #fff;
  font-weight: 600;
  font-size: 14px;
}
.ghost:hover {
  background: #f1f5f9;
}
.actions button,
.modal-actions button,
.hero-actions button,
.hero-actions .ghost,
.card-header-row .ghost,
form.inline button {
  width: auto;
  max-width: none;
}
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}
th, td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px;
  vertical-align: top;
}
.flash { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.flash.info { background: #e0ecff; }
.flash.success { background: #def7ec; }
.flash.error { background: #fee2e2; }
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 14px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #cfd7e3;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 #f3f6fa;
  color: #64748b;
  font-size: 13px;
}
.breadcrumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #1c365d;
  text-decoration: none;
  font-weight: 600;
}
.breadcrumbs a:hover {
  background: #f7fafc;
  border-color: #dfe7f2;
}
.breadcrumbs .sep {
  color: #90a2bb;
  font-size: 14px;
  line-height: 1;
}
.audit-list {
  display: grid;
  gap: 10px;
}
.audit-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfcfd;
  overflow: hidden;
}
.audit-item summary {
  list-style: none;
}
.audit-item summary::-webkit-details-marker {
  display: none;
}
.audit-summary-row {
  cursor: pointer;
  padding: 14px 16px;
}
.audit-summary {
  font-weight: 700;
  color: var(--ink);
}
.audit-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.audit-body {
  padding: 0 16px 16px;
}
.audit-change-table {
  min-width: 100%;
}
.filter-actions {
  display: flex;
  align-items: end;
}
.breadcrumbs .current {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #d7e1ee;
  background: #f5f8fc;
  color: #0a2247;
  font-weight: 700;
}
.muted { color: var(--muted); }
.badge { border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.badge.draft { background: #e2e8f0; color: #1f2937; }
.badge.proto { background: #dbeafe; color: #1e3a8a; }
.badge.salesman_sample { background: #e0e7ff; color: #312e81; }
.badge.pp_sample { background: #ede9fe; color: #4c1d95; }
.badge.production { background: #fef3c7; color: #92400e; }
.badge.active { background: #dcfce7; color: #065f46; }
.badge.archived { background: #fee2e2; color: #991b1b; }

.product-lifecycle-card { margin-top: 4px; }
.lifecycle-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-start;
  margin-top: 10px;
}
.lifecycle-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
}
.lifecycle-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}
.lifecycle-step.is-past .lifecycle-dot { background: #22c55e; }
.lifecycle-step.is-current .lifecycle-dot {
  background: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
}
.lifecycle-step.is-current .lifecycle-label {
  font-weight: 700;
  color: #1e3a8a;
}
.lifecycle-step.is-future .lifecycle-label { color: #94a3b8; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.small { font-size: 12px; }
.product-top-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
}
.product-side-stack {
  display: grid;
  gap: 16px;
}
.product-hero .hero-card {
  background: linear-gradient(165deg, #ffffff, #f4f7f9);
  border: 1px solid #e1e7ef;
}
.hero-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  gap: 14px;
  align-items: start;
}
.hero-overline {
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #6b7280;
}
.hero-title {
  font-size: 26px;
  line-height: 1.2;
  margin: 6px 0 8px;
}
.hero-subline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hero-sku {
  font-weight: 700;
  color: #111827;
  background: #e5eef0;
  padding: 4px 8px;
  border-radius: 999px;
}
.hero-meta {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 12px;
  padding: 10px 12px;
}
.hero-meta-label {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #cbd5f5;
}
.hero-meta-value {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
}
.hero-description {
  margin-top: 12px;
  background: #ffffff;
  border: 1px solid #e7ecf2;
  border-radius: 12px;
  padding: 12px 14px;
}
.hero-description p {
  margin: 6px 0 0;
  color: #334155;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.hero-actions .ghost,
.card-header-row .ghost {
  border-radius: var(--control-radius);
}
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.cover-card {
  background: #101827;
  color: #f8fafc;
  border: 1px solid #111827;
}
.cover-card h3 {
  color: #f8fafc;
}
.cover-hero {
  border-radius: 14px;
  border: 0;
  background: #0b1020;
  padding: 6px;
}
.qr-card {
  background: #fffaf2;
  border: 1px solid #fde68a;
}
.qr-hero {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  border: 1px solid #fcd34d;
  background: #fff;
}
.spec-card {
  border: 1px solid #e5e7eb;
}
.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.spec-chip {
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.spec-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #64748b;
}
.spec-value {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}
.attribute-group-block {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}
.attribute-group-block:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.attribute-group-block h4 {
  margin: 0 0 10px;
}
.comment-list,
.notification-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.comment-card,
.notification-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfcfd;
  padding: 14px 16px;
}
.notification-item.is-unread {
  border-color: #93c5fd;
  background: #f8fbff;
}
.comment-meta,
.notification-item-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}
.comment-body {
  margin-top: 10px;
  white-space: pre-wrap;
}
.comment-edit,
.comment-history {
  margin-top: 12px;
}
.comment-edit summary,
.comment-history summary {
  cursor: pointer;
  color: #1c365d;
  font-weight: 600;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.product-card-link {
  text-decoration: none;
  color: inherit;
}
.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}
.product-cover {
  width: 100%;
  height: 156px;
  object-fit: cover;
  object-position: top center;
  display: block;
  background: #f1f5f9;
}
.product-card-body {
  padding: 10px 12px 12px;
}
.product-line-1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.product-name {
  margin-top: 6px;
  font-weight: 600;
  line-height: 1.3;
}
.product-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.detail-cover {
  width: 100%;
  max-width: 520px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
  display: block;
}

.label-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  user-select: none;
}
.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  transform: none;
  width: max-content;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  z-index: 20;
}
.tooltip:hover::after {
  opacity: 1;
}

.kanban-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 12px;
  align-items: start;
}
.kanban-col {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.kanban-dropzone {
  min-height: 80px;
  border-radius: 10px;
  transition: background-color .15s ease, outline-color .15s ease;
}
.kanban-dropzone.drop-hover {
  background: #e2e8f0;
  outline: 2px dashed #64748b;
}
.kanban-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  cursor: grab;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.dashboard-kpi {
  display: grid;
  gap: 6px;
}
.dashboard-kpi-label {
  color: var(--muted);
  font-size: 13px;
}
.dashboard-kpi-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
}
.kanban-card.dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
dialog.modal {
  border: 0;
  border-radius: 12px;
  padding: 0;
  width: min(920px, 92vw);
  max-height: 88vh;
  overflow: visible;
}
dialog.modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.modal-body {
  padding: 16px;
  max-height: 88vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.user-edit-sections {
  display: grid;
  gap: 12px;
}
.user-profile-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}
.user-profile-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
}
.user-role-form {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}
.user-role-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.user-role-actions,
.user-danger-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.user-danger-actions {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}
.user-danger-actions form {
  margin: 0;
}
.qr-preview {
  width: 170px;
  height: 170px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
@media (max-width: 920px) {
  nav .container {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px;
  }
  nav .nav-left {
    flex-wrap: wrap;
  }
  nav .nav-right {
    margin-left: 0;
  }
  .nav-dropdown-menu {
    position: static;
    margin-top: 8px;
    width: 100%;
  }
  .product-top-layout {
    grid-template-columns: 1fr;
  }
  .products-filter-row {
    grid-template-columns: 1fr;
  }
  .hero-header {
    grid-template-columns: 1fr;
  }
  .hero-meta {
    order: 2;
  }
  .user-profile-grid {
    grid-template-columns: 1fr;
  }
  .user-role-grid {
    grid-template-columns: 1fr;
  }
}

