:root {
  --ink: #172019;
  --muted: #718078;
  --line: #e5ebe6;
  --paper: #f5f7f4;
  --white: #fff;
  --green: #b9f448;
  --green-dark: #101a13;
  --teal: #4db89b;
  --amber: #f3bd5d;
  --blue: #7ca9ef;
  --danger: #d74b4b;
  --shadow: 0 18px 50px rgba(22, 35, 26, 0.09);
  --radius: 18px;
}
* {
  box-sizing: border-box;
}
html {
  font-size: 16px;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
.app-shell {
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 245px;
  padding: 32px 22px 24px;
  background: #111a14;
  color: #eaf1eb;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-heading {
  margin: 19px 13px 2px;
  color: #66756b;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.25px;
  text-transform: uppercase;
}
.nav-heading:first-child {
  margin-top: 0;
}
.nav-item {
  border: 0;
  background: transparent;
  color: #91a097;
  padding: 12px 13px;
  border-radius: 11px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  transition: 0.18s;
}
.nav-item:hover {
  color: #fff;
  background: #1a271f;
}
.nav-item.active {
  color: #162016;
  background: var(--green);
}
.nav-icon {
  font-size: 19px;
  width: 20px;
  text-align: center;
}
.nav-count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.13);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
}
.nav-item.active .nav-count {
  background: rgba(13, 25, 17, 0.12);
}
.main {
  margin-left: 245px;
  min-height: 100vh;
  padding: 0 42px 55px;
}
.topbar {
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 24px;
}
.topbar h1 {
  margin: 0;
  font: 700 25px "Manrope";
  letter-spacing: -0.8px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.search-wrap {
  width: 235px;
  height: 43px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
}
.search-wrap span {
  font-size: 20px;
  color: #89968e;
}
.search-wrap input {
  border: 0;
  outline: 0;
  width: 100%;
  font-size: 13px;
  background: transparent;
}
.btn {
  border: 0;
  border-radius: 11px;
  min-height: 43px;
  padding: 0 18px;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.btn-primary {
  background: var(--green-dark);
  color: #fff;
}
.btn-primary:hover {
  background: #25372a;
}
.btn-secondary {
  background: #edf1ed;
  color: #344038;
}
.btn-danger {
  background: #fff0f0;
  color: var(--danger);
}
.mobile-menu {
  display: none;
  border: 0;
  background: transparent;
  font-size: 22px;
}
.view {
  display: none;
}
.view.active {
  display: block;
}
#dashboardView {
  padding-top: 24px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}
.metric-card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 21px;
  box-shadow: 0 4px 18px rgba(28, 42, 31, 0.025);
}
.metric-card.dark-card {
  background: #18221b;
  color: #fff;
  border-color: #18221b;
}
.metric-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #738078;
}
.dark-card .metric-top {
  color: #aebbb1;
}
.metric-icon {
  width: 29px;
  height: 29px;
  border-radius: 9px;
  background: var(--green);
  color: #152016;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.metric-icon.light {
  background: #e9f8cc;
}
.metric-icon.amber {
  background: #fff2d9;
}
.metric-icon.blue {
  background: #e4eefe;
}
.metric-value {
  font: 700 27px "Manrope";
  letter-spacing: -1px;
  margin: 20px 0 7px;
}
.metric-value small {
  font: 600 13px "DM Sans";
  color: #85928a;
  letter-spacing: 0;
}
.metric-foot {
  color: #89948e;
  font-size: 11px;
}
.metric-foot strong {
  color: #536159;
}
.dark-card .metric-foot {
  color: #829087;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, 0.75fr);
  gap: 15px;
  margin-top: 15px;
}
.lower-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.65fr);
}
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  min-width: 0;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.panel h2 {
  margin: 0;
  font: 700 16px "Manrope";
  letter-spacing: -0.3px;
}
.legend {
  display: flex;
  gap: 15px;
  font-size: 11px;
  color: #758178;
}
.legend i,
.status-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}
.profit-dot {
  background: #1b281f;
}
.revenue-dot {
  background: #cfe99c;
}
.chart {
  height: 210px;
  margin-top: 16px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 8px 0;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 49px,
    #f0f3f0 50px
  );
}
.empty-chart {
  margin: auto;
  color: #9aa49e;
  font-size: 12px;
  align-self: center;
}
.bar-group {
  height: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  position: relative;
  min-width: 25px;
}
.bar {
  width: min(16px, 38%);
  border-radius: 5px 5px 0 0;
  min-height: 2px;
  transition: 0.3s;
}
.bar.revenue {
  background: #dff0bd;
}
.bar.profit {
  background: #26362b;
}
.bar-label {
  position: absolute;
  bottom: -20px;
  font-size: 9px;
  color: #87928b;
  white-space: nowrap;
}
.chart-panel {
  padding-bottom: 33px;
}
.donut-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  min-height: 217px;
}
.donut {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(
    var(--green) 0 33%,
    var(--teal) 33% 66%,
    #27382d 66%
  );
  position: relative;
}
.donut:after {
  content: "";
  position: absolute;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: #fff;
}
.donut > div {
  z-index: 1;
  text-align: center;
}
.donut strong,
.donut span {
  display: block;
}
.donut strong {
  font: 700 24px "Manrope";
}
.donut span {
  font-size: 10px;
  color: #8a958e;
}
.status-legend {
  min-width: 120px;
}
.status-legend div {
  display: grid;
  grid-template-columns: 15px 1fr auto;
  align-items: center;
  margin: 13px 0;
  font-size: 11px;
  color: #758179;
}
.status-legend strong {
  color: #243027;
}
.sold-color {
  background: #27382d;
}
.text-btn {
  border: 0;
  background: transparent;
  color: #506057;
  font-weight: 700;
  font-size: 11px;
}
.recent-list {
  margin-top: 13px;
}
.recent-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #edf0ed;
  cursor: pointer;
}
.recent-thumb,
.item-thumb {
  background: #eff3ef;
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #829087;
}
.recent-thumb {
  width: 42px;
  height: 42px;
}
.recent-thumb img,
.item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.recent-info strong,
.recent-info span {
  display: block;
}
.recent-info strong {
  font-size: 12px;
}
.recent-info span {
  font-size: 10px;
  color: #8a958d;
  margin-top: 3px;
}
.recent-price {
  text-align: right;
}
.recent-price strong,
.recent-price span {
  display: block;
  font-size: 12px;
}
.recent-price span {
  font-size: 9px;
  color: #7a897f;
  margin-top: 3px;
}
.positive {
  color: #4c8c31 !important;
}
.negative {
  color: #ca4b4b !important;
}
.channel-list {
  margin-top: 18px;
}
.channel-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
  margin-bottom: 17px;
  font-size: 11px;
}
.channel-row strong {
  font-size: 11px;
}
.channel-bar {
  grid-column: 1/-1;
  height: 5px;
  background: #eef1ee;
  border-radius: 5px;
  overflow: hidden;
}
.channel-bar i {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 5px;
}
.items-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 16px;
}
.filter-tabs {
  display: flex;
  background: #e9ede9;
  border-radius: 11px;
  padding: 4px;
  gap: 2px;
}
.filter-tabs button {
  border: 0;
  background: transparent;
  padding: 8px 15px;
  border-radius: 8px;
  color: #758078;
  font-size: 12px;
  font-weight: 600;
}
.filter-tabs button.active {
  background: #fff;
  color: #1f2b22;
  box-shadow: 0 2px 8px rgba(31, 45, 34, 0.08);
}
.items-toolbar p {
  font-size: 12px;
  color: #7b887f;
}
.items-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}
th {
  text-align: left;
  padding: 14px 18px;
  background: #fafbfa;
  color: #89948d;
  font-size: 10px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}
td {
  padding: 14px 18px;
  border-top: 1px solid #edf0ed;
  font-size: 12px;
}
tbody tr {
  cursor: pointer;
}
tbody tr:hover {
  background: #fbfcfb;
}
.item-cell {
  display: flex;
  align-items: center;
  gap: 11px;
}
.item-thumb {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}
.item-name strong,
.item-name span {
  display: block;
}
.item-name strong {
  font-size: 13px;
}
.item-name span {
  font-size: 10px;
  color: #89948e;
  margin-top: 3px;
}
.status-pill {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: capitalize;
}
.status-sold {
  background: #ebf8d3;
  color: #54772c;
}
.status-purchased {
  background: #fff2d9;
  color: #8b641f;
}
.status-received {
  background: #e5eefc;
  color: #426a9f;
}
.status-prepared {
  background: #efe8fb;
  color: #7352a5;
}
.status-published {
  background: #e5f8f2;
  color: #25816a;
}
.row-menu {
  border: 0;
  background: transparent;
  font-size: 18px;
  color: #7e8a82;
}
.empty-state {
  text-align: center;
  padding: 70px 20px;
}
.empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: #edf2eb;
  margin: 0 auto 15px;
  display: grid;
  place-items: center;
  font-size: 26px;
}
.empty-state h3 {
  font: 700 17px "Manrope";
  margin: 0;
}
.empty-state p {
  font-size: 12px;
  color: #839087;
  margin: 7px 0 18px;
}
.hidden {
  display: none !important;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}
.modal.open {
  display: block;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 16, 11, 0.58);
  backdrop-filter: blur(4px);
}
.modal-panel {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: min(760px, 100%);
  background: #f8faf7;
  box-shadow: -20px 0 70px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.25s ease;
}
@keyframes slideIn {
  from {
    transform: translateX(30px);
    opacity: 0.6;
  }
}
.modal-head {
  padding: 23px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h2 {
  font: 700 21px "Manrope";
  margin: 0;
}
.close-btn {
  border: 0;
  background: #f0f3f0;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  font-size: 24px;
  color: #69756d;
}
.modal form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.form-body {
  overflow-y: auto;
  padding: 20px 28px 35px;
}
.form-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 21px;
  margin-bottom: 14px;
}
.section-title {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-bottom: 19px;
}
.section-title > span {
  font: 700 10px "Manrope";
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f8c7;
}
.section-title h3 {
  margin: 0;
  font: 700 14px "Manrope";
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.span-2 {
  grid-column: 1/-1;
}
.field > span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #66736b;
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #dfe5df;
  border-radius: 9px;
  background: #fbfcfb;
  padding: 10px 11px;
  outline: 0;
  font-size: 12px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #93bc44;
  box-shadow: 0 0 0 3px rgba(185, 244, 72, 0.14);
}
.money-field > div {
  position: relative;
}
.money-field b {
  position: absolute;
  left: 11px;
  top: 10px;
  font-size: 12px;
  color: #879188;
}
.money-field input {
  padding-left: 25px;
}
.cost-preview,
.profit-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f2f5f1;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 11px;
}
.cost-preview strong,
.profit-preview strong {
  font: 700 15px "Manrope";
}
.profit-preview {
  background: #eff9dd;
}
.upload-block {
  border: 1px dashed #cdd6ce;
  border-radius: 11px;
  padding: 13px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.upload-block strong,
.upload-block span {
  display: block;
}
.upload-block strong {
  font-size: 11px;
}
.upload-block span {
  font-size: 9px;
  color: #89948e;
  margin-top: 3px;
}
.upload-button {
  background: #edf1ed;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.upload-button input {
  display: none;
}
.image-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.preview-image {
  position: relative;
  width: 72px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  background: #edf0ed;
}
.preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preview-image button {
  position: absolute;
  top: 3px;
  right: 3px;
  border: 0;
  background: rgba(15, 25, 18, 0.78);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
}
.stage-section {
  position: relative;
  transition:
    border-color 0.2s,
    opacity 0.2s;
}
.stage-section.current-stage {
  border-color: #9bc84a;
  box-shadow: 0 0 0 3px rgba(185, 244, 72, 0.12);
}
.stage-section.future-stage {
  opacity: 0.68;
}
.stage-section.future-stage:focus-within {
  opacity: 1;
}
.subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 9px;
  font-size: 11px;
}
.expense-list {
  display: grid;
  gap: 8px;
}
.expense-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 125px 34px;
  gap: 8px;
}
.expense-row input {
  width: 100%;
  border: 1px solid #dfe5df;
  border-radius: 9px;
  background: #fbfcfb;
  padding: 10px 11px;
  outline: 0;
  font-size: 12px;
}
.expense-amount {
  position: relative;
}
.expense-amount span {
  position: absolute;
  left: 11px;
  top: 10px;
  color: #879188;
  font-size: 12px;
}
.expense-amount input {
  padding-left: 25px;
}
.expense-remove {
  border: 0;
  border-radius: 9px;
  background: #fff0f0;
  color: var(--danger);
}
.marketplace-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.marketplace-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #dfe5df;
  border-radius: 9px;
  padding: 10px;
  font-size: 11px;
  cursor: pointer;
}
.marketplace-options input {
  width: auto;
  accent-color: #18221b;
}
.purchased-color {
  background: #f3bd5d;
}
.received-color {
  background: #7ca9ef;
}
.prepared-color {
  background: #9d7bea;
}
.published-color {
  background: #4db89b;
}
.notes-section {
  margin-bottom: 0;
}
.form-footer {
  display: flex;
  gap: 9px;
  padding: 15px 28px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.footer-spacer {
  flex: 1;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: #18221b;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 12px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  box-shadow: var(--shadow);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.error {
  background: #a93636;
}
@media (max-width: 1050px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .status-panel {
    min-height: 260px;
  }
  .lower-grid {
    grid-template-columns: 1fr 1fr;
  }
  .search-wrap {
    width: 190px;
  }
}
@media (max-width: 760px) {
  .sidebar {
    transform: translateX(-100%);
    transition: 0.25s;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
    padding: 0 16px 35px;
  }
  .topbar {
    height: 92px;
  }
  .mobile-menu {
    display: block;
  }
  .topbar > div:nth-child(2) {
    margin-right: auto;
  }
  .topbar h1 {
    font-size: 18px;
  }
  .header-actions .search-wrap {
    display: none;
  }
  .btn {
    padding: 0 13px;
  }
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }
  .lower-grid {
    grid-template-columns: 1fr;
  }
  .form-body,
  .modal-head,
  .form-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: auto;
  }
  .items-toolbar {
    align-items: flex-end;
  }
  .filter-tabs button {
    padding: 8px 10px;
  }
}
@media (max-width: 480px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
  .header-actions .btn span {
    display: none;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 17px;
  }
  .donut-row {
    gap: 18px;
  }
  .filter-tabs button {
    font-size: 10px;
    padding: 7px 8px;
  }
  .items-toolbar p {
    display: none;
  }
  .upload-block {
    align-items: flex-start;
    flex-direction: column;
  }
  .upload-button {
    width: 100%;
    text-align: center;
  }
}

/* Bootstrap Icons and responsive refinements */
.bi {
  line-height: 1;
}
.nav-icon {
  font-size: 17px;
}
.metric-icon .bi {
  font-size: 14px;
}
.mobile-menu {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid var(--line);
  place-items: center;
  flex: 0 0 auto;
}
.mobile-menu .bi {
  font-size: 22px;
}
.search-wrap .bi {
  font-size: 14px;
  color: #89968e;
}
.search-wrap input {
  min-width: 0;
}
.btn .bi,
.upload-button .bi,
.text-btn .bi {
  font-size: 12px;
}
.close-btn {
  display: grid;
  place-items: center;
}
.close-btn .bi {
  font-size: 15px;
}
.empty-icon .bi {
  font-size: 22px;
}
.row-menu {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}
.row-menu:hover {
  background: #edf1ed;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(7, 13, 9, 0.52);
  backdrop-filter: blur(2px);
  z-index: 19;
}
.preview-image button {
  display: grid;
  place-items: center;
  padding: 0;
}
.preview-image button .bi {
  font-size: 13px;
}
.recent-thumb .bi,
.item-thumb .bi {
  font-size: 16px;
}
.page-heading {
  min-width: 0;
}

@media (max-width: 1200px) {
  .main {
    padding-left: 28px;
    padding-right: 28px;
  }
  .metric-card {
    padding: 18px;
  }
  .dashboard-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(275px, 0.75fr);
  }
}

@media (max-width: 1050px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .lower-grid {
    grid-template-columns: 1fr 1fr;
  }
  .status-panel {
    min-height: 0;
  }
  .donut-row {
    min-height: 190px;
  }
  .chart {
    height: 230px;
  }
}

@media (max-width: 900px) {
  body.nav-open {
    overflow: hidden;
  }
  .sidebar {
    width: min(290px, 86vw);
    transform: translateX(-105%);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.22);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop.open {
    display: block;
  }
  .main {
    margin-left: 0;
    padding: 0 24px 40px;
  }
  .mobile-menu {
    display: grid;
  }
  .topbar {
    height: 96px;
  }
  .topbar .page-heading {
    margin-right: auto;
  }
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .header-actions {
    flex: 0 0 auto;
  }
  .search-wrap {
    width: 210px;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 0 16px 32px;
  }
  .topbar {
    height: auto;
    min-height: 0;
    padding: 16px 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
  }
  .topbar .page-heading {
    margin: 0;
  }
  .topbar h1 {
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-actions {
    grid-column: 1/-1;
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
  }
  .header-actions .search-wrap {
    display: flex;
    width: auto;
    min-width: 0;
    height: 42px;
  }
  .header-actions .btn {
    height: 42px;
  }
  .metric-grid {
    gap: 10px;
  }
  .metric-card {
    padding: 16px;
    border-radius: 15px;
  }
  .metric-value {
    font-size: 23px;
    margin: 15px 0 6px;
  }
  .dashboard-grid {
    gap: 10px;
    margin-top: 10px;
  }
  .lower-grid {
    grid-template-columns: 1fr;
  }
  .panel {
    border-radius: 15px;
  }
  .chart {
    height: 205px;
    gap: 5px;
  }
  .donut-row {
    justify-content: space-around;
  }
  .items-toolbar {
    padding: 16px 0 12px;
    gap: 10px;
    overflow-x: auto;
  }
  .filter-tabs {
    flex: 0 0 auto;
  }
  .items-panel {
    border-radius: 15px;
  }
  .table-wrap {
    overflow-x: auto;
  }
  table {
    min-width: 570px;
  }
  th:nth-child(3),
  td:nth-child(3),
  th:nth-child(5),
  td:nth-child(5) {
    display: none;
  }
  .modal-panel {
    width: 100%;
    height: 100dvh;
  }
  .modal-head {
    padding-top: max(16px, env(safe-area-inset-top));
  }
  .form-body {
    padding-bottom: 24px;
  }
  .form-footer {
    padding-bottom: max(15px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 480px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .topbar h1 {
    font-size: 16px;
  }
  .header-actions {
    grid-template-columns: minmax(0, 1fr) 42px;
  }
  .header-actions .btn {
    width: 42px;
    padding: 0;
  }
  .header-actions .btn span {
    display: none;
  }
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metric-card {
    min-height: 132px;
  }
  .metric-card .metric-top > span:first-child {
    max-width: 105px;
  }
  .metric-value {
    font-size: 21px;
  }
  .metric-foot {
    line-height: 1.35;
  }
  .panel {
    padding: 16px;
  }
  .panel-head {
    gap: 12px;
  }
  .legend {
    gap: 9px;
  }
  .donut-row {
    flex-direction: column;
    gap: 8px;
    padding: 20px 0;
  }
  .status-legend {
    width: 180px;
  }
  .status-legend div {
    margin: 9px 0;
  }
  .recent-item {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }
  .recent-info {
    min-width: 0;
  }
  .recent-info strong,
  .recent-info span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .filter-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .filter-tabs button {
    padding: 8px 4px;
  }
  .items-toolbar {
    width: 100%;
  }
  .items-toolbar p {
    display: none;
  }
  table {
    min-width: 0;
  }
  th:nth-child(4),
  td:nth-child(4) {
    display: none;
  }
  th,
  td {
    padding: 12px 9px;
  }
  th:first-child,
  td:first-child {
    padding-left: 13px;
  }
  .item-thumb {
    width: 38px;
    height: 38px;
  }
  .item-name {
    max-width: 130px;
  }
  .item-name strong,
  .item-name span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .status-pill {
    padding: 5px 7px;
  }
  .row-menu {
    width: 26px;
  }
  .form-section {
    padding: 17px;
  }
  .form-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .form-footer .footer-spacer {
    display: none;
  }
  .form-footer #deleteItemBtn {
    grid-column: 1/-1;
    order: 3;
  }
  .upload-block {
    gap: 10px;
  }
  .upload-button {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
  }
  .profit-preview,
  .cost-preview {
    grid-column: 1/-1;
  }
  .marketplace-options {
    grid-template-columns: 1fr;
  }
  .expense-row {
    grid-template-columns: minmax(0, 1fr) 105px 34px;
  }
}

@media (max-width: 370px) {
  .main {
    padding-left: 11px;
    padding-right: 11px;
  }
  .topbar {
    gap: 8px;
  }
  .mobile-menu {
    width: 38px;
    height: 38px;
  }
  .topbar h1 {
    font-size: 15px;
  }
  .header-actions .btn {
    padding: 0 11px;
  }
  .metric-grid {
    grid-template-columns: 1fr;
  }
  .metric-card {
    min-height: auto;
  }
  .item-name {
    max-width: 105px;
  }
  th,
  td {
    padding-left: 6px;
    padding-right: 6px;
  }
}

.donut {
  transition: background 0.3s ease;
}
.donut.empty:after {
  width: 96px;
  height: 96px;
}
.donut.empty strong {
  color: #68756d;
}
.donut.empty span {
  color: #9aa49e;
}

/* Single-page stock workflow */
.stock-shell {
  min-height: 100vh;
  padding: 0 32px 48px;
}
.stock-header {
  min-height: 102px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.stock-header h1 {
  margin: 0;
  font: 700 25px "Manrope", sans-serif;
  letter-spacing: -0.8px;
}
.stock-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.stock-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stock-actions .search-wrap {
  width: 250px;
}
.stock-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 22px 0 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
}
.stock-summary > div {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.stock-summary > div:last-child {
  border-right: 0;
}
.stock-summary span {
  color: var(--muted);
  font-size: 10px;
}
.stock-summary strong {
  font: 700 16px "Manrope", sans-serif;
  white-space: nowrap;
}
.summary-money {
  background: #fafbf9;
}
.workflow-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(245px, 1fr));
  gap: 12px;
  align-items: start;
}
.board-column {
  min-width: 0;
  background: #eef1ed;
  border-radius: 16px;
  padding: 12px;
}
.board-column > header {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 3px 3px 12px;
}
.board-column h2 {
  margin: 0;
  font: 700 12px "Manrope", sans-serif;
}
.board-column header b {
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: #fff;
  font-size: 10px;
}
.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.stage-purchased .stage-dot { background: #f3bd5d; }
.stage-received .stage-dot { background: #7ca9ef; }
.stage-prepared .stage-dot { background: #9d7bea; }
.stage-published .stage-dot { background: #4db89b; }
.board-list {
  display: grid;
  gap: 9px;
}
.column-empty {
  padding: 28px 10px;
  border: 1px dashed #ccd4cd;
  border-radius: 11px;
  color: #919b94;
  text-align: center;
  font-size: 11px;
}
.stock-card {
  background: #fff;
  border: 1px solid #e0e5e0;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 15px rgba(25, 40, 29, 0.035);
}
.stock-card-top {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 9px;
}
.stock-thumb {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #eff3ef;
  color: #87928b;
}
.stock-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.stock-card-title {
  min-width: 0;
}
.stock-card-title h3 {
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stock-card-title span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}
.icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #77847b;
}
.icon-btn:hover {
  background: #edf1ed;
}
.stock-card-data {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 0 10px;
  font-size: 10px;
  color: var(--muted);
}
.stock-card-data span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.stock-card-data strong {
  color: var(--ink);
  font-size: 11px;
}
.stock-card-actions {
  min-height: 31px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid #edf0ed;
  padding-top: 9px;
}
.card-spacer { flex: 1; }
.proceed-btn,
.ad-progress {
  min-height: 29px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 700;
}
.proceed-btn {
  background: #18221b;
  color: #fff;
}
.ad-progress {
  background: #e5f8f2;
  color: #25725e;
}
.sold-panel {
  margin-top: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.sold-head {
  min-height: 66px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sold-head h2 {
  margin: 0;
  font: 700 14px "Manrope", sans-serif;
}
.sold-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}
.sold-content {
  border-top: 1px solid var(--line);
}
.channels-panel {
  width: min(460px, 100%);
}
.channels-body {
  padding: 20px;
  overflow-y: auto;
}
#channelForm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 16px;
}
#channelForm input {
  min-width: 0;
  border: 1px solid #dfe5df;
  border-radius: 10px;
  padding: 10px 12px;
  outline: 0;
}
.channels-list {
  display: grid;
  gap: 7px;
}
.channels-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px;
  background: #f3f5f2;
  border-radius: 9px;
  font-size: 12px;
}
.channels-list button {
  border: 0;
  background: transparent;
  color: var(--danger);
}
.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 1100px) {
  .stock-summary { grid-template-columns: repeat(3, 1fr); }
  .stock-summary > div:nth-child(3) { border-right: 0; }
  .stock-summary > div:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .workflow-board { overflow-x: auto; grid-template-columns: repeat(4, 280px); padding-bottom: 8px; }
}
@media (max-width: 720px) {
  .stock-shell { padding: 0 14px 30px; }
  .stock-header { padding: 14px 0; align-items: flex-start; flex-direction: column; gap: 12px; }
  .stock-actions { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 42px 42px; }
  .stock-actions .search-wrap { width: auto; }
  .stock-actions .btn { width: 42px; padding: 0; }
  .stock-actions .btn span { display: none; }
  .stock-summary { grid-template-columns: repeat(2, 1fr); margin-top: 14px; }
  .stock-summary > div { border-bottom: 1px solid var(--line); }
  .stock-summary > div:nth-child(2n) { border-right: 0; }
  .stock-summary > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .workflow-board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .board-column { scroll-snap-align: start; }
  .modal-panel { height: 100dvh; }
}
@media (max-width: 430px) {
  .stock-summary > div { padding: 12px; }
  .stock-summary span { font-size: 9px; }
  .stock-summary strong { font-size: 14px; }
  .expense-row { grid-template-columns: minmax(0, 1fr) 92px 34px; }
}

/* Grouped workflow list actions */
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}
.table-proceed,
.return-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 31px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 700;
}
.table-proceed {
  background: #18221b;
  color: #fff;
}
.return-btn {
  background: #fff2d9;
  color: #805d20;
}
.items-panel table {
  min-width: 930px;
}
.channels-button {
  white-space: nowrap;
}
.settings-view {
  padding-top: 24px;
  width: 100%;
}
.settings-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
}
.settings-head h2 {
  margin: 0;
  font: 700 17px "Manrope", sans-serif;
}
.settings-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  margin: 22px 0 16px;
}
.settings-form input {
  min-width: 0;
  border: 1px solid #dfe5df;
  border-radius: 10px;
  padding: 10px 12px;
  outline: 0;
}
.settings-list {
  display: grid;
  gap: 7px;
}
.settings-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 13px;
  background: #f3f5f2;
  border-radius: 9px;
  font-size: 12px;
}
.settings-list button {
  border: 0;
  background: transparent;
  color: var(--danger);
}
.settings-list form {
  margin: 0;
}
.table-proceed,
.return-btn,
.ad-progress,
.row-menu,
.recent-item,
.text-btn {
  text-decoration: none;
}
.page-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #e8f6e8;
  color: #246035;
  font-size: 12px;
  font-weight: 700;
}
.page-alert.error {
  background: #fff0ee;
  color: #a43e32;
}

.nav-item {
  width: 100%;
  text-decoration: none;
}
.sidebar {
  display: flex;
  flex-direction: column;
}
.sidebar .nav {
  flex: 1;
}
.logout-form {
  margin: auto 0 0;
}
.sidebar-logout {
  color: #9fb0a5;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #edf1ed;
}
.login-card {
  width: min(100%, 390px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(24, 34, 27, .09);
}
.login-card h1 {
  margin: 0 0 6px;
  font: 800 25px "Manrope", sans-serif;
}
.login-card > p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
}
.login-form {
  display: grid;
  gap: 16px;
}
.login-form label > span {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 700;
}
.login-form label > div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid #dfe5df;
  border-radius: 10px;
  color: var(--muted);
}
.login-form input {
  min-width: 0;
  width: 100%;
  height: 44px;
  border: 0;
  outline: 0;
  font: inherit;
}
.login-form .btn {
  width: 100%;
  margin-top: 4px;
}
.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fff0ee;
  color: #a43e32;
  font-size: 11px;
  font-weight: 600;
}

@media (max-width: 900px) {
  .header-actions {
    flex: 1 1 auto;
  }
}
@media (max-width: 680px) {
  .header-actions {
    grid-template-columns: minmax(0, 1fr) 42px;
  }
  .header-actions .btn {
    width: 42px;
    padding: 0;
  }
  .header-actions .btn span {
    display: none;
  }
}

.subcategory-panel + .subcategory-panel { margin-top: 16px; }

#itemModal button:disabled { cursor: wait; opacity: .65; }
.save-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: save-spin .8s linear infinite;
}
@keyframes save-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .save-spinner { animation: none; }
}
