:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #647064;
  --line: #d8e0d4;
  --paper: #f7f2df;
  --panel: #fffef8;
  --head: #eef5e8;
  --leaf: #2f6b3f;
  --leaf-dark: #1f4d2b;
  --warn: #a05b14;
  --danger: #9a3529;
  --readonly: #f4f2e8;
  --edited: #fff7d4;
  --shadow: 0 18px 50px rgba(31, 45, 31, 0.12);
  --login-field-width: 380px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(233, 217, 174, 0.75), transparent 32rem),
    radial-gradient(circle at 100% 5%, rgba(47, 107, 63, 0.16), transparent 26rem),
    linear-gradient(135deg, #f4edd7 0%, #fbfaf2 48%, #edf4e6 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  width: min(100% - 24px, 1760px);
  margin: 0 auto;
  padding: 18px 0 36px;
}

.topline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--leaf);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(30px, 4vw, 56px);
  letter-spacing: -0.06em;
}

h2 {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.topline__actions,
.totals {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.panel {
  background: transparent;
  border: 1px solid rgba(216, 224, 212, 0.96);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.login-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1fr);
  width: min(100%, 1080px);
  min-height: 420px;
  margin: clamp(18px, 7vh, 86px) auto 0;
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(255, 254, 248, 0.9), rgba(255, 254, 248, 0.98)),
    radial-gradient(circle at 15% 18%, rgba(111, 161, 63, 0.22), transparent 28rem);
}

.login-panel p,
.document-head p {
  color: var(--muted);
}

.login-copy {
  position: relative;
  display: grid;
  align-content: center;
  gap: 18px;
  min-height: 100%;
  padding: clamp(28px, 4vw, 52px);
  overflow: hidden;
  color: #fffef4;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 221, 139, 0.38), transparent 14rem),
    radial-gradient(circle at 88% 12%, rgba(151, 200, 103, 0.28), transparent 16rem),
    linear-gradient(145deg, #17391f 0%, #2f6b3f 52%, #6f8f35 100%);
}

.login-copy::after {
  content: "";
  position: absolute;
  right: -54px;
  bottom: -74px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 46% 54% 41% 59%;
  background: rgba(255, 255, 255, 0.08);
  transform: rotate(-16deg);
}

.login-badge {
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff9d8;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-copy h2 {
  position: relative;
  z-index: 1;
  max-width: 460px;
  font-size: clamp(30px, 4.2vw, 52px);
  letter-spacing: -0.06em;
}

.login-copy p {
  position: relative;
  z-index: 1;
  max-width: 420px;
  margin: 0;
  color: rgba(255, 254, 244, 0.82);
  font-size: 16px;
  line-height: 1.55;
}

.login-highlights {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.login-highlights span {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.13);
  color: #fffef4;
  font-size: 13px;
  font-weight: 900;
}

.login-form {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 16px;
  padding: clamp(26px, 4vw, 52px);
  background:
    linear-gradient(180deg, rgba(255, 254, 248, 0.98), rgba(250, 246, 231, 0.94));
}

.login-form > label,
.login-form button,
.login-form__head {
  width: min(100%, var(--login-field-width));
}

.login-form__head {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.login-form__head h2 {
  font-size: clamp(26px, 3vw, 36px);
}

.login-form__head p {
  max-width: 460px;
  margin: 0;
  line-height: 1.5;
}

label {
  display: grid;
  gap: 6px;
  color: #39453b;
  font-size: 13px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffef9;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(47, 107, 63, 0.14);
}

.login-form button,
.save-button {
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--leaf);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(47, 107, 63, 0.22);
}

.login-form button {
  min-height: 48px;
  margin-top: 4px;
}

.save-button:not(.save-button--dirty) {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  box-shadow: none;
}

.ghost-button,
.ghost-link,
.secondary-button,
.warning-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
}

.icon-button {
  width: 46px;
  min-width: 46px;
  padding: 0;
  border-radius: 14px;
  background: #fffef9;
  color: var(--leaf-dark);
  font-size: 24px;
  line-height: 1;
}

.secondary-button {
  border-radius: 14px;
  background: #e7f1df;
  color: var(--leaf-dark);
}

.warning-button {
  border-radius: 14px;
}

.warning-button--active,
.save-button--dirty {
  border-radius: 14px;
  background: #fff0d2;
  color: #623a06;
  box-shadow: 0 10px 24px rgba(160, 91, 20, 0.18);
}

.save-button--dirty {
  background: linear-gradient(135deg, #2f6b3f, #6fa13f);
  color: #fff;
}

.save-button:disabled {
  border-color: var(--line);
  background: #edf5e8;
  color: #849084;
  box-shadow: none;
}

.send-button--urgent {
  border-color: #d97d27;
  background: linear-gradient(135deg, #ffd88a, #f08a38);
  color: #3b2105;
  box-shadow: 0 12px 28px rgba(217, 125, 39, 0.28);
}

.document-app {
  position: relative;
  display: grid;
  gap: 14px;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(244, 237, 215, 0.44);
  backdrop-filter: blur(10px);
}

.busy-overlay__card {
  width: min(100%, 420px);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 24px 24px 22px;
  border: 1px solid rgba(216, 224, 212, 0.96);
  border-radius: 24px;
  background:
    radial-gradient(circle at top, rgba(233, 217, 174, 0.48), transparent 16rem),
    linear-gradient(180deg, rgba(255, 254, 248, 0.98), rgba(247, 242, 223, 0.96));
  box-shadow: 0 30px 70px rgba(31, 45, 31, 0.18);
  text-align: center;
}

.busy-overlay__card strong {
  font-size: 24px;
  letter-spacing: -0.04em;
}

.busy-overlay__card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}

.busy-overlay__spinner {
  width: 54px;
  height: 54px;
  border: 4px solid rgba(47, 107, 63, 0.16);
  border-top-color: var(--leaf);
  border-right-color: #d7a13e;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  animation: busy-overlay-spin 0.9s linear infinite;
}

.document-app--busy .document-toolbar,
.document-app--busy .summary-panel,
.document-app--busy .manager-board,
.document-app--busy .document-panel {
  filter: saturate(0.92);
}

.workspace-overview {
  display: grid;
  grid-template-columns: minmax(0, 360px);
  justify-content: end;
  gap: 14px;
  align-items: stretch;
}

.document-toolbar {
  position: sticky;
  top: 10px;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(520px, 1.35fr) minmax(430px, 1fr) minmax(170px, 0.4fr);
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  max-width: 100%;
}

.document-toolbar > * {
  min-width: 0;
}

.document-toolbar button {
  min-width: 0;
  white-space: normal;
}

.toolbar-section {
  display: grid;
  gap: 10px;
  align-items: end;
  min-width: 0;
  border: 1px solid rgba(216, 224, 212, 0.88);
  border-radius: 16px;
  padding: 10px;
  background: rgba(255, 254, 248, 0.74);
}

.toolbar-section__title {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.toolbar-section--context {
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.45fr) minmax(130px, 0.35fr);
}

.toolbar-section--actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toolbar-section--control {
  grid-template-columns: 1fr;
}

.admin-status-override {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(216, 224, 212, 0.88);
}

.admin-status-override label {
  min-width: 0;
}

.admin-status-override select,
.admin-status-override button {
  width: 100%;
}

.admin-status-override button {
  white-space: normal;
}

.toolbar-section button {
  min-height: 42px;
  padding-inline: 12px;
  font-size: 14px;
  white-space: nowrap;
}

.document-toolbar button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: none;
}

.user-card {
  align-self: stretch;
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
  border: 1px solid rgba(216, 224, 212, 0.96);
  border-radius: 20px;
  padding: 14px 16px;
  background:
    radial-gradient(circle at 0 0, rgba(233, 217, 174, 0.75), transparent 13rem),
    linear-gradient(135deg, rgba(255, 254, 248, 0.95), rgba(239, 246, 234, 0.88));
  box-shadow: 0 12px 30px rgba(31, 45, 31, 0.08);
}

.user-card strong {
  color: var(--ink);
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card__caption,
.status-card__caption {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.document-status-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  border-left-width: 7px;
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: 0 12px 30px rgba(31, 45, 31, 0.08);
}

.document-head .document-status-card {
  max-width: 840px;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: none;
}

.document-status-card strong {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.document-status-card p {
  max-width: 980px;
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.42;
}

.status-card__meta {
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(90, 111, 80, 0.16);
  border-radius: 999px;
  padding: 5px 9px;
  color: #4f6248;
  background: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.status-history {
  margin-top: 2px;
  border-top: 1px solid rgba(90, 111, 80, 0.16);
  padding-top: 8px;
}

.status-history summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  color: #3f5238;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.status-history summary::-webkit-details-marker {
  display: none;
}

.status-history summary::after {
  content: "Показать";
  border: 1px solid rgba(90, 111, 80, 0.18);
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(255, 255, 255, 0.58);
  color: #4f6248;
  font-size: 11px;
}

.status-history[open] summary::after {
  content: "Скрыть";
}

.status-history__count {
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  place-items: center;
  border-radius: 999px;
  background: rgba(63, 82, 56, 0.12);
  color: #31442b;
  font-size: 11px;
}

.status-history ol {
  display: grid;
  gap: 7px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.status-history li {
  display: grid;
  gap: 2px;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.56);
}

.status-history__time {
  color: #687c60;
  font-size: 11px;
  font-weight: 850;
}

.status-history__text {
  color: #263620;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
}

.document-status-card--synced {
  animation: document-sync-pulse 1.4s ease;
}

.pill {
  width: fit-content;
  border-radius: 999px;
  background: #dfead7;
  color: var(--leaf-dark);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.document-panel {
  position: relative;
  overflow: hidden;
}

.summary-panel {
  overflow: hidden;
}

.summary-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 248, 0.96);
}

.summary-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.summary-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.summary-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border-radius: 999px;
  padding: 7px 10px;
  border: 1px solid #d3dcd0;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.summary-sync-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.85;
}

.summary-sync-badge--idle {
  color: var(--muted);
}

.summary-sync-badge--checking {
  border-color: #d7d9c5;
  background: #f7f6ec;
  color: #6f735c;
}

.summary-sync-badge--fresh {
  border-color: #c3d9bd;
  background: #edf5e8;
  color: var(--leaf-dark);
}

.summary-sync-badge--updated {
  border-color: #b7d7ae;
  background: #e4f4df;
  color: var(--leaf-dark);
}

.summary-sync-badge--stale {
  border-color: #e0b564;
  background: #fff2d4;
  color: #7a4216;
}

.summary-sync-badge--pulse {
  animation: sync-badge-pulse 1.2s ease;
}

.summary-panel--synced {
  animation: document-sync-pulse 1.4s ease;
}

.manager-board {
  overflow: hidden;
}

.manager-board__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 248, 0.96);
}

.manager-board__head h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1;
}

.manager-board__head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.manager-board__actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.manager-board__actions label {
  min-width: 220px;
}

.manager-board__actions input[type="search"] {
  min-width: 220px;
}

.manager-board__cards {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.manager-board__stores {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.manager-board-empty {
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  padding: 22px;
  text-align: center;
  font-weight: 900;
}

.manager-board-sync-notice {
  margin: 14px 18px 0;
}

.manager-store-card {
  border: 1px solid var(--line);
  border-left: 6px solid #c5d3bd;
  border-radius: 22px;
  background: #fffef9;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.manager-store-card--danger {
  border-left-color: #d56343;
}

.manager-store-card--warning {
  border-left-color: #d6a538;
}

.manager-store-card--info {
  border-left-color: #4c95b8;
}

.manager-store-card--success {
  border-left-color: #6aa35d;
}

.manager-store-card--dirty {
  box-shadow: inset 0 0 0 2px rgba(197, 137, 43, 0.2), var(--shadow-soft);
}

.manager-store-card--collapsed .manager-store-card__summary {
  border-bottom: 0;
}

.manager-store-card--updated {
  box-shadow: inset 0 0 0 2px rgba(47, 107, 63, 0.18), var(--shadow-soft);
}

.manager-store-card--updated-new {
  animation: manager-board-update-flash 1.4s ease;
}

.manager-store-card--updated-changed {
  animation: manager-board-update-flash 1.4s ease;
}

.manager-store-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #fffef9, #f4efe2);
  border-bottom: 1px solid var(--line);
}

.manager-store-card__head h3 {
  margin: 4px 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.manager-store-card__head p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.manager-store-card__status {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(42, 63, 44, 0.08);
  color: var(--leaf-dark);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 950;
}

.manager-store-card__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.manager-store-card__actions .manager-board-action-button {
  width: 38px;
  min-width: 38px;
  min-height: 34px;
  padding: 0;
  border-radius: 12px;
}

.manager-store-card__actions .manager-board-action-button--text {
  width: auto;
  min-width: 0;
  padding: 0 12px;
  gap: 8px;
}

.manager-store-card__actions .button-icon {
  width: 17px;
  height: 17px;
}

.manager-store-card__actions .manager-board-action-button__text {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.manager-store-card__save {
  background: linear-gradient(135deg, #2f6b3f, #6fa13f);
  color: #fff;
}

.manager-store-card__discard {
  color: #7a4216;
  background: #fff7e8;
}

.manager-store-card__summary {
  display: grid;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.manager-store-card__summary strong {
  font-size: 14px;
}

.manager-store-card__summary span,
.manager-store-card__summary small {
  color: var(--muted);
  font-weight: 800;
}

.manager-store-card__history {
  margin-top: 6px;
  border: 1px solid rgba(216, 224, 212, 0.88);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.64);
}

.manager-store-card__history summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  color: var(--leaf-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
}

.manager-store-card__history ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 10px 10px 28px;
}

.manager-store-card__history li span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.manager-store-card__history li strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
}

.manager-store-card__table-wrap {
  overflow-x: auto;
}

.manager-store-card__table-actions {
  display: flex;
  justify-content: flex-start;
  padding: 12px 16px 16px;
  background: #fffef9;
}

.manager-board-add-row {
  width: auto;
  min-width: 190px;
  margin: 0;
}

.manager-store-table {
  width: max(1220px, 100%);
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.manager-store-table th,
.manager-store-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fffef9;
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.manager-store-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf5e8;
  color: var(--leaf-dark);
  font-size: 12px;
  font-weight: 950;
}

.manager-store-table td.cell-invalid {
  background: #fff1d6 !important;
  box-shadow: inset 0 0 0 2px #df8b2d;
}

.manager-store-table td.cell-low-margin {
  background: rgba(183, 58, 72, 0.12) !important;
  box-shadow: inset 0 0 0 1px rgba(183, 58, 72, 0.28);
}

.manager-store-table td.cell-low-margin input {
  background: rgba(183, 58, 72, 0.08);
  color: #8c2e37;
}

.manager-store-table td:first-child,
.manager-store-table th:first-child {
  width: 48px;
  text-align: center;
}

.manager-store-table td strong,
.manager-store-table td span {
  display: block;
}

.manager-store-table td span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.manager-board-input {
  width: 100%;
  min-width: 92px;
  min-height: 34px;
  border-radius: 10px;
  padding: 6px 8px;
  font: inherit;
  font-weight: 900;
  text-align: right;
  background: #fff;
}

.manager-board-input--product {
  min-width: 260px;
  text-align: left;
}

.manager-board-product-button {
  width: 100%;
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.manager-board-product-button strong,
.manager-board-product-button span {
  display: block;
}

.manager-board-product-button strong {
  font-size: 13px;
}

.manager-board-product-button span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.manager-board-product-button--dirty {
  border-color: #c5892b;
  background: #fff7e8;
}

.manager-board-input--dirty {
  border-color: #c5892b;
  background: #fff7e8;
}

.manager-board-row--dirty td {
  background: #fffaf0;
}

.manager-board-row--issue td {
  background: #fff7ed;
}

.manager-board-row--updated td {
  background: #f0faeb;
}

.manager-board-row--updated-new td {
  box-shadow: inset 0 0 0 1px rgba(47, 107, 63, 0.16);
}

.manager-board-row--updated-changed td {
  box-shadow: inset 0 0 0 1px rgba(197, 137, 43, 0.18);
}

.manager-board-row--issue.manager-board-row--updated td {
  background: #fff7ed;
}

.manager-board-status {
  display: inline-flex;
  border-radius: 999px;
  background: #eef3ea;
  color: var(--leaf-dark);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.manager-board-control {
  min-width: 220px;
}

.manager-board-control ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 16px;
  color: #8a3c25;
  font-weight: 900;
}

.manager-board-comments {
  margin-top: 8px;
}

.manager-board-comments:empty {
  display: none;
}

.manager-board-comments .comment-history {
  display: grid;
  gap: 6px;
}

.manager-board-comments .comment-chip {
  padding: 6px 8px;
}

.manager-board-comment-editor {
  margin-top: 8px;
}

.manager-board-comment-editor .manager-board-input {
  min-width: 220px;
  text-align: left;
}

@keyframes manager-board-update-flash {
  0% {
    box-shadow: inset 0 0 0 2px rgba(47, 107, 63, 0.28), 0 0 0 0 rgba(47, 107, 63, 0.12), var(--shadow-soft);
  }

  50% {
    box-shadow: inset 0 0 0 2px rgba(47, 107, 63, 0.22), 0 0 0 6px rgba(47, 107, 63, 0.08), var(--shadow-soft);
  }

  100% {
    box-shadow: inset 0 0 0 2px rgba(47, 107, 63, 0.18), var(--shadow-soft);
  }
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px 18px;
}

.summary-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffef9;
  padding: 12px;
}

.summary-card--updated {
  border-color: #9dc790;
  background: linear-gradient(135deg, #eef9e9, #fffef9);
  box-shadow: inset 0 0 0 1px rgba(47, 107, 63, 0.14);
  animation: summary-update-flash 1.4s ease;
}

.summary-card--danger {
  border-color: #e6a08f;
  background: #fff2ee;
}

.summary-card--info {
  border-color: #9ebfd4;
  background: #eef7fb;
}

.summary-card--success {
  border-color: #a9c99a;
  background: #eef8e7;
}

.summary-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.summary-card strong {
  font-size: 22px;
  letter-spacing: -0.04em;
}

.summary-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  padding: 0 18px 14px;
}

.summary-table-wrap {
  max-height: 360px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.summary-table {
  width: max(1120px, 100%);
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.summary-table th,
.summary-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fffef9;
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
}

.summary-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--head);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.summary-table .number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.summary-table .issue-cell {
  color: var(--danger);
  font-weight: 900;
}

.summary-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 18px 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 254, 248, 0.96);
}

.summary-detail-head h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.summary-detail-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.summary-detail-wrap {
  max-height: 430px;
}

.summary-detail-table {
  width: max(1500px, 100%);
}

.summary-row--issue td {
  background: #fff7e3;
}

.summary-row--updated td {
  background: #eef7ea;
}

.summary-row--updated-new td {
  background: #e6f6df;
}

.summary-row--updated-changed td {
  background: #f1f8ea;
}

.summary-issue-cell {
  min-width: 210px;
}

.summary-issue,
.summary-ok {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.summary-issue {
  background: #f6ded7;
  color: var(--danger);
}

.summary-ok {
  background: #e4f0dc;
  color: var(--leaf-dark);
}

.document-head {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(420px, max-content);
  gap: 16px;
  align-items: stretch;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 248, 0.96);
}

.document-head__main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.document-head p {
  margin: 6px 0 0;
}

.document-head__meta {
  display: grid;
  grid-template-columns: max-content minmax(190px, 244px) max-content;
  gap: 10px;
  align-items: stretch;
  justify-content: end;
  min-width: 0;
}

.document-meta-group {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
  border: 1px solid rgba(216, 224, 212, 0.82);
  border-radius: 16px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.54);
}

.document-meta-group__title {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.document-meta-group--settings {
  min-width: 128px;
}

.document-meta-group .totals {
  flex-wrap: nowrap;
}

.document-state--neutral {
  border: 1px solid var(--line);
  border-left-color: #a6af9e;
  background: #f6f2e2;
  color: var(--ink);
}

.document-state--danger {
  border-color: #e19981;
  border-left-color: var(--danger);
  background: #fff0e9;
  color: #7a2318;
}

.document-state--warning {
  border-color: #e3bd67;
  border-left-color: #c97914;
  background: #fff5d6;
  color: #633d07;
}

.document-state--success {
  border-color: #9ec48f;
  border-left-color: var(--leaf);
  background: #eaf6e5;
  color: var(--leaf-dark);
}

.totals span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--head);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 900;
  min-height: 30px;
  white-space: nowrap;
}

.unsaved-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd9c3;
  background: #edf5e8;
  color: var(--leaf-dark);
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.unsaved-badge--dirty {
  background: #fff0d2;
  color: #7a4308;
  border-color: #e4b45c;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  width: 100%;
  min-width: 0;
  border: 1px solid #d3dcd0;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.sync-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.85;
}

.sync-badge--idle {
  color: var(--muted);
}

.sync-badge--fresh {
  border-color: #c3d9bd;
  background: #edf5e8;
  color: var(--leaf-dark);
}

.sync-badge--checking {
  border-color: #d7d9c5;
  background: #f7f6ec;
  color: #6f735c;
}

.sync-badge--stale {
  border-color: #e2b564;
  background: #fff3d3;
  color: #7b4a09;
  box-shadow: 0 8px 18px rgba(217, 125, 39, 0.12);
}

.sync-badge--updated {
  border-color: #b7d7ae;
  background: #e4f4df;
  color: var(--leaf-dark);
}

.sync-badge--pulse {
  animation: sync-badge-pulse 1.2s ease;
}

.document-meta-group .table-settings-button {
  min-height: 30px;
  border: 1px solid rgba(47, 107, 63, 0.22);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--leaf-dark);
  font-size: 12px;
  font-weight: 900;
}

.document-meta-group .table-settings-button--primary {
  border-color: rgba(47, 107, 63, 0.36);
  background: #e4f0dc;
}

.document-meta-group .table-settings-button--active {
  border-color: #d38b2d;
  background: #fff0d2;
  color: #754309;
}

.document-meta-group .table-settings-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.validation-panel {
  margin: 12px 18px 0;
  border: 1px solid #edc17e;
  border-radius: 14px;
  background: #fff4d9;
  color: #613b08;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
}

.sync-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 18px 0;
  border: 1px solid #e1bb72;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7df, #fff2d0);
  color: #6f4309;
  padding: 11px 12px;
  box-shadow: 0 12px 26px rgba(160, 91, 20, 0.08);
}

.sync-notice__copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sync-notice__copy strong {
  font-size: 14px;
  letter-spacing: -0.02em;
}

.sync-notice__copy span {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.sync-notice .secondary-button {
  flex: 0 0 auto;
  min-width: 118px;
  background: #fffef7;
}

.supplier-aggregate {
  margin: 12px 18px 0;
  border: 1px solid rgba(47, 107, 63, 0.22);
  border-radius: 18px;
  background: rgba(237, 246, 232, 0.84);
  overflow: hidden;
}

.supplier-aggregate summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 12px 14px;
  color: var(--leaf-dark);
  cursor: pointer;
  font-weight: 900;
}

.supplier-aggregate summary::marker {
  color: var(--leaf);
}

.supplier-aggregate summary::after {
  content: "Показать свод";
  border: 1px solid rgba(47, 107, 63, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--leaf-dark);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.supplier-aggregate[open] summary::after {
  content: "Скрыть свод";
}

.supplier-aggregate__summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.supplier-aggregate__summary strong {
  display: block;
  font-size: 15px;
}

.supplier-aggregate__summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.supplier-aggregate__summary-text {
  color: var(--leaf-dark);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.supplier-aggregate__body {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(47, 107, 63, 0.14);
  padding: 12px;
  justify-items: center;
}

.supplier-aggregate__stats {
  width: min(100%, 940px);
  padding: 0;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

.supplier-aggregate__card strong {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.supplier-aggregate__table-wrap {
  width: min(100%, 940px);
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.supplier-aggregate__table {
  width: 100%;
  min-width: 820px;
  table-layout: fixed;
}

.supplier-aggregate__table th:first-child,
.supplier-aggregate__table td:first-child {
  width: 28%;
}

.supplier-aggregate__table th:nth-child(2),
.supplier-aggregate__table td:nth-child(2) {
  width: 8%;
}

.supplier-aggregate__table th:nth-child(3),
.supplier-aggregate__table td:nth-child(3) {
  width: 8%;
}

.supplier-aggregate__table th:nth-child(n + 4),
.supplier-aggregate__table td:nth-child(n + 4) {
  width: 11.2%;
}

.supplier-aggregate__table td:first-child {
  white-space: normal;
}

.supplier-aggregate__table td:not(:first-child),
.supplier-aggregate__table th:not(:first-child) {
  white-space: nowrap;
}

.supplier-aggregate__unit,
.supplier-aggregate__stores {
  color: var(--muted);
  font-weight: 800;
}

.supplier-aggregate__row--pending td {
  background: rgba(255, 248, 222, 0.82);
}

.supplier-aggregate__row--pending td:first-child {
  box-shadow: inset 3px 0 0 rgba(211, 145, 31, 0.78);
}

.supplier-aggregate__row--cancelled td {
  background: rgba(244, 241, 235, 0.82);
}

.supplier-aggregate__row--cancelled td:first-child {
  box-shadow: inset 3px 0 0 rgba(133, 118, 98, 0.7);
}

.supplier-aggregate__pending-value {
  color: #9b5a00;
  font-weight: 900;
}

.supplier-aggregate__cancelled-value {
  color: #6d6257;
  font-weight: 900;
}

.mass-operations {
  margin: 12px 18px 0;
  border: 1px solid rgba(47, 107, 63, 0.22);
  border-radius: 18px;
  background: rgba(255, 252, 239, 0.78);
  overflow: hidden;
}

.mass-operations summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--leaf-dark);
  cursor: pointer;
  font-weight: 900;
}

.mass-operations summary::marker {
  color: var(--leaf);
}

.mass-operations summary::after {
  content: "Показать";
  border: 1px solid rgba(47, 107, 63, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--leaf-dark);
  font-size: 12px;
  font-weight: 900;
}

.mass-operations[open] summary::after {
  content: "Скрыть";
}

.mass-operations summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mass-operations__body {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(47, 107, 63, 0.14);
  padding: 12px;
}

.supplier-tools,
.pricing-tools {
  display: grid;
  gap: 12px;
  align-items: end;
  margin: 0;
  border: 1px solid rgba(47, 107, 63, 0.28);
  border-radius: 16px;
  background: #edf6e8;
  padding: 12px;
}

.supplier-tools {
  grid-template-columns: minmax(240px, 1fr) auto minmax(180px, 240px) auto;
}

.pricing-tools {
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 220px) minmax(130px, 180px) auto minmax(130px, 180px) auto;
  background: #f7f0d9;
}

.supplier-tools div,
.pricing-tools div {
  display: grid;
  gap: 3px;
}

.supplier-tools strong,
.pricing-tools strong {
  font-size: 14px;
}

.supplier-tools span,
.pricing-tools span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table-wrap {
  max-height: calc(100vh - 226px);
  overflow: auto;
}

.document-table {
  width: max(1640px, 100%);
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.document-table.table-compact {
  width: max(980px, 100%);
}

.supplier-mode .document-table {
  width: max(1280px, 100%);
}

.seller-mode .document-table {
  width: max(1360px, 100%);
}

.supplier-mode .document-table.table-compact {
  width: max(980px, 100%);
}

.seller-mode .document-table.table-compact {
  width: max(860px, 100%);
}

.seller-mode .document-table [data-col="store"],
.supplier-mode .document-table [data-col="seller-quantity"],
.supplier-mode .document-table [data-col="sale-price"],
.supplier-mode .document-table [data-col="markup"],
.supplier-mode .document-table [data-col="sale-sum"] {
  display: none;
}

.supplier-mode .document-table tfoot {
  display: none;
}

.document-table .is-compact-hidden {
  display: none !important;
}

.document-table th,
.document-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
  vertical-align: middle;
  background: #fffef9;
}

.document-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--head);
  padding: 9px 8px;
  color: #334133;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  white-space: nowrap;
}

.document-table [data-col="no"] { width: var(--col-no, 52px); min-width: var(--col-no, 52px); }
.document-table [data-col="store"] { width: var(--col-store, 220px); min-width: var(--col-store, 220px); }
.document-table [data-col="product"] { width: var(--col-product, 330px); min-width: var(--col-product, 330px); }
.document-table [data-col="code"] { width: var(--col-code, 86px); min-width: var(--col-code, 86px); }
.document-table [data-col="seller-quantity"] { width: var(--col-seller-quantity, 112px); min-width: var(--col-seller-quantity, 112px); }
.document-table [data-col="manager-quantity"] { width: var(--col-manager-quantity, 124px); min-width: var(--col-manager-quantity, 124px); }
.document-table [data-col="unit"] { width: var(--col-unit, 56px); min-width: var(--col-unit, 56px); }
.document-table [data-col="supplier"] { width: var(--col-supplier, 126px); min-width: var(--col-supplier, 126px); }
.document-table [data-col="shipment"] { width: var(--col-shipment, 104px); min-width: var(--col-shipment, 104px); }
.document-table [data-col="purchase"] { width: var(--col-purchase, 90px); min-width: var(--col-purchase, 90px); }
.document-table [data-col="purchase-sum"] { width: var(--col-purchase-sum, 112px); min-width: var(--col-purchase-sum, 112px); }
.document-table [data-col="actual-weight"] { width: var(--col-actual-weight, 92px); min-width: var(--col-actual-weight, 92px); }
.document-table [data-col="sale-price"] { width: var(--col-sale-price, 92px); min-width: var(--col-sale-price, 92px); }
.document-table [data-col="markup"] { width: var(--col-markup, 92px); min-width: var(--col-markup, 92px); }
.document-table [data-col="sale-sum"] { width: var(--col-sale-sum, 112px); min-width: var(--col-sale-sum, 112px); }
.document-table [data-col="comment"] { width: var(--col-comment, 220px); min-width: var(--col-comment, 220px); }
.document-table [data-col="status"] { width: var(--col-status, 160px); min-width: var(--col-status, 160px); }
.document-table [data-col="action"] { width: var(--col-action, 52px); min-width: var(--col-action, 52px); }

.column-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  width: 9px;
  cursor: col-resize;
  touch-action: none;
  z-index: 4;
}

.column-resizer::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 4px;
  bottom: 7px;
  width: 2px;
  border-radius: 99px;
  background: rgba(47, 107, 63, 0.18);
}

.document-table th:hover .column-resizer::after,
.is-resizing-column .column-resizer::after {
  background: rgba(47, 107, 63, 0.72);
}

.is-resizing-column {
  cursor: col-resize;
  user-select: none;
}

.document-table tbody tr:hover td {
  background: #fbf8eb;
}

.document-table tbody tr.is-edited td {
  background: var(--edited);
}

.document-table tbody tr.row-updated td {
  background: #eef7ea;
}

.document-table tbody tr.row-updated--new td {
  background: #e3f5dc;
}

.document-table tbody tr.row-updated--changed td {
  background: #f1f8ea;
}

.document-table tbody tr.row-invalid td {
  background: #fffaf0;
}

.document-table tbody tr.row-invalid.is-edited td {
  background: #fff3cc;
}

.document-table td.cell-invalid {
  position: relative;
  background: #fff1d6 !important;
  box-shadow: inset 0 0 0 2px #df8b2d;
}

.document-table td.cell-updated {
  background: #f1f8ea !important;
  box-shadow: inset 0 0 0 2px rgba(47, 107, 63, 0.18);
}

.document-table td.cell-low-margin {
  background: rgba(183, 58, 72, 0.12) !important;
  box-shadow: inset 0 0 0 1px rgba(183, 58, 72, 0.28);
}

.document-table td.cell-low-margin input,
.document-table td.cell-low-margin .readonly {
  background: rgba(183, 58, 72, 0.08);
  color: #8c2e37;
}

.document-table td.cell-invalid input,
.document-table td.cell-invalid .readonly,
.document-table td.cell-invalid .product-select {
  padding-right: 42px;
}

.cell-validation-trigger {
  position: absolute;
  top: 50%;
  right: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #b75617;
  font-size: 0;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-50%);
  z-index: 2;
  touch-action: manipulation;
}

.cell-validation-trigger::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border: 1px solid rgba(255, 247, 230, 0.96);
  border-radius: 999px;
  background: #c46a24;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(126, 44, 32, 0.18);
}

.cell-validation-trigger:focus,
.cell-validation-trigger:hover {
  outline: 3px solid rgba(208, 100, 32, 0.24);
  outline-offset: 1px;
}

.document-table tbody tr.is-deleted td {
  opacity: 0.52;
  text-decoration: line-through;
}

.document-table tfoot td {
  padding: 8px;
  background: #f4f9ef;
  text-align: left;
}

.table-add-row-button {
  width: min(360px, calc(100vw - 48px));
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px dashed rgba(47, 107, 63, 0.45);
  border-radius: 12px;
  background: #eef6e9;
  color: var(--leaf-dark);
  font-weight: 900;
}

.table-add-row-button span {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--leaf);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.table-add-row-button:hover,
.table-add-row-button:focus {
  border-color: var(--leaf);
  background: #e2f0d8;
  outline: 3px solid rgba(47, 107, 63, 0.14);
  outline-offset: -3px;
}

.table-add-row-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.document-table input,
.document-table select,
.document-table textarea {
  min-height: 38px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
}

.document-table textarea {
  min-height: 38px;
  resize: vertical;
}

.document-table .readonly {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px;
  background: var(--readonly);
  color: #4c584d;
}

.document-table .number-cell input {
  text-align: right;
}

.availability-control {
  display: grid;
  gap: 5px;
  justify-items: end;
  margin-top: 6px;
}

.availability-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(185, 102, 35, 0.26);
  border-radius: 999px;
  background: #fff3d9;
  color: #7b430d;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
}

.availability-toggle {
  min-height: 30px;
  border: 1px solid rgba(185, 102, 35, 0.38);
  border-radius: 999px;
  background: #fffaf0;
  color: #7b430d;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.availability-toggle:hover,
.availability-toggle:focus {
  border-color: rgba(185, 102, 35, 0.72);
  outline: 3px solid rgba(185, 102, 35, 0.16);
  outline-offset: 1px;
}

.availability-toggle--active {
  background: #f4e3c5;
}

.comments-cell {
  display: grid;
  gap: 7px;
  min-height: 38px;
  padding: 6px;
  background: #fffdf4;
}

.comment-history {
  display: grid;
  gap: 5px;
}

.comment-chip {
  display: grid;
  gap: 2px;
  border: 1px solid rgba(216, 224, 212, 0.92);
  border-left: 4px solid var(--leaf);
  border-radius: 10px;
  background: #fffef9;
  padding: 6px 8px;
  line-height: 1.28;
}

.comment-chip strong {
  color: var(--leaf-dark);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.comment-chip span {
  color: #39453b;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 800;
}

.comment-chip--manager {
  border-left-color: #7b8f2f;
}

.comment-chip--supplier {
  border-left-color: #b87424;
}

.comment-chip--quality {
  border-left-color: var(--danger);
}

.comment-editor {
  display: grid;
  gap: 4px;
}

.comment-editor > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.comment-editor input {
  border: 1px solid rgba(216, 224, 212, 0.92);
  border-radius: 10px;
  background: #fffef9;
}

.document-table .col-no,
.document-table .col-action {
  text-align: center;
}

.product-select {
  width: 100%;
  min-height: 46px;
  display: grid;
  gap: 2px;
  justify-items: start;
  padding: 7px 9px;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.product-select:hover,
.product-select:focus {
  background: #eef6e9;
  outline: 2px solid rgba(47, 107, 63, 0.18);
  outline-offset: -2px;
}

.product-select__name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.product-select__hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  background: #f6e3dd;
  color: var(--danger);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.row-action + .row-action {
  margin-left: 6px;
}

.row-action[aria-label] {
  width: 34px;
  padding: 0;
}

.row-action--warn {
  background: #fff0d9;
  color: #9b5a00;
}

.row-action--neutral {
  background: #e9eee6;
  color: #2f5539;
}

.row-action--confirm {
  background: #e3f0dc;
  color: var(--leaf-dark);
}

.row-cancel-request td {
  background: #fff5e6;
}

.row-cancel-request td:first-child {
  box-shadow: inset 3px 0 0 rgba(211, 145, 31, 0.78);
}

.row-cancelled td {
  background: #f4f1eb;
  color: #6d6257;
}

.row-cancelled td:first-child {
  box-shadow: inset 3px 0 0 rgba(133, 118, 98, 0.7);
}

.availability-badge--cancel-request {
  background: #fff0d9;
  color: #9b5a00;
}

.availability-badge--cancelled {
  background: #ece7df;
  color: #6d6257;
}

.cell-note {
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(460px, calc(100vw - 36px));
  border-radius: 16px;
  background: #18231d;
  color: #fff;
  padding: 13px 15px;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.toast.error {
  background: #7e2c20;
}

@keyframes busy-overlay-spin {
  to {
    transform: rotate(360deg);
  }
}

.product-picker {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
}

.product-picker__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 28, 21, 0.46);
  cursor: default;
}

.product-picker__panel {
  position: relative;
  width: min(920px, 100%);
  max-height: min(780px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  border: 1px solid rgba(216, 224, 212, 0.96);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(8, 18, 10, 0.28);
  padding: 18px;
}

.product-picker__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.product-search {
  font-size: 13px;
}

.product-search input {
  min-height: 48px;
  border-radius: 16px;
  font-size: 16px;
}

.product-picker__meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.product-picker__results {
  min-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  align-content: start;
  gap: 8px;
  padding-right: 4px;
}

.product-option {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffef9;
  padding: 11px 12px;
  color: var(--ink);
  text-align: left;
}

.product-option:hover,
.product-option:focus {
  border-color: var(--leaf);
  background: #eef6e9;
  outline: none;
}

.product-option__name {
  font-size: 16px;
  font-weight: 900;
}

.product-option__meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.product-option__empty {
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
  font-weight: 900;
}

body.modal-open {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

@keyframes sync-badge-pulse {
  0% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 rgba(47, 107, 63, 0.14);
  }

  45% {
    transform: translateY(-1px);
    box-shadow: 0 0 0 10px rgba(47, 107, 63, 0);
  }

  100% {
    transform: translateY(0);
    box-shadow: none;
  }
}

@keyframes document-sync-pulse {
  0% {
    box-shadow: none;
  }

  45% {
    box-shadow: 0 0 0 4px rgba(47, 107, 63, 0.12);
  }

  100% {
    box-shadow: none;
  }
}

@keyframes summary-update-flash {
  0% {
    box-shadow: inset 0 0 0 1px rgba(47, 107, 63, 0.14);
  }

  45% {
    box-shadow: inset 0 0 0 2px rgba(47, 107, 63, 0.22), 0 0 0 4px rgba(47, 107, 63, 0.08);
  }

  100% {
    box-shadow: inset 0 0 0 1px rgba(47, 107, 63, 0.14);
  }
}

@media (max-width: 1180px) {
  .manager-board__head,
  .manager-store-card__head {
    flex-direction: column;
  }

  .manager-board__actions,
  .manager-store-card__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .manager-board__cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .document-toolbar {
    position: static;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .toolbar-section--context {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(160px, 220px) minmax(140px, 180px);
  }

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

  .toolbar-section--actions #printDocumentButton,
  .toolbar-section--actions #exportExcelButton,
  .toolbar-section--actions #sendToSupplierButton,
  .toolbar-section--actions #handoffButton {
    grid-column: 1 / -1;
  }

  .toolbar-section--control {
    grid-template-columns: minmax(0, 0.6fr) minmax(0, 1.4fr);
  }

  .toolbar-section--control .toolbar-section__title {
    grid-column: 1 / -1;
  }

  .admin-status-override {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-top: 0;
    border-top: 0;
  }

  .document-head {
    grid-template-columns: 1fr;
  }

  .document-head__meta {
    grid-template-columns: minmax(0, 1.6fr) minmax(190px, 1fr) minmax(150px, 0.8fr);
    justify-content: stretch;
    width: 100%;
  }

  .document-meta-group .totals {
    flex-wrap: wrap;
  }

  .summary-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .supplier-aggregate__summary {
    flex-direction: column;
    align-items: stretch;
  }

  .supplier-aggregate__summary-text {
    text-align: left;
  }

  .supplier-aggregate__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-controls {
    grid-template-columns: 1fr 1fr;
  }

  .supplier-tools,
  .pricing-tools {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .manager-board__cards {
    grid-template-columns: 1fr 1fr;
    padding-inline: 10px;
  }

  .manager-board__stores {
    padding-inline: 10px;
  }

  .manager-board__actions label,
  .manager-board__actions input[type="search"],
  .manager-board__actions button {
    width: 100%;
  }

  .manager-store-card__actions .manager-board-action-button {
    width: 38px;
    flex: 0 0 38px;
  }

  .manager-store-card__actions .manager-board-action-button--text {
    width: auto;
    flex: 0 1 auto;
    min-width: 0;
    padding-inline: 11px;
  }

  .shell {
    width: min(100% - 16px, 720px);
    padding-top: 12px;
  }

  .topline,
  .document-head,
  .summary-head,
  .login-panel {
    display: grid;
    grid-template-columns: 1fr;
  }

  .workspace-overview {
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: 0;
    margin-top: 14px;
    border-radius: 20px;
  }

  .login-copy {
    min-height: 220px;
    padding: 20px;
  }

  .login-copy h2 {
    max-width: 100%;
  }

  .login-copy p {
    max-width: 100%;
  }

  .login-form {
    padding: 20px;
  }

  .login-badge {
    padding: 6px 10px;
    font-size: 10px;
  }

  .login-copy {
    gap: 12px;
  }

  .login-copy h2 {
    font-size: 25px;
  }

  .login-copy p {
    font-size: 14px;
    line-height: 1.42;
  }

  .login-highlights {
    margin-top: 2px;
  }

  .login-highlights span {
    padding: 6px 9px;
    font-size: 12px;
  }

  .document-toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar-section--context,
  .toolbar-section--actions {
    grid-template-columns: 1fr;
  }

  .toolbar-section--actions {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-section--actions .toolbar-section__title,
  .toolbar-section--actions #printDocumentButton,
  .toolbar-section--actions #exportExcelButton,
  .toolbar-section--actions #sendToSupplierButton,
  .toolbar-section--actions #handoffButton {
    grid-column: 1 / -1;
  }

  .summary-head {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-head__actions {
    justify-content: stretch;
  }

  .summary-sync-badge,
  .summary-head__actions .secondary-button,
  .summary-head__actions .ghost-button {
    width: 100%;
  }

  .toolbar-section--control,
  .admin-status-override {
    grid-template-columns: 1fr;
  }

  .admin-status-override {
    padding-top: 10px;
    border-top: 1px solid rgba(216, 224, 212, 0.88);
  }

  .document-head__meta {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .document-meta-group {
    width: 100%;
  }

  .unsaved-badge {
    width: 100%;
    white-space: normal;
  }

  .sync-badge {
    width: 100%;
  }

  .sync-notice {
    align-items: stretch;
    flex-direction: column;
  }

  .sync-notice .secondary-button {
    width: 100%;
  }

  .mass-operations summary {
    display: grid;
    justify-content: stretch;
  }

  .supplier-aggregate summary {
    align-items: flex-start;
  }

  .supplier-aggregate__stats {
    grid-template-columns: 1fr 1fr;
    padding-inline: 10px;
  }

  .mass-operations summary small {
    line-height: 1.35;
  }

  .supplier-tools,
  .pricing-tools {
    grid-template-columns: 1fr;
    margin-inline: 10px;
  }

  .summary-cards {
    grid-template-columns: 1fr 1fr;
    padding-inline: 10px;
  }

  .summary-controls {
    grid-template-columns: 1fr;
    padding-inline: 10px;
  }

  .table-wrap {
    max-height: calc(100vh - 252px);
  }

  .document-table {
    width: 1640px;
  }

  .document-table.table-compact {
    width: 980px;
  }

  .supplier-mode .document-table {
    width: 1280px;
  }

  .supplier-mode .document-table.table-compact {
    width: 980px;
  }

  .seller-mode .document-table {
    width: 1360px;
  }

  .seller-mode .document-table.table-compact {
    width: 860px;
  }

  .product-picker {
    padding: 0;
    align-items: end;
  }

  .product-picker__panel {
    width: 100%;
    height: min(92vh, 820px);
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
    padding: 16px;
  }

  .product-picker__head {
    align-items: center;
  }

  .product-picker__results {
    min-height: 0;
  }

  .product-option {
    padding: 13px;
  }

  .product-option__name {
    font-size: 15px;
  }
}

@media (max-width: 340px) {
  .toolbar-actions {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1181px) {
  body {
    overflow-x: hidden;
    background:
      radial-gradient(circle at 8% 0%, rgba(232, 215, 166, 0.72), transparent 30rem),
      radial-gradient(circle at 100% 0%, rgba(68, 121, 69, 0.14), transparent 34rem),
      linear-gradient(135deg, #f3ecd5 0%, #fbfaf2 42%, #edf4e7 100%);
  }

  .shell {
    width: min(100% - 28px, 1900px);
    padding: 14px 0 28px;
  }

  .topline {
    align-items: center;
    margin-bottom: 12px;
  }

  .topline > div:first-child {
    display: flex;
    align-items: baseline;
    gap: 14px;
    min-width: 0;
  }

  .topline .eyebrow {
    margin: 0;
    flex: 0 0 auto;
  }

  h1 {
    font-size: clamp(30px, 2.5vw, 42px);
    letter-spacing: -0.055em;
  }

  .document-app {
    display: grid;
    grid-template-columns: minmax(294px, 314px) minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 14px;
    align-items: start;
  }

  .workspace-overview {
    position: sticky;
    top: 12px;
    z-index: 13;
    grid-column: 1;
    grid-row: 1;
    display: block;
  }

  .user-card {
    min-height: 78px;
    border-radius: 22px;
    padding: 14px 16px;
  }

  .document-toolbar {
    position: sticky;
    top: 104px;
    z-index: 12;
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-self: start;
    max-height: calc(100vh - 118px);
    margin-top: 108px;
    overflow: auto;
    padding: 10px;
    border-radius: 24px;
    background:
      linear-gradient(180deg, rgba(255, 254, 248, 0.96), rgba(247, 244, 228, 0.92)),
      radial-gradient(circle at 0 0, rgba(111, 161, 63, 0.12), transparent 18rem);
  }

  .document-toolbar::-webkit-scrollbar,
  .table-wrap::-webkit-scrollbar {
    width: 11px;
    height: 11px;
  }

  .document-toolbar::-webkit-scrollbar-thumb,
  .table-wrap::-webkit-scrollbar-thumb {
    border: 3px solid rgba(255, 254, 248, 0.88);
    border-radius: 999px;
    background: rgba(80, 108, 76, 0.42);
  }

  .toolbar-section {
    gap: 8px;
    align-items: stretch;
    border-radius: 18px;
    padding: 12px;
    background: rgba(255, 255, 250, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  }

  .toolbar-section__title {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .toolbar-section__title::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.55;
  }

  .toolbar-section--context,
  .toolbar-section--control {
    grid-template-columns: 1fr;
  }

  .toolbar-section--actions {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-section--actions .toolbar-section__title,
  .toolbar-section--actions #sendToSupplierButton,
  .toolbar-section--actions #handoffButton {
    grid-column: 1 / -1;
  }

  .toolbar-section label {
    gap: 5px;
    font-size: 12px;
  }

  .toolbar-section input,
  .toolbar-section select {
    min-height: 40px;
  }

  .toolbar-section button {
    min-height: 38px;
    border-radius: 13px;
    padding: 9px 11px;
    font-size: 13px;
    line-height: 1.15;
  }

  #sendToSupplierButton,
  #handoffButton {
    min-height: 44px;
    font-size: 14px;
  }

  .admin-status-override {
    gap: 8px;
    margin-top: 2px;
    padding-top: 10px;
  }

  .summary-panel {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .document-panel {
    display: grid;
    grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: calc(100vh - 84px);
    border-radius: 26px;
    box-shadow: 0 20px 54px rgba(31, 45, 31, 0.13);
  }

  .document-head {
    display: grid;
    grid-template-columns: minmax(420px, 1fr) minmax(330px, 390px);
    gap: 12px;
    align-items: start;
    padding: 13px 16px;
    background:
      linear-gradient(180deg, rgba(255, 254, 248, 0.98), rgba(249, 247, 237, 0.94)),
      radial-gradient(circle at 0 0, rgba(233, 217, 174, 0.35), transparent 20rem);
  }

  .document-head__main {
    gap: 10px;
  }

  .document-head h2 {
    overflow: hidden;
    font-size: 24px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .document-head .document-status-card {
    align-self: start;
    max-width: none;
    min-height: 108px;
    border-radius: 18px;
    padding: 13px 14px;
  }

  .document-status-card strong {
    font-size: 20px;
  }

  .document-status-card p {
    max-width: 100%;
    font-size: 13px;
    line-height: 1.38;
  }

  .document-head__meta {
    grid-template-columns: 1fr;
    gap: 10px;
    justify-content: stretch;
  }

  .document-meta-group {
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: center;
    border-radius: 17px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.6);
  }

  .document-head__meta .document-meta-group:nth-child(2) {
    grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1fr);
  }

  .document-meta-group--settings {
    grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
  }

  .document-meta-group__title {
    grid-column: 1;
    grid-row: 1 / -1;
    line-height: 1.15;
  }

  .document-meta-group .totals,
  .document-head__meta .document-meta-group:nth-child(2) .unsaved-badge,
  .document-meta-group--settings .table-settings-button--primary {
    grid-column: 2;
  }

  .document-head__meta .document-meta-group:nth-child(2) .sync-badge,
  .document-meta-group--settings #resetColumnWidthsButton {
    grid-column: 3;
  }

  .document-meta-group .totals {
    gap: 6px;
  }

  .totals span,
  .unsaved-badge,
  .sync-badge {
    min-height: 28px;
    padding: 6px 9px;
    font-size: 12px;
  }

  .validation-panel,
  .sync-notice,
  .supplier-aggregate,
  .mass-operations {
    margin: 10px 16px 0;
  }

  .mass-operations summary,
  .supplier-aggregate summary {
    min-height: 44px;
    padding: 10px 13px;
  }

  .table-wrap {
    grid-row: 6;
    height: 100%;
    min-height: 0;
    max-height: none;
    margin-top: 0;
    border-top: 1px solid var(--line);
    background: #fffef9;
  }

  .document-table {
    font-size: 13px;
  }

  .document-table th {
    padding: 8px 8px;
    background:
      linear-gradient(180deg, #eff6e9 0%, #e4eddc 100%);
    box-shadow: inset 0 -1px 0 rgba(47, 107, 63, 0.08);
  }

  .document-table input,
  .document-table select,
  .document-table textarea,
  .document-table .readonly {
    min-height: 36px;
  }

  .product-select {
    min-height: 42px;
  }
}

@media (min-width: 1181px) {
  .shell {
    position: relative;
    width: min(100% - 24px, 1880px);
    height: auto;
    padding: 14px 0 18px;
  }

  .topline {
    min-height: 44px;
    margin-bottom: 10px;
  }

  .topline__actions {
    gap: 9px;
  }

  .topline__actions .ghost-link,
  .topline__actions .ghost-button {
    min-height: 38px;
    border-radius: 999px;
    padding: 8px 14px;
    background: rgba(255, 254, 248, 0.88);
    box-shadow: 0 8px 22px rgba(30, 42, 30, 0.06);
  }

  .document-app {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 10px;
    align-items: stretch;
  }

  .workspace-overview {
    position: absolute;
    top: 7px;
    right: 190px;
    z-index: 18;
    display: block;
    width: auto;
    max-width: min(420px, calc(100vw - 650px));
  }

  .user-card {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    min-width: 0;
    border-radius: 999px;
    padding: 8px 13px;
    background: rgba(255, 254, 248, 0.9);
    box-shadow: 0 8px 22px rgba(30, 42, 30, 0.06);
  }

  .user-card__caption {
    display: none;
  }

  .user-card strong {
    max-width: 250px;
    font-size: 14px;
  }

  .user-card .pill {
    padding: 3px 7px;
    font-size: 11px;
    white-space: nowrap;
  }

  .document-toolbar {
    position: sticky;
    top: 8px;
    z-index: 15;
    display: grid;
    grid-template-columns:
      minmax(360px, 0.94fr)
      minmax(410px, 1.28fr)
      minmax(290px, 0.74fr)
      minmax(116px, 0.36fr);
    grid-column: 1;
    grid-row: 1;
    gap: 10px;
    align-items: stretch;
    max-height: none;
    margin-top: 0;
    overflow: visible;
    border-radius: 24px;
    padding: 10px;
    background: rgba(255, 254, 248, 0.9);
    box-shadow: var(--shadow);
  }

  .toolbar-section {
    min-width: 0;
    border-radius: 18px;
    padding: 9px;
    background: rgba(255, 255, 250, 0.72);
  }

  .toolbar-section--context {
    grid-template-columns: minmax(0, 1fr) minmax(132px, 0.55fr);
    align-content: start;
  }

  .toolbar-section--context #openDocumentButton {
    grid-column: 1 / -1;
  }

  .toolbar-section--status {
    padding: 0;
    border-color: transparent;
    background: transparent;
  }

  .toolbar-section--actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
  }

  .toolbar-section--actions .toolbar-section__title {
    grid-column: 1 / -1;
  }

  .toolbar-section--actions #sendToSupplierButton,
  .toolbar-section--actions #handoffButton {
    grid-column: 1 / -1;
  }

  .toolbar-section--control {
    position: relative;
    grid-template-columns: 1fr;
    align-content: start;
  }

  .toolbar-section label {
    font-size: 11px;
  }

  .toolbar-section input,
  .toolbar-section select {
    min-height: 38px;
    border-radius: 13px;
  }

  .toolbar-section button {
    min-height: 36px;
    border-radius: 13px;
    padding: 8px 10px;
    font-size: 13px;
  }

  #sendToSupplierButton,
  #handoffButton {
    min-height: 42px;
    border-color: #df872a;
    background: linear-gradient(135deg, #ffb35d, #f18a33);
    color: #3b2105;
    box-shadow: 0 10px 24px rgba(241, 145, 53, 0.22);
    font-size: 14px;
  }

  .toolbar-section--status .document-status-card {
    position: relative;
    height: 100%;
    min-height: 118px;
    max-width: none;
    display: grid;
    align-content: center;
    border-left-width: 0;
    border-radius: 18px;
    padding: 14px 14px 14px 66px;
    box-shadow: none;
  }

  .toolbar-section--status .document-status-card::before {
    content: "!";
    position: absolute;
    left: 16px;
    top: 50%;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--danger);
    color: #fff;
    font-size: 24px;
    font-weight: 950;
    transform: translateY(-50%);
  }

  .toolbar-section--status .document-state--warning::before {
    background: #c97914;
  }

  .toolbar-section--status .document-state--success::before {
    background: var(--leaf);
  }

  .toolbar-section--status .document-status-card strong {
    font-size: 20px;
  }

  .toolbar-section--status .document-status-card p {
    font-size: 13px;
    line-height: 1.34;
  }

  .admin-status-override {
    position: relative;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .admin-status-override summary {
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(47, 107, 63, 0.22);
    border-radius: 13px;
    background: rgba(255, 255, 250, 0.72);
    color: var(--leaf-dark);
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 900;
    list-style: none;
    cursor: pointer;
  }

  .admin-status-override summary::-webkit-details-marker {
    display: none;
  }

  .admin-status-override__body {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 35;
    width: 360px;
    display: grid;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
    padding: 12px;
    box-shadow: 0 18px 50px rgba(31, 45, 31, 0.16);
  }

  .document-panel {
    display: grid;
    grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
    grid-column: 1;
    grid-row: 2;
    min-height: calc(100vh - 286px);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow);
  }

  .document-head {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(580px, max-content);
    gap: 12px;
    align-items: center;
    min-height: 54px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 254, 248, 0.98), rgba(242, 247, 238, 0.94));
  }

  .document-head__main {
    display: block;
  }

  .document-head h2 {
    font-size: 17px;
    letter-spacing: -0.02em;
  }

  .document-head__meta {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: flex-end;
  }

  .document-meta-group {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    border-radius: 999px;
    padding: 5px 7px 5px 10px;
    background: rgba(255, 255, 250, 0.74);
  }

  .document-meta-group__title {
    grid-column: auto;
    grid-row: auto;
    font-size: 10px;
    white-space: nowrap;
  }

  .document-meta-group .totals {
    gap: 5px;
    flex-wrap: nowrap;
  }

  .totals span,
  .unsaved-badge,
  .sync-badge,
  .document-meta-group .table-settings-button {
    min-height: 26px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .unsaved-badge,
  .sync-badge {
    width: auto;
  }

  .sync-badge {
    max-width: 170px;
    white-space: nowrap;
  }

  .document-meta-group--settings {
    display: flex;
  }

  .validation-panel,
  .sync-notice,
  .supplier-aggregate,
  .mass-operations {
    margin: 10px 14px 0;
  }

  .table-wrap {
    grid-row: 6;
    height: 100%;
    min-height: 0;
    max-height: none;
    margin-top: 0;
    border-top: 1px solid var(--line);
  }

  .document-table {
    width: max(1640px, 100%);
  }

  .document-table th {
    padding: 8px 9px;
  }

  .summary-panel {
    grid-column: 1;
    grid-row: 3;
  }
}

@media (min-width: 1181px) and (max-width: 1366px) {
  .topline {
    min-height: 42px;
  }

  h1 {
    font-size: clamp(28px, 2.7vw, 36px);
  }

  .workspace-overview {
    right: 210px;
    max-width: 360px;
  }

  .user-card strong {
    max-width: 205px;
  }

  .user-card .pill {
    display: inline-flex;
    flex: 0 0 auto;
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .document-toolbar {
    grid-template-columns: minmax(320px, 0.42fr) minmax(0, 0.58fr);
    gap: 9px;
    padding: 9px;
  }

  .toolbar-section--context {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: minmax(0, 1fr) 132px 120px;
  }

  .toolbar-section--context #openDocumentButton {
    grid-column: auto;
  }

  .toolbar-section--status {
    grid-column: 2;
    grid-row: 1;
  }

  .toolbar-section--actions {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .toolbar-section--actions #sendToSupplierButton,
  .toolbar-section--actions #handoffButton {
    grid-column: 1 / -1;
  }

  .toolbar-section--control {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .toolbar-section--control .toolbar-section__title {
    grid-column: 1 / -1;
  }

  .toolbar-section--control #openSummaryButton,
  .toolbar-section--control .admin-status-override {
    justify-self: start;
    min-width: 0;
    width: min(220px, 100%);
  }

  .toolbar-section--status .document-status-card {
    min-height: 124px;
  }

  .toolbar-section--status .document-status-card p {
    font-size: 12px;
  }

  .document-panel {
    min-height: max(300px, calc(100vh - 388px));
  }

  .document-head {
    grid-template-columns: 1fr;
    gap: 7px;
    min-height: 76px;
    padding: 8px 12px;
  }

  .document-head__meta {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  .document-meta-group {
    min-height: 30px;
    padding: 4px 6px;
  }

  .document-meta-group__title {
    display: none;
  }

  .totals span,
  .unsaved-badge,
  .sync-badge,
  .document-meta-group .table-settings-button {
    min-height: 24px;
    padding: 4px 7px;
    font-size: 11px;
  }
}

@media (min-width: 900px) and (max-width: 1180px) {
  .workspace-overview {
    grid-template-columns: 1fr;
  }

  .user-card {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 18px;
    padding: 10px 12px;
  }

  .user-card__caption {
    display: none;
  }

  .user-card .pill {
    margin-left: auto;
  }

  .document-toolbar {
    display: grid;
    grid-template-columns: minmax(320px, 0.45fr) minmax(0, 0.55fr);
    gap: 9px;
    padding: 9px;
  }

  .toolbar-section--context {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: minmax(0, 1fr) 132px 118px;
  }

  .toolbar-section--context #openDocumentButton {
    grid-column: auto;
  }

  .toolbar-section--status {
    grid-column: 2;
    grid-row: 1;
    padding: 0;
    border-color: transparent;
    background: transparent;
  }

  .toolbar-section--status .document-status-card {
    position: relative;
    height: 100%;
    min-height: 118px;
    max-width: none;
    border-left-width: 0;
    border-radius: 18px;
    padding: 13px 13px 13px 62px;
    box-shadow: none;
  }

  .toolbar-section--status .document-status-card::before {
    content: "!";
    position: absolute;
    left: 15px;
    top: 50%;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--danger);
    color: #fff;
    font-size: 22px;
    font-weight: 950;
    transform: translateY(-50%);
  }

  .toolbar-section--actions {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .toolbar-section--actions .toolbar-section__title,
  .toolbar-section--actions #sendToSupplierButton,
  .toolbar-section--actions #handoffButton {
    grid-column: 1 / -1;
  }

  .toolbar-section--actions #printDocumentButton,
  .toolbar-section--actions #exportExcelButton {
    grid-column: auto;
  }

  .toolbar-section--control {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: 1fr 1fr;
    align-content: start;
  }

  .toolbar-section--control .toolbar-section__title {
    grid-column: 1 / -1;
  }

  .toolbar-section--control #openSummaryButton,
  .toolbar-section--control .admin-status-override {
    min-width: 0;
  }

  .admin-status-override {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .admin-status-override summary {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(47, 107, 63, 0.22);
    border-radius: 13px;
    background: rgba(255, 255, 250, 0.72);
    color: var(--leaf-dark);
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 900;
    list-style: none;
    cursor: pointer;
  }

  .admin-status-override summary::-webkit-details-marker {
    display: none;
  }

  .admin-status-override__body {
    display: grid;
    gap: 9px;
    margin-top: 8px;
  }

  .document-head {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .document-head__meta {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  .document-meta-group {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    border-radius: 999px;
    padding: 4px 7px;
  }

  .document-meta-group__title {
    display: none;
  }
}

@media (min-width: 980px) and (max-width: 1180px) {
  .document-app {
    position: relative;
  }

  .workspace-overview {
    position: absolute;
    top: -54px;
    right: 210px;
    z-index: 18;
    display: block;
    width: min(380px, calc(100vw - 620px));
    min-width: 260px;
  }

  .user-card {
    min-height: 38px;
    border-radius: 999px;
    padding: 8px 13px;
    background: rgba(255, 254, 248, 0.9);
    box-shadow: 0 8px 22px rgba(30, 42, 30, 0.06);
  }

  .user-card strong {
    max-width: 190px;
    font-size: 14px;
  }

  .user-card .pill {
    display: inline-flex;
    flex: 0 0 auto;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (min-width: 900px) and (max-width: 1366px) {
  .document-toolbar {
    align-items: stretch;
  }

  .toolbar-section {
    align-content: start;
  }

  .toolbar-section--context {
    align-items: end;
  }

  .toolbar-section--context .toolbar-section__title {
    align-self: start;
  }

  .toolbar-section--context #openDocumentButton {
    align-self: end;
    min-height: 38px;
    height: 38px;
  }

  .toolbar-section--actions,
  .toolbar-section--control {
    align-content: start;
  }

  .toolbar-section--control {
    justify-items: start;
    align-self: start;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    padding: 8px 10px;
  }

  .toolbar-section--actions button,
  .toolbar-section--control button,
  .admin-status-override summary {
    min-height: 38px;
  }

  .toolbar-section--control #openSummaryButton,
  .toolbar-section--control .admin-status-override {
    width: min(220px, 100%);
  }
}

@media (min-width: 1367px) {
  .toolbar-section--context #openDocumentButton {
    justify-self: start;
    width: min(180px, 100%);
  }
}

@media (min-width: 1181px) {
  .summary-panel {
    grid-column: 1;
    grid-row: 2;
  }

  .document-app.summary-open .document-panel {
    grid-row: 3;
  }
}

@media (min-width: 1181px) and (max-width: 1366px) {
  .toolbar-section--context,
  .toolbar-section--actions,
  .toolbar-section--control {
    padding: 10px;
  }

  .toolbar-section--status .document-status-card {
    min-height: 116px;
  }

  .document-toolbar {
    gap: 8px;
    padding: 8px;
  }
}

@media (min-width: 900px) and (max-width: 1180px) {
  .topline {
    margin-bottom: 10px;
  }

  .document-toolbar {
    gap: 8px;
    padding: 8px;
  }

  .toolbar-section {
    padding: 8px;
  }

  .toolbar-section--status .document-status-card {
    min-height: 108px;
    gap: 5px;
    padding: 12px 12px 12px 58px;
  }

  .toolbar-section--status .document-status-card strong {
    font-size: 18px;
  }

  .toolbar-section--status .document-status-card p {
    font-size: 12px;
    line-height: 1.28;
  }

  .toolbar-section--status .document-status-card::before {
    left: 14px;
    width: 34px;
    height: 34px;
    border-radius: 13px;
    font-size: 20px;
  }

  .document-head {
    padding: 8px 12px;
  }
}

@media (min-width: 1280px) {
  .document-toolbar {
    position: relative;
    top: auto;
    display: grid;
    grid-template-columns: minmax(360px, 0.92fr) minmax(410px, 1.14fr) minmax(210px, 0.5fr);
    grid-template-rows: auto auto;
    gap: 12px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .toolbar-section {
    border: 1px solid rgba(216, 224, 212, 0.86);
    border-radius: 20px;
    padding: 14px;
    background: rgba(255, 254, 248, 0.82);
    box-shadow: 0 14px 36px rgba(31, 45, 31, 0.07);
  }

  .toolbar-section--context {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: minmax(0, 1fr) 132px;
    align-items: end;
  }

  .toolbar-section--context #openDocumentButton {
    grid-column: 1 / -1;
    justify-self: start;
    width: min(180px, 100%);
    min-height: 38px;
  }

  .toolbar-section--status {
    grid-column: 2;
    grid-row: 1;
    padding: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .toolbar-section--status .document-status-card {
    min-height: 100%;
    border: 1px solid rgba(235, 200, 190, 0.72);
    border-radius: 20px;
    background: rgba(255, 239, 233, 0.82);
    box-shadow: 0 14px 36px rgba(120, 53, 45, 0.07);
  }

  .toolbar-section--control {
    grid-column: 3;
    grid-row: 1;
    grid-template-columns: 1fr;
    align-self: stretch;
    justify-items: stretch;
    border-color: rgba(216, 224, 212, 0.86);
    background: rgba(255, 254, 248, 0.82);
    box-shadow: 0 14px 36px rgba(31, 45, 31, 0.07);
  }

  .toolbar-section--control #openSummaryButton,
  .toolbar-section--control .admin-status-override {
    width: 100%;
  }

  .toolbar-section--actions {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(120px, 148px)) minmax(240px, 1fr);
    align-items: center;
    column-gap: 12px;
  }

  .toolbar-section--actions .toolbar-section__title {
    grid-column: 1 / -1;
  }

  .toolbar-section--actions #saveDocumentButton,
  .toolbar-section--actions #discardChangesButton,
  .toolbar-section--actions #printDocumentButton,
  .toolbar-section--actions #exportExcelButton {
    grid-column: auto;
    width: 100%;
  }

  .toolbar-section--actions #sendToSupplierButton,
  .toolbar-section--actions #handoffButton {
    grid-column: 5;
    justify-self: end;
    width: min(320px, 100%);
  }

  .toolbar-section button,
  .admin-status-override summary {
    border-radius: 14px;
  }

  .document-panel {
    min-height: calc(100vh - 330px);
  }

  .document-head {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
    min-height: 58px;
    padding: 9px 14px;
  }

  .document-head__meta {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .document-meta-group {
    min-height: 34px;
  }
}

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

.button-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

@media (min-width: 1181px) {
  .document-toolbar {
    grid-template-columns: minmax(508px, 0.92fr) minmax(430px, 1.1fr) minmax(220px, 0.42fr);
  }

  .toolbar-section--context {
    grid-template-columns: minmax(210px, 1fr) 118px 132px;
    align-items: end;
  }

  .toolbar-section--context #openDocumentButton {
    grid-column: auto;
    justify-self: stretch;
    width: 100%;
    height: 40px;
    min-height: 40px;
  }

  .toolbar-section--actions {
    grid-template-columns: max-content repeat(4, minmax(108px, 132px)) minmax(240px, 1fr);
    align-items: center;
    column-gap: 12px;
    row-gap: 10px;
  }

  .toolbar-section--actions .toolbar-section__title {
    grid-column: auto;
    align-self: center;
    margin-right: 2px;
  }

  .toolbar-section--actions #saveDocumentButton,
  .toolbar-section--actions #discardChangesButton,
  .toolbar-section--actions #printDocumentButton,
  .toolbar-section--actions #exportExcelButton {
    grid-column: auto;
    width: 100%;
    min-height: 40px;
  }

  .toolbar-section--actions #sendToSupplierButton,
  .toolbar-section--actions #handoffButton {
    grid-column: 6;
    justify-self: end;
    width: min(320px, 100%);
    min-height: 42px;
  }
}

@media (min-width: 1181px) and (max-width: 1366px) {
  .document-toolbar {
    grid-template-columns: minmax(500px, 0.95fr) minmax(410px, 1.05fr) minmax(210px, 0.42fr);
  }

  .toolbar-section--context {
    grid-template-columns: minmax(210px, 1fr) 116px 128px;
  }

  .toolbar-section--actions {
    grid-template-columns: max-content repeat(4, minmax(94px, 1fr)) minmax(232px, 1.35fr);
    column-gap: 9px;
  }

  .toolbar-section--actions button {
    padding-inline: 10px;
  }

  .action-button {
    gap: 7px;
  }

  .button-icon {
    width: 16px;
    height: 16px;
  }
}

@media (min-width: 1181px) and (max-width: 1279px) {
  .document-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 9px;
  }

  .toolbar-section--context {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: minmax(210px, 1fr) 116px 128px;
  }

  .toolbar-section--status {
    grid-column: 2;
    grid-row: 1;
  }

  .toolbar-section--actions {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .toolbar-section--control {
    grid-column: 1 / -1;
    grid-row: 3;
    grid-template-columns: max-content minmax(180px, 220px) minmax(180px, 220px);
    align-items: center;
    justify-content: start;
  }

  .toolbar-section--control .toolbar-section__title {
    grid-column: auto;
  }
}

.topline__brand {
  min-width: 0;
}

.topline__account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgba(216, 224, 212, 0.82);
  border-radius: 999px;
  padding: 4px;
  background: rgba(255, 254, 248, 0.76);
  box-shadow: 0 12px 30px rgba(31, 45, 31, 0.08);
}

.topline__account.hidden {
  display: none !important;
}

.topline .workspace-overview {
  position: static;
  inset: auto;
  z-index: auto;
  display: block;
  width: auto;
  max-width: none;
}

.topline .user-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  padding: 0 8px 0 10px;
  background: transparent;
  box-shadow: none;
}

.topline .user-card__caption {
  display: none;
}

.topline .user-card strong {
  max-width: 250px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.1;
}

.topline .user-card .pill {
  display: inline-flex;
  flex: 0 0 auto;
  max-width: 175px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topline__actions {
  flex-wrap: nowrap;
  gap: 6px;
}

.topline__actions .ghost-link,
.topline__actions .ghost-button {
  min-height: 34px;
  padding: 7px 13px;
  background: #fffef9;
  box-shadow: none;
}

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

.document-meta-group--document-actions {
  gap: 8px;
}

.document-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.document-action-buttons .action-button {
  position: relative;
  width: 38px;
  min-width: 38px;
  min-height: 34px;
  padding: 0;
  border-radius: 12px;
}

.document-action-buttons .button-icon {
  width: 17px;
  height: 17px;
}

.document-action-buttons .action-button--excel {
  color: #176b46;
}

.button-icon--excel .icon-accent {
  fill: currentColor;
  opacity: 0.14;
  stroke: none;
}

@media (min-width: 1181px) {
  .topline {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) auto;
    align-items: center;
    gap: 16px;
  }

  .topline > .topline__brand {
    display: flex;
    align-items: baseline;
    gap: 14px;
  }

  .toolbar-section--actions {
    grid-template-columns: max-content minmax(240px, 320px);
    justify-content: end;
    align-items: center;
  }

  .toolbar-section--actions .toolbar-section__title {
    grid-column: auto;
  }

  .toolbar-section--actions #sendToSupplierButton,
  .toolbar-section--actions #handoffButton {
    grid-column: 2;
    width: 100%;
    justify-self: stretch;
  }

  .document-head__meta {
    align-items: center;
  }

  .document-meta-group--document-actions {
    order: 2;
  }
}

@media (min-width: 1181px) and (max-width: 1366px) {
  .topline {
    grid-template-columns: minmax(330px, 1fr) minmax(0, auto);
    gap: 12px;
  }

  .topline .user-card strong {
    max-width: 200px;
  }

  .topline .user-card .pill {
    max-width: 145px;
  }

  .toolbar-section--actions {
    grid-template-columns: max-content minmax(232px, 320px);
  }
}

@media (max-width: 1180px) {
  .topline {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
  }

  .topline__account {
    width: 100%;
    border-radius: 18px;
    justify-content: space-between;
  }

  .topline .user-card strong {
    max-width: min(280px, 38vw);
  }

  .toolbar-section--actions {
    grid-template-columns: max-content minmax(220px, 1fr);
    align-items: center;
  }

  .toolbar-section--actions .toolbar-section__title {
    grid-column: auto;
  }

  .toolbar-section--actions #sendToSupplierButton,
  .toolbar-section--actions #handoffButton {
    grid-column: 2;
    width: 100%;
  }
}

@media (min-width: 1280px) {
  .document-toolbar {
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }

  .toolbar-section--context {
    grid-row: 1 / 3;
  }

  .toolbar-section--status {
    grid-row: 1 / 3;
  }

  .toolbar-section--control {
    grid-column: 3;
    grid-row: 1;
  }

  .toolbar-section--actions {
    grid-column: 3;
    grid-row: 2;
    grid-template-columns: 1fr;
    align-content: stretch;
    justify-content: stretch;
    padding: 12px;
  }

  .toolbar-section--actions .toolbar-section__title {
    grid-column: 1;
  }

  .toolbar-section--actions #sendToSupplierButton,
  .toolbar-section--actions #handoffButton {
    grid-column: 1;
    align-self: end;
    width: 100%;
  }
}

@media (min-width: 1181px) and (max-width: 1279px) {
  .toolbar-section--actions {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: max-content minmax(220px, 1fr);
  }

  .toolbar-section--control {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-section--control .toolbar-section__title {
    grid-column: 1 / -1;
  }
}

.status-card__actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.status-card__actions #sendToSupplierButton,
.status-card__actions #handoffButton {
  width: min(320px, 100%);
  min-height: 40px;
  border-color: #df872a;
  background: linear-gradient(135deg, #ffb35d, #f18a33);
  color: #3b2105;
  box-shadow: 0 10px 24px rgba(241, 145, 53, 0.2);
}

@media (min-width: 1280px) {
  .document-toolbar {
    grid-template-rows: auto;
  }

  .toolbar-section--context,
  .toolbar-section--status,
  .toolbar-section--control {
    grid-row: 1;
  }

  .toolbar-section--status .document-status-card {
    align-content: center;
  }
}

@media (min-width: 1181px) and (max-width: 1279px) {
  .document-toolbar {
    grid-template-rows: auto auto;
  }

  .toolbar-section--context {
    grid-column: 1;
    grid-row: 1;
  }

  .toolbar-section--status {
    grid-column: 2;
    grid-row: 1;
  }

  .toolbar-section--control {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 1180px) {
  .status-card__actions {
    flex-wrap: wrap;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .document-head__meta {
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .document-head__meta .document-meta-group {
    flex: 0 1 auto;
    max-width: 100%;
    overflow: hidden;
  }

  .document-head__meta .document-meta-group:nth-child(2) {
    min-width: 278px;
    flex-wrap: wrap;
  }

  .document-head__meta .unsaved-badge,
  .document-head__meta .sync-badge {
    width: auto;
    max-width: 100%;
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (min-width: 761px) and (max-width: 899px) {
  .document-toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar-section--context,
  .toolbar-section--status,
  .toolbar-section--control {
    grid-column: 1;
    grid-row: auto;
  }

  .toolbar-section--control,
  .admin-status-override {
    grid-template-columns: 1fr;
  }

  .toolbar-section--control #openSummaryButton,
  .toolbar-section--control .admin-status-override {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .topline__account {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    border-radius: 18px;
    padding: 8px;
  }

  .topline .workspace-overview,
  .topline .user-card {
    width: 100%;
    min-width: 0;
  }

  .topline .user-card {
    justify-content: flex-start;
    border: 1px solid rgba(216, 224, 212, 0.82);
    border-radius: 14px;
    padding: 8px 10px;
    background: #fffef9;
  }

  .topline .user-card strong {
    min-width: 0;
    max-width: none;
    flex: 1 1 auto;
  }

  .topline .user-card .pill {
    max-width: 150px;
  }

  .topline__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .topline__actions .ghost-link,
  .topline__actions .ghost-button {
    width: 100%;
    min-width: 0;
  }
}
