:root {
  color-scheme: light;
  --bg: #fff8f1;
  --surface: #fffdfa;
  --surface-soft: #fff0f6;
  --surface-warm: #fff8df;
  --text: #5b3548;
  --muted: #a47769;
  --line: #f4d4de;
  --rose: #ff86b6;
  --rose-deep: #d85b8d;
  --rose-soft: #ffe4ef;
  --pink: #ffb1c8;
  --peach: #ffc8ad;
  --yellow: #ffe28a;
  --lavender: #d6b6ff;
  --mint: #bde6da;
  --cream: #fffaf0;
  --brown-soft: #d3b094;
  --shadow: 0 18px 44px rgba(213, 121, 150, 0.16), 0 4px 14px rgba(169, 119, 93, 0.08);
  --shadow-soft: 0 12px 28px rgba(213, 121, 150, 0.12);
  --radius: 24px;
  --radius-small: 18px;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  min-width: 320px;
  margin: 0;
  padding-bottom: env(safe-area-inset-bottom);
  background:
    radial-gradient(circle at 10% 9%, rgba(255, 177, 200, 0.40), transparent 24%),
    radial-gradient(circle at 88% 12%, rgba(255, 226, 138, 0.42), transparent 22%),
    radial-gradient(circle at 80% 88%, rgba(255, 200, 173, 0.35), transparent 24%),
    linear-gradient(135deg, rgba(255, 134, 182, 0.18), transparent 34%),
    repeating-linear-gradient(0deg, rgba(244, 212, 222, 0.26) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(244, 212, 222, 0.18) 0 1px, transparent 1px 34px),
    var(--bg);
  color: var(--text);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 78%, rgba(255, 255, 255, 0.72) 0 14px, transparent 15px),
    radial-gradient(circle at 92% 42%, rgba(255, 255, 255, 0.62) 0 18px, transparent 19px),
    radial-gradient(circle at 36% 18%, rgba(255, 255, 255, 0.54) 0 10px, transparent 11px);
  content: "";
  pointer-events: none;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    filter 160ms ease,
    transform 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.18);
  opacity: 0.58;
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 1px;
  min-height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 24px;
  padding: 28px 20px;
  background: rgba(255, 253, 248, 0.88);
  border-right: 2px dashed rgba(244, 212, 222, 0.94);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 22px;
  background: linear-gradient(135deg, var(--rose), var(--peach));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(255, 134, 182, 0.26);
  transform: rotate(-3deg);
}

.brand h1,
.topbar h2,
.panel h3 {
  margin: 0;
}

.brand h1 {
  overflow-wrap: anywhere;
  font-size: 21px;
  line-height: 1.18;
}

.brand-kicker,
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.brand-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.brand-meta span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid rgba(244, 212, 222, 0.94);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.80);
}

.nav-tabs {
  display: grid;
  gap: 10px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
  font-weight: 900;
  text-align: left;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    transform 120ms ease;
}

.nav-tab:hover {
  background: rgba(255, 240, 246, 0.90);
  color: var(--text);
}

.nav-tab.is-active {
  border-color: rgba(255, 134, 182, 0.46);
  background: linear-gradient(135deg, #fff, var(--rose-soft));
  color: var(--rose-deep);
  box-shadow: var(--shadow-soft);
}

.nav-tab:active,
.mobile-bottom-tab:active,
.primary-button:active,
.ghost-button:active,
.icon-button:active {
  transform: translateY(1px) scale(0.98);
}

.nav-tab:focus-visible,
.mobile-bottom-tab:focus-visible,
.primary-button:focus-visible,
.ghost-button:focus-visible,
.icon-button:focus-visible,
.text-button:focus-visible {
  outline: 3px solid rgba(255, 134, 182, 0.34);
  outline-offset: 3px;
}

.details-subtab:focus-visible,
.record-filter:focus-visible {
  outline: 3px solid rgba(255, 134, 182, 0.34);
  outline-offset: 3px;
}

.mobile-bottom-tabs {
  display: none;
}

.nav-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: currentColor;
  font-size: 26px;
  line-height: 1;
}

.sidebar-panel {
  margin-top: auto;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, #fff, #ffe8f1 58%, #fff8df);
  box-shadow: var(--shadow-soft);
}

.sidebar-panel p,
.sidebar-panel span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sidebar-panel strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 26px;
}

.main-content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px dashed rgba(244, 212, 222, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.72);
  box-shadow: var(--shadow-soft);
}

.topbar h2 {
  font-size: clamp(26px, 3vw, 38px);
}

.topbar-actions,
.form-actions,
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar .topbar-actions {
  display: none;
}

.primary-button,
.ghost-button,
.text-button,
.icon-button {
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 800;
}

.primary-button {
  padding: 0 18px;
  background: linear-gradient(135deg, var(--rose), var(--pink));
  color: #fff;
  box-shadow: 0 12px 28px rgba(255, 134, 182, 0.26);
}

.primary-button:hover {
  filter: saturate(1.08) brightness(0.98);
}

.ghost-button {
  padding: 0 16px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  box-shadow: 0 6px 16px rgba(213, 121, 150, 0.08);
}

.ghost-button:hover {
  border-color: rgba(255, 111, 167, 0.42);
  background: #fff;
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--rose-deep);
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.button-icon {
  line-height: 1;
}

.page-view {
  display: none;
}

.page-view.is-active {
  display: block;
}

body.mobile-tab-overview #overviewPage {
  display: block;
}

body.mobile-tab-overview #ordersPage {
  display: none;
}

body.mobile-tab-new #overviewPage,
body.mobile-tab-details #overviewPage {
  display: none;
}

body.mobile-tab-new #ordersPage,
body.mobile-tab-details #ordersPage {
  display: block;
}

body.mobile-tab-new .details-workspace {
  display: none;
}

body.mobile-tab-details .entry-layout {
  display: none;
}

body.mobile-tab-details .details-workspace {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.metric-card,
.panel {
  border: 1px solid rgba(244, 212, 222, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 20px;
}

.metric-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  content: "";
}

.metric-card::after {
  position: absolute;
  right: 16px;
  bottom: 12px;
  color: rgba(255, 134, 182, 0.22);
  content: "♡";
  font-size: 34px;
  font-weight: 900;
  pointer-events: none;
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin: 14px 0 8px;
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1;
}

.accent-rose::before {
  background: var(--rose);
}

.accent-pink::before {
  background: var(--pink);
}

.accent-peach::before {
  background: var(--peach);
}

.accent-yellow::before {
  background: var(--yellow);
}

.accent-lavender::before {
  background: var(--lavender);
}

.accent-mint::before {
  background: var(--mint);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 16px;
}

.history-chart-stack {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel {
  position: relative;
  min-width: 0;
  padding: 20px;
}

.wide-panel {
  min-height: 360px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  min-width: 0;
}

.panel h3 {
  font-size: 20px;
}

.panel-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(244, 212, 222, 0.82);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
}

.recent-panel {
  margin-top: 16px;
}

.compact-list {
  display: grid;
  gap: 10px;
}

.recent-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff, var(--surface-soft));
  box-shadow: 0 8px 18px rgba(213, 121, 150, 0.08);
}

.recent-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-weight: 800;
}

.recent-title span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-meta {
  color: var(--muted);
  font-size: 13px;
}

.style-rank-list {
  display: grid;
  gap: 10px;
}

.style-rank-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 13px;
  border: 1px dashed rgba(244, 212, 222, 0.92);
  border-radius: 22px;
  background: linear-gradient(135deg, #fff, var(--surface-soft));
  box-shadow: 0 8px 18px rgba(213, 121, 150, 0.08);
}

.style-rank-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.style-rank-main > div {
  min-width: 0;
}

.style-rank-main strong,
.style-rank-main span {
  display: block;
}

.style-rank-main strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.style-rank-main span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.style-rank-index {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  margin-top: 0;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--rose), var(--peach));
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  box-shadow: 0 8px 16px rgba(255, 134, 182, 0.20);
}

.style-rank-count {
  color: var(--rose-deep);
  font-weight: 900;
  white-space: nowrap;
}

.style-rank-bar {
  grid-column: 1 / -1;
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 228, 239, 0.92);
}

.style-rank-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--peach));
}

.entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  margin-bottom: 16px;
}

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

.inventory-cost-block {
  min-width: 0;
}

.blank-source-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 10px;
  min-width: 0;
}

.blank-source-row label,
.blank-source-row select,
.blank-source-row input {
  min-width: 0;
}

.inventory-source-field select {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-cost-hint {
  margin: 7px 0 0;
  color: #6f8266;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.inventory-cost-hint.is-error {
  color: #b33c55;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.span-2 {
  grid-column: span 2;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: #fffdfb;
  color: var(--text);
  outline: none;
}

input[type="date"] {
  min-width: 0;
  max-width: 100%;
  appearance: none;
}

input[type="date"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

input,
select {
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
}

.suggest-field {
  position: relative;
  display: block;
  min-width: 0;
}

.suggest-list {
  position: absolute;
  z-index: 35;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(244, 212, 222, 0.94);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 18px 44px rgba(213, 121, 150, 0.20);
}

.suggest-list[hidden] {
  display: none;
}

.suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.suggest-item span {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggest-item small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.suggest-item:hover,
.suggest-item.is-active {
  border-color: rgba(255, 134, 182, 0.36);
  background: var(--rose-soft);
  color: var(--rose-deep);
}

.image-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.upload-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(255, 134, 182, 0.17);
}

input[readonly] {
  border-color: rgba(255, 134, 182, 0.28);
  background: var(--surface-soft);
  color: var(--rose-deep);
  font-weight: 900;
}

.calc-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.calc-strip div {
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #fff, var(--surface-soft));
  box-shadow: inset 0 -2px 0 rgba(255, 177, 200, 0.18);
}

.calc-strip span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.calc-strip strong {
  font-size: 24px;
}

.tips-panel {
  align-self: start;
}

.rule-toggle {
  width: 100%;
}

.rule-panel {
  margin-top: 16px;
}

.rule-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.rule-list div {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--cream), #fff);
}

.rule-list dt {
  margin-bottom: 6px;
  font-weight: 900;
}

.rule-list dd {
  margin: 0;
  color: var(--muted);
}

.table-heading {
  align-items: center;
}

.details-workspace {
  min-width: 0;
}

.details-subtabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 5px;
  margin-bottom: 12px;
  padding: 5px;
  border: 1px solid rgba(244, 212, 222, 0.94);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow-soft);
}

.details-subtab,
.record-filter {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.details-subtab.is-active,
.record-filter.is-active {
  background: linear-gradient(135deg, var(--rose), var(--peach));
  color: #fff;
  box-shadow: 0 8px 18px rgba(255, 134, 182, 0.22);
}

.details-pane {
  display: none;
}

.details-pane.is-active {
  display: block;
}

.inventory-heading {
  align-items: center;
}

.inventory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inventory-table-wrap,
.inventory-records-wrap {
  overflow: auto;
}

.inventory-table {
  min-width: 680px;
}

.inventory-table th,
.inventory-table td {
  padding: 15px 12px;
}

.inventory-name-cell {
  min-width: 180px;
  font-weight: 900;
}

.inventory-name-content {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inventory-name-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.inventory-item-rename-button {
  display: inline-grid;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  flex: 0 0 32px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--rose-deep);
  font-size: 17px;
  line-height: 1;
}

.inventory-item-rename-button:hover {
  border-color: var(--rose);
  background: var(--rose-soft);
}

.inventory-quantity-cell strong {
  color: var(--rose-deep);
  font-size: 20px;
}

.inventory-quantity-value {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.stock-status,
.movement-type {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.stock-status.is-stocked {
  background: #e1f7e8;
  color: #28764a;
}

.stock-status.is-out {
  background: #ffe1ea;
  color: #a73055;
}

.movement-type {
  background: var(--rose-soft);
  color: var(--rose-deep);
}

.quantity-in {
  color: #28764a;
  font-weight: 900;
}

.quantity-out {
  color: #a73055;
  font-weight: 900;
}

.inventory-empty-row td {
  padding: 30px 16px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.filter-row {
  justify-content: flex-end;
}

.filter-row input,
.filter-row select {
  width: auto;
  min-width: 150px;
}

.filter-row input {
  min-width: 220px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1260px;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-small);
  background: rgba(255, 253, 248, 0.72);
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(244, 212, 222, 0.82);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

td {
  font-size: 14px;
}

tbody tr:hover {
  background: rgba(255, 134, 182, 0.08);
}

.money-cell,
.number-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.name-cell {
  min-width: 180px;
  font-weight: 800;
}

.note-line {
  display: block;
  max-width: 220px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge,
.status-select {
  border-radius: 999px;
  font-weight: 900;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
}

.status-select {
  width: 150px;
  min-height: 34px;
  border-color: transparent;
  padding: 0 10px;
  font-size: 12px;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.72);
}

.status-draft {
  background: #fff1cb;
  color: #8a5a03;
}

.status-made {
  background: #ffe3ef;
  color: #a73c70;
}

.status-ready {
  background: #dff8f5;
  color: #2f766f;
}

.status-postage {
  background: #ffd7e4;
  color: #a73055;
}

.status-shipping {
  background: #dfefff;
  color: #326ca8;
}

.status-payment {
  background: #f0e0ff;
  color: #7b42b7;
}

.status-done {
  background: #e1f7e8;
  color: #28764a;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.row-action-content {
  min-width: 0;
}

.row-image-inline {
  display: none;
}

.row-image-thumb {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(244, 212, 222, 0.94);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(199, 75, 127, 0.1);
}

.row-image-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
}

.icon-button {
  display: inline-grid;
  min-width: 36px;
  place-items: center;
  border-color: var(--line);
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-small);
}

.icon-button:hover {
  border-color: var(--rose);
}

.image-button.has-image {
  border-color: rgba(255, 134, 182, 0.54);
  background: var(--rose-soft);
  color: var(--rose-deep);
}

.delete-button:hover {
  border-color: rgba(239, 111, 97, 0.6);
  color: #bb3328;
}

.mobile-expand-button {
  display: none;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 170px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 18px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid rgba(244, 212, 222, 0.72);
  border-radius: var(--radius);
  background: rgba(91, 53, 72, 0.94);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.chart-tooltip {
  position: fixed;
  z-index: 60;
  min-width: 150px;
  padding: 10px 12px;
  border: 1px solid rgba(241, 207, 221, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.98);
  color: var(--text);
  box-shadow: 0 16px 38px rgba(213, 121, 150, 0.18);
  pointer-events: none;
}

.chart-tooltip strong,
.chart-tooltip span {
  display: block;
}

.chart-tooltip strong {
  margin-bottom: 8px;
  font-size: 13px;
}

.chart-tooltip span {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chart-tooltip em {
  color: var(--text);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.image-preview-panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(91, 53, 72, 0.22);
  backdrop-filter: blur(10px);
}

.image-preview-panel[hidden] {
  display: none;
}

.image-preview-card {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(244, 212, 222, 0.94);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 24px 70px rgba(91, 53, 72, 0.22);
}

.image-preview-header,
.image-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-preview-header {
  margin-bottom: 14px;
}

.image-preview-header h3 {
  margin: 0;
  font-size: 20px;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}

.image-preview-item {
  min-width: 0;
}

.image-preview-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid rgba(244, 212, 222, 0.86);
  border-radius: 20px;
  background: #fff;
}

.image-preview-name {
  margin-top: 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview-empty {
  padding: 28px 16px;
  border: 1px dashed var(--line);
  border-radius: 22px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.image-preview-actions {
  margin-top: 14px;
}

.inventory-modal {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(91, 53, 72, 0.24);
  backdrop-filter: blur(10px);
}

.inventory-modal[hidden] {
  display: none;
}

.inventory-modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  border: 1px solid rgba(244, 212, 222, 0.94);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.99);
  box-shadow: 0 24px 70px rgba(91, 53, 72, 0.22);
}

.inventory-records-card {
  width: min(1180px, 100%);
}

.inventory-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.inventory-modal-header h3 {
  margin: 0;
  font-size: 22px;
}

.inventory-intake-card form {
  display: grid;
  gap: 14px;
}

.inventory-name-field input {
  padding-right: 48px;
}

.inventory-name-clear {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 3px;
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  touch-action: manipulation;
}

.inventory-name-clear[hidden] {
  display: none;
}

.inventory-name-clear:hover {
  background: var(--rose-soft);
  color: var(--rose-deep);
}

.inventory-name-clear:focus-visible,
.inventory-item-rename-button:focus-visible {
  outline: 3px solid rgba(255, 134, 182, 0.34);
  outline-offset: 2px;
}

.purchase-pair-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 10px;
  min-width: 0;
}

.purchase-pair-row label,
.purchase-pair-row input {
  min-width: 0;
}

.inventory-modal-actions {
  margin-top: 2px;
}

.modal-close-button {
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.inventory-rename-card {
  width: min(440px, 100%);
}

.inventory-rename-card form {
  display: grid;
  gap: 14px;
}

.inventory-form-error {
  margin: -4px 0 0;
  padding: 9px 11px;
  border-radius: 12px;
  background: #ffe5ed;
  color: #a73055;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.inventory-form-error[hidden] {
  display: none;
}

.inventory-record-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding: 5px;
  border: 1px solid rgba(244, 212, 222, 0.86);
  border-radius: 20px;
  background: var(--surface-soft);
}

.record-filter {
  flex: 0 0 auto;
}

.inventory-records-table {
  min-width: 1180px;
}

.inventory-records-table td {
  max-width: 230px;
  overflow-wrap: anywhere;
}

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

  .dashboard-grid,
  .entry-layout,
  .history-layout {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  body {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 14px;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(241, 207, 221, 0.88);
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
  }

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

  .brand-meta {
    margin-top: 6px;
  }

  .sidebar-panel {
    display: none;
    margin-top: 0;
    padding: 12px 14px;
  }

  .sidebar-panel strong {
    margin: 4px 0 2px;
    font-size: 22px;
  }

  .nav-tabs {
    display: none;
  }

  .nav-tab {
    justify-content: center;
    min-height: 42px;
    padding: 0 10px;
  }

  .main-content {
    padding: 14px;
  }

  .mobile-bottom-tabs {
    position: fixed;
    z-index: 30;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 1px dashed rgba(244, 212, 222, 0.96);
    border-radius: 24px;
    background: rgba(255, 253, 248, 0.94);
    box-shadow: 0 16px 42px rgba(213, 121, 150, 0.20);
    backdrop-filter: blur(18px);
  }

  .mobile-bottom-tab {
    display: grid;
    gap: 2px;
    min-height: 44px;
    place-items: center;
    border: 0;
    border-radius: 18px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    line-height: 1.1;
  }

  .mobile-bottom-tab.is-active {
    background: linear-gradient(135deg, var(--rose), var(--peach));
    color: #fff;
    box-shadow: 0 10px 24px rgba(255, 134, 182, 0.26);
  }

  .mobile-tab-icon {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    color: currentColor;
    font-size: 22px;
    line-height: 1;
  }

  body.mobile-tab-overview #overviewPage {
    display: block;
  }

  body.mobile-tab-overview #ordersPage {
    display: none;
  }

  body.mobile-tab-new #overviewPage,
  body.mobile-tab-details #overviewPage {
    display: none;
  }

  body.mobile-tab-new #ordersPage,
  body.mobile-tab-details #ordersPage {
    display: block;
  }

  body.mobile-tab-new .details-workspace {
    display: none;
  }

  body.mobile-tab-details .entry-layout {
    display: none;
  }

  body.mobile-tab-details .details-workspace {
    display: block;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
  }

  .topbar h2 {
    font-size: 28px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .topbar-actions button,
  .form-actions button {
    width: 100%;
  }

  .form-grid,
  .calc-strip {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .blank-source-row {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 8px;
  }

  .blank-source-row select,
  .blank-source-row input {
    padding-right: 8px;
    padding-left: 8px;
  }

  .image-upload-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .upload-button {
    justify-content: center;
    width: 100%;
    min-height: 46px;
  }

  .upload-meta {
    text-align: center;
    white-space: normal;
  }

  .calc-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
  }

  .calc-strip .mobile-hide-calc {
    display: none;
  }

  .calc-strip .mobile-fee-calc {
    min-width: 0;
    padding: 12px;
  }

  .calc-strip .mobile-fee-calc strong {
    font-size: 22px;
  }

  .auto-fee-field {
    display: none;
  }

  .form-grid label {
    min-width: 0;
  }

  .order-form input,
  .order-form select,
  .order-form textarea {
    min-height: 48px;
    font-size: 16px;
    line-height: 1.35;
    -webkit-user-select: text;
    user-select: text;
  }

  .order-form textarea {
    min-height: 96px;
  }

  #dateInput {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    font-size: 16px;
  }

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

  .metric-card {
    min-height: 104px;
    padding: 15px 13px;
  }

  .metric-card strong {
    margin: 10px 0 6px;
    font-size: 25px;
  }

  .span-2 {
    grid-column: span 1;
  }

  .panel {
    padding: 14px;
  }

  .dashboard-grid,
  .entry-layout {
    gap: 10px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .panel-chip {
    max-width: 100%;
    white-space: normal;
  }

  .wide-panel {
    min-height: 0;
  }

  .filter-row,
  .filter-row input,
  .filter-row select {
    width: 100%;
  }

  .details-subtabs {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-heading {
    align-items: stretch;
  }

  .inventory-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-actions button {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
  }

  .toast {
    right: 14px;
    bottom: 14px;
  }

  .image-preview-panel {
    align-items: end;
    padding: 12px;
  }

  .inventory-modal {
    align-items: end;
    padding: 10px;
  }

  .inventory-modal-card {
    width: 100%;
    max-height: 90vh;
    padding: 16px;
    border-radius: 28px 28px 20px 20px;
  }

  .inventory-intake-card input,
  .inventory-rename-card input,
  .inventory-intake-card textarea {
    min-height: 48px;
    font-size: 16px;
  }

  .inventory-modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-modal-actions button {
    width: 100%;
  }

  .image-preview-card {
    max-height: 86vh;
    padding: 16px;
  }

  .image-preview-actions .ghost-button {
    width: 100%;
  }
}

@media (max-width: 820px) and (hover: none) {
  .nav-tab:active,
  .mobile-bottom-tab:active,
  .primary-button:active,
  .ghost-button:active,
  .icon-button:active,
  .upload-button:active {
    transform: translateY(2px) scale(0.96);
    filter: saturate(1.08);
  }

  .mobile-bottom-tab {
    transition:
      background-color 160ms ease,
      box-shadow 160ms ease,
      color 160ms ease,
      transform 110ms ease;
  }
}

@media (max-width: 640px) {
  .table-wrap {
    overflow-x: visible;
  }

  .inventory-table-wrap,
  .inventory-records-wrap {
    overflow: visible;
  }

  .inventory-table,
  .inventory-records-table {
    min-width: 0;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
  }

  .inventory-records-table td {
    max-width: none;
  }

  .inventory-empty-row {
    padding: 0;
  }

  .inventory-empty-row td {
    display: block;
    padding: 24px 12px;
    border-bottom: 0;
    text-align: center;
  }

  .inventory-empty-row td::before {
    display: none;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tbody tr {
    overflow: hidden;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
  }

  tbody tr:hover {
    background: var(--surface-soft);
  }

  td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid rgba(241, 207, 221, 0.72);
  }

  td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
  }

  .name-cell {
    min-width: 0;
  }

  .note-line {
    max-width: none;
    white-space: normal;
  }

  .status-select {
    width: 100%;
  }

  body.mobile-tab-details tbody tr {
    padding: 14px;
    border-color: rgba(241, 207, 221, 0.92);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 30px rgba(199, 75, 127, 0.12);
  }

  body.mobile-tab-details td.mobile-extra {
    display: none;
  }

  body.mobile-tab-details tbody tr.is-expanded td.mobile-extra {
    display: grid;
  }

  body.mobile-tab-details tbody tr.is-expanded .row-image-inline {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  body.mobile-tab-details .mobile-expand-button {
    display: inline-grid;
  }

  .row-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

@media (max-width: 380px) {
  .metric-grid,
  .topbar-actions {
    grid-template-columns: 1fr;
  }

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

  .brand-meta {
    flex-wrap: wrap;
  }

  td {
    grid-template-columns: 82px minmax(0, 1fr);
  }
}
