:root {
  --bg: #f5fbff;
  --bg-cream: #fff8ea;
  --surface: #ffffff;
  --surface-blue: #f0f8ff;
  --surface-blue-2: #e2f3ff;
  --text-color-primary: #163152;
  --text-color-secondary: #66768f;
  --text-color-muted: #8a97aa;
  --ink: var(--text-color-primary);
  --muted: var(--text-color-secondary);
  --line: #d8e9f7;
  --line-strong: #b7dcf5;
  --accent: #16a7e9;
  --accent-logo: #16a7e9;
  --accent-strong: #0b8fcb;
  --accent-soft: #dcefff;
  --danger: #f04438;
  --danger-bg: #fff0ed;
  --ok: #08a05c;
  --ok-bg: #e7f8ef;
  --warn: #f59e0b;
  --warn-bg: #fff5dc;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 16px 42px rgba(8, 32, 74, 0.08);
  --shadow-blue: 0 12px 28px rgba(22, 167, 233, 0.2);
  --font-family-base: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-sans: var(--font-family-base);
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --font-size-caption: 12px;
  --font-size-description: 14px;
  --font-size-body: 14px;
  --font-size-nav: 15px;
  --font-size-section-title: 20px;
  --font-size-page-title: 32px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-body: 1.5;
  --line-height-title: 1.25;
  --text-xs: var(--font-size-caption);
  --text-sm: var(--font-size-description);
  --text-md: var(--font-size-body);
  --text-lg: var(--font-size-section-title);
  --text-xl: var(--font-size-page-title);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 88% 10%, rgba(224, 245, 255, 0.9), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 58%, var(--bg-cream) 100%);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-body);
}

button,
input,
select {
  font: inherit;
  font-family: var(--font-family-base);
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 100;
  transform: translateY(-140%);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: white;
  padding: 10px 12px;
  text-decoration: none;
  transition: transform 160ms var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 248, 234, 0.98), transparent 28%),
    linear-gradient(135deg, #e9f7ff 0%, #8fd7ff 38%, #28a8f0 100%);
  padding: 20px;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(460px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(8, 32, 74, 0.24);
  padding: 28px;
}

.login-brand {
  color: var(--ink);
  margin-bottom: 22px;
}

.login-brand h1 {
  font-size: 31px;
  color: var(--accent);
  line-height: 1;
  letter-spacing: 1px;
  font-weight: var(--font-weight-semibold);
}

.login-brand p {
  margin: 8px 0 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  letter-spacing: 7px;
}

.login-card h2 {
  margin: 0 0 6px;
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-title);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.login-form label,
.language-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
}

.language-field {
  margin-top: 16px;
}

.pin-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: var(--text-xs);
}

.pin-hint span {
  width: 100%;
  font-weight: var(--font-weight-semibold);
  color: var(--ink);
}

.pin-hint code {
  background: var(--surface-blue);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 7px;
  color: var(--accent-strong);
  font-family: var(--font-mono);
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: rgba(255, 255, 255, 0.88);
  border-right: 1px solid var(--line);
  color: var(--ink);
  padding: 20px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.sidebar-brand {
  justify-content: flex-start;
  gap: 10px;
  text-align: left;
  min-height: 46px;
  padding: 0 8px 14px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand .brand-mark {
  display: none;
}

.sidebar-brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
  font-size: 18px;
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.56);
  box-shadow: 0 6px 14px rgba(22, 167, 233, 0.14);
}

.sidebar-brand-mark span {
  transform: translateY(-1px);
}

.brand-copy {
  min-width: 0;
}

.sidebar-brand .brand-copy h1 {
  font-size: 18px;
  letter-spacing: 0.4px;
  line-height: 1.05;
  color: var(--accent);
  font-weight: var(--font-weight-semibold);
}

.sidebar-brand .brand-copy p {
  margin-top: 4px;
  color: var(--text-color-secondary);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  line-height: 1.2;
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  background: var(--accent);
  border: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(22, 167, 233, 0.16);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  padding: 0;
  transform: scale(1.42);
  transform-origin: center;
}

.brand h1 {
  font-size: 22px;
  margin: 0;
  color: var(--accent);
  line-height: 1.12;
  letter-spacing: 0.5px;
  font-weight: var(--font-weight-semibold);
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--font-weight-regular);
  letter-spacing: 0;
}

.role-switcher {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  background: var(--surface-blue);
  border-radius: 14px;
  padding: 12px;
}

.role-badge {
  min-height: 48px;
  display: flex;
  align-items: center;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  padding: 0 14px;
  color: var(--ink);
  font-weight: var(--font-weight-semibold);
}

select,
input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  line-height: 1.4;
  outline: none;
}

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--accent-logo);
  outline: 3px solid rgba(40, 168, 240, 0.22);
  outline-offset: 2px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-button,
.nav-group-button {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 12px 14px;
  border-radius: 11px;
  cursor: pointer;
  font-size: var(--font-size-nav);
  font-weight: var(--font-weight-medium);
  width: 100%;
  line-height: 1.35;
}

.nav-icon {
  width: 22px;
  text-align: center;
  color: var(--accent);
  font-weight: var(--font-weight-semibold);
}

.nav-group-button {
  justify-content: flex-start;
}

.nav-group-button .nav-arrow {
  margin-left: auto;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.nav-group-button.active-group,
.nav-group-button.open {
  background: var(--surface-blue);
  border-color: var(--line);
  color: var(--accent-strong);
}

.nav-children {
  display: none;
  gap: 5px;
  padding: 0 0 4px 34px;
}

.nav-children.open {
  display: grid;
}

.nav-child {
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--font-weight-regular);
}

.nav-button.active {
  background: linear-gradient(135deg, var(--accent) 0%, #0b83f6 100%);
  color: white;
  box-shadow: var(--shadow-blue);
  font-weight: var(--font-weight-semibold);
}

.nav-button.active .nav-icon {
  color: white;
}

.nav-button:hover:not(.active) {
  background: var(--surface-blue);
  border-color: var(--line);
  color: var(--accent-strong);
}

.nav-group-button:hover {
  background: var(--surface-blue);
  border-color: var(--line);
  color: var(--accent-strong);
}

.sidebar-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--accent-strong);
  box-shadow: 0 8px 20px rgba(8, 32, 74, 0.05);
  cursor: pointer;
  font-size: 20px;
  font-weight: var(--font-weight-semibold);
}

.main {
  position: relative;
  min-width: 0;
  padding: 30px 26px 32px 34px;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
}

.topbar h2 {
  margin: 0;
  font-size: var(--text-xl);
  line-height: var(--line-height-title);
  color: var(--ink);
  font-weight: var(--font-weight-semibold);
}

.topbar-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-body);
}

.topbar-actions,
.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sync-status {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
}

.sync-status[data-status="已同步"],
.sync-status[data-status="已连接"] {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: #b7ecd0;
}

.sync-status[data-status="同步失败"] {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: #ffd4cc;
}

.sync-status[data-status="离线"] {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: #ffe0a1;
}

button {
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  padding: 0 14px;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  line-height: 1.35;
  transition: transform 140ms var(--ease-out), box-shadow 140ms var(--ease-out), border-color 140ms var(--ease-out), background 140ms var(--ease-out);
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, #0b83f6 100%);
  color: white;
  box-shadow: var(--shadow-blue);
}

.ghost-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost-button:hover {
  border-color: var(--line-strong);
  color: var(--accent-strong);
  box-shadow: 0 8px 22px rgba(8, 32, 74, 0.08);
}

.file-input {
  display: none;
}

tr[draggable="true"] {
  cursor: grab;
}

tr.dragging {
  opacity: 0.55;
}

.drag-cell {
  white-space: nowrap;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 16px;
  animation: view-in 220ms var(--ease-out);
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-header h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  line-height: 1.35;
}

.panel[data-status="missing"] {
  border-color: #ffc4ba;
  background: var(--danger-bg);
}

.panel[data-status="missing"] .panel-header {
  background: linear-gradient(180deg, #fff8f6, #fff0ed);
}

.panel[data-status="partial"] {
  border-color: #ffe0a1;
  background: var(--warn-bg);
}

.panel[data-status="partial"] .panel-header {
  background: linear-gradient(180deg, #fffaf0, #fff5dc);
}

.panel[data-status="complete"] {
  border-color: #b7ecd0;
}

.muted {
  color: var(--muted);
  font-weight: var(--font-weight-regular);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  min-height: 132px;
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.kpi-icon {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #2caaff, #0b78ed);
  color: white;
  font-size: 28px;
  font-weight: var(--font-weight-semibold);
  box-shadow: var(--shadow-blue);
}

.kpi-card span {
  display: block;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
}

.kpi-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
  font-weight: var(--font-weight-bold);
}

.kpi-card small {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-body);
}

.dashboard-grid,
.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr);
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
}

.form-grid .checkbox-field {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.checkbox-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.wide {
  grid-column: span 2;
}

.form-submit {
  align-self: end;
}

.compact-form {
  grid-template-columns: 1fr 1fr 1fr auto;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.allocation-form .compact-form {
  grid-template-columns: minmax(180px, 260px) minmax(180px, 260px);
}

.batch-form {
  display: grid;
}

.batch-table input,
.batch-table select {
  min-width: 128px;
}

.batch-table .notes-input {
  min-width: 180px;
}

.allocation-batch-table {
  min-width: 1040px;
}

.allocation-batch-table input[type="number"] {
  min-width: 92px;
}

.batch-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface-blue);
}

.store-inputs {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: #273c5c;
  font-size: var(--font-size-table);
  font-weight: var(--font-weight-regular);
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
  line-height: var(--line-height-body);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--text-color-secondary);
  background: #eaf5ff;
  font-size: var(--font-size-table);
  font-weight: var(--font-weight-medium);
  text-transform: none;
}

tbody tr:hover {
  background: #f7fcff;
}

td input,
td select,
.batch-table input,
.batch-table select {
  height: 38px;
  min-height: 38px;
  padding: 6px 10px;
  line-height: 1.4;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
}

td input[type="number"],
.batch-table input[type="number"] {
  width: 112px;
  min-width: 96px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td input[type="file"],
.batch-table input[type="file"] {
  min-width: 180px;
  padding: 7px 10px;
  text-align: left;
}

td .notes-input,
.batch-table .notes-input {
  min-width: 180px;
  text-align: left;
}

.status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 10px;
  font-weight: var(--font-weight-medium);
  font-size: var(--text-xs);
}

.status.ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: #b7ecd0;
}

.status.warn {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: #ffe0a1;
}

.status.danger {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: #ffd4cc;
}

.stack-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: var(--surface);
}

.list-item strong {
  display: block;
  font-weight: var(--font-weight-semibold);
}

.list-item small {
  color: var(--muted);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-body);
}

.receiving-product-group {
  display: grid;
  gap: 10px;
}

.receiving-product-group h4 {
  margin: 0 4px;
  font-size: 16px;
  color: var(--ink);
  font-weight: var(--font-weight-semibold);
}

.delivery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.delivery-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, var(--surface), var(--surface-blue));
}

.delivery-card h4 {
  margin: 0 0 10px;
  font-weight: var(--font-weight-semibold);
}

.delivery-card ul {
  margin: 0;
  padding-left: 18px;
}

.do-item-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 0;
}

.do-item-table th,
.do-item-table td {
  vertical-align: top;
}

.do-item-table select,
.do-item-table input {
  width: 100%;
  min-width: 120px;
}

.do-item-table small,
.inline-checkbox {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.inline-checkbox input {
  width: auto;
  min-width: 0;
  margin-right: 6px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.summary-pill {
  background: var(--surface-blue);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.summary-pill span {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-regular);
}

.summary-pill strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: var(--font-weight-semibold);
}

.product-toolbar,
.product-bulkbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(150px, 0.6fr));
  gap: 10px;
  padding: 16px 18px 0;
  background: var(--surface);
}

.product-bulkbar {
  grid-template-columns: minmax(180px, 0.8fr) 118px repeat(4, auto) minmax(210px, 1fr);
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.bulk-hint {
  color: var(--text-color-muted);
  font-size: var(--text-xs);
  line-height: 1.35;
}

.product-selection-bulkbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #eef9ff, #ffffff);
  box-shadow: 0 10px 24px rgba(8, 32, 74, 0.08);
}

.product-selection-bulkbar strong {
  color: var(--accent-strong);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
}

.selected-shelf-life-input {
  width: 118px;
  min-width: 108px;
}

.product-group-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.product-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  overflow: hidden;
}

.product-group-header {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-radius: 0;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.product-group-header:hover {
  background: var(--surface-blue);
}

.product-group-toggle {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  text-align: left;
}

.product-group-toggle:hover {
  transform: none;
  box-shadow: none;
}

.product-group-arrow {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 18px;
}

.product-group-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.product-category-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-color-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-regular);
  white-space: nowrap;
}

.product-category-select input,
.product-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  accent-color: var(--accent);
}

.product-table-select-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: var(--font-weight-medium);
}

.product-group-header strong {
  font-size: var(--font-size-nav);
  font-weight: var(--font-weight-semibold);
}

.product-group-header small {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-regular);
}

.product-group-body {
  display: none;
}

.product-group.open .product-group-body {
  display: block;
}

.product-table th:first-child,
.product-table td:first-child {
  width: 58px;
  text-align: center;
}

.product-table th:nth-child(2),
.product-table td:nth-child(2) {
  width: 190px;
}

.product-category-cell {
  background: linear-gradient(180deg, #f8fcff, #fffaf0);
  color: var(--text-color-secondary);
  font-weight: var(--font-weight-medium);
  white-space: normal;
}

.product-flavor-name {
  color: var(--ink);
  font-weight: var(--font-weight-medium);
}

.shelf-life-input {
  width: 72px;
  min-width: 64px;
  padding-inline: 10px;
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
  margin-right: 6px;
}

.empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.record-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
}

.record-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 16px;
}

.record-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 16px 14px;
}

.record-filters input,
.record-filters select {
  max-width: 220px;
}

.record-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  padding: 0;
  text-align: left;
}

.record-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.record-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  display: none;
  background: rgba(8, 32, 74, 0.25);
}

.record-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  width: min(760px, 92vw);
  height: 100vh;
  overflow-y: auto;
  transform: translateX(104%);
  transition: transform 180ms var(--ease-out);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(8, 32, 74, 0.16);
  padding: 24px;
}

body.record-detail-open .record-drawer {
  transform: translateX(0);
}

body.record-detail-open .record-drawer-backdrop {
  display: block;
}

.record-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.record-drawer-header h3 {
  margin: 4px 0 0;
  font-size: var(--font-size-section-title);
  font-weight: var(--font-weight-semibold);
  line-height: 1.35;
}

.record-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.record-detail-cell {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.record-detail-cell span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
}

.record-detail-cell strong {
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-body);
}

.record-section-title {
  margin: 18px 0 10px;
  font-size: 18px;
  font-weight: var(--font-weight-semibold);
  line-height: 1.35;
}

.quick-panel {
  position: relative;
  overflow: visible;
}

.quick-panel::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: -18px;
  width: 170px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(40, 168, 240, 0.28), transparent 66%);
  pointer-events: none;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  gap: 14px;
  padding: 18px;
}

.quick-action {
  min-height: 84px;
  display: grid;
  place-items: center;
  gap: 8px;
  background: linear-gradient(180deg, #ffffff, var(--surface-blue));
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(8, 32, 74, 0.04);
}

.quick-action span {
  color: var(--accent);
  font-size: 25px;
  line-height: 1;
  font-weight: var(--font-weight-semibold);
}

.quick-action:hover {
  border-color: var(--line-strong);
  color: var(--accent-strong);
  box-shadow: var(--shadow-blue);
}

.price-input {
  width: 96px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--ink);
  color: white;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  transform: translateY(120%);
  transition: transform 180ms var(--ease-out);
  z-index: 20;
}

.toast.show {
  transform: translateY(0);
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  button:hover {
    transform: none;
  }
}

@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-actions {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 30;
    width: min(320px, 86vw);
    height: 100vh;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 180ms var(--ease-out);
    box-shadow: 24px 0 60px rgba(8, 32, 74, 0.16);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(8, 32, 74, 0.24);
  }

  .sidebar-toggle {
    display: grid;
    place-items: center;
  }

  .sidebar-brand {
    justify-content: flex-start;
    text-align: left;
  }

  .dashboard-grid,
  .two-column,
  .delivery-grid,
  .summary-strip,
  .form-grid,
  .store-inputs {
    grid-template-columns: 1fr;
  }

  .allocation-form .compact-form {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .topbar,
  .panel-header,
  .batch-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .filters {
    justify-content: flex-start;
  }

  .product-toolbar,
  .product-bulkbar {
    grid-template-columns: 1fr;
  }

  .product-bulkbar button {
    width: 100%;
  }

  .product-group-header {
    grid-template-columns: auto 1fr;
  }

  .product-group-header small {
    grid-column: 2;
  }

  td input,
  td select,
  .batch-table input,
  .batch-table select {
    height: 40px;
    min-height: 40px;
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px 14px 28px;
  }

  .sidebar {
    padding: 18px 14px;
  }

  .brand h1 {
    font-size: 25px;
  }

  .nav-list,
  .kpi-grid,
  .quick-actions {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    min-height: 112px;
  }

  .topbar-actions > *,
  .filters > *,
  .batch-actions button {
    width: 100%;
  }

  .record-drawer {
    width: 100vw;
    padding: 18px 14px;
  }

  .record-drawer-header,
  .record-detail-grid {
    grid-template-columns: 1fr;
  }

  .record-drawer-header {
    flex-direction: column;
  }

  .login-card {
    padding: 22px;
  }
}
