/* Sneat Free 3.0.0 supplies the layout, Bootstrap components and theme.
   These styles adapt the Chinese ERP's data views without replacing the theme. */
:root {
  --bs-font-sans-serif:
    "Public Sans", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --bs-body-font-family: var(--bs-font-sans-serif);
  --wine-ink: #384551;
  --wine-muted: #7a838b;
  --wine-border: #ebecef;
  --wine-topbar-inset: 20px;
  --wine-topbar-edge: 104px;
}
body {
  font-size: 14px;
}
a {
  text-decoration: none;
}
.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.skip-link {
  position: fixed;
  top: -60px;
  left: 20px;
  z-index: 2000;
  padding: 12px 20px;
  background: white;
  border-radius: 6px;
}
.skip-link:focus {
  top: 10px;
}
:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 3px;
}
.wine-brand {
  min-height: 96px;
  padding: 22px 24px;
  gap: 10px;
}
.wine-brand .app-brand-link {
  gap: 12px;
  min-width: 0;
}
.brand-mark {
  width: 40px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e7e7ff;
  color: #696cff;
  border-radius: 10px;
  flex-shrink: 0;
}
.brand-mark .icon {
  width: 26px;
  height: 26px;
}
.app-brand-text {
  color: var(--wine-ink);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.app-brand-text small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--wine-muted);
  margin-top: 5px;
  letter-spacing: 1px;
}
.layout-menu .menu-inner {
  list-style: none;
  padding-inline: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: #dfe0e7 transparent;
  min-height: 0;
}
/* Neutral group headings; only the current page uses the theme highlight. */
.sidebar-group-tools {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  flex-shrink: 0;
  margin: 0 18px 12px;
  padding: 4px;
  background: #f5f6f8;
  border: 1px solid var(--wine-border);
  border-radius: 8px;
}
.sidebar-group-tools .btn {
  flex: 1;
  padding: 6px 4px;
  color: #646e78;
  border: 0;
  box-shadow: none;
  font-size: 12px;
}
.sidebar-group-tools .btn:hover {
  background: #fff;
  color: var(--bs-primary);
}
.sidebar-group-tools .btn[aria-disabled="true"] {
  color: #a3aab1;
}
.sidebar-group-tools > span {
  height: 14px;
  border-left: 1px solid #dfe2e6;
}
.layout-menu .menu-section {
  margin: 0 0 4px;
  width: 100%;
}
.menu-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 32px);
  margin: 2px 16px;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #56616d;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.menu-group-title {
  flex: 1;
}
.menu-group-toggle[aria-expanded="true"] {
  background: #f7f8fa;
}
.menu-group-toggle:hover {
  background: #f0f2f5;
}
.menu-group-icon {
  width: 18px;
  height: 18px;
  color: #8b96a2;
}
.menu-group-chevron {
  width: 14px;
  height: 14px;
  color: #929ca7;
  transition: transform 0.2s ease;
}
.menu-group-toggle[aria-expanded="true"] .menu-group-chevron {
  transform: rotate(90deg);
}
.menu-group-links {
  padding: 3px 0 5px;
  margin: 0;
  list-style: none;
}
.menu-group-links > .menu-item {
  margin: 2px 16px 2px 30px;
  width: calc(100% - 46px);
}
.menu-group-links > .menu-item > .menu-link {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.menu-group-links .menu-icon.icon {
  width: 17px;
  height: 17px;
  margin-inline-end: 10px;
}
.menu-group-links > .menu-item.active > .menu-link {
  color: var(--bs-primary);
  background: var(--bs-primary-bg-subtle, #e7e7ff);
  font-weight: 500;
}
@media (prefers-reduced-motion: reduce) {
  .menu-group-chevron {
    transition: none;
  }
}
.sidebar-toggle {
  display: inline-flex;
  gap: 8px;
  flex-shrink: 0;
  width: auto;
}
.sidebar-toggle [data-sidebar-label] {
  font-size: 12px;
  white-space: nowrap;
}
@media (min-width: 1200px) {
  #layout-menu {
    transition:
      transform 0.2s ease,
      visibility 0.2s;
  }
  .layout-menu-fixed.wine-sidebar-hidden #layout-menu {
    transform: translateX(-100%);
    visibility: hidden;
    pointer-events: none;
  }
  .layout-menu-fixed.wine-sidebar-hidden .layout-page {
    padding-inline-start: 0;
  }
  .wine-sidebar-hidden .main-content {
    max-width: none;
  }
}
.menu-icon.icon {
  width: 20px;
  height: 20px;
  margin-inline-end: 12px;
}
.menu-link {
  gap: 0;
}
.menu-tag {
  margin-left: auto;
  color: #8592a3;
  background: #f0f1f3;
  border-radius: 4px;
  font-size: 10px;
  padding: 2px 5px;
}
.sidebar-footer {
  border-top: 1px solid var(--wine-border);
  margin: 0 20px;
  padding: 18px 6px;
  font-size: 12px;
  color: var(--wine-muted);
  display: flex;
  gap: 9px;
  align-items: center;
}
.status-dot {
  width: 7px;
  height: 7px;
  background: #71dd37;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.layout-page {
  min-width: 0;
}
.layout-page .topbar {
  position: sticky;
  top: var(--wine-topbar-inset);
  z-index: 1020;
  margin: 20px 28px 0;
  width: auto;
  padding: 0 22px;
  min-height: 68px;
  height: auto;
  gap: 16px;
  flex-wrap: nowrap;
  justify-content: space-between;
}
.topbar-start,
.topbar-right,
.account {
  display: flex;
  align-items: center;
}
.topbar-start {
  min-width: 0;
  gap: 12px;
}
.breadcrumb-line {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  min-width: 0;
}
.breadcrumb-line a {
  color: var(--wine-muted);
  white-space: nowrap;
}
.breadcrumb-line > span {
  color: #b9bdc2;
}
.breadcrumb-line strong {
  color: var(--wine-ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right {
  gap: 18px;
  flex-shrink: 0;
}
.topbar-date {
  color: var(--wine-muted);
  font-size: 12px;
}
.icon-btn {
  border: 0;
  background: transparent;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
  border-radius: 6px;
  color: #646e78;
  cursor: pointer;
}
.icon-btn:hover {
  background: #eeeef9;
  color: #696cff;
}
.account {
  gap: 10px;
  color: var(--wine-ink);
}
.account .avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #e7e7ff;
  color: #696cff;
  border-radius: 50%;
  font-weight: 600;
}
.account strong {
  font-size: 13px;
  font-weight: 500;
}
.account small {
  display: block;
  color: var(--wine-muted);
  font-size: 11px;
  margin-top: 2px;
}
.logout-btn {
  border: 0;
  border-left: 1px solid var(--wine-border);
  padding: 6px 0 6px 16px;
  background: none;
  color: var(--wine-muted);
  font-size: 12px;
  cursor: pointer;
}
.logout-btn:hover {
  color: var(--bs-primary);
}
.menu-close,
.sidebar-backdrop {
  display: none;
}
.main-content {
  width: 100%;
  padding: 28px 28px 0;
  max-width: 1800px;
  margin: 0 auto;
  flex: 1;
  min-width: 0;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 8px;
}
.page-heading p {
  color: var(--wine-muted);
  font-size: 13px;
  line-height: 1.7;
  margin: 0;
}
.btn {
  gap: 7px;
  white-space: nowrap;
  font-size: 13px;
}
.btn .icon {
  width: 17px;
  height: 17px;
}
.btn-sm {
  font-size: 12px;
}
.card {
  min-width: 0;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--wine-border);
  flex-wrap: wrap;
}
.card-title {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}
.card-subtitle {
  font-size: 12px;
  margin: 6px 0 0;
  color: var(--wine-muted);
}
.card-body {
  padding: 24px;
}
.card-footer {
  padding: 18px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--wine-border);
}
.subtle-link {
  color: var(--bs-primary);
  font-size: 12px;
  white-space: nowrap;
}
.overview-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  background: #e7e7ff;
  color: #5f61df;
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 24px;
}
.overview-banner > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.overview-banner strong {
  font-weight: 600;
}
.overview-banner a {
  font-size: 12px;
  white-space: nowrap;
  color: #5759d0;
}
.banner-icon {
  display: inline-flex;
}
.metric-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}
.metric-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.metric-card,
.stat-card {
  padding: 22px 24px;
  min-width: 0;
  background: var(--bs-paper-bg, white);
  border-radius: var(--bs-border-radius);
  box-shadow: var(--bs-box-shadow-sm);
}
.metric-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #646e78;
  font-size: 13px;
}
.metric-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
}
.teal {
  background: #e8fadf;
  color: #388318;
}
.blue {
  background: #d7f5fc;
  color: #0089a6;
}
.amber {
  background: #fff2d6;
  color: #a36c00;
}
.purple {
  background: #e7e7ff;
  color: #696cff;
}
.metric-value {
  font-size: clamp(22px, 2.05vw, 32px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--wine-ink);
  margin: 18px 0 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.metric-value small {
  font-size: 17px;
  margin-right: 5px;
}
.metric-foot {
  font-size: 11px;
  color: var(--wine-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.6;
}
.small-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.dashboard-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(290px, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}
.chart-body {
  padding: 20px 24px;
}
.revenue-chart {
  width: 100%;
  display: block;
  max-height: 270px;
}
.chart-tick {
  fill: #8592a3;
  font-size: 11px;
}
.chart-caption {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  margin-top: 8px;
}
.chart-caption .text-secondary {
  font-size: 11px;
}
.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #696cff;
  display: inline-block;
  flex-shrink: 0;
}
.channel-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 24px 24px;
}
.donut-wrap {
  width: 158px;
  height: 158px;
  position: relative;
  flex-shrink: 0;
}
.donut {
  width: 100%;
  height: 100%;
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut-center strong {
  font-size: 28px;
  font-weight: 500;
  color: var(--wine-ink);
}
.donut-center span {
  font-size: 12px;
  color: var(--wine-muted);
}
.channel-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  gap: 12px 18px;
  margin-top: 16px;
}
.channel-legend > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.channel-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}
.channel-legend i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex-shrink: 0;
}
.channel-legend strong {
  font-weight: 500;
  color: var(--wine-ink);
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}
.quick-actions > a {
  display: flex;
  gap: 13px;
  align-items: center;
  background: white;
  border-radius: var(--bs-border-radius);
  box-shadow: var(--bs-box-shadow-sm);
  padding: 20px;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.quick-actions > a:hover {
  transform: translateY(-2px);
  box-shadow: var(--bs-box-shadow);
}
.quick-icon {
  width: 40px;
  height: 40px;
  background: #e7e7ff;
  color: #696cff;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}
.quick-actions strong {
  font-size: 14px;
  font-weight: 500;
  color: var(--wine-ink);
  display: block;
  margin-bottom: 5px;
}
.quick-actions small {
  font-size: 11px;
  color: var(--wine-muted);
}
.quick-arrow {
  margin-left: auto;
  color: #a7acb2;
}
.dashboard-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr);
  gap: 24px;
}
.table {
  font-size: 13px;
  margin-bottom: 0;
}
.table > thead {
  background: #fafafc;
}
.table thead th {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.25px;
  text-transform: none;
  color: var(--wine-ink);
  white-space: nowrap;
  padding-block: 15px;
}
.table td {
  padding-block: 16px;
  vertical-align: middle;
  white-space: nowrap;
}
.table tfoot {
  background: #fafafc;
}
.table tfoot th {
  font-size: 13px;
  padding-block: 16px;
}
.table-responsive {
  border-radius: 0 0 var(--bs-border-radius) var(--bs-border-radius);
}
.row-title {
  color: var(--wine-ink);
  font-weight: 500;
}
a.row-title:hover {
  color: var(--bs-primary);
}
.row-subtitle {
  display: block;
  font-size: 11px;
  color: var(--wine-muted);
  margin-top: 5px;
}
.font-numeric {
  font-variant-numeric: tabular-nums;
}
.state {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  padding: 5px 9px;
  border-radius: 5px;
  background: #ebeef0;
  color: #566473;
  white-space: nowrap;
}
.state-pending {
  background: #fff2d6;
  color: #926000;
}
.state-approved,
.state-completed,
.state-available {
  background: #e8fadf;
  color: #347619;
}
.state-partial,
.state-shipped {
  background: #e7e7ff;
  color: #5f61df;
}
.state-cancelled,
.state-void {
  background: #ffe0db;
  color: #c03319;
}
.count-pill {
  margin-left: 6px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  background: #fff2d6;
  color: #926000;
}
.warning-list {
  padding: 0 24px;
}
.warning-list > a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 1px solid var(--wine-border);
}
.warning-list > a:last-child {
  border-bottom: 0;
}
.warning-icon {
  color: #ffab00;
  display: flex;
}
.warning-list strong {
  color: var(--wine-ink);
  display: block;
  font-size: 13px;
  font-weight: 500;
}
.warning-list small {
  display: block;
  font-size: 11px;
  color: var(--wine-muted);
  margin-top: 6px;
  line-height: 1.6;
}
.warning-list .state {
  margin-left: auto;
}
.warehouse-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-top: 1px solid var(--wine-border);
  margin-top: auto;
  font-size: 12px;
}
.warehouse-summary b {
  color: var(--wine-ink);
  margin-inline: 4px;
}
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 24px 28px;
  color: var(--wine-muted);
  font-size: 12px;
}
.app-footer a {
  color: var(--wine-muted);
}
.app-footer a:hover {
  color: var(--bs-primary);
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.toolbar > div:first-child,
.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.search-form > .icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--wine-muted);
}
.search-form > input.form-control,
.search-form > input.form-control:focus {
  padding-inline-start: 38px;
  width: 280px;
}
.search-form > select {
  width: 145px;
}
.form-control,
.form-select {
  font-size: 14px;
}
.form-label {
  font-size: 13px;
  line-height: 1.6;
  color: var(--wine-ink);
}
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}
.full-width {
  grid-column: 1/-1;
}
.form-card {
  max-width: 1120px;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 52px 24px;
  color: var(--wine-muted);
  text-align: center;
}
.empty-state > .icon {
  width: 36px;
  height: 36px;
  color: #b5b6ff;
  margin-bottom: 16px;
}
.empty-state strong {
  font-size: 15px;
  font-weight: 500;
  color: var(--wine-ink);
}
.empty-state p {
  margin: 10px 0 0;
  font-size: 13px;
}
.pagination-bar {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
}
.pagination-bar > div {
  display: flex;
  gap: 8px;
}
.section-tabs {
  display: flex;
  gap: 26px;
  overflow-x: auto;
  margin: 22px 0;
  border-bottom: 1px solid #dfe0e7;
}
.section-tabs a {
  padding: 4px 2px 14px;
  color: var(--wine-muted);
  white-space: nowrap;
}
.section-tabs a.active {
  color: #696cff;
  border-bottom: 2px solid #696cff;
}
.order-entry-table {
  min-width: 840px;
}
.order-entry-table td,
.order-entry-table th {
  padding-inline: 16px;
}
.order-entry-table td:first-child {
  width: 27%;
}
.order-entry-table td:nth-child(2),
.order-entry-table td:nth-child(3) {
  width: 95px;
}
.order-entry-table td:nth-child(4) {
  width: 145px;
}
.order-entry-table .form-control {
  min-width: 65px;
}
.order-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.order-total > div:last-child {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.order-total label {
  max-width: 150px;
  margin: 0;
}
.order-total strong {
  font-size: 26px;
  color: var(--bs-primary);
  font-weight: 500;
  white-space: nowrap;
}
.order-total small {
  font-size: 12px;
  color: var(--wine-muted);
}
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 24px;
}
.detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  border-top: 1px solid var(--wine-border);
  padding-top: 20px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--wine-muted);
}
.detail-meta strong {
  display: block;
  margin-top: 8px;
  color: var(--wine-ink);
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.amount-card {
  border-top: 3px solid #696cff;
}
.amount-card h2 {
  color: #696cff;
  font-size: 34px;
  font-weight: 500;
  margin: 16px 0 22px;
  overflow-wrap: anywhere;
}
.amount-card .card-body > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
}
.amount-card b {
  font-weight: 500;
  color: var(--wine-ink);
}
.amount-card .balance {
  border-top: 1px dashed #d9d9ed;
  padding-top: 16px;
  margin-top: 18px;
}
.allocation-list > div {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  flex-wrap: wrap;
}
.allocation-list > div > span:last-child {
  margin-left: auto;
}
.action-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}
.inline-form {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.inline-form > .form-control,
.inline-form > .form-select {
  width: auto;
  max-width: 250px;
}
.compact-input {
  max-width: 110px !important;
}
.wrap-cell {
  white-space: normal !important;
  min-width: 180px;
  max-width: 450px;
  overflow-wrap: anywhere;
}
.timeline-list > div {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--wine-border);
}
.timeline-list small {
  margin-left: auto;
  color: var(--wine-muted);
  font-size: 12px;
}
.timeline-list strong {
  font-weight: 500;
}
.shipment-item {
  border: 1px solid var(--wine-border);
  border-radius: 8px;
  margin-bottom: 18px;
}
.shipment-item > .panel-toggle {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  flex-wrap: wrap;
}
.shipment-item > .panel-toggle > div {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.shipment-item > .panel-toggle > div:first-child {
  flex: 1;
}
.shipment-item > .panel-toggle strong {
  font-weight: 500;
}
.error-card {
  max-width: 700px;
  margin: 60px auto;
  text-align: center;
}
.error-card .card-body {
  padding: 60px 32px;
}
.error-number {
  font-size: 72px;
  color: #b5b6ff;
  display: block;
  margin-bottom: 16px;
}
.error-card p {
  margin: 22px 0 30px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stat-card strong {
  color: var(--wine-ink);
  font-size: 28px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.stat-card small {
  color: var(--wine-muted);
}
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bs-body-bg);
}
.login-card {
  width: 100%;
  max-width: 448px;
}
.login-card .card-body {
  padding: 40px;
}
.login-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 36px;
}
.login-brand .app-brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-card h1 {
  font-size: 22px;
  margin-bottom: 12px;
}
.login-card .form-label {
  display: block;
}
.login-card .btn {
  min-height: 42px;
}
.login-note {
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-top: 26px;
  color: var(--wine-muted);
}
.login-page .app-footer {
  padding: 26px 0 0;
  font-size: 11px;
}
.public-trace {
  background: var(--bs-body-bg);
}
.trace-shell {
  max-width: 560px;
  padding: 48px 24px;
  margin: auto;
  text-align: center;
}
.trace-shell h1 {
  font-size: 25px;
  margin: 24px 0 16px;
}
.trace-shell > small {
  display: block;
  margin-top: 24px;
}
.trace-facts {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
  margin: 24px 0;
  font-size: 13px;
}
.trace-facts dt {
  color: var(--wine-muted);
  font-weight: 400;
}
.trace-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
@media (min-width: 1600px) {
  .channel-content {
    flex-direction: row;
    justify-content: center;
    gap: 28px;
    padding-block: 42px;
  }
  .channel-legend {
    grid-template-columns: 1fr;
    max-width: 200px;
    margin-top: 0;
  }
}
@media (max-width: 1399px) {
  .quick-actions {
    gap: 16px;
  }
  .quick-actions > a {
    padding: 18px 14px;
    gap: 10px;
  }
  .quick-actions small {
    font-size: 10px;
  }
  .quick-arrow {
    display: none;
  }
  .dashboard-bottom {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 1199px) {
  .layout-menu-expanded body {
    overflow: hidden;
  }
  .menu-close {
    display: inline-flex;
  }
  .menu-close {
    margin-left: auto;
    font-size: 26px;
    padding: 0 6px;
  }
  .layout-menu {
    transition: transform 0.2s ease;
    z-index: 1101 !important;
  }
  .layout-menu-expanded .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    width: 100%;
    border: 0;
    z-index: 1100;
    background: #22303e66;
  }
  .topbar-date {
    display: none;
  }
  .metric-grid,
  .stats-grid {
    gap: 18px;
  }
}
@media (max-width: 900px) {
  .metric-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-charts {
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
    gap: 18px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .metric-value {
    font-size: 28px;
  }
}
@media (max-width: 650px) {
  :root {
    --wine-topbar-inset: 12px;
    --wine-topbar-edge: 88px;
  }
  .sidebar-toggle [data-sidebar-label] {
    display: none;
  }
  .layout-page .topbar {
    margin: 12px 14px 0;
    min-height: 60px;
    padding: 0 12px;
    gap: 10px;
  }
  .main-content {
    padding: 24px 14px 0;
  }
  .topbar-start,
  .topbar-right {
    gap: 8px;
  }
  .breadcrumb-line {
    font-size: 12px;
    gap: 8px;
  }
  .breadcrumb-line a,
  .breadcrumb-line > span,
  .account > span:last-child,
  .topbar-right > .icon-btn {
    display: none;
  }
  .logout-btn {
    padding-left: 10px;
  }
  .page-heading {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
  }
  .page-heading h1 {
    font-size: 22px;
    overflow-wrap: anywhere;
  }
  .page-heading p {
    font-size: 12px;
  }
  .page-heading .btn {
    padding-inline: 12px;
    flex-shrink: 0;
  }
  .page-heading .btn .icon {
    display: none;
  }
  .overview-banner {
    padding: 16px;
    font-size: 12px;
    line-height: 1.8;
  }
  .overview-banner a {
    display: none;
  }
  .metric-grid,
  .stats-grid,
  .quick-actions {
    gap: 12px;
  }
  .metric-card,
  .stat-card {
    padding: 17px 16px;
  }
  .metric-label {
    font-size: 12px;
    align-items: flex-start;
  }
  .metric-icon {
    width: 28px;
    height: 28px;
  }
  .metric-icon .icon {
    width: 17px;
    height: 17px;
  }
  .metric-value {
    font-size: 23px;
  }
  .metric-value small {
    font-size: 13px;
  }
  .metric-foot {
    font-size: 10px;
  }
  .stat-card strong {
    font-size: 23px;
  }
  .metric-grid.three,
  .dashboard-charts,
  .action-panels,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .channel-content {
    flex-direction: row;
    gap: 20px;
    justify-content: center;
    padding: 18px;
  }
  .channel-legend {
    grid-template-columns: 1fr;
    max-width: 160px;
    margin-top: 0;
  }
  .donut-wrap {
    width: 140px;
    height: 140px;
  }
  .channel-legend > div {
    font-size: 11px;
  }
  .quick-actions > a {
    padding: 16px 12px;
    gap: 10px;
  }
  .quick-actions strong {
    font-size: 13px;
  }
  .quick-actions small {
    font-size: 10px;
    line-height: 1.5;
    display: block;
  }
  .quick-icon {
    width: 32px;
    height: 32px;
  }
  .quick-icon .icon {
    width: 18px;
    height: 18px;
  }
  .card-header,
  .card-body {
    padding: 20px 18px;
  }
  .card-title {
    font-size: 15px;
  }
  .card-header > .text-secondary {
    font-size: 12px;
  }
  .card-footer {
    padding: 16px 18px;
  }
  .search-form {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .search-form > input {
    width: 100%;
  }
  .search-form > .icon {
    top: 11px;
  }
  .search-form > select {
    flex: 1;
  }
  .table th,
  .table td {
    padding-inline: 18px;
  }
  .detail-meta {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
  .order-total {
    gap: 20px;
  }
  .order-total > div:last-child {
    gap: 12px;
  }
  .order-total strong {
    font-size: 23px;
  }
  .timeline-list > div {
    flex-wrap: wrap;
  }
  .timeline-list small {
    width: 100%;
    padding-left: 22px;
  }
  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 14px;
    gap: 8px;
    font-size: 11px;
  }
  .login-card .card-body {
    padding: 28px 24px;
  }
  .login-page .app-footer {
    align-items: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
@media print {
  .layout-menu,
  .topbar,
  .toolbar,
  .action-panels,
  .app-footer,
  .page-heading .btn,
  .form-actions,
  .report-filters,
  .sidebar-backdrop {
    display: none !important;
  }
  .layout-menu-fixed .layout-page {
    padding: 0 !important;
  }
  .main-content {
    padding: 0;
  }
  body {
    background: white;
    font-size: 11px;
  }
  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
    margin-bottom: 16px;
  }
  .table-responsive {
    overflow: visible;
  }
  .table {
    font-size: 10px;
  }
  .table th,
  .table td {
    padding-inline: 8px;
    white-space: normal;
  }
  .detail-grid {
    display: block;
  }
  .amount-card {
    margin-top: 16px;
  }
}

/* Long company names keep the sidebar brand on one line. */
.wine-brand .app-brand-text {
  min-width: 0;
  font-size: 19px;
}
.wine-brand .brand-name {
  display: block;
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.login-brand .app-brand-text {
  font-size: 20px;
}
@media (max-width: 1199.98px) {
  .wine-brand {
    padding-inline: 20px 10px;
    gap: 5px;
  }
  .wine-brand .brand-name {
    max-width: 145px;
  }
}

/* Shared server-rendered form dialog and plain-language module guidance. */
.module-guide {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.85rem 1rem;
  margin: -0.5rem 0 1.5rem;
  background: #f0efff;
  border-radius: 0.5rem;
  color: #566071;
  font-size: 0.88rem;
}
.module-guide strong {
  flex-shrink: 0;
  color: #6965df;
}
.form-editor-frame {
  display: block;
  width: 100%;
  height: min(76vh, 850px);
  min-height: 350px;
  border: 0;
  background: #f5f5fa;
}
.wine-dialog-page #layout-menu,
.wine-dialog-page .layout-navbar,
.wine-dialog-page .app-footer,
.wine-dialog-page .skip-link,
.wine-dialog-page .sidebar-backdrop {
  display: none !important;
}
.wine-dialog-page .layout-page {
  padding-left: 0 !important;
  margin-left: 0 !important;
}
.wine-dialog-page .main-content {
  padding: 1.25rem !important;
  max-width: none;
  width: 100%;
}
.wine-dialog-page .page-heading h1 {
  display: none;
}
.wine-dialog-page .page-heading {
  margin-bottom: 1rem;
}
.wine-dialog-page .page-heading p {
  margin: 0;
}
.permission-group {
  border: 1px solid #e5e5ec;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
}
.permission-group legend {
  float: none;
  font-size: 1rem;
  width: auto;
  padding: 0 0.5rem;
  font-weight: 600;
  margin: 0;
}
.permission-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1.2rem;
}
.permission-options label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  cursor: pointer;
}
.permission-options small {
  display: block;
  color: #8592a3;
  font-size: 0.78rem;
  margin-top: 0.15rem;
}
.permission-tools {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}
.permission-options [hidden],
.alert[hidden] {
  display: none !important;
}
@media (max-width: 767px) {
  .form-editor-frame {
    height: calc(100dvh - 75px);
  }
  .permission-options {
    grid-template-columns: 1fr;
  }
  .module-guide {
    flex-direction: column;
    gap: 0.2rem;
  }
  .wine-dialog-page .main-content {
    padding: 1rem !important;
  }
}
.wine-dialog-page form > .card-footer,
.wine-dialog-page form > .form-actions,
.wine-dialog-page [data-permission-editor] > .card > .card-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: #fff;
  padding: 1rem;
  border-top: 1px solid #e5e5ec;
  box-shadow: 0 -4px 10px #22334408;
}

/* Keep the page width and menu position stable across full SSR navigations. */
html {
  scrollbar-gutter: stable;
  scroll-padding-top: var(--wine-topbar-edge);
}
.layout-menu .menu-inner {
  overflow-anchor: none;
}

/* System configuration categories share one compact selector on narrow screens. */
.system-settings-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}
.system-settings-content {
  min-width: 0;
}
.config-category-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 16px;
  overflow-anchor: none;
}
@media (min-width: 992px) {
  .system-settings-page {
    --settings-panel-height: max(280px, calc(100dvh - var(--wine-topbar-edge) - 64px));
    grid-template-columns: 200px minmax(0, 1fr);
    min-height: calc(var(--settings-panel-height) + 48px);
    overflow-anchor: none;
  }
  .system-settings-sidebar,
  .system-settings-content {
    position: sticky;
    top: var(--wine-topbar-edge);
    align-self: start;
  }
  .config-category-nav {
    grid-template-columns: minmax(0, 1fr);
    max-height: var(--settings-panel-height);
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-padding-block: 16px;
  }
  .system-settings-content {
    max-height: var(--settings-panel-height);
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding: 1px 10px 10px 1px;
  }
}

.system-settings-form {
  width: 100%;
}
.system-settings-form fieldset {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}
.system-settings-page .config-category-nav .nav-link {
  text-align: left;
  white-space: nowrap;
  padding: 12px 16px;
}

.backup-records-table { table-layout: fixed; width: 100%; }
.backup-records-table th:nth-child(1) { width: 26%; }
.backup-records-table th:nth-child(2) { width: 20%; }
.backup-records-table th:nth-child(3) { width: 37%; }
.backup-records-table th:nth-child(4) { width: 17%; }
.backup-records-table td, .backup-records-table th { padding-inline: 12px; white-space: normal; overflow-wrap: anywhere; }
.backup-records-table .btn { white-space: normal; }
