:root {
  --brand-900: #0d4638;
  --brand-800: #125a46;
  --brand-700: #18705a;
  --brand-500: #55a884;
  --brand-soft: #e5f2eb;
  --ink: #173b2e;
  --muted-ink: #718078;
  --line: #dfe9e2;
}

.header {
  background: linear-gradient(110deg, var(--brand-900) 0%, var(--brand-800) 58%, #238064 100%);
  box-shadow: 0 10px 28px rgba(10, 50, 39, .18);
}

.header::before {
  height: 2px;
  background: linear-gradient(90deg, transparent, #b9dc78, transparent);
  opacity: .75;
}

.header-inner {
  min-height: 76px;
  gap: 28px;
  padding: 0 30px;
}

.brand {
  text-shadow: none;
  letter-spacing: .07em;
}

.brand:hover {
  transform: none;
}

.brand-mark,
.brand-mark.small {
  background: #d9edb4;
  color: var(--brand-900);
  box-shadow: 0 4px 14px rgba(217, 237, 180, .2);
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.brand:hover .brand-mark {
  transform: none;
  box-shadow: 0 4px 14px rgba(217, 237, 180, .2);
}

nav {
  gap: 3px;
}

nav a,
nav button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #c0d8cc;
  background: transparent;
  box-shadow: none;
  transform: none;
  backdrop-filter: none;
  font-size: 12px;
  letter-spacing: .01em;
}

nav a::before,
nav button::before {
  display: none;
}

nav a:hover,
nav button:hover,
nav a.active,
nav button[aria-expanded="true"] {
  border-color: rgba(224, 244, 205, .16);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  box-shadow: none;
  transform: none;
}

nav a.active::after,
nav button[aria-expanded="true"]::after {
  left: 14px;
  right: 14px;
  bottom: 3px;
  width: auto;
  height: 2px;
  background: #cde99b;
  box-shadow: none;
  transform: none;
}

nav button.finance-trigger::after,
nav button.catalog-trigger::after {
  content: none;
}

.nav-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  color: #b9d7bf;
}

.nav-icon svg,
#logout svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nav-caret {
  margin-left: 1px;
  color: #9cc4ad;
  font-size: 12px;
  line-height: 1;
}

.header-user {
  gap: 9px;
  min-height: 40px;
  padding: 6px 8px 6px 12px;
  border-color: rgba(255, 255, 255, .14);
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  box-shadow: none;
}

.header-user:hover {
  transform: none;
  box-shadow: none;
  background: rgba(255, 255, 255, .12);
}

.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cde99b;
  box-shadow: 0 0 0 3px rgba(205, 233, 155, .14);
}

.header-user button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .12);
  color: #e9f5e8;
  box-shadow: none;
}

.header-user button:hover {
  transform: none;
  background: #d9edb4;
  color: var(--brand-900);
  box-shadow: none;
}

.finance-menu {
  min-width: 214px;
  padding: 7px;
  border: 1px solid #dce8df;
  border-radius: 12px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 16px 36px rgba(23, 59, 46, .18);
}

.finance-menu a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #315844;
  font-size: 13px;
  font-weight: 600;
}

.finance-menu a:hover {
  color: var(--brand-900);
  background: var(--brand-soft);
}

.stock-entry-panel {
  overflow: hidden;
  padding: 0;
  border-color: #dce8df;
  box-shadow: 0 8px 30px rgba(23, 59, 46, .07);
}

.stock-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 23px 26px 20px;
  border-bottom: 1px solid #e6eee8;
  background: linear-gradient(135deg, #f6faf5, #edf6ee);
}

.stock-entry-head h2 {
  margin: 0 0 5px;
  color: var(--ink);
  font: 800 18px/1.2 Manrope, sans-serif;
}

.stock-entry-head p {
  margin: 0;
  max-width: 600px;
  color: var(--muted-ink);
  font-size: 13px;
}

.stock-entry-form-body {
  padding: 25px 26px 27px;
}

.stock-entry-form-body .form-grid {
  gap: 18px 24px;
}

.stock-entry-form-body .field-cost_price input,
.stock-entry-form-body .field-sale_price input {
  background: #fffaf0;
  border-color: #e8d6a7;
}

.stock-entry-form-body .field-margin input {
  background: #f1edfa;
  border-color: #c6b9df;
  color: #604a89;
  font-weight: 800;
}

.stock-entry-type {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfdfb;
}

.stock-entry-type > span {
  color: #546b5b;
  font-size: 12px;
  font-weight: 700;
}

.stock-entry-type label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #375744;
  font-size: 13px;
  font-weight: 700;
}

.stock-entry-type input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--brand-700);
}

.stock-entry-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid #edf2ee;
}

.stock-history-panel h2 {
  display: flex;
  align-items: center;
  gap: 9px;
}

.stock-history-panel h2::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #55a884;
}

.stock-history-panel .stock-history-table {
  min-width: 900px;
}

.stock-history-panel .movement-in {
  background: #e6f4e9;
  color: #2b7848;
}

.stock-history-panel .movement-out {
  background: #fff0e9;
  color: #a9583d;
}

.stock-history-panel .product-movement-badge {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .header-inner {
    padding: 12px 20px;
  }
}

@media (max-width: 700px) {
  .stock-entry-head,
  .stock-entry-form-body {
    padding: 19px;
  }

  .stock-entry-head {
    display: block;
  }

  .stock-entry-type {
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 16px;
  }
}

.stock-history-filters {
  align-items: end;
  margin: 17px 0 21px;
  padding: 14px;
  border: 1px solid #e5eee7;
  border-radius: 10px;
  background: #fbfdfb;
}

.stock-history-filters label {
  flex: 1 1 320px;
  max-width: 520px;
}

.stock-history-filters input {
  min-height: 40px;
}

.stock-history-panel .pager {
  margin-top: 17px;
}

@media (max-width: 700px) {
  .stock-history-filters .btn {
    flex: 1 1 auto;
  }
}

.stock-product-code {
  min-width: 0;
}

.stock-code-input {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.stock-code-input input {
  min-width: 0;
  flex: 1;
}

.stock-code-input .btn {
  flex: 0 0 auto;
  padding-inline: 13px;
}

.stock-product-code small {
  min-height: 15px;
  color: #7a8b80;
  font-size: 11px;
  font-weight: 500;
}

.stock-product-code small.stock-product-error {
  color: #b95744;
}

.stock-history-shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid #e5eee7;
  border-radius: 10px;
  background: #fbfdfb;
}

.stock-history-shortcut p {
  margin: 0;
  color: #75847b;
  font-size: 13px;
}

.stock-history-dialog {
  width: min(96vw, 1280px);
  max-width: 1280px;
  padding: 0;
  overflow: hidden;
}

.stock-history-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px 20px;
  border-bottom: 1px solid #e5eee7;
  background: linear-gradient(135deg, #f6faf5, #edf6ee);
}

.stock-history-dialog-head h2 {
  margin: 0 0 5px;
  font: 800 21px/1.2 Manrope, sans-serif;
  color: #173b2e;
}

.stock-history-dialog-head p {
  margin: 0;
}

.dialog-close {
  width: 34px;
  height: 34px;
  border: 1px solid #dce8df;
  border-radius: 9px;
  background: #fff;
  color: #557565;
  font-size: 22px;
  line-height: 1;
}

.dialog-close:hover {
  background: #e5f2eb;
  color: #0d4638;
}

.stock-history-dialog .stock-history-filters {
  display: grid;
  grid-template-columns: 150px 150px minmax(240px, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin: 0;
  padding: 20px 28px;
  border: 0;
  border-bottom: 1px solid #e7eee8;
  border-radius: 0;
  background: #fff;
}

#edit-form-dialog:has(.cash-open-intro) {
  width: min(520px, calc(100% - 28px));
  padding: 28px;
  border: 1px solid #dce8df;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(13, 50, 37, .24);
}

#edit-form-dialog:has(.cash-open-intro) h2 {
  margin: 0 0 8px;
  color: #123f30;
  font: 800 24px/1.2 Manrope, sans-serif;
}

.cash-open-intro {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  padding: 14px 16px;
  border: 1px solid #d7eadb;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0f8ef, #e7f3e9);
  color: #426650;
  font-size: 13px;
  line-height: 1.55;
}

#edit-form-dialog:has(.cash-open-intro) .form-grid {
  gap: 17px;
}

#edit-form-dialog:has(.cash-open-intro) input {
  min-height: 46px;
  border-radius: 10px;
}

#edit-form-dialog:has(.cash-open-intro) .form-actions {
  margin-top: 22px;
}

@media (max-width: 560px) {
  #edit-form-dialog:has(.cash-open-intro) {
    padding: 22px 18px;
  }
}

.stock-history-dialog .stock-modal-search {
  max-width: none;
}

.stock-modal-filter-actions {
  display: flex;
  gap: 8px;
}

.stock-modal-results {
  padding: 22px 28px 26px;
}

.stock-history-dialog .stock-history-table {
  min-width: 980px;
}

.stock-modal-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 17px;
  color: #7b8a80;
  font-size: 12px;
}

.stock-modal-pager > div {
  display: flex;
  gap: 8px;
}

@media (max-width: 800px) {
  .stock-history-dialog .stock-history-filters {
    grid-template-columns: 1fr 1fr;
  }

  .stock-history-dialog .stock-modal-search,
  .stock-modal-filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .stock-history-shortcut {
    align-items: stretch;
    flex-direction: column;
  }

  .stock-history-dialog-head,
  .stock-modal-results {
    padding-inline: 18px;
  }

  .stock-history-dialog .stock-history-filters {
    grid-template-columns: 1fr;
    padding-inline: 18px;
  }

  .stock-history-dialog .stock-modal-search,
  .stock-modal-filter-actions {
    grid-column: auto;
  }

  .stock-modal-filter-actions .btn {
    flex: 1;
  }

  .stock-modal-pager {
    align-items: stretch;
    flex-direction: column;
  }
}
