* {
  box-sizing: border-box;
}

:root {
  --bg: #f3f6fb;
  --border: #d8e2f0;
  --border-strong: #b8c8dd;
  --blue: #2f6fed;
  --green: #14844c;
  --red: #d93c3c;
  --text: #172033;
  --muted: #68758a;
  --panel: #ffffff;
  --head: #edf3fb;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.35 "PT Sans", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login__box {
  width: min(380px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(35, 54, 84, .12);
}

.login__box h1 {
  margin: 14px 0 22px;
  font-size: 24px;
  line-height: 1.15;
}

.login__box label,
.toolbar label {
  display: grid;
  gap: 6px;
  color: #52617a;
  font-weight: 600;
}

.login__box input,
.toolbar input,
.toolbar select,
.cell-input,
.cell-textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.login__box input {
  height: 42px;
  padding: 0 12px;
  font-size: 16px;
}

.login__box button {
  width: 100%;
  height: 42px;
  margin-top: 18px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--red);
}

.mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid #2e3440;
  border-radius: 12px;
  background: linear-gradient(135deg, #242424, #000 62%, #151515);
  color: #fff;
  font-size: 23px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

.mark--small {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  font-size: 18px;
}

.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(6px);
}

.topbar__title,
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--muted);
}

.user {
  color: var(--muted);
  white-space: nowrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  color: #17428f;
  font-weight: 700;
}

.button--primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.button--ghost:hover,
.tab:hover {
  background: #f8fbff;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1.6fr) repeat(5, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: #f9fbff;
}

.toolbar__search {
  min-width: 320px;
}

.toolbar input,
.toolbar select {
  height: 38px;
  padding: 0 10px;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 12px 18px 0;
}

.tab {
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #fff;
  color: #42506a;
  font-weight: 700;
}

.tab.is-active {
  color: #0d1b35;
  background: var(--panel);
}

.panel {
  display: none;
  padding: 0 18px 18px;
}

.panel.is-active {
  display: block;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 12px 0;
}

.panel__head span {
  margin-left: 12px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - 250px);
  border: 1px solid var(--border);
  background: var(--panel);
}

.orders-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.orders-table th,
.orders-table td {
  border-bottom: 1px solid #e4ebf4;
  border-right: 1px solid #eef2f7;
  padding: 5px 6px;
  vertical-align: top;
  word-break: break-word;
}

.orders-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--head);
  color: #44526a;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  text-transform: none;
  white-space: nowrap;
}

.orders-table tr.is-sent {
  background: #f4fbf7;
}

.orders-table tr.is-ready {
  background: #fbfff5;
}

.orders-table tr:hover {
  background: #f8fbff;
}

.deal-link {
  color: #0b63ce;
  font-weight: 700;
  text-decoration: none;
}

.deal-link:hover {
  text-decoration: underline;
}

.col-select {
  width: 34px;
  text-align: center !important;
}

.orders-table th:nth-child(2),
.orders-table td:nth-child(2) {
  width: 74px;
}

.orders-table th:nth-child(3),
.orders-table td:nth-child(3) {
  width: 86px;
}

.orders-table th:nth-child(4),
.orders-table td:nth-child(4) {
  width: 108px;
  font-size: 13px;
  line-height: 1.2;
}

.col-order,
.orders-table td:nth-child(5) {
  width: 34%;
}

.orders-table th:nth-child(6),
.orders-table td:nth-child(6) {
  width: 84px;
}

.orders-table th:nth-child(7),
.orders-table td:nth-child(7) {
  width: 82px;
  text-align: right;
}

.orders-table th:nth-child(8),
.orders-table td:nth-child(8) {
  width: 118px;
}

.orders-table th:nth-child(9),
.orders-table td:nth-child(9) {
  width: 74px;
}

.orders-table th:nth-child(10),
.orders-table td:nth-child(10) {
  width: 186px;
}

.orders-table th:nth-child(11),
.orders-table td:nth-child(11) {
  width: 44px;
  text-align: center;
}

.orders-table th:nth-child(12),
.orders-table td:nth-child(12) {
  width: 106px;
}

.orders-table--history {
  min-width: 0;
}

.cell-input,
.cell-textarea {
  padding: 5px 6px;
  line-height: 1.25;
}

.cell-input {
  height: 30px;
}

.cell-input[type="number"] {
  text-align: right;
}

.cell-textarea {
  display: block;
  min-height: 92px;
  resize: vertical;
  white-space: pre-wrap;
}

.cell-input--batch {
  height: 28px;
}

.dimensions {
  display: grid;
  grid-template-columns: repeat(3, minmax(48px, 1fr));
  gap: 6px;
}

.dimensions .cell-input {
  padding: 5px 4px;
  text-align: center;
}

.order-items {
  display: grid;
  gap: 5px;
  max-height: 166px;
  overflow-y: auto;
  padding-right: 2px;
}

.order-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 6px;
  align-items: start;
  padding-bottom: 5px;
  border-bottom: 1px solid #eef2f7;
}

.order-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.order-item__name {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.order-item__meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.order-item__batch label {
  display: grid;
  gap: 2px;
  color: #53627a;
  font-size: 11px;
  font-weight: 700;
}

.batch-skip {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f8;
  color: #42506a;
  font-weight: 700;
}

.status--icon {
  justify-content: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.status--ready {
  background: #e6f7ee;
  color: var(--green);
}

.status--sent {
  background: #e8f0ff;
  color: #2453aa;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 14px 36px rgba(26, 39, 66, .16);
}

@media (max-width: 1100px) {
  .topbar,
  .topbar__actions,
  .topbar__title {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .toolbar__search {
    grid-column: 1 / -1;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

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

  .panel__head {
    align-items: flex-start;
    flex-direction: column;
  }
}
