.calendar-panel {
  margin-top: 16px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.calendar-title-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.calendar-title-row h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.08em;
}

.calendar-month-name {
  font-size: 32px;
  font-weight: 800;
  color: #d62828;
  line-height: 1;
  text-transform: uppercase;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  min-height: 120px;
  height: 150px;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calendar-cell.empty {
  border-color: transparent;
  background: transparent;
  min-height: 0;
}

.calendar-cell.has-events {
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(0, 163, 255, 0.2);
}

.calendar-cell.past-day {
  background: #eef8ff;
}

.calendar-cell.today {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 163, 255, 0.22);
}

.calendar-day-number {
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.calendar-events {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.calendar-events::-webkit-scrollbar {
  width: 6px;
}

.calendar-events::-webkit-scrollbar-thumb {
  background: rgba(0, 163, 255, 0.45);
  border-radius: 999px;
}

.calendar-events::-webkit-scrollbar-track {
  background: transparent;
}

.calendar-event {
  background: #f6f7fb;
  border-radius: 6px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.calendar-event-value {
  font-weight: 700;
}

.calendar-event-label {
  color: var(--muted);
  line-height: 1.2;
}

.calendar-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-event-task {
  background: #fff8dc;
  border: 1px solid #ffd400;
  flex-direction: row;
  align-items: center;
  gap: 4px;
}

.dashboard-agenda-popup {
  width: min(480px, 96vw);
  max-height: 80vh;
}

.dashboard-agenda-popup-date {
  margin: 0 0 12px;
}

.dashboard-agenda-tasks-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 50vh;
  overflow: auto;
}

.dashboard-agenda-tasks-list li {
  background: #fff8dc;
  border: 1px solid #ffd400;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--ink);
}

.calendar-cell.past-day .calendar-event-task {
  background: #eef8ff;
  border-color: #eef8ff;
}

.calendar-event-task .calendar-event-label {
  color: var(--ink);
  font-weight: 600;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.calendar-event-label-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1px 4px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.calendar-event-delete {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: #b42318;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  font-size: 14px;
  opacity: 0.75;
}

.calendar-event-delete:hover {
  opacity: 1;
}

.calendar-more {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
}

.unit-characteristics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.unit-characteristics-grid label {
  min-width: 0;
}
:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #16141c;
  --muted: #5f6373;
  --line: #dde1eb;
  --accent: #00a3ff;
  --accent-2: #ff1f8f;
  --accent-3: #ffd400;
  --ink-strong: #121212;
  --danger: #c21d4f;
  --shadow: 0 10px 28px rgba(24, 33, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
}

.sidebar {
  min-height: auto;
  padding: 16px 18px;
  background: linear-gradient(120deg, #0d0d10 0%, #151521 45%, #0f3e72 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 64px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 24px;
  font-weight: 800;
}

.mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.mark-fallback {
  display: none;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: 0.4px;
}

.brand small,
.muted {
  color: #aab4c2;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  align-items: flex-start;
}

button,
input {
  font: inherit;
}

input[type="text"],
input[type="search"],
textarea {
  text-transform: uppercase;
}

input[data-preserve-case],
textarea[data-preserve-case] {
  text-transform: none;
}

.nav-button,
.secondary {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  min-height: 44px;
}

.nav-button {
  text-align: center;
  color: #f2f6ff;
  background: transparent;
}

.nav-button.active,
.nav-button:hover {
  filter: saturate(1.05) brightness(1.02);
}

.nav-button[data-group-toggle="painel"],
.nav-button[data-group-toggle="estoque"] {
  background: linear-gradient(95deg, rgba(6, 182, 212, 0.95), rgba(34, 211, 238, 0.92));
  color: #0f172a;
}

.nav-button[data-group-toggle="cadastro"],
.nav-button[data-group-toggle="financeiro"] {
  background: linear-gradient(95deg, rgba(219, 39, 119, 0.95), rgba(236, 72, 153, 0.92));
  color: #ffffff;
}

.nav-button[data-group-toggle="compras"],
.nav-button[data-group-toggle="relatorios"] {
  background: linear-gradient(95deg, rgba(255, 212, 0, 0.95), rgba(255, 232, 120, 0.92));
  color: #121212;
}

.nav-button[data-group-toggle="vendas"],
.nav-button[data-group-toggle="outros"] {
  background: #121212;
  color: #f8fafc;
  box-shadow: inset 0 0 0 1px #94a3b8;
}

.nav-group[data-group="painel"] .nav-sub-button:hover,
.nav-group[data-group="painel"] .nav-sub-button.active,
.nav-group[data-group="estoque"] .nav-sub-button:hover,
.nav-group[data-group="estoque"] .nav-sub-button.active {
  background: linear-gradient(95deg, rgba(6, 182, 212, 0.95), rgba(34, 211, 238, 0.92));
  color: #0f172a;
}

.nav-group[data-group="cadastro"] .nav-sub-button:hover,
.nav-group[data-group="cadastro"] .nav-sub-button.active,
.nav-group[data-group="financeiro"] .nav-sub-button:hover,
.nav-group[data-group="financeiro"] .nav-sub-button.active {
  background: linear-gradient(95deg, rgba(219, 39, 119, 0.95), rgba(236, 72, 153, 0.92));
  color: #ffffff;
}

.nav-group[data-group="compras"] .nav-sub-button:hover,
.nav-group[data-group="compras"] .nav-sub-button.active,
.nav-group[data-group="relatorios"] .nav-sub-button:hover,
.nav-group[data-group="relatorios"] .nav-sub-button.active {
  background: linear-gradient(95deg, rgba(255, 212, 0, 0.95), rgba(255, 232, 120, 0.92));
  color: #121212;
}

.nav-group[data-group="vendas"] .nav-sub-button:hover,
.nav-group[data-group="vendas"] .nav-sub-button.active,
.nav-group[data-group="outros"] .nav-sub-button:hover,
.nav-group[data-group="outros"] .nav-sub-button.active {
  background: #121212;
  color: #f8fafc;
  box-shadow: inset 0 0 0 1px #94a3b8;
}

.nav-subgroup .nav-button {
  background: rgba(255, 255, 255, 0.08);
  color: #e8f0ff;
}

.nav-group {
  position: relative;
}

.nav-subgroup {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 160px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
  z-index: 20;
}

.nav-group.open .nav-subgroup {
  display: grid;
  gap: 4px;
}

.nav-sub-button {
  text-align: left;
  width: 100%;
}

.nav-subgroup-nested {
  min-width: 170px;
}

.nav-subsection {
  position: relative;
}

.nav-subsection-toggle {
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-subsection-toggle::after {
  content: "›";
  opacity: 0.7;
  font-size: 18px;
  line-height: 1;
}

.nav-subsection-items {
  display: none;
  position: absolute;
  top: 0;
  left: calc(100% + 4px);
  min-width: 210px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
  z-index: 21;
  gap: 4px;
}

.nav-subsection.open .nav-subsection-items {
  display: grid;
}

.nav-group[data-group="cadastro"] .nav-subsection-toggle:hover,
.nav-group[data-group="cadastro"] .nav-subsection.open .nav-subsection-toggle {
  background: linear-gradient(95deg, rgba(219, 39, 119, 0.95), rgba(236, 72, 153, 0.92));
  color: #ffffff;
}

.secondary {
  margin-top: 0;
  color: #121212;
  background: linear-gradient(95deg, var(--accent-3), #ffe970);
  white-space: nowrap;
}

.primary {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  color: #fff;
  background: linear-gradient(95deg, var(--accent-2), var(--accent));
  cursor: pointer;
}

.mini-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.mini-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.danger-button {
  color: var(--danger);
}

.danger-button:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.row-actions-menu {
  position: relative;
  display: inline-block;
}

.wa-editor-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.wa-editor-toolbar .mini-button {
  min-width: 28px;
  font-weight: 700;
}

.wa-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wa-tag-chip {
  border: 1px solid var(--line);
  background: #f7f8fa;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
}

.wa-tag-chip:hover {
  border-color: var(--accent, #2f6fed);
}

.order-status-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-status-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 11px;
  padding: 2px 4px;
}

#ordersTable .order-status-cell,
#ordersHistoryTable .order-status-cell {
  overflow: hidden;
  vertical-align: middle;
}

#ordersTable .order-status-cell .order-status-select,
#ordersHistoryTable .order-status-cell .order-status-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.order-whatsapp-cell {
  white-space: nowrap;
}

#orderWhatsappSendModalBackdrop .order-whatsapp-send-panel {
  width: min(440px, 94vw);
  max-width: min(440px, 94vw);
  max-height: none;
  overflow: visible;
  box-sizing: border-box;
}

#orderWhatsappSendModalBackdrop .order-whatsapp-send-panel .form-grid.horizontal-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

#orderWhatsappSendModalBackdrop .order-whatsapp-send-panel .horizontal-form .span-two,
#orderWhatsappSendModalBackdrop .order-whatsapp-send-panel .horizontal-form .form-actions {
  grid-column: 1 / -1;
}

#orderWhatsappSendModalBackdrop .order-whatsapp-send-panel .form-grid label,
#orderWhatsappSendModalBackdrop .order-whatsapp-send-panel .form-grid input,
#orderWhatsappSendModalBackdrop .order-whatsapp-send-panel .form-grid select,
#orderWhatsappSendModalBackdrop .order-whatsapp-send-panel .form-grid textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#orderWhatsappSendModalBackdrop .order-whatsapp-send-panel #orderWhatsappSendPreview {
  min-height: 330px;
  height: 330px;
  resize: vertical;
}

#orderWhatsappSendModalBackdrop .order-whatsapp-send-panel .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions-toggle {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  background: #fff;
  line-height: 1;
  user-select: none;
}

.row-actions-toggle::-webkit-details-marker {
  display: none;
}

.row-actions-list {
  position: absolute;
  bottom: calc(100% + 4px);
  top: auto;
  left: 0;
  z-index: 1000;
  min-width: 120px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
}

.notes-cell {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
}

.notes-clip {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  min-width: 0;
  padding: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 14px;
  margin-bottom: 10px;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
}

#searchInput {
  width: min(320px, 38vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  font-size: 12px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 18px;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
}

.metric-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.metric-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
}

.dashboard-month-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.dashboard-month-nav strong {
  min-width: 4.5em;
  text-align: center;
}

.notice-top-button {
  position: relative;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.notice-top-button.has-unread {
  border-color: var(--accent-2);
  color: #fff;
  background: linear-gradient(95deg, var(--accent-2), var(--accent));
  animation: notice-pulse 0.9s ease-in-out infinite;
}

.notice-top-icon {
  display: inline-grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 22px;
}

.notice-top-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-3);
  color: #121212;
  font-size: 11px;
  line-height: 20px;
}

@keyframes notice-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 31, 143, 0); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(255, 31, 143, 0.16); }
}

.metric-month .metric-icon {
  background: #fff3c4;
}

.metric-sales .metric-icon {
  background: #e7f0ff;
}

.metric-profit .metric-icon {
  background: #e7fbef;
}

.metric-cost .metric-icon {
  background: #ffe8f2;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
  color: var(--ink-strong);
}

.grid.two {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.dashboard-week-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.95fr);
  gap: 14px;
  align-items: start;
  margin-top: 12px;
}

.dashboard-week-panel .dashboard-week-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.dashboard-notices-panel {
  min-height: 166px;
}

.dashboard-notices-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.dashboard-notices-header h2 {
  margin: 0;
}

.dashboard-notices-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.dashboard-notices-tabs .active {
  border-color: var(--accent);
  color: var(--accent);
  background: #eef8ff;
}

.dashboard-notices-list {
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow: auto;
}

.dashboard-notice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.dashboard-notice:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dashboard-notice-content {
  min-width: 0;
}

.dashboard-notice.warning {
  border-left-color: var(--accent-3);
}

.dashboard-notice.critical {
  border-left-color: var(--danger);
}

.dashboard-notice.is-read {
  opacity: 0.62;
}

.dashboard-notice-title {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: baseline;
  font-weight: 800;
  min-width: 0;
}

.dashboard-notice-title small,
.dashboard-notice p {
  color: var(--muted);
}

.dashboard-notice-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-notice-title small {
  flex: 0 0 auto;
  white-space: nowrap;
}

.dashboard-notice p {
  display: none;
  margin: 6px 0 0;
  line-height: 1.35;
}

.dashboard-notice.is-expanded {
  align-items: start;
}

.dashboard-notice.is-expanded p {
  display: block;
}

.dashboard-notice-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}

.icon-button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}

@media (max-width: 900px) {
  .dashboard-week-row {
    grid-template-columns: 1fr;
  }
}

.grid.product-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.stack-layout {
  display: grid;
  gap: 14px;
}

.orders-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 6px;
  align-items: start;
}

.orders-summary-panel {
  position: sticky;
  top: 0;
  padding: 5px;
  max-height: none;
  overflow: visible;
}

.orders-summary-panel h2 {
  margin-bottom: 2px;
  font-size: 11px;
}

#ordersMonthLabel {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 4px;
}

.orders-table-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px 0;
}

.orders-table-heading h2 {
  margin: 0;
}

.orders-list-month-label {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}

.orders-list-month-nav {
  flex-shrink: 0;
}

.orders-table-panel > .orders-list-hint {
  padding: 0 12px;
  margin: 6px 0 10px;
}

.orders-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 6px;
  margin-top: 3px;
}

.orders-summary-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 5px;
  background: #f9fbfd;
}

.orders-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.orders-summary-grid strong {
  display: block;
  margin-top: 1px;
  font-size: 12px;
}

.panel {
  padding: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-panel {
  width: min(1200px, 96vw);
  max-height: 90vh;
  overflow: auto;
}

#productGroupModalBackdrop .modal-panel,
#productCharacteristicGroupModalBackdrop .modal-panel {
  width: min(720px, 96vw);
  max-width: 96vw;
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

#productGroupForm.horizontal-form,
#productCharacteristicGroupForm.horizontal-form {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

#productGroupForm .span-two,
#productCharacteristicGroupForm .span-two,
#productGroupForm .form-actions,
#productCharacteristicGroupForm .form-actions {
  grid-column: 1 / -1;
}

#productGroupForm .form-actions,
#productCharacteristicGroupForm .form-actions {
  flex-wrap: wrap;
}

#productGroupForm input,
#productGroupForm textarea,
#productCharacteristicGroupForm input,
#productCharacteristicGroupForm textarea {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

#product-groups .table-wrap,
#product-characteristics .table-wrap {
  overflow-x: hidden;
}

#product-groups .table-wrap table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
  font-size: 12px;
}

#product-characteristics .table-wrap table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
  font-size: 12px;
}

#product-groups .table-wrap table th,
#product-groups .table-wrap table td,
#product-characteristics .table-wrap table th,
#product-characteristics .table-wrap table td {
  padding-left: 4px;
  padding-right: 4px;
}

#product-groups .table-wrap table th,
#product-characteristics .table-wrap table th {
  font-size: 11px;
  white-space: nowrap;
}

#product-groups .table-wrap table th:nth-child(1),
#product-groups .table-wrap table td:nth-child(1),
#product-characteristics .table-wrap table th:nth-child(1),
#product-characteristics .table-wrap table td:nth-child(1) {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding-left: 4px;
  padding-right: 4px;
  white-space: nowrap;
  overflow: visible;
}

#product-groups .table-wrap table th:nth-child(2),
#product-groups .table-wrap table td:nth-child(2) {
  width: 11em;
  min-width: 0;
  white-space: nowrap;
  overflow: visible;
  line-height: 1.35;
  vertical-align: top;
}

#product-groups .table-wrap table td:nth-child(2) {
  white-space: normal;
}

#product-characteristics .table-wrap table th:nth-child(2),
#product-characteristics .table-wrap table td:nth-child(2) {
  width: 11em;
  min-width: 0;
  white-space: nowrap;
  overflow: visible;
  line-height: 1.35;
  vertical-align: top;
}

#product-characteristics .table-wrap table td:nth-child(2) {
  white-space: normal;
}

#product-groups .table-wrap table th:nth-child(3),
#product-groups .table-wrap table td:nth-child(3) {
  width: auto;
  min-width: 0;
  white-space: normal;
  overflow: visible;
  line-height: 1.35;
  vertical-align: top;
}

#product-characteristics .table-wrap table th:nth-child(3),
#product-characteristics .table-wrap table td:nth-child(3) {
  width: auto;
  min-width: 0;
  white-space: normal;
  overflow: visible;
  line-height: 1.35;
  vertical-align: top;
}

#product-groups .table-wrap table th:nth-child(3),
#product-characteristics .table-wrap table th:nth-child(3) {
  white-space: nowrap;
}

#product-groups .table-wrap table th:nth-child(4),
#product-groups .table-wrap table td:nth-child(4) {
  width: 1%;
  min-width: 3em;
  white-space: normal;
  overflow: visible;
  line-height: 1.35;
}

#product-characteristics .table-wrap table th:nth-child(4),
#product-characteristics .table-wrap table td:nth-child(4) {
  width: 4.5em;
  min-width: 0;
  white-space: normal;
  overflow: visible;
  line-height: 1.35;
}

#product-groups .table-wrap table th:nth-child(4),
#product-characteristics .table-wrap table th:nth-child(4) {
  white-space: nowrap;
}

#productModalBackdrop.input-modal-active {
  padding: 6px;
  place-items: start center;
  overflow: auto;
}

#productModalBackdrop.input-modal-active .input-modal-panel {
  width: min(1060px, 98vw);
  max-height: calc(100dvh - 12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px 10px 10px;
}

#productModalBackdrop.input-modal-active #productForm.input-mode {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#productModalBackdrop.input-modal-active .input-modal-panel h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  line-height: 1.2;
  flex-shrink: 0;
}

#productForm.input-mode {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-height: 0;
  grid-template-columns: none;
}

#productForm.input-mode .input-form-block-full {
  grid-column: 1 / -1;
}

#productForm.input-mode .input-form-block-identity .product-name-field {
  margin: 0;
}

#productForm.input-mode .input-form-layout {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-height: 0;
}

#productForm.input-mode .input-form-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 2px;
}

#productForm.input-mode .input-form-actions {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-top: 6px;
  margin-top: 2px;
}

#productForm.input-mode .input-form-body {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 5px;
  align-items: start;
}

#productForm.input-mode .input-form-column {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

#productForm.input-mode .input-form-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

#productForm.input-mode .input-form-block-title {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  line-height: 1.1;
}

#productForm.input-mode .input-supplier-quick-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

#productForm.input-mode .input-supplier-quick-bar .small-hint {
  margin: 0;
  font-size: 11px;
}

#productForm.input-mode .input-quick-supplier-panel {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

#productForm.input-mode .input-quick-supplier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#productForm.input-mode .input-quick-supplier-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
}

#productForm.input-mode .input-quick-supplier-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#productForm.input-mode .input-purchase-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
}

#productForm.input-mode .input-purchase-row--thirds {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#productForm.input-mode #inputPurchaseColumn {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#productForm.input-mode #productCostField {
  margin: 0;
}

#productForm.input-mode #productNotesField,
#productForm.input-mode #changeReasonField {
  margin: 0;
}

#productForm.input-mode .unit-characteristics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
}

#productModalBackdrop .modal-panel {
  width: min(1040px, 96vw);
}

#productModalBackdrop:not(.input-modal-active) .modal-panel {
  max-height: 90vh;
  overflow: auto;
}

.backup-import-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f7fb;
  color: var(--ink);
  font-weight: 600;
}

.backup-import-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(0, 163, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: backup-import-spin 0.8s linear infinite;
  flex: 0 0 auto;
}

#backupModulePickerBackdrop.is-importing .individual-backup-options,
#backupModulePickerBackdrop.is-importing .backup-module-all,
#backupModulePickerBackdrop.is-importing .backup-restore-presets-bar {
  opacity: 0.55;
  pointer-events: none;
}

.backup-restore-presets-bar {
  display: grid;
  gap: 8px;
  margin: 10px 0 12px;
}

.backup-restore-preset-select-label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

.backup-restore-preset-select-label select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.backup-restore-preset-actions {
  margin: 0;
}

.backup-item-picker-panel {
  width: min(920px, 96vw);
  max-height: 88vh;
  overflow: auto;
}

.backup-item-picker-groups {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.backup-item-search {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  font-size: 0.92rem;
}

.backup-item-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

#backupItemSearchHint {
  margin: 6px 0 0;
}

.backup-item-group h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.backup-item-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.backup-item-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.backup-item-detail {
  grid-column: 2;
  font-size: 0.85rem;
}

#backupItemPickerBackdrop.is-importing .backup-item-picker-groups,
#backupItemPickerBackdrop.is-importing .backup-module-all {
  opacity: 0.55;
  pointer-events: none;
}

@keyframes backup-import-spin {
  to {
    transform: rotate(360deg);
  }
}

.period-list {
  display: grid;
  gap: 10px;
}

.period-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.period-row:last-child {
  border-bottom: 0;
}

.period-row small {
  color: var(--muted);
}

.recent-months-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: stretch;
  width: 100%;
}

.recent-month-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 6px;
  background: #ffffff;
  min-width: 0;
  flex: 1 1 0;
}

.recent-month-card-header {
  margin-bottom: 3px;
  font-size: 11px;
  color: #0f172a;
}

.recent-month-metrics {
  display: grid;
  gap: 1px;
}

.recent-month-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.recent-month-metric .metric-label {
  font-size: 9px;
  color: var(--muted);
}

.recent-month-metric .metric-label .metric-icon {
  margin-right: 2px;
}

.recent-month-metric strong {
  font-size: 11px;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .recent-months-list {
    flex-wrap: wrap;
    width: 100%;
  }

  .recent-month-card {
    flex: 1 1 calc(50% - 6px);
  }
}

.break-even-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.break-even-card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.break-even-wrap {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  align-items: center;
}

.break-even-pie {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-2) 0deg 0deg, var(--accent) 0deg 360deg);
  border: 1px solid var(--line);
}

.break-even-legend {
  display: grid;
  gap: 8px;
  font-size: 12px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot-expense {
  background: var(--accent-2);
}

.dot-sales {
  background: var(--accent);
}

.dot-excess,
.dot-excess-1 {
  background: #22c55e;
}

.dot-excess-2 {
  background: #ffd400;
}

.dot-excess-3 {
  background: #a855f7;
}

.dot-excess-4 {
  background: #f97316;
}

.dot-excess-5 {
  background: #06b6d4;
}

.break-even-excess-legend {
  display: grid;
  gap: 6px;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.horizontal-form {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  align-items: end;
}

#orders .horizontal-form {
  grid-template-columns: repeat(9, minmax(86px, 1fr));
  gap: 6px;
}

.customer-credit-history {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.customer-credit-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.customer-credit-history-heading h3 {
  margin: 0;
}

.customer-credit-history-heading strong {
  color: #166534;
  font-size: 1.05rem;
}

.customer-credit-history-table-wrap {
  max-height: 280px;
}

.customer-credit-history-table-wrap .credit {
  color: #15803d;
}

.customer-credit-history-table-wrap .debit {
  color: #b91c1c;
}

#orderModalBackdrop {
  padding: 6px;
  place-items: start center;
  overflow: auto;
}

#orderModalBackdrop .order-modal-panel {
  width: min(1060px, 98vw);
  max-height: calc(100dvh - 12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px 10px 10px;
}

#orderModalBackdrop .order-modal-panel h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.order-form {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-height: 0;
}

#orderModalBackdrop .order-form-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 2px;
}

#orderModalBackdrop .order-form-actions {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-top: 6px;
  margin-top: 2px;
}

.order-form-body {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 5px;
  align-items: start;
}

.order-form-column {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.order-form-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.order-form-block-title {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  line-height: 1.1;
}

.order-product-catalog-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 7px;
  width: 100%;
  min-width: 0;
}

.order-product-catalog-filters select {
  min-width: 0;
  max-width: 100%;
}

.order-form-grid {
  display: grid;
  gap: 5px 7px;
  align-items: end;
}

.order-form-block-client .order-form-grid-head {
  grid-template-columns: 1fr;
}

.order-form-grid-measures {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.order-form-block-payment .order-form-grid-payment {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.order-customer-credit-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  color: #475569;
}

.order-customer-credit-summary.has-credit {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.order-prepaid-credit-block {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 9px;
  border: 1px solid #86efac;
  border-radius: 7px;
  background: #f0fdf4;
}

.order-prepaid-credit-block > label {
  display: grid;
  gap: 2px;
  margin: 0;
}

.order-prepaid-credit-block .small-hint {
  margin: 0;
}

.order-payment-with-discount {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 6px;
  align-items: end;
}

.order-payment-with-discount > label {
  display: grid;
  gap: 2px;
  margin: 0;
}

.order-cost-with-account {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
}

.order-cost-with-account > label,
.order-income-with-account > label,
.order-manual-values > label,
.order-status-with-signal > label {
  display: grid;
  gap: 2px;
  margin: 0;
}

.order-manual-cost-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}

#orderStructureCostButton {
  min-height: 26px;
  white-space: nowrap;
}

.order-structure-cost-field input[readonly] {
  background: var(--bg-alt, #f4f4f4);
  color: var(--text-muted, #555);
}

#orderStructureCostModalBackdrop {
  z-index: 130;
}

.order-structure-cost-panel {
  width: min(980px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

#orderStructureCostForm input[readonly] {
  background: #eef0f3;
  color: #354052;
  cursor: default;
}

#orderStructureCostForm .structure-possibility input {
  pointer-events: none;
}

.order-structure-cost-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.order-structure-cost-header h2 {
  margin: 0 0 2px;
  font-size: 1.05rem;
}

.order-structure-cost-list {
  overflow: auto;
  max-height: min(58vh, 520px);
  display: grid;
  gap: 12px;
}

.order-structure-cost-group {
  display: grid;
  gap: 6px;
}

.order-structure-cost-group strong {
  font-size: 12px;
  color: #1f3a8a;
}

.order-structure-cost-row {
  align-items: end;
}

.order-structure-cost-panel input[readonly] {
  background: #eef0f3;
  color: #354052;
  cursor: default;
}

.order-structure-cost-order-value {
  font-size: 11px;
  margin: 0 0 8px;
}

.order-structure-cost-adjust {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.order-structure-cost-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid #d5d9e0;
  font-size: 14px;
}

.order-structure-cost-empty {
  color: #6b7280;
  font-size: 13px;
}

.order-income-with-account,
.order-manual-values,
.order-status-with-signal {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
}

.order-manual-signal-field.is-disabled,
.order-manual-signal-field.is-disabled input {
  color: #8a8f98;
}

.order-manual-signal-field.is-disabled input {
  background: #eef0f3;
  border-color: #d5d9e0;
  cursor: not-allowed;
}

.order-discount-rate-field input {
  text-align: right;
}

.order-form-grid-links {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.order-form label,
.order-form .order-form-inline-action {
  display: grid;
  gap: 2px;
  margin: 0;
  color: #354052;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
}

.order-form input:not([type="checkbox"]),
.order-form select,
.order-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 7px;
  font-size: 12px;
  line-height: 1.2;
}

.order-form textarea {
  min-height: 28px;
  resize: none;
}

.order-form .order-form-inline-action {
  align-self: end;
  padding-bottom: 0;
}

.order-form .order-form-checkbox-field {
  align-self: center;
}

.order-form-notes-compact {
  grid-column: auto;
}

.order-form-hint {
  margin: 0;
  font-size: 10px;
  line-height: 1.25;
}

.order-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-top: 0;
}

.order-form .order-customer-field,
.order-form .order-product-field,
.order-form .order-service-field,
.order-form .order-material-measure-field {
  position: relative;
}

.order-slice-suggestion-group {
  display: grid;
  gap: 2px;
}

.order-slice-suggestion-parent {
  padding: 6px 8px 0;
  color: #354052;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.order-slice-suggestion-group .order-customer-suggestion {
  padding-left: 18px;
}

#orderPricingTierSuggestions .order-customer-suggestion:disabled {
  color: #64748b;
  background: #f1f5f9;
  border-color: transparent;
  cursor: not-allowed;
}

.order-form #orderPricingTierSuggestions {
  max-height: min(320px, 40vh);
}

.order-form .order-customer-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 20;
  margin-top: 0;
  grid-column: unset;
  max-height: 140px;
  padding: 4px;
  gap: 3px;
}

.order-form .order-customer-quick-bar {
  margin-top: 0;
  gap: 6px;
}

.order-form .order-customer-quick-bar .small-hint {
  font-size: 10px;
  line-height: 1.2;
}

.order-form .order-quick-customer-panel {
  margin-top: 0;
  padding: 8px;
  gap: 6px;
}

.order-form-image-section {
  display: grid;
  gap: 4px;
}

.order-form-image-inline {
  margin-top: 1px;
}

.order-form-image-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  border: 1px dashed #9bb8d9;
  border-radius: 8px;
  overflow: hidden;
  background: #f4f9ff;
}

.order-form-image-paste-side {
  margin: 0;
  border: 0;
  border-radius: 0;
  min-height: 34px;
  cursor: text;
}

.order-form-image-paste-side.is-focused,
.order-form-image-paste-side:focus {
  background: #eef4ff;
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.order-form-image-select-btn {
  align-self: stretch;
  min-width: 84px;
  margin: 0;
  border: 0;
  border-left: 1px dashed #9bb8d9;
  border-radius: 0;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
}

.order-form-image-select-btn:hover,
.order-form-image-select-btn:focus {
  background: #eef4ff;
}

#orderForm .order-image-paste-zone {
  padding: 5px 8px;
  margin: 0;
  gap: 3px;
  font-size: 10px;
}

#orderForm .order-form-image-paste-side {
  border-width: 0;
}

#orderForm .order-image-paste-zone strong {
  font-size: 11px;
}

#orderForm .order-form-image-hint {
  margin: 0;
  font-size: 10px;
  line-height: 1.2;
}

#orderForm .order-form-image-preview img {
  max-height: 48px;
}

.order-form .order-draft-section {
  margin-top: 0;
  padding: 6px 8px;
}

#orderForm .order-sale-value-display {
  margin-top: 1px;
  font-size: 0.95rem;
  line-height: 1.1;
}

#orderForm .order-qty-field input[type="number"] {
  text-align: left;
}

#orderForm .order-draft-section:not(.has-draft-items) .order-draft-table-wrap {
  display: none;
}

#orderForm .order-draft-section:not(.has-draft-items) .order-draft-toolbar {
  margin-bottom: 0;
  justify-content: stretch;
}

#orderForm .order-draft-section:not(.has-draft-items) .order-draft-toolbar-actions {
  width: 100%;
}

#orderForm .order-draft-section:not(.has-draft-items) #addOrderItemButton {
  flex: 1;
}

#orderForm .order-draft-section:not(.has-draft-items) .order-draft-toolbar h3 {
  display: none;
}

#orderForm .order-draft-table {
  width: 100%;
  table-layout: fixed;
}

#orderForm .order-draft-table col.order-draft-col-index {
  width: 28px;
}

#orderForm .order-draft-table col.order-draft-col-qty {
  width: 52px;
}

#orderForm .order-draft-table col.order-draft-col-rg {
  width: 30px;
}

#orderForm .order-draft-table col.order-draft-col-money {
  width: 76px;
}

#orderForm .order-draft-table col.order-draft-col-photo {
  width: 42px;
}

#orderForm .order-draft-table col.order-draft-col-actions {
  width: 60px;
}

#orderForm .order-draft-table th,
#orderForm .order-draft-table td {
  padding: 3px 5px;
  font-size: 11px;
  vertical-align: middle;
  word-break: break-word;
}

#orderForm .order-draft-table th:nth-child(1),
#orderForm .order-draft-table td:nth-child(1) {
  text-align: center;
  padding-left: 2px;
  padding-right: 2px;
  white-space: nowrap;
}

#orderForm .order-draft-table th:nth-child(3),
#orderForm .order-draft-table td:nth-child(3),
#orderForm .order-draft-table th:nth-child(4),
#orderForm .order-draft-table td:nth-child(4) {
  text-align: center;
  white-space: nowrap;
}

#orderForm .order-draft-table .order-rg-col {
  text-align: center;
  padding-left: 2px;
  padding-right: 2px;
}

#orderForm .order-draft-table .order-draft-actions-col {
  width: 60px;
  padding-left: 2px;
  padding-right: 2px;
}

#orderForm .order-draft-table-wrap.table-wrap {
  overflow: visible;
  max-height: none;
}

#orderForm .order-draft-table .col-money {
  text-align: right;
  white-space: nowrap;
}

#orderForm .order-draft-table th:nth-child(7),
#orderForm .order-draft-table td:nth-child(7) {
  text-align: center;
  padding-left: 2px;
  padding-right: 2px;
}

#orderForm .order-draft-table .order-rg-alert {
  color: #b45309;
  font-weight: 700;
}

#orderForm .order-draft-table .order-rg-empty {
  color: #94a3b8;
  text-align: center;
}

@media (max-width: 900px) {
  .order-form-body {
    grid-template-columns: 1fr;
  }

  .order-form-grid-measures,
  .order-form-block-payment .order-form-grid-payment,
  .order-form-grid-links {
    grid-template-columns: 1fr 1fr;
  }

  .order-prepaid-credit-block {
    grid-template-columns: 1fr;
  }
}

#orders .order-top-field {
  grid-column: span 2;
}

#orders .order-date-field {
  grid-column: span 2;
}

#orders .order-customer-field {
  grid-column: span 3;
}

#colorantRecordForm .order-customer-field,
#productionRecordForm .order-customer-field {
  grid-column: 1 / -1;
}

#colorantRecordForm .order-customer-suggestions,
#productionRecordForm .order-customer-suggestions {
  grid-column: 1 / -1;
}

#orders .order-product-field {
  grid-column: span 4;
}

.order-customer-quick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.order-customer-quick-bar .small-hint {
  margin: 0;
}

.order-customer-suggestions {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  margin-top: -2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.order-customer-suggestions.hidden {
  display: none;
}

.order-customer-suggestion {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
}

.order-customer-suggestion:hover,
.order-customer-suggestion:focus,
.order-customer-suggestion.is-active {
  border-color: var(--line);
  background: #eef2ff;
  outline: none;
}

.order-quick-customer-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.order-quick-customer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.order-quick-customer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
}

.order-quick-customer-grid .span-two {
  grid-column: 1 / -1;
}

.order-quick-customer-grid label {
  display: grid;
  gap: 6px;
  color: #354052;
  font-size: 13px;
  font-weight: 600;
}

.order-quick-customer-grid input,
.order-quick-customer-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
}

.order-quick-customer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

#orders .order-line2-field {
  grid-column: span 1;
}

#pricingTierField {
  margin-top: 2px;
}

#orders .order-qty-field {
  min-width: 0;
}

#orders .order-qty-stepper input {
  text-align: center;
  min-width: 0;
}

#orders .order-line3-field {
  grid-column: span 2;
}

#orders .order-line3-notes {
  grid-column: span 3;
}

.order-sale-value-display {
  display: block;
  margin-top: 2px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #be185d;
  line-height: 1.1;
}

.order-draft-section {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.order-draft-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.order-draft-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.order-draft-toolbar h3 {
  margin: 0;
  font-size: 12px;
  color: #334155;
}

.order-draft-table-wrap {
  overflow: visible;
}

.order-draft-table {
  width: 100%;
}

.order-draft-row-editing td {
  background: #eef4ff;
}

.order-draft-detail-row td {
  border-top: 0;
  padding-top: 0;
}

.order-draft-detail-cell {
  font-size: 10px;
  line-height: 1.35;
  color: #64748b;
  padding-bottom: 6px !important;
}

.order-draft-actions-cell {
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

.order-draft-actions-inline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.order-draft-actions-inline .icon-button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  display: inline-grid;
  place-items: center;
  line-height: 1;
  vertical-align: middle;
}

.order-draft-actions-cell .icon-button {
  padding: 0;
  min-width: 0;
  line-height: 1;
}

.order-draft-photo-thumb {
  display: block;
  max-width: 36px;
  max-height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.order-draft-empty-row td {
  text-align: center;
  padding: 14px 10px;
}

.horizontal-form textarea {
  min-height: 32px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: #354052;
  font-size: 13px;
  font-weight: 600;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

#orders .form-grid label {
  gap: 1px;
  font-size: 11px;
  margin: 0;
}

#orders .form-grid input,
#orders .form-grid select,
#orders .form-grid textarea {
  padding: 6px 7px;
  font-size: 11px;
  min-height: 30px;
}

#orders .form-actions .primary,
#orders .form-actions .mini-button {
  padding: 7px 9px;
  font-size: 11px;
}

#orders #orderCalcHint,
#orders #orderPriceHint {
  font-size: 10px;
  line-height: 1.15;
  margin-top: 1px;
  grid-column: 1 / -1;
}

#orders .compact-notes textarea {
  min-height: 24px;
  max-height: 32px;
}

#orders .panel {
  padding: 8px;
}

#orders-history .panel {
  padding: 8px;
}

#orders-history .orders-table-heading {
  padding: 4px 4px 0;
}

#orders-history .orders-table-panel > .orders-list-hint,
#orders-history .orders-visible-tithe {
  padding-left: 4px;
  padding-right: 4px;
}

#orders-history .orders-history-filter-bar {
  grid-template-columns: minmax(210px, 1.6fr) repeat(6, minmax(70px, 0.85fr)) auto;
  gap: 6px;
  padding: 8px 4px;
  margin-bottom: 8px;
}

#orders-history .orders-history-filter-bar > label {
  min-width: 0;
}

#orders-history .orders-history-filter-bar select,
#orders-history .orders-history-filter-bar input[type="date"] {
  width: 100%;
  min-width: 0;
  font-size: 12px;
  padding: 6px 7px;
}

#orders-history .orders-history-period-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

#orders-history .orders-history-period-filter > .field-label {
  font-size: 12px;
  color: var(--muted);
}

#orders-history .orders-history-period-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

#orders-history .orders-history-period-inputs label {
  min-width: 0;
  display: grid;
  gap: 4px;
  font-size: 11px;
}

#orders .panel h2 {
  margin-bottom: 6px;
}

.form-grid textarea {
  resize: vertical;
}

.span-two {
  grid-column: 1 / -1;
}

.modal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
}

#productModalBackdrop .modal-panel,
#unitModalBackdrop .modal-panel {
  position: relative;
}

.modal-title-row h2 {
  margin: 0;
}

.icon-help-button {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.icon-help-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.input-help-popover {
  position: absolute;
  z-index: 20;
  top: 48px;
  right: 16px;
  width: min(440px, calc(100% - 32px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
}

.input-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.input-help-header h3 {
  margin: 0;
  font-size: 14px;
}

.input-help-popover ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 12px;
  line-height: 1.35;
}

.horizontal-form .span-two {
  grid-column: span 2;
}

.horizontal-form .form-actions {
  align-self: end;
}

.backup-folder-form {
  margin-top: 10px;
}

.backup-folder-path-field {
  display: grid;
  gap: 6px;
  width: 100%;
  font-size: 0.92rem;
}

.backup-folder-path-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.backup-folder-path-row input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.backup-folder-path-row .primary {
  white-space: nowrap;
}

.backup-folder-history {
  margin-top: 16px;
}

.backup-folder-history h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.backup-folder-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.backup-folder-history-list:empty,
.backup-folder-history-list.is-empty {
  display: none;
}

.backup-folder-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.backup-folder-history-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

#productForm.input-mode > :not(.product-name-field):not(#inputFormLayout):not(input[name="id"]) {
  display: none !important;
}

#productForm.input-mode #inputPurchaseHistorySection {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.product-variations-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 10px;
}

.product-variations-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.product-catalog-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 10px;
}

.product-catalog-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.product-catalog-group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.product-catalog-search-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #354052;
  position: relative;
  min-width: 0;
}

.product-characteristic-link-rows,
.catalog-children-rows {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.catalog-children-rows {
  max-height: 42vh;
  overflow-x: hidden;
  overflow-y: auto;
}

.product-characteristic-link-row,
.catalog-child-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) auto;
  gap: 8px;
  align-items: end;
  width: 100%;
  min-width: 0;
}

.catalog-child-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
}

.catalog-child-row label,
.catalog-child-row input,
.product-characteristic-link-row label,
.product-characteristic-link-row input,
.product-characteristic-link-row select {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.catalog-child-row [data-remove-catalog-child],
.product-characteristic-link-row [data-remove-char-row] {
  white-space: nowrap;
  width: auto;
}

.catalog-children-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

.catalog-children-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.product-structure-picker {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 1 1 280px;
  min-width: 0;
}

.product-structure-picker label,
.product-structure-picker .product-structure-search-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #354052;
  flex: 1 1 260px;
  min-width: 0;
  position: relative;
}

.product-structure-picker select,
.product-structure-picker input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}

.product-structure-picker [data-product-structure-suggestions],
.product-structure-picker #productStructureSuggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 220px;
}

.product-structure-picker .mini-button {
  flex: 0 0 auto;
  min-height: 36px;
}

.product-price-history-section {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
  min-width: 0;
}

.product-price-history-section h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #243247;
}

.product-price-history-list {
  display: grid;
  gap: 6px;
  width: 100%;
  max-height: 180px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  box-sizing: border-box;
}

.product-price-history-item {
  display: grid;
  gap: 2px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5ebf3;
  color: #354052;
  font-size: 12.5px;
  line-height: 1.35;
}

.product-price-history-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.product-price-history-item strong {
  color: #1f2a37;
  font-weight: 700;
}

.product-structure-bulk-prices {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 180px));
  gap: 8px;
  align-items: end;
  margin-left: auto;
}

.product-structure-bulk-prices label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #354052;
  min-width: 0;
}

.product-structure-bulk-prices input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}

.product-variation-rows {
  display: grid;
  gap: 8px;
}

.product-variation-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.2fr) repeat(3, minmax(110px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.product-variation-row--input,
.product-variation-row--structure {
  grid-template-columns: minmax(200px, 1.4fr) repeat(3, minmax(110px, 1fr)) auto;
}

.product-variation-row--structure.has-possibilities {
  grid-template-columns: minmax(170px, 1.1fr) minmax(150px, 1fr) repeat(3, minmax(110px, 1fr)) auto;
}

.product-variation-row--structure.product-variation-row--structure-expanded,
.product-variation-row--structure.has-possibilities.product-variation-row--structure-expanded {
  grid-template-columns: minmax(320px, 2.2fr) repeat(3, minmax(110px, 1fr)) auto;
}

.product-structure-possibility-cell {
  min-width: 0;
}

.product-structure-empty-hint {
  margin: 4px 0 0;
  font-size: 13px;
}

.product-structure-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: end;
  justify-content: flex-end;
}

.product-variation-row--structure.product-variation-row--structure-picker {
  grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 1fr) auto;
}

.product-variation-row--structure.product-variation-row--structure-picker.has-possibilities {
  grid-template-columns: minmax(170px, 1.1fr) minmax(150px, 1fr) auto;
}

.product-structure-quantity-tiers {
  display: grid;
  gap: 8px;
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafbfd;
}

.product-structure-quantity-tiers-title {
  font-size: 12px;
  font-weight: 600;
}

.product-structure-quantity-tier-rows {
  display: grid;
  gap: 8px;
}

.product-structure-quantity-tier-row {
  grid-template-columns: minmax(130px, 1.2fr) repeat(3, minmax(110px, 1fr)) auto;
}

.product-structure-size-tiers {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafbfd;
}

.product-structure-size-tiers-title {
  font-size: 12px;
  font-weight: 600;
}

.product-structure-size-tier-rows {
  display: grid;
  gap: 8px;
}

.product-structure-size-tiers-empty {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.product-structure-size-tier-card {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-size-tier-main {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(0, 2fr);
  gap: 10px;
  align-items: end;
}

.product-size-tier-title {
  min-width: 0;
}

.product-size-tier-measures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.product-size-tier-measure-group {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.product-size-tier-measure-group-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}

.product-size-tier-measure-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(58px, 1fr));
  gap: 6px;
  align-items: end;
}

.product-size-tier-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.product-size-tier-cost {
  flex: 1 1 130px;
  min-width: 120px;
  max-width: 190px;
}

.product-size-tier-price {
  flex: 0 0 108px;
  min-width: 96px;
}

.product-size-tier-field-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  color: #354052;
  line-height: 1.2;
}

.product-structure-size-tier-card label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.product-structure-size-tier-card input {
  min-width: 0;
  padding: 7px 8px;
  font-size: 12px;
}

.product-structure-size-tier-card .product-variation-remove {
  flex: 0 0 auto;
  min-height: 36px;
  align-self: end;
}

.product-structure-entry {
  display: grid;
  gap: 6px;
}

.product-structure-entry.is-disabled {
  opacity: 0.58;
}

.product-structure-entry.is-disabled .product-variation-row--structure-expanded {
  background: #f3f4f6;
}

.product-variation-row--structure-expanded {
  align-items: end;
}

.product-structure-slices {
  display: grid;
  gap: 6px;
  margin: 0 0 4px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafbfd;
}

.product-structure-slices-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.product-structure-slices-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-structure-slice-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: #334155;
  font-size: 12px;
  line-height: 1.3;
}

.product-variation-row label {
  min-width: 0;
}

.product-variation-row label span,
.product-variation-row label {
  overflow-wrap: anywhere;
}

.product-variation-remove {
  min-height: 38px;
}

#productForm.input-mode .input-purchase-history-empty {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
}

#productForm.input-mode .input-purchase-history-table-wrap {
  max-height: 160px;
}

#productForm.input-mode .input-purchase-history-table-wrap table {
  min-width: 0;
  width: 100%;
  font-size: 11px;
}

#productForm.input-mode .input-purchase-history-table-wrap th,
#productForm.input-mode .input-purchase-history-table-wrap td {
  padding: 6px 8px;
}

.stock-status-cell {
  text-align: center;
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  padding-left: 4px !important;
  padding-right: 4px !important;
}

#stock .table-wrap table {
  table-layout: fixed;
  width: 100%;
}

#stock .table-wrap table th:nth-child(1),
#stock .table-wrap table td:nth-child(1) {
  width: 30px;
  min-width: 30px;
  max-width: 30px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

#stock .table-wrap table th:nth-child(2),
#stock .table-wrap table td:nth-child(2) {
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  padding-left: 4px;
  padding-right: 4px;
  white-space: nowrap;
}

#stock .table-wrap table th:nth-child(3),
#stock .table-wrap table td:nth-child(3),
#stock .table-wrap table th.stock-status-header {
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

#stock .table-wrap table th:nth-child(4),
#stock .table-wrap table td:nth-child(4) {
  width: auto;
  min-width: 120px;
  white-space: normal;
  line-height: 1.35;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
}

#stock .table-wrap table th:nth-child(5),
#stock .table-wrap table td:nth-child(5) {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  padding-left: 4px;
  padding-right: 4px;
  white-space: nowrap;
  text-align: right;
}

#stock .table-wrap table th:nth-child(6),
#stock .table-wrap table td:nth-child(6) {
  width: 128px;
  min-width: 128px;
  max-width: 128px;
  padding-left: 6px;
  padding-right: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#stock .table-wrap table th:nth-child(7),
#stock .table-wrap table td:nth-child(7) {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  padding-left: 4px;
  padding-right: 4px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-title-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.stock-title-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

#inputsTable tr[data-input-child-of] > td.tree-child-title {
  padding-left: 1.75rem;
}

#stockTable tr[data-stock-child-of] > td.tree-child-title {
  padding-left: 2.75rem;
}

.stock-view-hint {
  margin: 0 0 12px;
}

.stock-history-cell {
  min-width: 0;
}

.stock-history-cell strong {
  display: block;
}

.stock-history-cell .muted {
  font-size: 12px;
}

.stock-qty-cell {
  text-align: right;
  white-space: nowrap;
}

#stockRecordModalBackdrop {
  padding: 6px;
  place-items: start center;
  overflow: auto;
}

.stock-record-modal-panel {
  width: min(920px, 98vw);
  max-height: calc(100dvh - 12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px 10px 10px;
}

.stock-record-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
}

.stock-record-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 8px;
}

.stock-record-block {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.stock-record-block-title {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.stock-record-product-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.stock-record-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: start;
}

.stock-record-grid > label,
.stock-record-photos-field {
  display: grid;
  grid-template-rows: auto minmax(34px, auto);
  gap: 4px;
  min-width: 0;
  margin: 0;
  color: #354052;
  font-size: 12px;
  font-weight: 600;
}

.stock-record-grid > label.span-all,
.stock-record-photos-field.span-all,
.stock-record-color-field.span-all {
  grid-column: 1 / -1;
  grid-template-rows: auto auto;
}

.stock-record-grid input,
.stock-record-grid select,
.stock-record-grid textarea {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 400;
}

.stock-record-grid textarea {
  min-height: 64px;
  resize: vertical;
}

.stock-record-photos-label {
  font-size: 12px;
  font-weight: 600;
  color: #354052;
}

.stock-record-color-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.stock-record-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stock-record-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.2);
}

.stock-record-color-swatch.is-selected {
  border-color: #111827;
  box-shadow: 0 0 0 1px #111827, inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.stock-record-color-hint {
  margin: 0;
  font-size: 11px;
}

.stock-record-photos-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: #1d4ed8;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.stock-record-photos-link:hover {
  color: #1e40af;
}

.stock-record-photos-field .order-form-image-section {
  min-height: 34px;
}

.stock-record-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stock-record-photo-thumb {
  position: relative;
  width: 72px;
  height: 72px;
}

.stock-record-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.stock-record-photo-thumb .mini-button {
  position: absolute;
  top: 2px;
  right: 2px;
  min-height: 20px;
  padding: 0 6px;
  font-size: 11px;
}

.stock-record-form-actions,
.stock-record-footer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stock-record-form.is-readonly .stock-record-form-actions {
  display: none;
}

.stock-record-form.is-readonly .stock-record-color-swatches,
.stock-record-form.is-readonly #stockRecordImageSelectButton,
.stock-record-form.is-readonly #clearStockRecordImagesButton,
.stock-record-form.is-readonly [data-remove-stock-photo] {
  pointer-events: none;
}

.stock-record-form.is-readonly #stockRecordImageSelectButton,
.stock-record-form.is-readonly #clearStockRecordImagesButton,
.stock-record-form.is-readonly [data-remove-stock-photo] {
  display: none !important;
}

.stock-record-form.is-readonly .stock-record-color-swatch {
  cursor: default;
  opacity: 0.95;
}

.stock-record-form.is-readonly .order-image-paste-zone {
  cursor: default;
}

.stock-record-footer-actions {
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.stock-record-history-wrap {
  max-height: 280px;
}

@media (max-width: 720px) {
  .stock-record-grid {
    grid-template-columns: 1fr;
  }
  .stock-record-grid > label.span-all,
  .stock-record-photos-field.span-all {
    grid-column: auto;
  }
}

.stock-status-btn {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  display: inline-block;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.stock-status-btn--in {
  background: #22c55e;
}

.stock-status-btn--out {
  background: #ef4444;
}

.stock-status-btn:hover {
  filter: brightness(0.92);
}

#productForm.input-mode #changeReasonField {
  order: 17;
}

#productForm.input-mode .form-actions {
  order: 18;
}

#productForm.input-mode .input-form-section {
  display: block;
  padding: 0;
  margin: 0;
  border-top: 0;
  line-height: 1.2;
}

#productForm.input-mode .input-form-section h3 {
  margin: 0;
  padding: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.2;
}

#productForm.input-mode label {
  gap: 2px;
  font-size: 11px;
}

#productForm.input-mode input,
#productForm.input-mode select,
#productForm.input-mode textarea {
  min-height: 30px;
  padding: 5px 7px;
  font-size: 11px;
}

#productForm.input-mode textarea {
  min-height: 48px;
}

#productForm.input-mode .unit-characteristics-grid {
  grid-template-columns: repeat(2, minmax(100px, 1fr));
  gap: 6px;
}

#productForm.input-mode .input-conditional.is-muted {
  opacity: 0.45;
}

#productForm.input-mode .input-conditional.is-muted input,
#productForm.input-mode .input-conditional.is-muted select,
#productForm.input-mode .input-conditional.is-muted textarea {
  background: #f1f5f9;
  cursor: not-allowed;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented .seg {
  border: 0;
  background: #fff;
  color: var(--ink);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.segmented .seg.active {
  background: var(--accent);
  color: #fff;
}

.hidden {
  display: none !important;
}

.purchase-last-price-field {
  display: grid;
  gap: 2px;
  margin: 0;
  color: #354052;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
}

.purchase-last-price-box {
  display: grid;
  gap: 3px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 11px;
  line-height: 1.25;
  font-weight: 400;
  color: var(--ink);
}

.purchase-last-price-box strong {
  font-size: 12px;
  color: #0f172a;
}

.purchase-history-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.purchase-history-table-wrap {
  max-height: 240px;
}

.purchase-history-table-wrap table {
  min-width: 860px;
}

.purchase-history-empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 14px 10px;
}

.purchase-form-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.purchase-main-panel {
  padding: 10px;
}

#purchases .table-panel {
  padding: 10px;
}

#purchases .table-panel > h2 {
  margin: 0 0 8px;
  font-size: 14px;
}

#purchases .purchase-cart-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#purchases .order-form-block {
  gap: 5px;
}

#purchases .order-form-grid label {
  display: grid;
  gap: 2px;
  margin: 0;
  color: #354052;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
}

#purchases .order-form-grid input:not([type="checkbox"]),
#purchases .order-form-grid select,
#purchases .order-form-grid textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 28px;
  padding: 4px 7px;
  font-size: 12px;
  line-height: 1.2;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

#purchases .purchase-ident-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

#purchases .purchase-item-grid {
  grid-template-columns: minmax(180px, 2.2fr) minmax(200px, 2fr) minmax(100px, 0.9fr) 70px minmax(90px, 0.8fr);
  align-items: start;
}

#purchases .purchase-product-field,
#purchases .purchase-last-price-field,
#purchases .purchase-price-field,
#purchases .purchase-qty-field,
#purchases .purchase-sliced-field {
  grid-column: span 1;
  min-width: 0;
}

#purchases .purchase-product-field {
  position: relative;
}

#purchases .purchase-product-field .order-customer-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 180px;
  overflow: auto;
  padding: 4px;
  gap: 3px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

#purchases .purchase-qty-field {
  max-width: 70px;
}

#purchases .purchase-qty-field input[type="number"] {
  text-align: left;
}

#purchases .purchase-slice-count-field {
  max-width: 110px;
}

#purchases #purchaseItemSliceFields {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 5px 7px;
  max-width: 620px;
  margin-top: 5px;
}

#purchases #purchaseItemSliceFields label {
  display: grid;
  gap: 2px;
  color: #354052;
  font-size: 11px;
  font-weight: 600;
}

#purchases #purchaseItemSliceFields input {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 12px;
  color: var(--ink);
  background: #fff;
}

#purchases .order-form-actions {
  margin-top: 2px;
}

#purchases .order-form-actions .primary,
#purchases .order-form-actions .mini-button {
  padding: 6px 10px;
  font-size: 11px;
}

.purchase-item-builder {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.purchase-cart-footer-grid {
  grid-template-columns: 140px minmax(220px, 1fr) minmax(220px, 1.2fr);
  align-items: start;
  margin-top: 4px;
}

.purchase-cart-freight-field {
  max-width: 140px;
}

.purchase-buyer-display {
  margin: 0;
  font-size: 11px;
}

.purchase-cart-panel > .purchase-cart-items-list {
  margin-bottom: 4px;
}

#paymentModalBackdrop .payment-modal-panel {
  width: fit-content;
  max-width: min(760px, 98vw);
  max-height: calc(100dvh - 12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 12px 12px;
}

.payment-modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.payment-modal-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) max-content;
  gap: 16px;
  align-items: start;
  justify-content: start;
  min-height: 0;
}

.payment-modal-fields {
  display: grid;
  gap: 10px;
}

.payment-requirement-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

#orderForm label.order-requirement-active {
  font-weight: 600;
}

.payment-modal-installments {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
}

.payment-modal-installments-title {
  margin: 0;
  font-size: 0.95rem;
}

.payment-modal-installments-hint {
  margin: 4px 0 8px;
}

.payment-installments-scroll {
  align-self: flex-start;
  width: max-content;
  max-width: 100%;
  max-height: min(560px, calc(100dvh - 240px));
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.payment-installments-table {
  width: max-content;
  min-width: max-content;
  table-layout: fixed;
}

.payment-installments-table th,
.payment-installments-table td {
  padding: 6px 6px;
  white-space: nowrap;
}

.payment-installments-table th:first-child,
.payment-installments-table td:first-child {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
}

.payment-installments-table th:nth-child(2),
.payment-installments-table td:nth-child(2) {
  width: 92px;
  min-width: 92px;
  max-width: 92px;
}

.payment-installments-table th:nth-child(3),
.payment-installments-table td:nth-child(3) {
  width: 108px;
  min-width: 108px;
  max-width: 108px;
}

.payment-installment-row-disabled td {
  opacity: 0.45;
}

.payment-installment-row-disabled input:disabled {
  background: #f1f5f9;
  cursor: not-allowed;
}

.payment-modal-actions {
  margin-top: 4px;
}

.payment-installment-options {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.payment-installment-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}

#orderPaymentInstallmentsBlock .field-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 2px;
}

#orderPaymentInstallmentsBlock .payment-installment-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  width: 100%;
  gap: 2px 0;
  margin-top: 0;
}

#orderPaymentInstallmentsBlock .payment-installment-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  min-width: 0;
  padding: 2px 10px;
  border-right: 1px solid var(--border, #d5dae3);
  line-height: 1.15;
  font-size: 0.84rem;
  white-space: nowrap;
  cursor: pointer;
  margin: 0;
  color: inherit;
  font-weight: 400;
}

#orderPaymentInstallmentsBlock .payment-installment-option:nth-child(4n),
#orderPaymentInstallmentsBlock .payment-installment-option:last-child {
  border-right: none;
  padding-right: 0;
}

#orderPaymentInstallmentsBlock .payment-installment-option:nth-child(4n + 1) {
  padding-left: 0;
}

#orderPaymentInstallmentsBlock .payment-installment-option-count {
  font-weight: 600;
  flex-shrink: 0;
}

#orderPaymentInstallmentsBlock .payment-installment-option-fee {
  color: var(--muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

#orderPaymentInstallmentsBlock .payment-installment-option input[type="radio"] {
  margin: 0;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 0;
  box-sizing: content-box;
}

.order-detail-balance-installments {
  display: grid;
  gap: 4px;
  margin: 0;
}

.order-detail-balance-installments .field-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}

.order-detail-balance-installments .payment-installment-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  width: 100%;
  gap: 2px 0;
}

.order-detail-balance-installments .payment-installment-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  min-width: 0;
  padding: 2px 8px;
  border-right: 1px solid var(--border, #d5dae3);
  line-height: 1.15;
  font-size: 0.84rem;
  white-space: nowrap;
  cursor: pointer;
  margin: 0;
  color: inherit;
  font-weight: 400;
}

.order-detail-balance-installments .payment-installment-option:nth-child(3n),
.order-detail-balance-installments .payment-installment-option:last-child {
  border-right: none;
  padding-right: 0;
}

.order-detail-balance-installments .payment-installment-option-count {
  font-weight: 600;
  flex-shrink: 0;
}

.order-detail-balance-installments .payment-installment-option-fee {
  color: var(--muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.order-detail-balance-installments .payment-installment-option input[type="radio"] {
  margin: 0;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 0;
  box-sizing: content-box;
}

.payment-installments-table input {
  width: 92px;
  min-width: 92px;
  max-width: 92px;
}

#paymentInstallmentCount {
  max-width: 120px;
}

.purchase-cart-items-list {
  display: grid;
  gap: 8px;
}

.purchase-cart-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.purchase-cart-item-info {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 240px;
}

.purchase-cart-item-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.purchase-cart-item-title {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
}

.purchase-cart-item-meta {
  font-size: 11px;
  color: var(--muted);
}

.purchase-cart-item label {
  display: grid;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  color: #354052;
  min-width: 0;
}

.purchase-cart-item-field {
  width: 82px;
}

.purchase-cart-item-field:nth-child(3) {
  width: 90px;
}

.purchase-cart-item-field input {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-sizing: border-box;
}

.purchase-cart-item .purchase-qty-field {
  width: 64px;
  flex: 0 0 auto;
}

.purchase-cart-item .purchase-qty-field input[type="number"] {
  width: 100%;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-sizing: border-box;
  text-align: left;
}

.purchase-cart-item > .danger-button {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}

.purchase-cart-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.purchase-cart-totals > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.purchase-cart-totals span {
  font-size: 11px;
  color: var(--muted);
}

.purchase-cart-totals strong {
  font-size: 13px;
  color: #0f172a;
}

.purchase-cart-grand-total strong {
  color: #0f172a;
}

.purchase-cart-notes {
  min-width: 0;
}

#purchases .purchase-cart-notes textarea {
  min-height: 48px;
  resize: vertical;
}

.purchase-carts-list {
  display: grid;
  gap: 10px;
}

.purchase-cart-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.purchase-cart-card-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}

.purchase-cart-card-header strong {
  font-size: 14px;
}

.purchase-cart-card-items {
  display: grid;
  gap: 6px;
  font-size: 11px;
  color: #354052;
}

@media (max-width: 900px) {
  #productStructureForm .structure-main-field,
  #productStructureForm .structure-base-field {
    grid-column: span 6;
  }

  .structure-factor-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .structure-item-row {
    grid-template-columns: 1fr 90px;
  }

  #productStructureForm .structure-item-row,
  #orderStructureCostForm .structure-item-row {
    grid-template-columns: minmax(140px, 1fr) 90px;
  }

  #purchases .purchase-ident-grid,
  #purchases .purchase-item-grid,
  #purchases #purchaseItemSliceFields,
  #purchases .purchase-cart-footer-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    max-width: none;
  }

  #purchases .purchase-product-field,
  #purchases .purchase-last-price-field {
    grid-column: 1 / -1;
  }

  #purchases .purchase-qty-field {
    max-width: none;
  }

  .purchase-cart-item-info {
    max-width: none;
    width: 100%;
  }

  .purchase-cart-item > .danger-button {
    margin-left: 0;
  }

  .purchase-cart-totals {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  #productStructureForm .structure-main-field,
  #productStructureForm .structure-base-field {
    grid-column: 1 / -1;
  }

  .structure-factor-grid,
  .structure-item-row {
    grid-template-columns: 1fr;
  }

  #purchases .purchase-ident-grid,
  #purchases .purchase-item-grid,
  #purchases #purchaseItemSliceFields,
  #purchases .purchase-cart-footer-grid {
    grid-template-columns: 1fr;
  }
}

.product-table {
  max-height: calc(100vh - 175px);
}

.input-table-filters,
.input-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: end;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}

.input-table-filters label {
  display: grid;
  gap: 2px;
  min-width: 160px;
  font-size: 11px;
  font-weight: 600;
  color: #354052;
}

.input-table-filters select {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 7px;
  font-size: 11px;
  color: var(--ink);
  background: #fff;
}

.input-bulk-actions {
  background: #f8fafc;
}

.input-bulk-actions strong {
  margin-right: auto;
  font-size: 12px;
}

#inputsTable input[type="checkbox"],
#selectAllInputs,
#stockTable input[type="checkbox"],
#selectAllStock {
  width: 14px;
  height: 14px;
}

#inputs .table-wrap table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

#inputs .table-wrap table th:nth-child(1),
#inputs .table-wrap table td:nth-child(1) {
  width: 30px;
  min-width: 30px;
  max-width: 30px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

#inputs .table-wrap table th:nth-child(2),
#inputs .table-wrap table td:nth-child(2) {
  width: 70px;
  min-width: 70px;
  max-width: 70px;
  padding-left: 4px;
  padding-right: 4px;
  white-space: nowrap;
}

#inputs .table-wrap table th:nth-child(3),
#inputs .table-wrap table td:nth-child(3) {
  width: auto;
  min-width: 0;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
}

#inputs .table-wrap table th:nth-child(4),
#inputs .table-wrap table td:nth-child(4) {
  width: 78px;
}

#inputs .table-wrap table th:nth-child(5),
#inputs .table-wrap table td:nth-child(5) {
  width: 130px;
}

#inputs .table-wrap table th:nth-child(6),
#inputs .table-wrap table td:nth-child(6) {
  width: 96px;
  text-align: right;
}

#inputs .table-wrap table th:nth-child(7),
#inputs .table-wrap table td:nth-child(7) {
  width: 78px;
}

#inputs .table-wrap table th:nth-child(8),
#inputs .table-wrap table td:nth-child(8) {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
}

#inputs .table-wrap table th:not(:nth-child(3)),
#inputs .table-wrap table td:not(:nth-child(3)) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#energy-costs .table-wrap {
  overflow-x: hidden;
}

#energy-costs .table-wrap table {
  table-layout: auto;
  width: 100%;
  min-width: 0;
  font-size: 12px;
}

#energy-costs .table-wrap table th,
#energy-costs .table-wrap table td {
  padding-left: 4px;
  padding-right: 4px;
  white-space: nowrap;
}

#energy-costs .table-wrap table th {
  font-size: 11px;
}

#energy-costs .table-wrap table th:nth-child(1),
#energy-costs .table-wrap table td:nth-child(1) {
  width: 30px;
  min-width: 30px;
  max-width: 30px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

#energy-costs .table-wrap table th:nth-child(2),
#energy-costs .table-wrap table td:nth-child(2) {
  width: 1%;
  padding-left: 4px;
  padding-right: 4px;
}

#energy-costs .table-wrap table th:nth-child(3),
#energy-costs .table-wrap table td:nth-child(3) {
  width: 100%;
  min-width: 80px;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
}

#energy-costs .table-wrap table th:nth-child(4),
#energy-costs .table-wrap table td:nth-child(4) {
  width: 1%;
}

#energy-costs .table-wrap table th:nth-child(5),
#energy-costs .table-wrap table td:nth-child(5),
#energy-costs .table-wrap table th:nth-child(7),
#energy-costs .table-wrap table td:nth-child(7),
#energy-costs .table-wrap table th:nth-child(8),
#energy-costs .table-wrap table td:nth-child(8) {
  width: 1%;
  text-align: right;
}

#energy-costs .table-wrap table th:nth-child(6),
#energy-costs .table-wrap table td:nth-child(6) {
  width: 1%;
  text-align: right;
}

#energy-costs .table-wrap table th:nth-child(9),
#energy-costs .table-wrap table td:nth-child(9) {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
}

#energy-costs .table-wrap table th:not(:nth-child(3)),
#energy-costs .table-wrap table td:not(:nth-child(3)) {
  overflow: visible;
  text-overflow: clip;
}

#energyMachinesTable input[type="checkbox"],
#selectAllEnergyMachines {
  width: 14px;
  height: 14px;
}

#ink-costs .table-wrap {
  overflow-x: auto;
}

#ink-costs .table-wrap table {
  table-layout: auto;
  width: 100%;
  min-width: 1060px;
  font-size: 12px;
}

#ink-costs .table-wrap table th,
#ink-costs .table-wrap table td {
  padding-left: 5px;
  padding-right: 5px;
  white-space: nowrap;
}

#ink-costs .table-wrap table th:nth-child(2),
#ink-costs .table-wrap table td:nth-child(2) {
  min-width: 210px;
  white-space: normal;
  line-height: 1.35;
}

.ink-estimate-result {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.ink-estimate-result div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.ink-estimate-result span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.ink-estimate-result strong {
  display: block;
  color: var(--ink);
}

.ink-correction-history-wrap {
  margin-top: 10px;
  max-height: 210px;
}

.ink-correction-history-wrap table {
  min-width: 760px;
  font-size: 12px;
}

#inkCorrectionForm {
  grid-template-columns: minmax(260px, 2fr) minmax(170px, 1fr) minmax(180px, 1fr) max-content;
}

#inkCorrectionForm .form-actions {
  justify-content: flex-start;
  white-space: nowrap;
}

.ink-simulation-modal {
  width: min(720px, 94vw);
}

.ink-simulation-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f7fb;
}

.ink-simulation-summary strong,
.ink-simulation-summary span {
  display: block;
}

.ink-simulation-summary span {
  color: var(--muted);
  font-size: 12px;
}

#product-structures .table-wrap {
  overflow-x: hidden;
}

#product-structures .table-wrap table {
  table-layout: auto;
  width: 100%;
  min-width: 0;
  font-size: 12px;
}

#product-structures .table-wrap table th,
#product-structures .table-wrap table td {
  padding-left: 4px;
  padding-right: 4px;
  white-space: nowrap;
}

#product-structures .table-wrap table th {
  font-size: 11px;
}

#product-structures .table-wrap table th:nth-child(1),
#product-structures .table-wrap table td:nth-child(1) {
  width: 30px;
  min-width: 30px;
  max-width: 30px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

#product-structures .table-wrap table th:nth-child(2),
#product-structures .table-wrap table td:nth-child(2) {
  width: 1%;
  padding-left: 4px;
  padding-right: 4px;
}

#product-structures .table-wrap table th:nth-child(3),
#product-structures .table-wrap table td:nth-child(3) {
  width: 100%;
  min-width: 80px;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
}

#product-structures .table-wrap table th:nth-child(4),
#product-structures .table-wrap table td:nth-child(4),
#product-structures .table-wrap table th:nth-child(5),
#product-structures .table-wrap table td:nth-child(5),
#product-structures .table-wrap table th:nth-child(7),
#product-structures .table-wrap table td:nth-child(7) {
  width: 1%;
}

#product-structures .table-wrap table th:nth-child(8),
#product-structures .table-wrap table td:nth-child(8) {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
}

#product-structures .table-wrap table th:nth-child(6),
#product-structures .table-wrap table td:nth-child(6) {
  width: 1%;
  text-align: right;
}

#product-structures .table-wrap table th:not(:nth-child(3)),
#product-structures .table-wrap table td:not(:nth-child(3)) {
  overflow: visible;
  text-overflow: clip;
}

#productStructuresTable input[type="checkbox"],
#selectAllProductStructures {
  width: 14px;
  height: 14px;
}

#suppliers .table-wrap table th:nth-child(6),
#suppliers .table-wrap table td:nth-child(6),
#payments .table-wrap table th:nth-child(5),
#payments .table-wrap table td:nth-child(5) {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
}

.tall-table {
  max-height: calc(100vh - 330px);
}

.input-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.input-actions > .mini-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
}

.product-structure-modal {
  width: min(980px, 96vw);
}

#productStructureForm,
#orderStructureCostForm {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: 8px 10px;
}

#productStructureForm .span-two,
#productStructureForm .structure-title-field,
#productStructureForm .structure-factor-grid,
#productStructureForm .structure-machines-section,
#productStructureForm .structure-labor-section,
#productStructureForm .structure-items-section,
#productStructureForm .structure-notes-field,
#productStructureForm .structure-total-box,
#productStructureForm .form-actions,
#orderStructureCostForm .span-two,
#orderStructureCostForm .structure-title-field,
#orderStructureCostForm .structure-factor-grid,
#orderStructureCostForm .structure-machines-section,
#orderStructureCostForm .structure-labor-section,
#orderStructureCostForm .structure-items-section,
#orderStructureCostForm .structure-notes-field,
#orderStructureCostForm .structure-total-box,
#orderStructureCostForm .form-actions {
  grid-column: 1 / -1;
}

#productStructureForm .structure-title-field,
#orderStructureCostForm .structure-title-field {
  order: 1;
}

#productStructureForm .structure-main-field,
#orderStructureCostForm .structure-main-field {
  grid-column: span 3;
  order: 2;
}

#productStructureForm .structure-base-field,
#orderStructureCostForm .structure-base-field {
  grid-column: span 3;
  order: 3;
}

.structure-factor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  order: 4;
}

.structure-factor {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.structure-factor span {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 34px;
  line-height: 1.25;
}

.structure-machines-section,
.structure-labor-section,
.structure-items-section {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.structure-machines-section {
  order: 5;
}

.structure-labor-section {
  order: 6;
}

.structure-items-section {
  order: 7;
}

.structure-items-header {
  display: grid;
  gap: 2px;
}

#productStructureForm .structure-notes-field,
#orderStructureCostForm .structure-notes-field {
  order: 8;
}

.structure-items-list {
  display: grid;
  gap: 6px;
}

.structure-item-block {
  display: grid;
  gap: 2px;
}

.structure-item-cost {
  font-size: 11px;
  padding-left: 2px;
}

.structure-item-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 92px 132px 34px;
  gap: 6px;
  align-items: end;
}

#productStructureForm .structure-item-row,
#orderStructureCostForm .structure-item-row {
  grid-template-columns: minmax(130px, 1fr) 72px repeat(4, minmax(88px, auto)) 32px;
}

.structure-machine-row,
.structure-labor-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px 120px 34px;
  gap: 6px;
  align-items: end;
}

.structure-labor-actions {
  flex-wrap: wrap;
}

.structure-item-row label,
.structure-search-field {
  min-width: 0;
  position: relative;
}

.structure-search-field [data-structure-suggestions] {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 30;
  margin-top: 0;
  grid-column: unset;
  max-height: 180px;
}

.structure-possibility,
.structure-consume-unit,
.structure-consume-width,
.structure-consume-height {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  font-size: 11px;
  font-weight: 600;
}

.structure-remove-item {
  width: 32px;
  height: 32px;
  padding: 0;
}

.structure-total-box {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  order: 9;
}

#productStructureForm > .form-actions {
  order: 10;
}

.structure-total-preview {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.structure-total-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.table-panel h2 {
  padding: 10px 12px 0;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 160px);
}

#accounts2 .table-panel,
#accounts2 .table-wrap {
  max-height: none;
  overflow: visible;
}

.orders-top-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  margin: 0 0 4px 0;
  border-bottom: 1px solid var(--line);
}

#ordersTopScrollInner {
  height: 1px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 12px;
}

th,
td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.2;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f7;
  color: #354052;
  font-size: 11px;
  text-transform: uppercase;
}

#products .table-wrap table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

#products .table-wrap table th:nth-child(1),
#products .table-wrap table td:nth-child(1) {
  width: 30px;
  min-width: 30px;
  max-width: 30px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

#products .table-wrap table th:nth-child(2),
#products .table-wrap table td:nth-child(2) {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding-left: 4px;
  padding-right: 4px;
  white-space: nowrap;
}

#products .table-wrap table th:nth-child(2) {
  overflow: hidden;
  text-overflow: clip;
}

#products .table-wrap table td:nth-child(2) {
  overflow: visible;
}

#products .table-wrap table th:nth-child(3),
#products .table-wrap table td:nth-child(3) {
  width: auto;
  min-width: 0;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
  vertical-align: top;
}

#products .table-wrap table th:nth-child(4),
#products .table-wrap table td:nth-child(4) {
  width: 110px;
}

#products .table-wrap table th:nth-child(5),
#products .table-wrap table td:nth-child(5) {
  width: 110px;
}

#products .table-wrap table th:nth-child(6),
#products .table-wrap table td:nth-child(6),
#products .table-wrap table th:nth-child(7),
#products .table-wrap table td:nth-child(7),
#products .table-wrap table th:nth-child(8),
#products .table-wrap table td:nth-child(8) {
  width: 88px;
}

#products .table-wrap table th:nth-child(9),
#products .table-wrap table td:nth-child(9) {
  width: 64px;
}

#products .table-wrap table th:nth-child(10),
#products .table-wrap table td:nth-child(10) {
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#products .table-wrap table th:not(:nth-child(2)):not(:nth-child(3)),
#products .table-wrap table td:not(:nth-child(2)):not(:nth-child(3)) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#productsTable input[type="checkbox"],
#selectAllProducts {
  width: 14px;
  height: 14px;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.table-sort-button:hover {
  color: var(--accent);
}

.table-sort-button .sort-indicator {
  display: inline-block;
  min-width: 2.4em;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.3;
}

#productForm.horizontal-form .product-name-field {
  grid-column: 1 / -1;
}

#productForm .product-name-field input {
  font-size: 15px;
  padding: 10px 12px;
}

#productForm:not(.input-mode) {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px 8px;
  align-items: start;
}

#productForm:not(.input-mode) label {
  gap: 4px;
  font-size: 12px;
  min-width: 0;
}

#productForm:not(.input-mode) input,
#productForm:not(.input-mode) select,
#productForm:not(.input-mode) textarea {
  padding: 8px 9px;
  font-size: 13px;
}

#productForm:not(.input-mode) #pricingMethodField {
  grid-column: span 4;
}

#productForm:not(.input-mode) #productSupplierTextField {
  grid-column: span 4;
}

#productForm:not(.input-mode) #productCostField,
#productForm:not(.input-mode) #productSalePriceField,
#productForm:not(.input-mode) #productResellerPriceField {
  grid-column: span 2;
}

#productForm:not(.input-mode) #productProductionDaysField {
  grid-column: span 2;
  max-width: 120px;
}

#productForm:not(.input-mode) #productProductionDayModeField {
  grid-column: span 3;
  max-width: 170px;
}

#productForm:not(.input-mode) #tiersField {
  grid-column: 1 / -1;
}

#productForm:not(.input-mode) #productNotesField,
#productForm:not(.input-mode) #changeReasonField,
#productForm:not(.input-mode) #productPriceHistorySection,
#productForm:not(.input-mode) #productCatalogSection,
#productForm:not(.input-mode) .form-actions {
  grid-column: 1 / -1;
}

#productForm:not(.input-mode) .form-actions {
  justify-content: flex-start;
  align-self: start;
}

#productForm:not(.input-mode) .product-variation-row {
  grid-template-columns: minmax(120px, 1.1fr) repeat(3, minmax(88px, 0.85fr)) auto;
  gap: 6px;
}

#productForm:not(.input-mode) .product-variation-row--input,
#productForm:not(.input-mode) .product-variation-row--structure {
  grid-template-columns: minmax(160px, 1.3fr) repeat(3, minmax(88px, 0.85fr)) auto;
}

#productForm:not(.input-mode) .product-variation-row--structure.has-possibilities {
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 0.9fr) repeat(3, minmax(88px, 0.85fr)) auto;
}

#productForm:not(.input-mode) .product-variation-row--structure.product-variation-row--structure-expanded,
#productForm:not(.input-mode) .product-variation-row--structure.has-possibilities.product-variation-row--structure-expanded {
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(88px, 0.85fr)) auto;
}

#productForm:not(.input-mode) .product-variation-row--structure.product-variation-row--structure-picker {
  grid-template-columns: minmax(180px, 1.4fr) minmax(120px, 0.9fr) auto;
}

#productForm:not(.input-mode) .product-variation-row--structure.product-variation-row--structure-picker.has-possibilities {
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 0.9fr) auto;
}

#productForm:not(.input-mode) .product-structure-quantity-tier-row {
  grid-template-columns: minmax(120px, 1.1fr) repeat(3, minmax(88px, 0.85fr)) auto;
}

@media (max-width: 900px) {
  #productForm:not(.input-mode) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  #productForm:not(.input-mode) #pricingMethodField,
  #productForm:not(.input-mode) #productSupplierTextField {
    grid-column: span 3;
  }

  #productForm:not(.input-mode) #productProductionDaysField,
  #productForm:not(.input-mode) #productProductionDayModeField {
    max-width: none;
  }

  .product-size-tier-main {
    grid-template-columns: 1fr;
  }
}

.order-variation-field select {
  font-size: 15px;
  font-weight: 600;
  padding: 10px 12px;
}

#orderPriceHint.order-price-warning {
  color: #b45309;
  font-weight: 600;
}

#ordersTable td:nth-child(3),
#ordersHistoryTable td:nth-child(2) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ordersTable td:nth-child(4),
#ordersTable th:nth-child(4),
#ordersHistoryTable td:nth-child(3),
#ordersHistoryTable th:nth-child(3) {
  min-width: 110px;
  max-width: 170px;
}

.order-company-cell {
  font-size: 12px;
  font-weight: 700;
  color: #2f6fb3 !important;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  line-height: 1.25;
}

.order-client-cell {
  font-weight: 600;
  line-height: 1.25;
}

#ordersTable td:nth-child(5),
#ordersHistoryTable td:nth-child(4) {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
}

.orders-table-panel .orders-top-scroll {
  display: none;
}

.orders-table-panel .table-wrap {
  overflow-x: hidden;
}

.orders-table-panel table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.orders-table-panel th,
.orders-table-panel td {
  padding-left: 5px;
  padding-right: 5px;
}

.orders-table-panel th:nth-child(1),
.orders-table-panel td:nth-child(1) {
  width: 2.4%;
}

.orders-table-panel th:nth-child(2),
.orders-table-panel td:nth-child(2) {
  width: 3.4%;
}

.orders-table-panel th:nth-child(3),
.orders-table-panel td:nth-child(3) {
  width: 6.2%;
}

.orders-table-panel th:nth-child(4),
.orders-table-panel td:nth-child(4) {
  width: 8.2%;
}

.orders-table-panel th:nth-child(5),
.orders-table-panel td:nth-child(5) {
  width: 9.5%;
}

.orders-table-panel th:nth-child(6),
.orders-table-panel td:nth-child(6) {
  width: 28.2%;
}

.orders-table-panel th:nth-child(7),
.orders-table-panel td:nth-child(7),
.orders-table-panel th:nth-child(8),
.orders-table-panel td:nth-child(8) {
  width: 5.2%;
}

.orders-table-panel th.order-rg-col,
.orders-table-panel td.order-rg-col {
  width: 2.4%;
  min-width: 24px;
  max-width: 30px;
  padding-left: 2px;
  padding-right: 2px;
  text-align: center;
  vertical-align: middle;
}

#ordersTable .order-rg-alert,
#ordersHistoryTable .order-rg-alert {
  color: #c99700;
  font-size: 14px;
  line-height: 1;
}

#ordersTable .order-rg-empty,
#ordersHistoryTable .order-rg-empty {
  color: #9aa3ad;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.orders-table-panel th:nth-child(10),
.orders-table-panel td:nth-child(10),
.orders-table-panel th:nth-child(11),
.orders-table-panel td:nth-child(11),
.orders-table-panel th:nth-child(12),
.orders-table-panel td:nth-child(12),
.orders-table-panel th:nth-child(14),
.orders-table-panel td:nth-child(14) {
  width: 5.9%;
}

.orders-table-panel th:nth-child(13),
.orders-table-panel td:nth-child(13) {
  width: 8.2%;
}

#ordersTable .order-product-cell,
#ordersHistoryTable .order-product-cell {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.25;
}

#ordersTable .order-quantity-cell,
#ordersHistoryTable .order-quantity-cell {
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.2;
}

#ordersTable .col-money,
#ordersHistoryTable .col-money {
  white-space: nowrap;
  font-size: 11px;
  text-align: right;
}

#ordersTable th.col-money,
#ordersHistoryTable th.col-money {
  text-align: right;
  font-size: 11px;
}

#ordersTable td.order-tithe-paid,
#ordersHistoryTable td.order-tithe-paid {
  opacity: 0.55;
}

#ordersTable td.order-tithe-paid.order-tithe-corrected,
#ordersHistoryTable td.order-tithe-paid.order-tithe-corrected {
  opacity: 1;
  vertical-align: middle;
  white-space: normal;
  line-height: 1.15;
}

.order-tithe-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  max-width: 100%;
}

.order-tithe-original {
  display: block;
  color: #b42318 !important;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: #b42318;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  opacity: 1;
}

.order-tithe-current {
  display: block;
  font-size: inherit;
  font-weight: 600;
  line-height: 1.15;
}

#ordersTable td.order-tithe-pending,
#ordersHistoryTable td.order-tithe-pending {
  color: #b42318;
  font-weight: 600;
}

.orders-visible-tithe {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: #b42318;
}

.orders-visible-tithe:empty {
  display: none;
}

#ordersFilterRow th {
  padding: 4px 6px;
}

#ordersFilterRow input,
#ordersFilterRow select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 11px;
  padding: 4px 6px;
  height: 24px;
}

.filter-handle-wrap {
  position: relative;
  display: inline-block;
}

.filter-handle-wrap input {
  padding-right: 18px !important;
}

.filter-handle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: #7a8798;
  pointer-events: none;
}

#filterFinished,
#filterPaymentStatus,
#filterTithePaid,
#filterInvoiceIssued {
  width: 92px;
}

#filterOrderDate,
#filterPaymentDate,
#filterDeliveryDate {
  width: 96px;
}

#filterQuantity {
  width: 56px;
}

#filterCustomer {
  width: 120px;
}

#filterProduct {
  width: 140px;
}

#filterSaleMeasure,
#filterProdMeasure {
  width: 120px;
}

#filterPaymentMethod {
  width: 110px;
}

#filterNotes {
  width: 90px;
}

td.money {
  text-align: right;
  white-space: nowrap;
}

td.money.credit {
  color: #2559a7;
}

td.money.debit {
  color: #b42318;
}

.account-amount-input,
.account-day-input {
  color: inherit;
}

.account-amount-input-locked {
  cursor: not-allowed;
  background: #f3f4f6;
  opacity: 0.92;
}

.orders-list-hint {
  margin: 0 0 10px;
  font-size: 13px;
}

.orders-filter-bar {
  margin-bottom: 10px;
  padding: 8px 0;
  gap: 8px;
}

.orders-filter-bar label {
  min-width: 120px;
}

#products .products-catalog-filter-bar.horizontal-form {
  margin: 0 0 10px;
  padding: 8px 0;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  align-items: end;
}

.products-catalog-filter-bar label {
  min-width: 140px;
}

.products-catalog-filter-clear-wrap,
.orders-filter-clear-wrap {
  display: flex;
  align-items: flex-end;
  min-width: auto;
}

.products-catalog-filter-clear-wrap .mini-button,
.orders-filter-clear-wrap .mini-button {
  white-space: nowrap;
}

#products .products-catalog-filter-bar select {
  width: 100%;
}

@media (max-width: 900px) {
  #products .products-catalog-filter-bar.horizontal-form {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .products-catalog-filter-clear-wrap {
    grid-column: 1 / -1;
  }
}

.orders-bulk-invoice-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.orders-bulk-invoice-bar.hidden {
  display: none;
}

#ordersBulkInvoiceCount {
  font-size: 14px;
  font-weight: 600;
}

.order-invoice-select-col,
.order-invoice-select {
  width: 34px;
  text-align: center;
}

.order-invoice-select input,
.order-invoice-select-col input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.order-bulk-invoice-panel {
  width: min(520px, 96vw);
}

.order-sales-report-panel {
  width: min(760px, 96vw);
  max-height: 92vh;
  overflow: auto;
}

.order-sales-report-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 14px;
  margin-bottom: 14px;
}

.order-sales-report-field-group {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.order-sales-report-field {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.order-sales-report-field select {
  width: 100%;
  min-height: 34px;
}

.order-sales-report-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  bottom: 0;
  padding-top: 10px;
  background: var(--panel-bg, #fff);
}

.order-bulk-invoice-panel h2 {
  margin: 0 0 4px;
}

.order-bulk-invoice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.order-bulk-invoice-list {
  margin: 0 0 12px;
  padding-left: 18px;
  max-height: 180px;
  overflow: auto;
  font-size: 14px;
}

.order-bulk-invoice-list li + li {
  margin-top: 4px;
}

.order-bulk-invoice-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 14px;
}

.order-bulk-invoice-field input {
  width: 100%;
}

.order-bulk-invoice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.order-dispatch-bank-panel {
  width: min(640px, 96vw);
  max-height: 90vh;
  overflow: auto;
}

.order-dispatch-bank-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.order-dispatch-bank-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  max-height: min(420px, 55vh);
  overflow: auto;
  display: grid;
  gap: 10px;
}

.order-dispatch-bank-list li {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border, #d6d6d6);
  border-radius: 8px;
  font-size: 14px;
}

.order-dispatch-bank-list .order-dispatch-bank-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: space-between;
}

.order-dispatch-bank-list .order-dispatch-bank-action {
  font-size: 12px;
  color: var(--muted, #666);
}

#orderBulkInvoiceModalBackdrop,
#orderDispatchBankModalBackdrop {
  z-index: 110;
}

#ordersTable tr[data-order-id],
#ordersHistoryTable tr[data-order-id] {
  cursor: pointer;
}

#ordersTable tr.order-row-selected td,
#ordersHistoryTable tr.order-row-selected td {
  background: #eef4ff !important;
}

#applicationsTable tr[data-application-id] {
  cursor: pointer;
}

#applicationsTable tr.application-row-selected td {
  background: #eef4ff !important;
}

#applications .tall-table table {
  table-layout: fixed;
  min-width: 640px;
  width: 100%;
}

#applications .tall-table th,
#applications .tall-table td {
  vertical-align: middle;
}

#applications .tall-table th:nth-child(2),
#applications .tall-table td:nth-child(2),
#applications .tall-table th:nth-child(3),
#applications .tall-table td:nth-child(3) {
  width: 140px;
  text-align: right;
  white-space: nowrap;
}

#applications .tall-table th:nth-child(4),
#applications .tall-table td:nth-child(4) {
  width: 90px;
  text-align: center;
}

#applications .tall-table th:nth-child(5),
#applications .tall-table td:nth-child(5) {
  width: 100px;
  text-align: center;
}

#applications .purchase-history-table-wrap table {
  table-layout: fixed;
  min-width: 860px;
  width: 100%;
}

#applications .purchase-history-table-wrap th,
#applications .purchase-history-table-wrap td {
  vertical-align: middle;
}

#applications .purchase-history-table-wrap th:nth-child(1),
#applications .purchase-history-table-wrap td:nth-child(1) {
  width: 90px;
}

#applications .purchase-history-table-wrap th:nth-child(2),
#applications .purchase-history-table-wrap td:nth-child(2) {
  width: 100px;
}

#applications .purchase-history-table-wrap th:nth-child(3),
#applications .purchase-history-table-wrap td:nth-child(3),
#applications .purchase-history-table-wrap th:nth-child(4),
#applications .purchase-history-table-wrap td:nth-child(4),
#applications .purchase-history-table-wrap th:nth-child(5),
#applications .purchase-history-table-wrap td:nth-child(5),
#applications .purchase-history-table-wrap th:nth-child(6),
#applications .purchase-history-table-wrap td:nth-child(6) {
  width: 120px;
  text-align: right;
  white-space: nowrap;
}

.application-available-input {
  width: 110px;
  max-width: 100%;
  box-sizing: border-box;
  margin-left: auto;
  display: block;
  text-align: right;
}

.order-detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  z-index: 90;
}

.order-detail-backdrop.hidden {
  display: none;
}

.order-detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 96vw);
  height: 100vh;
  background: var(--panel, #fff);
  border-left: 1px solid var(--line);
  z-index: 95;
  overflow-y: auto;
  box-shadow: -6px 0 24px rgba(15, 23, 42, 0.12);
  padding: 14px 16px 24px;
}

.order-detail-drawer.hidden {
  display: none;
}

.order-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.order-detail-header h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.order-detail-body {
  display: grid;
  gap: 14px;
}

.order-detail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.order-detail-section h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.order-detail-dl {
  display: grid;
  grid-template-columns: minmax(110px, 38%) 1fr;
  gap: 6px 10px;
  margin: 0;
  font-size: 14px;
}

.order-detail-dl dt {
  margin: 0;
  color: var(--muted);
}

.order-detail-dl dd {
  margin: 0;
  font-weight: 600;
}

.order-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.order-detail-balance {
  display: grid;
  gap: 8px;
}

.order-detail-balance label {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.order-detail-balance input,
.order-detail-balance select {
  width: 100%;
}

.order-detail-notes-empty {
  margin: 0;
}

.order-detail-notes {
  margin: 0;
  white-space: pre-wrap;
  font-size: 14px;
}

.order-detail-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  margin-bottom: 8px;
}

.order-detail-image-empty {
  margin: 0 0 8px;
}

.order-detail-linked-record + .order-detail-linked-record {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.order-detail-linked-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.order-detail-linked-detail,
.order-detail-linked-notes,
.order-detail-linked-empty {
  margin: 4px 0 0;
  font-size: 13px;
}

.order-detail-linked-detail {
  color: var(--text-muted, #666);
}

.order-dispatched-field {
  margin-top: 0;
}

.order-dispatched-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.order-product-cell-inner {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
}

.order-service-expand {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #4b5563;
  font-size: 11px;
  line-height: 1.2;
  padding: 0 2px;
  cursor: pointer;
}

.order-service-detail-row td {
  background: #f8fafc !important;
  padding-top: 0 !important;
}

.order-service-detail {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 8px 18px;
  font-size: 12px;
  color: #334155;
}

.order-service-detail-price {
  font-weight: 700;
  color: #0f172a;
}

.order-label-preview-panel {
  width: min(560px, 96vw);
}

.order-label-preview-panel h2 {
  margin: 0 0 4px;
}

.order-label-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.order-label-preview-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 12px 16px;
  background: #e2e8f0;
  border-radius: 8px;
  overflow: auto;
}

.order-label-preview-stage {
  position: relative;
  padding: 24px 0 0 32px;
}

.order-label-ruler {
  position: absolute;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.03em;
  pointer-events: none;
}

.order-label-ruler-top {
  top: 0;
  left: 32px;
  right: 0;
  text-align: center;
  line-height: 20px;
  border-top: 2px solid #94a3b8;
}

.order-label-ruler-left {
  left: 0;
  top: 24px;
  bottom: 0;
  width: 28px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 2px solid #94a3b8;
}

.order-label-preview-content {
  display: inline-block;
}

.order-label-page {
  width: 100mm;
  height: auto;
  min-height: 0;
  background: #fff;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.18);
  padding: 3mm;
  box-sizing: border-box;
}

.order-label-page.has-image {
  height: 70mm;
}

.order-label {
  width: 100%;
  height: auto;
  min-height: 0;
  border: 1px solid #222;
  padding: 3mm;
  display: flex;
  flex-direction: column;
  gap: 1.5mm;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
  color: #111;
}

.order-label-page.has-image .order-label,
.order-label-has-image {
  height: 100%;
}

.order-label-logo-wrap {
  flex: 0 0 auto;
  text-align: center;
  border-bottom: 0.5px solid #ddd;
  padding-bottom: 1mm;
}

.order-label-logo {
  height: 9mm;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: inline-block;
}

.order-label-content {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 28mm;
  gap: 3mm;
}

.order-label-no-image .order-label-content {
  grid-template-columns: 1fr;
}

.order-label-main {
  min-width: 0;
}

.order-label-id {
  font-size: 13pt;
  font-weight: 800;
  margin-bottom: 2mm;
}

.order-label-line {
  font-size: 10pt;
  line-height: 1.25;
  margin-bottom: 1.2mm;
  word-break: break-word;
}

.order-label-company {
  font-size: 11pt;
  font-weight: 700;
  color: #2f6fb3;
}

.order-label-product {
  font-size: 9.5pt;
  font-weight: 700;
  margin-top: 2mm;
}

.order-label-meta {
  font-size: 8.5pt;
  color: #444;
  margin-top: 2mm;
}

.order-label-balance {
  margin-top: 2.5mm;
  padding: 1.5mm 2mm;
  border: 1.5px solid #b91c1c;
  border-radius: 1mm;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 10pt;
  font-weight: 800;
  line-height: 1.2;
}

.order-label-image-wrap {
  width: 28mm;
  height: 28mm;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fafafa;
}

.order-label-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.order-label-image-empty {
  font-size: 8pt;
  color: #888;
  text-align: center;
  padding: 2mm;
}

.order-label-preview-hint {
  margin: 10px 0 0;
  font-size: 13px;
}

.order-label-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

#orderLabelPreviewBackdrop {
  z-index: 110;
}

.order-form-image-section {
  display: grid;
  gap: 8px;
}

.order-form-image-label {
  font-size: 12px;
  font-weight: 700;
  color: #354052;
}

.order-form-image-preview {
  max-width: 100%;
}

.order-form-image-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: #fff;
}

.order-form-image-hint {
  margin: 0;
}

.order-draft-photo-cell {
  text-align: center;
}

.order-draft-photo-cell .mini-button {
  margin-right: 4px;
}

.order-draft-has-photo {
  font-size: 12px;
  color: #1e4a7a;
}

.order-image-paste-zone {
  display: grid;
  gap: 6px;
  padding: 14px 12px;
  margin-bottom: 8px;
  border: 2px dashed #9bb8d9;
  border-radius: 8px;
  background: #f4f9ff;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  outline: none;
}

.order-image-paste-zone:focus,
.order-image-paste-zone:hover {
  border-color: var(--accent);
  background: #eef4ff;
}

.order-image-paste-zone strong {
  color: #1e4a7a;
  font-size: 14px;
}

.order-image-paste-zone kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  color: #333;
}

#ordersTable tr.order-canceled td,
#ordersHistoryTable tr.order-canceled td {
  background: #fdecec;
  color: #9b1c1c;
}

#ordersTable tr.order-canceled.order-row-selected td,
#ordersHistoryTable tr.order-canceled.order-row-selected td {
  background: #f9d4d4 !important;
}

.order-detail-canceled-note {
  margin: 0;
  font-size: 13px;
}

#ordersTable tr.order-finished-paid td,
#ordersHistoryTable tr.order-finished-paid td {
  background: #eefaf2;
  color: #486257;
}

#ordersTable tr.order-finished-pending td,
#ordersHistoryTable tr.order-finished-pending td {
  background: #dbeafe;
  color: #1e40af;
}

#ordersTable tr.order-dispatched td,
#ordersHistoryTable tr.order-dispatched td {
  background: #ffffff;
}

#ordersTable tr.order-not-dispatched td,
#ordersHistoryTable tr.order-not-dispatched td {
  background: #fef9c3;
}

#ordersTable tr.order-not-dispatched.order-row-selected td,
#ordersHistoryTable tr.order-not-dispatched.order-row-selected td {
  background: #eef4ff !important;
}

#ordersTable tr.order-finished-pending.order-row-selected td,
#ordersHistoryTable tr.order-finished-pending.order-row-selected td {
  background: #bfdbfe !important;
}

#ordersTable tr,
#ordersHistoryTable tr {
  position: relative;
}

#ordersTable td,
#ordersHistoryTable td {
  border-bottom: 0;
}

#ordersTable tr::after,
#ordersHistoryTable tr::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-bottom: 1px solid #cfd8e3;
  pointer-events: none;
}

.negative,
.money.negative,
td.money.negative {
  color: var(--danger);
}

.accounts-table-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.accounts-month-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.accounts-month-picker-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
}

.accounts-list-month-label {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 10px;
  color: var(--danger);
  font-size: 16px;
  font-weight: 700;
  border: 1px solid #e8c4c4;
  border-radius: 8px;
  background: #fff7f7;
  pointer-events: none;
}

.accounts-month-picker-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
}

.accounts-month-arrow {
  border: 1px solid #e8c4c4;
  border-radius: 6px;
  background: #fff7f7;
  color: var(--danger);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.accounts-month-arrow:hover {
  background: #ffeaea;
}

.accounts-month-picker {
  color: var(--danger);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  border: 1px solid #e8c4c4;
  border-radius: 8px;
  background: #fff7f7;
  padding: 4px 8px;
  cursor: pointer;
  min-height: 34px;
}

.accounts-month-picker:focus {
  outline: 2px solid rgba(176, 48, 48, 0.25);
  border-color: var(--danger);
}

#accounts .accounts-table tr.account-owner-company td,
#accounts2 .accounts2-table tr.account-owner-company td {
  background: #ecfccb;
}

#accounts .accounts-table tr.account-owner-carla td,
#accounts2 .accounts2-table tr.account-owner-carla td {
  background: #ffeaf4;
}

#accounts .accounts-table tr.account-owner-leandro td,
#accounts2 .accounts2-table tr.account-owner-leandro td {
  background: #dbeafe;
}

#accounts .accounts-table tr.account-owner-company td:first-child,
#accounts2 .accounts2-table tr.account-owner-company td:first-child {
  border-left: 4px solid #65a30d;
}

#accounts .accounts-table tr.account-owner-carla td:first-child,
#accounts2 .accounts2-table tr.account-owner-carla td:first-child {
  border-left: 4px solid #b34f88;
}

#accounts .accounts-table tr.account-owner-leandro td:first-child,
#accounts2 .accounts2-table tr.account-owner-leandro td:first-child {
  border-left: 4px solid #2563eb;
}

#accounts .accounts-table tr.account-row-paid td {
  color: var(--danger);
}

#accounts .accounts-table tr.account-row-paid .account-amount-input {
  color: var(--danger);
}

#accounts2 .accounts2-table tr.accounts2-row-paid td,
#accounts2 .accounts2-table tr.accounts2-row-paid .accounts2-child-desc,
#accounts2 .accounts2-table tr.accounts2-row-paid .accounts2-value-input {
  color: var(--danger);
}

#accounts .accounts-entry-panel {
  padding: 16px;
}

#accounts .accounts-form-large {
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  gap: 14px;
}

#accounts .accounts-form-large input:not([type="checkbox"]),
#accounts .accounts-form-large select {
  min-height: 42px;
  font-size: 14px;
}

#accounts .accounts-metrics,
#accounts2 .accounts-metrics {
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
}

#accounts2 .accounts-metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  #accounts2 .accounts-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

#accounts .accounts-metric-hint,
#accounts2 .accounts-metric-hint {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted, #6b7280);
  line-height: 1.2;
}

#accounts #accountsDuePeriod.accounts-period-surplus {
  color: var(--accent);
}

#accounts .accounts-metrics strong.negative,
#accounts #accountsDuePeriod.negative,
#accounts2 .accounts-metrics strong.negative,
#accounts2 .accounts2-outlook-negative {
  color: var(--danger);
}

#accounts2 .accounts2-outlook-positive {
  color: #15803d;
}

#accounts .accounts-metrics article,
#accounts2 .accounts-metrics article {
  padding: 8px 10px;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

#accounts .accounts-metrics span,
#accounts2 .accounts-metrics span {
  font-size: 11px;
}

#accounts .accounts-metrics strong,
#accounts2 .accounts-metrics strong {
  margin-top: 2px;
  font-size: 14px;
}

#accounts .accounts-side-tools {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

#accounts2 .accounts2-side-tools {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

#accounts .accounts-due-panel {
  padding: 10px;
}

#accounts .accounts-due-panel strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

#accounts .accounts-auto-credit-panel {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

#accounts .accounts-auto-credit-label {
  display: block;
  font-size: 11px;
  color: #64748b;
}

#accounts .accounts-auto-credit-latest {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.35;
  color: #334155;
}

#accounts .accounts-auto-credit-actions {
  margin-top: 6px;
  gap: 6px;
}

.order-account-credit-history {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.order-account-credit-history .account-auto-credit-list {
  max-height: 180px;
  overflow: auto;
  margin-top: 6px;
}

#orderDetailAccountCreditLatest {
  font-size: 11px;
  line-height: 1.35;
}

.account-auto-credit-modal {
  width: min(720px, 96vw);
  max-height: 85vh;
  display: grid;
  gap: 12px;
}

.account-auto-credit-list {
  max-height: 55vh;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.account-auto-credit-item {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
  line-height: 1.4;
}

.account-auto-credit-item strong {
  display: block;
  margin-bottom: 2px;
  color: #1e3a5f;
}

#accounts .accounts-balances-wrap,
#accounts2 .accounts-balances-wrap {
  display: grid;
  gap: 8px;
}

#accounts .accounts-balances-panel,
#accounts2 .accounts-balances-panel {
  padding: 12px 14px;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  background: #fbfdff;
}

#accounts .accounts-balances-panel-title,
#accounts2 .accounts-balances-panel-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #1e3a5f;
}

#accounts .accounts-balances-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#accounts .accounts-balances-layout,
#accounts2 .accounts-balances-layout {
  display: grid;
  gap: 10px;
}

#accounts .accounts-balances-divider,
#accounts2 .accounts-balances-divider {
  margin: 2px 0 0;
  border: 0;
  border-top: 1px solid #dbe3ee;
}

#accounts .accounts-balances-computed-grid,
#accounts2 .accounts-balances-computed-grid {
  margin-top: 0;
}

#accounts .accounts-balances-empty,
#accounts2 .accounts-balances-empty {
  margin: 0;
  font-size: 12px;
}

#accounts .accounts-balances-grid,
#accounts2 .accounts-balances-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

#accounts .account-balance-readonly,
#accounts2 .account-balance-readonly {
  background: #f8fafc;
  color: #334155;
  cursor: default;
}

.bank-accounts-search-bar {
  margin-bottom: 10px;
}

.bank-account-credit-cards-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

#accounts .accounts-balances-below-line-fields,
#accounts2 .accounts-balances-below-line-fields {
  display: contents;
}

.bank-account-below-line-option {
  display: grid;
  gap: 4px;
}

.bank-account-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.bank-account-credit-card-row {
  display: grid;
  grid-template-columns: 72px minmax(120px, 1fr) minmax(80px, 120px) minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 8px 10px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fbfdff;
}

.bank-account-credit-card-code {
  font-size: 12px;
  font-weight: 600;
  color: #1e3a5f;
  align-self: center;
}

.bank-account-modal-panel .order-form-block-title {
  margin-bottom: 8px;
}

.database-backup-metrics {
  white-space: pre-line;
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.database-backup-file-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
}

.individual-backup-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 12px;
}

.individual-backup-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.user-permissions-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 8px;
}

.user-perm-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}

.user-perm-item input[type="checkbox"] {
  margin: 0;
  width: 14px;
  height: 14px;
}

.user-perm-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

.user-perm-group summary {
  list-style: none;
  cursor: pointer;
}

.user-perm-group summary::-webkit-details-marker {
  display: none;
}

.user-perm-items {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 5px;
}

.cost-model-modules-fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
}

.cost-model-modules-fieldset legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
}

.cost-model-modules-help {
  margin: 0 0 8px;
  font-size: 12px;
}

.cost-model-modules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 8px;
}

#users .users-form {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
}

#users .users-form .span-two {
  grid-column: 1 / -1;
}

#users .users-form .form-actions {
  justify-content: flex-start;
}

@media (max-width: 900px) {
  .sidebar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar,
  .grid.two,
  .grid.product-layout,
  .horizontal-form,
  .orders-top-row {
    display: block;
  }

  .orders-summary-panel {
    position: static;
    margin-top: 12px;
  }

  #searchInput {
    width: 100%;
    margin-top: 14px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}




#reports .report-panel,
#reports-profit .report-panel,
#reports-annual .report-panel {
  border-top: 4px solid #ec4899;
  padding: 0;
  overflow: hidden;
}

.report-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin: 0;
  padding: 18px 20px;
  background: linear-gradient(135deg, #fdf2f8 0%, #ffffff 72%);
  border-bottom: 1px solid #fbcfe8;
}

.report-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #9d174d;
  letter-spacing: 0.02em;
}

.report-range-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
}

.report-range-form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #831843;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.report-range-form input[type="month"] {
  border-color: #f9a8d4;
  background: #fff;
}

.report-range-form input[type="month"]:focus {
  border-color: #ec4899;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.2);
}

#reports .report-toolbar .primary,
#reports-profit .report-toolbar .primary,
#reports-annual .report-toolbar .primary {
  background: linear-gradient(95deg, #db2777, #f472b6);
  border: 0;
}

#reports .report-toolbar .primary:hover,
#reports-profit .report-toolbar .primary:hover,
#reports-annual .report-toolbar .primary:hover {
  filter: brightness(1.05);
}

.report-range-actions {
  align-self: end;
}

.report-print-area,
.management-report-print-area,
.profit-report-print-area {
  margin-top: 0;
  padding: 18px 20px 22px;
  background: linear-gradient(180deg, #fffafb 0%, #ffffff 120px);
}

.report-hero {
  margin-bottom: 18px;
  padding: 20px 22px;
  border-radius: 14px;
  color: #ffffff;
  background: linear-gradient(125deg, #831843 0%, #db2777 42%, #f9a8d4 100%);
  box-shadow: 0 14px 34px rgba(219, 39, 119, 0.24);
}

.report-hero-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.report-hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.report-hero h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.report-hero-period {
  margin: 10px 0 0;
  font-size: 14px;
  opacity: 0.95;
}

.report-empty-hint {
  margin: 0;
  padding: 28px 20px;
  text-align: center;
  border: 1px dashed #f9a8d4;
  border-radius: 12px;
  background: #fdf2f8;
  color: #9d174d;
}

.report-block-card {
  background: #ffffff;
  border: 1px solid #fce7f3;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 8px 22px rgba(236, 72, 153, 0.08);
}

.report-block-card h3 {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid #fce7f3;
  font-size: 15px;
  font-weight: 800;
  color: #9d174d;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.management-report-by-month,
.profit-report-by-month {
  margin-top: 0;
}

.management-report-grid {
  gap: 18px;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}

.report-kpi-card {
  display: grid;
  gap: 6px;
  padding: 14px 14px 12px;
  border: 1px solid #fce7f3;
  border-radius: 12px;
  background: linear-gradient(160deg, #ffffff 0%, #fdf2f8 100%);
}

.report-kpi-card--wide {
  grid-column: 1 / -1;
}

.report-kpi-card--highlight {
  border-color: #f9a8d4;
  background: linear-gradient(145deg, #fff1f7 0%, #fce7f3 100%);
  box-shadow: 0 10px 24px rgba(236, 72, 153, 0.14);
}

.report-kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 14px;
  background: #fce7f3;
}

.report-kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: #9d174d;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-kpi-value {
  font-size: 20px;
  font-weight: 800;
  color: #831843;
  line-height: 1.15;
}

.report-kpi-value.negative {
  color: #dc2626;
}

.report-kpi-value.accounts-period-surplus {
  color: #0284c7;
}

.report-panel .management-report-table,
.report-panel .profit-report-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #fce7f3;
}

.report-panel .management-report-table thead {
  background: linear-gradient(95deg, #fce7f3, #fbcfe8);
}

.report-panel .management-report-table th {
  color: #831843;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #f9a8d4;
}

.report-panel .management-report-table tbody tr:nth-child(even) {
  background: #fffbfd;
}

.report-panel .management-report-table tbody tr:hover {
  background: #fdf2f8;
}

.management-report-total-row td {
  border-top: 2px solid #f9a8d4;
  background: #fdf2f8 !important;
  font-weight: 700;
}

.profit-report-layout {
  display: grid;
  gap: 18px;
}

.profit-report-footnote,
.management-report-footnote {
  margin: 12px 0 0;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.45;
  border-radius: 10px;
  background: #fdf2f8;
  border: 1px solid #fce7f3;
  color: #831843;
}

@page {
  size: A4 portrait;
  margin: 18mm 14mm 20mm 14mm;
}

@media print {
  body.printing-report aside.sidebar,
  body.printing-report .topbar,
  body.printing-report .report-toolbar,
  body.printing-report .no-print {
    display: none !important;
  }

  body.printing-report main {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  body.printing-report #reports,
  body.printing-report #reports-profit,
  body.printing-report #reports-annual {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: none !important;
  }

  body.printing-report .view:not(.active) {
    display: none !important;
  }

  body.printing-report .view.active {
    display: block !important;
  }

  body.printing-report .report-panel {
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  body.printing-report .report-print-header {
    margin-bottom: 10px;
    padding: 0 2mm;
  }

  body.printing-report .report-print-area,
  body.printing-report .management-report-print-area,
  body.printing-report .profit-report-print-area,
  body.printing-report .annual-result-report-print-area {
    padding: 4mm 2mm 6mm;
    box-sizing: border-box;
  }

  body.printing-report .management-report-content,
  body.printing-report .profit-report-content,
  body.printing-report .annual-result-report-content {
    padding: 0 2mm;
  }

  body.printing-report .table-wrap {
    overflow: visible !important;
  }

  body.printing-report .management-report-table,
  body.printing-report .profit-report-table {
    font-size: 11px;
  }

  body.printing-report .management-report-table th,
  body.printing-report .management-report-table td,
  body.printing-report .profit-report-table th,
  body.printing-report .profit-report-table td {
    padding: 4px 6px;
  }

  body.printing-report .management-report-block,
  body.printing-report .profit-report-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.printing-report .management-report-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body.printing-report .report-hero {
    background: #fdf2f8 !important;
    color: #831843 !important;
    box-shadow: none;
    border: 1px solid #f9a8d4;
  }

  body.printing-report .report-hero-badge {
    background: #fce7f3;
    border-color: #f9a8d4;
    color: #9d174d;
  }

  body.printing-report .report-kpi-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

.management-report-content {
  margin-top: 0;
}

.management-report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.management-report-block {
  min-width: 0;
}

#recurringExpenseModalBackdrop .recurring-expense-modal-panel {
  width: min(920px, 98vw);
  max-height: calc(100dvh - 12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px 10px 10px;
}

.recurring-expenses-search-bar {
  padding: 0 0 10px;
}

.account-recurring-toggle {
  min-width: 28px;
  padding: 2px 6px;
  margin-right: 4px;
  vertical-align: middle;
}

.account-recurring-unlink-button,
.account-recurring-draft-cancel-button {
  min-width: 30px;
  padding: 2px 6px;
  line-height: 1.1;
  font-size: 0.82rem;
}

#unlinkRecurringExpenseAccountButton {
  margin-top: 6px;
  justify-self: start;
}

.account-recurring-child-row td {
  background: color-mix(in srgb, var(--panel-bg) 92%, var(--accent) 8%);
  font-size: 0.92em;
}

.account-recurring-child-description {
  display: grid;
  gap: 2px;
  padding-left: 8px;
}

.account-recurring-paid-checkbox {
  width: 14px;
  height: 14px;
  margin: 0;
}

#accounts .accounts-table {
  table-layout: fixed;
  width: 100%;
}

#accounts .accounts-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px 12px;
}

#accounts .accounts-credit-panel {
  margin-top: 12px;
}

#accounts .accounts-list-toolbar .accounts-subtotal-wrap {
  margin-left: auto;
  text-align: right;
  min-width: 160px;
}

#accounts .accounts-list-toolbar .accounts-subtotal-wrap strong {
  display: inline-block;
  text-align: right;
  white-space: nowrap;
}

#accounts .accounts-table th,
#accounts .accounts-table td {
  text-align: center;
  vertical-align: middle;
}

#accounts .accounts-table th.accounts-col-descricao,
#accounts .accounts-table td.accounts-col-descricao {
  text-align: left;
}

#accounts .accounts-table .accounts-col-paga {
  width: 42px;
}

#accounts .accounts-table .accounts-col-data {
  width: 88px;
}

#accounts .accounts-table .accounts-col-tipo {
  width: 64px;
}

#accounts .accounts-table .accounts-col-recorrencia {
  width: 84px;
  white-space: nowrap;
}

#accounts .accounts-table .accounts-col-data-pg {
  width: 88px;
  white-space: nowrap;
}

#accounts .accounts-table .accounts-col-conta-pg {
  width: 100px;
  white-space: nowrap;
}

#accounts .account-repeat-count-wrap,
#accounts .account-repeat-pick-wrap {
  margin-top: 8px;
}

#accounts .account-repeat-count-input {
  width: 100%;
  min-height: 42px;
}

#accounts .account-repeat-month-pickers {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  margin-top: 4px;
  max-width: 100%;
}

#accounts .account-repeat-month-option {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
  padding: 1px 2px;
}

#accounts .account-repeat-month-option input[type="checkbox"] {
  width: 13px;
  height: 13px;
  min-height: 0;
  margin: 0;
  flex-shrink: 0;
}

#accounts .accounts-table .accounts-col-select {
  width: 34px;
  text-align: center;
}

#accounts .account-repeat-hint {
  display: block;
  margin-top: 4px;
  color: var(--muted, #6b7280);
  font-size: 12px;
  line-height: 1.3;
}

#accounts .accounts-table .accounts-col-mov {
  width: 64px;
}

#accounts .accounts-table .accounts-col-responsavel {
  width: 88px;
}

#accounts .accounts-table .accounts-col-virada {
  width: 56px;
}

#accounts .accounts-table .accounts-col-valor {
  width: 100px;
}

#accounts .accounts-table .accounts-col-total {
  width: 100px;
}

#accounts .accounts-table .accounts-col-acoes {
  width: 52px;
}

.account-recurring-search-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.account-recurring-search-suggestions {
  position: relative;
  z-index: 4;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  max-height: 220px;
  overflow: auto;
}

.account-recurring-suggestion-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 8px;
  width: 100%;
  text-align: left;
}

.account-recurring-suggestion-main {
  display: grid;
  gap: 2px;
}

.account-recurring-suggestion-linked {
  font-size: 0.9em;
}

.account-total-cell {
  font-weight: 600;
  white-space: nowrap;
}

#recurringExpenseAccountSuggestions .recurring-account-suggestion-header,
#recurringExpenseAccountSuggestions .recurring-account-suggestion-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr);
  gap: 10px;
  align-items: center;
  text-align: left;
}

#recurringExpenseAccountSuggestions .recurring-account-suggestion-header {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}

#recurringExpenseAccountSuggestions .recurring-account-suggestion-row span:last-child {
  color: #475569;
}

.energy-cost-account-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #0f4c5c;
  background: #d7f3f8;
  vertical-align: middle;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .management-report-grid {
    grid-template-columns: 1fr;
  }
}

.annual-result-year-input {
  width: 120px;
}

.annual-result-year-select {
  min-width: 110px;
  border-color: #f9a8d4;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
}

.annual-result-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.annual-result-mode-tab {
  border: 1px solid #f9a8d4;
  background: #fff;
  color: #9d174d;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.annual-result-mode-tab.active {
  background: linear-gradient(95deg, #db2777, #f472b6);
  border-color: transparent;
  color: #fff;
}

.annual-result-controls {
  display: block;
}

.annual-result-export-actions {
  margin-top: 2px;
}

.annual-result-fieldset {
  border: 1px solid #fbcfe8;
  border-radius: 10px;
  padding: 10px 12px 12px;
  margin: 0;
}

.annual-result-fieldset legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: #831843;
}

.annual-result-compare-columns-form {
  display: grid;
  gap: 12px;
}

.annual-result-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.annual-result-check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #334155;
}

.annual-result-report-content {
  overflow: visible;
}

.annual-result-single-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
}

.annual-result-single-layout .annual-result-sheet {
  flex: 0 0 auto;
}

.annual-result-source-legend {
  flex: 1 1 260px;
  min-width: 220px;
  max-width: 360px;
  margin-top: 36px;
  padding: 10px 12px;
  border: 1px solid #fbcfe8;
  border-radius: 10px;
  background: #fffafb;
}

.annual-result-source-legend h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  color: #9d174d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.annual-result-source-legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.annual-result-source-legend li {
  display: grid;
  gap: 2px;
}

.annual-result-source-legend strong {
  font-size: 12px;
  color: #831843;
}

.annual-result-source-legend span {
  font-size: 11px;
  line-height: 1.35;
  color: #475569;
}

@media (max-width: 1100px) {
  .annual-result-single-layout {
    flex-direction: column;
  }

  .annual-result-source-legend {
    margin-top: 0;
    max-width: none;
  }
}

.annual-result-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 8px;
  align-items: start;
  justify-content: start;
}

.annual-result-sheet {
  min-width: 0;
}

.annual-result-sheet:not(.annual-result-sheet-compact):not(.annual-result-sheet-compare-columns) {
  min-width: 0;
  width: max-content;
  max-width: 100%;
}

.annual-result-sheet-compact .annual-result-year-title {
  font-size: 16px;
  margin-bottom: 6px;
}

.annual-result-table-compact,
.annual-result-table-compare-columns {
  font-size: 9px;
}

.annual-result-table-compact th,
.annual-result-table-compact td,
.annual-result-table-compare-columns th,
.annual-result-table-compare-columns td {
  padding: 2px 3px;
  line-height: 1.15;
}

.annual-result-table-compact .annual-result-year-title,
.annual-result-sheet-compact .annual-result-year-title {
  font-size: 15px;
}

.annual-result-highlight-alt {
  color: #ea580c;
  font-weight: 800;
}

#reports-annual .annual-result-report-content {
  overflow: visible;
}

#reports-annual .annual-result-compare-grid,
#reports-annual .annual-result-sheet-compare-columns {
  overflow: visible;
}

.annual-result-sheet .annual-result-table-scroll {
  max-height: calc(100vh - 290px);
  overflow: auto;
  overscroll-behavior: contain;
  background: #ffffff;
}

.annual-result-compare-grid .annual-result-table-scroll {
  max-height: calc(100vh - 310px);
}

.annual-result-year-title {
  margin: 0 0 8px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: #1e293b;
}

.annual-result-table {
  width: max-content;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 10px;
  background: #ffffff;
  border: 1px solid #d8b4fe;
  table-layout: auto;
}

.annual-result-table th,
.annual-result-table td {
  border: 1px solid #d8b4fe;
  padding: 3px 4px;
  text-align: right;
  white-space: nowrap;
  line-height: 1.2;
}

.annual-result-table th:first-child,
.annual-result-table td:first-child {
  width: 2.1rem;
  min-width: 2.1rem;
  max-width: 2.1rem;
  padding: 3px 2px;
}

.annual-result-table th:first-child,
.annual-result-table td:first-child,
.annual-result-table .annual-result-col-share {
  text-align: center;
}

.annual-result-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e9d5ff;
  color: #4c1d95;
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0;
  padding: 3px 4px;
  box-shadow: 0 1px 0 #d8b4fe;
}

.annual-result-table thead th:first-child {
  left: 0;
  z-index: 4;
  box-shadow: 1px 1px 0 #d8b4fe;
}

.annual-result-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  box-shadow: 1px 0 0 #d8b4fe;
}

.annual-result-table .annual-result-month-cell {
  background: #f3e8ff;
  font-weight: 700;
  color: #4c1d95;
  font-size: 9px;
}

.annual-result-table .annual-result-col-share {
  background: #f3e8ff;
  min-width: 2.4rem;
  max-width: 3rem;
  padding-left: 2px;
  padding-right: 2px;
}

.annual-result-table .money {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.annual-result-table .annual-result-total-row td {
  background: #e9d5ff;
  font-weight: 700;
  color: #4c1d95;
  font-size: 9px;
}

.annual-result-table .annual-result-total-row td:first-child {
  background: #e9d5ff;
  z-index: 1;
}

.annual-result-table .annual-result-average-row td {
  font-weight: 700;
  font-size: 9px;
  background: #ffffff;
}

.annual-result-table .annual-result-average-row td:first-child {
  background: #ffffff;
  z-index: 1;
}

.annual-result-table .annual-result-average-row .annual-result-growth-cell {
  background: #f3e8ff;
}

.annual-result-table .annual-result-highlight {
  color: #dc2626;
  font-weight: 800;
}

.annual-result-col-header,
.annual-result-row-header {
  cursor: pointer;
  user-select: none;
}

.annual-result-col-header:hover,
.annual-result-row-header:hover {
  filter: brightness(0.96);
}

.annual-result-header-selected {
  background: #bbf7d0 !important;
  box-shadow: inset 0 0 0 2px #22c55e;
  color: #166534 !important;
}

.annual-result-col-selected {
  background: #dcfce7 !important;
}

.annual-result-row-selected {
  background: #dcfce7 !important;
}

.annual-result-cross-selected {
  background: #bbf7d0 !important;
  box-shadow: inset 0 0 0 1px #22c55e;
}

.annual-result-report-footnote {
  margin: 14px 2px 0;
  font-size: 12px;
  color: #64748b;
}

#reports-annual .annual-result-report-print-area {
  padding-top: 12px;
}

body.printing-report #reports-annual .annual-result-report-print-area,
body.printing-report #reports-annual .annual-result-table {
  break-inside: avoid;
}

body.printing-report .annual-result-table-scroll {
  max-height: none;
  overflow: visible;
}

body.printing-report .annual-result-table th,
body.printing-report .annual-result-table td {
  position: static !important;
  box-shadow: none !important;
}

@media (max-width: 1100px) {
  .annual-result-compare-grid {
    grid-template-columns: 1fr;
  }
}



/* === Contas 2 (Financeiro/Contas2) === */

.accounts2-table {
  width: 100%;
}

.accounts2-table th {
  white-space: nowrap;
}

.accounts2-table th,
.accounts2-table td {
  min-width: 0;
  max-width: 100%;
}

.accounts2-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#accounts2 .accounts2-period-panel,
#accounts2 .accounts2-actions-panel,
#accounts2 .accounts2-history-panel {
  display: grid;
  gap: 10px;
}

#accounts2 .accounts2-history-panel {
  padding: 10px;
}

#accounts2 .accounts2-actions-panel {
  padding: 12px;
}

#accounts2 .accounts2-owner-filter {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

#accounts2 .accounts2-owner-filter select {
  min-width: 120px;
}

#accounts2 .accounts2-period-filters {
  display: flex;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
}

#accounts2 .accounts2-period-filters label {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

#accounts2 .accounts2-clear-period-filter {
  align-self: end;
  white-space: nowrap;
}

#accounts2 .accounts2-period-hint {
  margin: 0;
  flex: 1 1 220px;
  font-size: 12px;
}

#accounts2 .accounts2-period-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#accounts2 .accounts2-period-metrics article {
  padding: 8px 10px;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

#accounts2 .accounts2-period-metrics span {
  font-size: 11px;
}

#accounts2 .accounts2-period-metrics strong {
  margin-top: 2px;
  font-size: 14px;
}

#accounts2 .accounts2-history-panel .accounts-auto-credit-label {
  display: block;
  font-size: 11px;
  color: #64748b;
}

#accounts2 .accounts2-history-panel .accounts-auto-credit-latest {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.35;
  color: #334155;
}

#accounts2 .accounts2-history-panel .accounts-auto-credit-actions {
  margin-top: 6px;
  gap: 6px;
}

@media (max-width: 760px) {
  #accounts2 .accounts2-side-tools {
    grid-template-columns: 1fr;
  }

  #accounts2 .accounts2-period-metrics {
    grid-template-columns: 1fr;
  }
}

.accounts2-table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.accounts2-table-heading .accounts-table-title {
  margin: 0;
}

.accounts2-heading-totals {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}

.accounts2-heading-totals strong,
.accounts2-open-total {
  white-space: nowrap;
}

.accounts2-table .accounts2-col-pago {
  width: 5.6em;
  text-align: center;
}

.accounts2-paid-cell {
  text-align: center;
}

.accounts2-table .accounts2-col-dia {
  width: 3.2em;
}

.accounts2-table .accounts2-col-acoes {
  width: 4em;
}

.accounts2-table .accounts2-col-descricao {
  width: 28%;
}

.accounts2-table .accounts2-col-responsavel {
  width: 7em;
}

.accounts2-table .accounts2-col-virada {
  width: 5em;
}

.accounts2-table .accounts2-col-recorrencia {
  width: 12em;
  white-space: nowrap;
}

.accounts2-table .accounts2-col-valor,
.accounts2-table .accounts2-col-filhos,
.accounts2-table .accounts2-col-total {
  width: 7.8em;
  white-space: nowrap;
}

.accounts2-child-row td {
  font-size: 13px;
}

.accounts2-parent-desc {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.accounts2-expand-toggle {
  width: 24px;
  min-width: 24px;
  height: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #334155;
  background: #ffffff;
  cursor: pointer;
  line-height: 1;
}

.accounts2-expand-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.accounts2-child-desc {
  padding-left: 46px;
  color: var(--muted);
}

.accounts2-value-input {
  width: 110px;
  max-width: 110px;
  text-align: right;
  padding: 4px 6px;
}

#accounts2ModalBackdrop .accounts2-modal-panel {
  width: min(860px, 96vw);
  max-height: 92vh;
  overflow: auto;
  box-sizing: border-box;
}

#accounts2Form.accounts2-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.accounts2-form-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px 28px;
  align-items: start;
}

.accounts2-form-column {
  display: grid;
  gap: 12px;
  align-content: start;
}

#accounts2Form .accounts2-form-column > label,
#accounts2Form .accounts2-field {
  display: grid;
  gap: 6px;
  color: #354052;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}

#accounts2Form input:not([type="checkbox"]),
#accounts2Form select {
  width: 100%;
  min-height: 42px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  color: var(--ink);
  background: #fff;
  box-sizing: border-box;
}

#accounts2Form .is-inactive,
#accounts2Form input:disabled,
#accounts2Form select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f4f6f8;
}

.accounts2-form-actions {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .accounts2-form-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

.accounts2-month-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.accounts2-month-check {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.accounts2-month-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

#accounts2BalancesSlot:empty {
  display: none;
}
