:root {
  --ink: #151719;
  --muted: #5c6469;
  --line: #aeb7bc;
  --line-dark: #42494e;
  --surface: #f4f6f6;
  --surface-2: #e5e9eb;
  --surface-3: #d2d8db;
  --page: #cfd5d8;
  --panel: #20262a;
  --panel-2: #111416;
  --panel-3: #30383d;
  --accent: #f1b52b;
  --accent-2: #c98d00;
  --green: #147a4f;
  --green-dark: #0f4d34;
  --red: #b72e27;
  --red-dark: #7e1d19;
  --blue: #1d6685;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
p {
  margin: 0;
}

.hidden {
  display: none;
}

.notice {
  padding: 12px 14px;
  border: 1px solid var(--red-dark);
  border-radius: 2px;
  font-size: 15px;
  font-weight: 700;
}

.notice.error {
  background: #f3d5d2;
  color: var(--red-dark);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--page);
}

.login-shell {
  width: min(100%, 1080px);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(250px, 0.82fr) minmax(320px, 1.18fr);
  overflow: hidden;
  border: 2px solid var(--panel-2);
  border-radius: 2px;
  background: var(--surface);
}

.brand-row {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 28px;
  background: var(--panel);
  color: #fff;
  border-right: 6px solid var(--accent);
}

.mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2px solid var(--accent);
  border-radius: 2px;
  background: var(--panel-2);
  color: var(--accent);
  font-size: 28px;
  font-weight: 900;
}

.brand-row h1 {
  margin-top: 26px;
  font-size: 38px;
  line-height: 1.08;
  font-weight: 900;
}

.brand-row p {
  display: inline-flex;
  width: fit-content;
  margin-top: 14px;
  padding: 8px 12px;
  border: 1px solid #667176;
  border-left: 5px solid var(--accent);
  border-radius: 2px;
  background: var(--panel-3);
  color: #f4f6f6;
  font-size: 20px;
  font-weight: 900;
}

.login-form {
  display: grid;
  gap: 16px;
  padding: 28px;
  background: var(--surface);
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 900;
}

.field select,
.field input {
  width: 100%;
  min-height: 68px;
  border: 2px solid var(--line);
  border-radius: 2px;
  padding: 0 15px;
  background: #fff;
  color: var(--ink);
  outline: none;
  font-weight: 800;
  font-size: 22px;
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--panel) 50%),
    linear-gradient(135deg, var(--panel) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field input {
  text-align: center;
  font-size: 34px;
  letter-spacing: 0;
}

.field select:focus,
.field input:focus {
  border-color: var(--accent-2);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 2px solid var(--line);
  background: var(--surface-2);
}

.keypad button,
.primary-action {
  min-height: 70px;
  border-radius: 2px;
  cursor: pointer;
  font-weight: 900;
}

.keypad button {
  border: 1px solid var(--line-dark);
  background: #fff;
  color: var(--ink);
  font-size: 30px;
}

.keypad button:hover {
  background: var(--surface-2);
}

.keypad button:active,
.primary-action:active {
  transform: translateY(1px);
}

.primary-action {
  width: 100%;
  border: 2px solid #4d3700;
  background: var(--accent);
  color: #201600;
  font-size: 22px;
}

.primary-action:hover {
  background: #dda31e;
}

.primary-action:disabled {
  opacity: 0.62;
  cursor: wait;
}

.tablo-page {
  height: 100vh;
  overflow: hidden;
  background: var(--page);
  color: var(--ink);
}

.tablo {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

.tablo-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 2px solid var(--panel-2);
  border-left: 8px solid var(--accent);
  border-radius: 2px;
  padding: 10px 12px 10px 18px;
  background: var(--panel);
  color: #fff;
}

.tablo-title {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex: 1 1 auto;
}

.tablo-title span {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 34px;
  font-weight: 900;
}

.tablo-title strong {
  min-width: 0;
  color: #fff;
  font-size: 29px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tablo-search {
  display: grid;
  gap: 5px;
  border: 2px solid var(--line-dark);
  border-top: 7px solid var(--accent);
  border-radius: 2px;
  background: var(--panel);
  padding: 10px;
}

.tablo-search label {
  color: #d6dde0;
  font-size: 13px;
  font-weight: 900;
}

.tablo-search-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  border: 1px solid var(--line-dark);
  background: var(--panel-2);
}

.tablo-search input {
  min-width: 0;
  min-height: 58px;
  border: 0;
  border-right: 1px solid #737d82;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font-size: 28px;
  font-weight: 900;
  outline: none;
  letter-spacing: 0;
}

.tablo-search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.search-clear {
  min-height: 58px;
  border: 0;
  background: var(--panel-3);
  color: #fff;
  font-size: 30px;
  font-weight: 900;
  cursor: pointer;
}

.search-clear:hover {
  color: var(--accent);
}

.search-keypad {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 2px solid var(--panel-2);
  background: var(--panel);
}

.search-keypad button {
  min-height: 58px;
  border: 1px solid #737d82;
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  font-size: 26px;
  font-weight: 900;
  cursor: pointer;
}

.search-keypad button:hover {
  background: var(--surface-2);
}

.search-keypad [data-search-clear-all] {
  font-size: 16px;
}

.tablo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.tablo-actions a {
  min-height: 58px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #737d82;
  border-radius: 2px;
  background: var(--panel-3);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  padding: 0 14px;
}

.tablo-actions a:first-child {
  width: 58px;
  padding: 0;
  font-size: 29px;
}

.tablo-actions a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tablo-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 12px;
}

.tablo-left {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.counter-block {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 2px solid var(--line-dark);
  border-radius: 2px;
  background: var(--surface);
}

.counter-block.ok {
  border-top: 7px solid var(--green);
}

.counter-block.danger {
  border-top: 7px solid var(--red);
}

.counter-title {
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 10px;
  border-bottom: 2px solid var(--line-dark);
  background: var(--panel-3);
  color: #fff;
  text-align: center;
  font-size: 19px;
  font-weight: 900;
}

.counter-value {
  min-height: 0;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 132px;
  line-height: 1;
  font-weight: 900;
}

.counter-block.ok .counter-value {
  color: var(--green-dark);
}

.counter-block.danger .counter-value {
  color: var(--red-dark);
}

.counter-foot {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-top: 2px solid var(--line-dark);
  background: #f0d6d4;
  color: var(--red-dark);
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  white-space: nowrap;
}

.counter-block.ok .counter-foot {
  background: #cfe3d9;
  color: var(--green-dark);
}

.tablo-table {
  min-height: 0;
  overflow-y: auto;
  border: 2px solid var(--line-dark);
  border-radius: 2px;
  background: var(--surface);
  scrollbar-color: var(--line-dark) var(--surface-2);
  scrollbar-width: auto;
}

.tablo-table-head,
.tablo-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.58fr) minmax(128px, 0.68fr) minmax(230px, 1.58fr) minmax(150px, 0.62fr);
}

.tablo-table-head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 54px;
  align-items: center;
  border-bottom: 2px solid var(--line-dark);
  background: var(--panel);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

.tablo-table-head span {
  padding: 0 14px;
  text-align: center;
}

.tablo-row {
  min-height: 84px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.tablo-row.is-hidden {
  display: none;
}

.tablo-row:nth-child(odd) {
  background: var(--surface);
}

.tablo-row:hover {
  background: #edf1f2;
}

.tablo-number,
.tablo-date,
.tablo-product,
.tablo-ready {
  min-width: 0;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  padding: 8px;
  text-align: center;
  font-size: 30px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.tablo-number {
  color: var(--panel-2);
}

.tablo-date {
  color: var(--blue);
  font-size: 28px;
}

.tablo-product {
  place-items: center start;
  color: var(--ink);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.16;
  text-align: left;
}

.tablo-ready {
  border-right: 0;
}

.ready-button {
  width: min(100%, 158px);
  min-height: 62px;
  border: 2px solid var(--green-dark);
  border-radius: 2px;
  background: var(--green);
  color: #fff;
  padding: 0 12px;
  font-size: 27px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.ready-button:hover {
  background: var(--green-dark);
}

.ready-button:active {
  transform: translateY(1px);
}

.ready-button.is-busy {
  opacity: 0.62;
  cursor: wait;
}

.tablo-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--muted);
  font-size: 28px;
  font-weight: 900;
  text-align: center;
}

.master-page {
  min-height: 100vh;
  background: var(--page);
}

.master-app {
  width: min(100%, 760px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  background: var(--surface-2);
}

.master-header {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 12px 12px;
  border-bottom: 3px solid var(--accent);
  background: var(--panel);
  color: #fff;
}

.master-title {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.master-title span {
  color: var(--accent);
  font-size: 20px;
  font-weight: 900;
}

.master-title strong {
  min-width: 0;
  font-size: 17px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.master-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.master-actions a {
  min-height: 46px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #737d82;
  background: var(--panel-3);
  color: #fff;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 900;
}

.master-actions a:first-child {
  width: 46px;
  padding: 0;
  font-size: 24px;
}

.master-filter {
  position: sticky;
  top: 74px;
  z-index: 2;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  scrollbar-width: none;
}

.master-filter::-webkit-scrollbar {
  display: none;
}

.master-filter a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  border: 1px solid var(--line-dark);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 900;
}

.master-filter a.is-active {
  border-color: var(--accent-2);
  background: var(--accent);
}

.master-filter span {
  min-width: 26px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  background: var(--panel);
  color: #fff;
  padding: 0 6px;
  font-size: 13px;
}

.master-notice {
  margin: 10px 10px 0;
  border: 1px solid var(--red-dark);
  background: #f0d6d4;
  color: var(--red-dark);
  padding: 10px;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.master-notice.is-visible {
  border-color: var(--line-dark);
  background: #fff;
  color: var(--ink);
}

.master-list {
  display: grid;
  gap: 10px;
  padding: 10px 10px calc(14px + env(safe-area-inset-bottom));
}

.master-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line-dark);
  background: #fff;
  color: var(--muted);
  padding: 18px;
  font-size: 19px;
  font-weight: 900;
  text-align: center;
}

.master-card {
  display: grid;
  gap: 10px;
  border: 2px solid var(--line-dark);
  border-top: 6px solid var(--accent);
  background: #fff;
  padding: 12px;
}

.master-card.is-busy {
  opacity: 0.68;
}

.master-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.master-card-top > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.master-stage {
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.master-card strong {
  color: var(--panel-2);
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
}

.master-card time {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--blue);
  padding: 0 8px;
  font-size: 17px;
  font-weight: 900;
  white-space: nowrap;
}

.master-product {
  color: var(--ink);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.22;
}

.master-worker {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.master-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.master-card-actions button {
  min-height: 54px;
  border: 2px solid;
  border-radius: 2px;
  color: #fff;
  padding: 0 10px;
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
}

.master-rework {
  border-color: var(--red-dark);
  background: var(--red);
}

.master-accept {
  border-color: var(--green-dark);
  background: var(--green);
}

.master-card-actions button:disabled {
  cursor: wait;
}

@media (max-width: 920px) {
  .login-panel {
    grid-template-columns: 1fr;
  }

  .brand-row {
    min-height: auto;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 22px;
    border-right: 0;
    border-bottom: 6px solid var(--accent);
  }

  .brand-row h1 {
    margin-top: 0;
    font-size: 28px;
  }

  .brand-row p {
    margin-top: 8px;
  }

  .field span {
    font-size: 16px;
  }

  .field select,
  .field input {
    min-height: 66px;
    font-size: 21px;
  }

  .field input {
    font-size: 33px;
  }

  .keypad button,
  .primary-action {
    min-height: 68px;
  }

  .keypad button {
    font-size: 29px;
  }

  .primary-action {
    font-size: 21px;
  }

  .tablo-title {
    display: grid;
    gap: 2px;
  }

  .tablo-header {
    flex-wrap: wrap;
  }

  .tablo-title span {
    font-size: 30px;
  }

  .tablo-title strong {
    font-size: 26px;
  }

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

  .tablo-left {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .tablo-left .tablo-search {
    grid-column: 1 / -1;
  }

  .counter-value {
    min-height: 142px;
    font-size: 88px;
  }

  .counter-title {
    min-height: 58px;
    font-size: 17px;
  }

  .counter-foot {
    min-height: 54px;
    font-size: 18px;
  }

  .tablo-table-head {
    min-height: 52px;
    font-size: 16px;
  }

  .tablo-row {
    min-height: 82px;
  }

  .tablo-table-head,
  .tablo-row {
    grid-template-columns: minmax(88px, 0.62fr) minmax(120px, 0.74fr) minmax(230px, 1.58fr) minmax(145px, 0.68fr);
  }

  .tablo-number,
  .tablo-date,
  .tablo-product,
  .tablo-ready {
    font-size: 27px;
  }

  .tablo-date {
    font-size: 25px;
  }

  .tablo-product {
    font-size: 19px;
  }

  .ready-button {
    width: min(100%, 150px);
    min-height: 60px;
    font-size: 25px;
  }
}

@media (max-width: 620px) {
  .login-page {
    padding: 12px;
  }

  .login-form {
    padding: 18px;
  }

  .brand-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .brand-row h1 {
    font-size: 25px;
  }

  .field select,
  .field input,
  .keypad button,
  .primary-action {
    min-height: 54px;
  }

  .field select {
    font-size: 18px;
  }

  .field input {
    font-size: 28px;
  }

  .keypad button {
    font-size: 24px;
  }

  .primary-action {
    font-size: 18px;
  }

  .tablo-page {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .tablo {
    height: auto;
    min-height: 100vh;
    padding: 8px;
    gap: 8px;
  }

  .tablo-header {
    min-height: auto;
    align-items: flex-start;
    padding: 12px;
  }

  .tablo-title span {
    font-size: 22px;
  }

  .tablo-title strong {
    font-size: 20px;
  }

  .tablo-actions {
    flex-direction: column;
  }

  .tablo-left {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .tablo-left .tablo-search {
    grid-column: auto;
  }

  .tablo-search input {
    min-height: 52px;
    font-size: 24px;
  }

  .tablo-search-control {
    grid-template-columns: minmax(0, 1fr) 52px;
  }

  .search-clear {
    min-height: 52px;
    font-size: 26px;
  }

  .search-keypad button {
    min-height: 50px;
    font-size: 22px;
  }

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

  .tablo-left {
    gap: 8px;
  }

  .counter-title {
    min-height: 44px;
    font-size: 13px;
  }

  .counter-value {
    min-height: 96px;
    font-size: 52px;
  }

  .counter-foot {
    min-height: 42px;
    font-size: 14px;
  }

  .tablo-table {
    overflow: visible;
  }

  .tablo-table-head,
  .tablo-row {
    grid-template-columns: minmax(62px, 0.62fr) minmax(74px, 0.68fr) minmax(126px, 1.22fr) minmax(94px, 0.72fr);
  }

  .tablo-table-head {
    min-height: 38px;
    font-size: 12px;
  }

  .tablo-table-head span {
    padding: 0 6px;
  }

  .tablo-row {
    min-height: 58px;
  }

  .tablo-number,
  .tablo-date,
  .tablo-product,
  .tablo-ready {
    padding: 6px;
    font-size: 15px;
  }

  .tablo-date {
    font-size: 14px;
  }

  .tablo-product {
    font-size: 12px;
    line-height: 1.12;
  }

  .ready-button {
    width: min(100%, 94px);
    min-height: 42px;
    padding: 0 6px;
    font-size: 15px;
  }
}
