:root {
  --admin-bg: #f5efe2;
  --admin-ink: #1f2330;
  --admin-muted: #5f6577;
  --admin-panel: rgba(255, 250, 240, 0.84);
  --admin-panel-strong: rgba(255, 248, 234, 0.94);
  --admin-line: rgba(31, 35, 48, 0.12);
  --admin-accent: #cf4f2f;
  --admin-ready: #1c8b5c;
  --admin-danger: #a2422a;
  --admin-shadow: 0 20px 60px rgba(67, 39, 17, 0.12);
  --screen-bg: #121314;
  --screen-ink: #f7f4ee;
  --screen-muted: #a9a29a;
  --screen-panel: rgba(23, 24, 25, 0.94);
  --screen-line: rgba(255, 255, 255, 0.12);
  --cooking: #ffcf33;
  --ready: #2ab979;
  --ready-soft: #69e0a6;
  --danger: #ff4b38;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

body.display-page {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: var(--screen-bg);
}

body.location-picker-page {
  height: auto;
  overflow: auto;
}

.queue-screen,
.screen-shell,
.media-screen,
.media-frame {
  width: 100%;
  height: 100%;
}

.queue-screen {
  position: relative;
  background: var(--screen-bg);
  color: var(--screen-ink);
  font-weight: 700;
  overflow: hidden;
}

.screen-shell {
  position: relative;
  padding: 28px 34px 30px;
  background:
    linear-gradient(135deg, rgba(255, 128, 39, 0.14) 0, rgba(255, 128, 39, 0.14) 18%, transparent 18%, transparent 100%),
    linear-gradient(315deg, rgba(42, 185, 121, 0.16) 0, rgba(42, 185, 121, 0.16) 22%, transparent 22%, transparent 100%),
    var(--screen-bg);
  background-size: cover;
  background-repeat: no-repeat;
}

.screen-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}

.topbar,
.board {
  position: relative;
  z-index: 1;
}

.topbar {
  height: 78px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 0.7fr) minmax(160px, 1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.place-mark {
  min-width: 0;
}

.brand-logo {
  display: block;
  max-width: 220px;
  max-height: 62px;
  object-fit: contain;
}

.service-state {
  justify-self: center;
  max-width: 100%;
  color: #d8d0c5;
  font-size: 18px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.service-state.error {
  color: #ffb3a8;
}

.state-dot,
.state-text {
  display: inline-block;
  vertical-align: middle;
}

.state-dot {
  width: 11px;
  height: 11px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--ready);
  box-shadow: 0 0 0 6px rgba(42, 185, 121, 0.15);
  animation: state-pulse 2s ease-in-out infinite;
}

.service-state.error .state-dot {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(255, 75, 56, 0.16);
}

.clock {
  justify-self: end;
  color: #ffffff;
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
}

.board {
  height: calc(100% - 102px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.lane {
  min-width: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--screen-line);
  border-radius: 8px;
  background: var(--screen-panel);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.28);
}

.lane-cooking {
  border-top: 7px solid var(--cooking);
}

.lane-ready {
  border-top: 7px solid var(--ready);
}

.lane-head {
  height: 116px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 34px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lane-kicker {
  color: var(--screen-muted);
  font-size: 16px;
  line-height: 1;
  text-transform: uppercase;
}

.lane-head h1 {
  margin: 8px 0 0;
  color: #ffffff;
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
}

.lane-cooking .lane-head h1 {
  color: var(--cooking);
}

.lane-ready .lane-head h1 {
  color: var(--ready-soft);
}

.lane-count {
  min-width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  font-size: 24px;
  font-weight: 900;
}

.orders-list {
  height: calc(100% - 116px);
  padding: 24px 28px 28px;
  overflow: hidden;
}

.orders-list.dense {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-left: 18px;
  padding-right: 18px;
}

.orders-column {
  min-width: 0;
}

.order-row {
  width: 100%;
  height: 78px;
  margin-bottom: 13px;
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: #202224;
  animation: row-enter 420ms ease-out both;
}

.orders-list.dense .order-row {
  height: 68px;
  grid-template-columns: 112px minmax(0, 1fr);
  margin-bottom: 11px;
}

.order-number,
.order-name {
  min-width: 0;
  display: flex;
  align-items: center;
}

.order-number {
  justify-content: center;
  color: #141414;
  background: var(--cooking);
  font-family: "Arial Black", Arial, Helvetica, sans-serif;
  font-size: 58px;
  font-weight: 900;
  line-height: 1;
}

.order-row.ready .order-number {
  color: #ffffff;
  background: var(--ready);
}

.orders-list.dense .order-number {
  font-size: 46px;
}

.order-name {
  padding: 0 22px;
  color: var(--screen-ink);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orders-list.dense .order-name {
  padding: 0 16px;
  font-size: 23px;
}

.order-name.empty {
  color: transparent;
}

.empty-state {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #77716b;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
}

.media-screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--screen-bg);
}

.media-image {
  width: 100%;
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.media-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popup-container {
  position: absolute;
  inset: 0;
  z-index: 10;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: rgba(18, 19, 20, 0.76);
  transition: opacity 0.25s linear;
}

.popup-wrapper {
  text-align: center;
}

.popup {
  min-width: 360px;
  padding: 34px 48px 38px;
  border: 7px solid var(--ready);
  border-radius: 8px;
  color: #ffffff;
  background: #202224;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.65);
}

.popup-label {
  color: var(--ready-soft);
  font-size: 34px;
  line-height: 1;
  text-transform: uppercase;
}

.popup-number {
  margin-top: 12px;
  color: #ffffff;
  font-size: 142px;
  font-weight: 900;
  line-height: 0.92;
}

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

@keyframes state-pulse {
  0%,
  100% {
    opacity: 0.75;
  }

  50% {
    opacity: 1;
  }
}

@keyframes row-enter {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1400px), (max-height: 820px) {
  .screen-shell {
    padding: 18px 24px 20px;
  }

  .screen-shell::before {
    background-size: 38px 38px;
  }

  .topbar {
    height: 58px;
    grid-template-columns: minmax(180px, 1fr) minmax(230px, 0.8fr) minmax(120px, 1fr);
    gap: 14px;
    margin-bottom: 14px;
  }

  .brand-logo {
    max-width: 172px;
    max-height: 50px;
  }

  .service-state {
    font-size: 15px;
  }

  .state-dot {
    width: 9px;
    height: 9px;
    margin-right: 7px;
    box-shadow: 0 0 0 5px rgba(42, 185, 121, 0.15);
  }

  .service-state.error .state-dot {
    box-shadow: 0 0 0 5px rgba(255, 75, 56, 0.16);
  }

  .clock {
    font-size: 40px;
  }

  .board {
    height: calc(100% - 72px);
    gap: 14px;
  }

  .lane-cooking,
  .lane-ready {
    border-top-width: 6px;
  }

  .lane-head {
    height: 88px;
    padding: 20px 24px 14px;
  }

  .lane-kicker {
    font-size: 13px;
  }

  .lane-head h1 {
    margin-top: 6px;
    font-size: 36px;
  }

  .lane-count {
    min-width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .orders-list {
    height: calc(100% - 88px);
    padding: 18px 20px 20px;
  }

  .orders-list.dense {
    gap: 10px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .order-row {
    height: 58px;
    grid-template-columns: 112px minmax(0, 1fr);
    margin-bottom: 9px;
  }

  .orders-list.dense .order-row {
    height: 46px;
    grid-template-columns: 84px minmax(0, 1fr);
    margin-bottom: 7px;
  }

  .order-number {
    font-size: 42px;
  }

  .orders-list.dense .order-number {
    font-size: 32px;
  }

  .order-name {
    padding: 0 16px;
    font-size: 24px;
  }

  .orders-list.dense .order-name {
    padding: 0 10px;
    font-size: 17px;
  }

  .empty-state {
    font-size: 22px;
  }

  .popup {
    min-width: 300px;
    padding: 28px 40px 32px;
    border-width: 6px;
  }

  .popup-label {
    font-size: 28px;
  }

  .popup-number {
    font-size: 112px;
  }
}

@media (max-width: 1100px), (max-height: 650px) {
  .screen-shell {
    padding: 12px 14px 14px;
  }

  .screen-shell::before {
    background-size: 32px 32px;
  }

  .topbar {
    height: 48px;
    grid-template-columns: minmax(140px, 1fr) minmax(180px, 0.9fr) minmax(90px, 0.7fr);
    gap: 10px;
    margin-bottom: 10px;
  }

  .brand-logo {
    max-width: 136px;
    max-height: 42px;
  }

  .service-state {
    font-size: 13px;
  }

  .state-dot {
    width: 8px;
    height: 8px;
    margin-right: 6px;
    box-shadow: 0 0 0 4px rgba(42, 185, 121, 0.15);
  }

  .service-state.error .state-dot {
    box-shadow: 0 0 0 4px rgba(255, 75, 56, 0.16);
  }

  .clock {
    font-size: 34px;
  }

  .board {
    height: calc(100% - 58px);
    gap: 10px;
  }

  .lane {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  }

  .lane-cooking,
  .lane-ready {
    border-top-width: 5px;
  }

  .lane-head {
    height: 72px;
    padding: 15px 18px 12px;
  }

  .lane-kicker {
    font-size: 11px;
  }

  .lane-head h1 {
    margin-top: 5px;
    font-size: 30px;
  }

  .lane-count {
    min-width: 32px;
    height: 32px;
    font-size: 17px;
  }

  .orders-list {
    height: calc(100% - 72px);
    padding: 12px 14px 14px;
  }

  .orders-list.dense {
    gap: 7px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .order-row {
    height: 42px;
    grid-template-columns: 92px minmax(0, 1fr);
    margin-bottom: 7px;
  }

  .orders-list.dense .order-row {
    height: 34px;
    grid-template-columns: 68px minmax(0, 1fr);
    margin-bottom: 6px;
  }

  .order-number {
    font-size: 30px;
  }

  .orders-list.dense .order-number {
    font-size: 24px;
  }

  .order-name {
    padding: 0 12px;
    font-size: 20px;
  }

  .orders-list.dense .order-name {
    padding: 0 8px;
    font-size: 15px;
  }

  .empty-state {
    font-size: 19px;
  }

  .popup {
    min-width: 260px;
    padding: 24px 34px 28px;
    border-width: 5px;
  }

  .popup-label {
    font-size: 24px;
  }

  .popup-number {
    font-size: 92px;
  }
}

body.admin-page {
  min-height: 100vh;
  color: var(--admin-ink);
  background:
    radial-gradient(circle at top left, rgba(243, 201, 106, 0.42), transparent 28%),
    radial-gradient(circle at bottom right, rgba(207, 79, 47, 0.24), transparent 30%),
    linear-gradient(135deg, #faf4e8, #efe4cd 52%, #f7f2e8);
}

.admin-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  display: grid;
  gap: 16px;
  padding: 24px 16px;
}

.admin-header,
.admin-grid,
.admin-actions,
.admin-status {
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-panel);
  box-shadow: var(--admin-shadow);
  backdrop-filter: blur(12px);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.admin-header h1 {
  margin: 0;
  line-height: 1;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
}

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

.field-wide {
  grid-column: 1 / -1;
}

.field span {
  color: var(--admin-muted);
  font-size: 14px;
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(31, 35, 48, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 16px;
}

.primary-button,
.secondary-button,
.secondary-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: none;
  border-radius: 8px;
  color: var(--admin-ink);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  color: #ffffff;
  background: var(--admin-accent);
}

.secondary-button,
.secondary-link {
  background: rgba(31, 35, 48, 0.08);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px;
}

.admin-status {
  min-height: 60px;
  padding: 20px;
  color: var(--admin-muted);
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

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

.location-picker {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  color: var(--screen-ink);
  background: var(--screen-bg);
}

.location-picker-shell {
  width: min(760px, 100%);
}

.location-picker-kicker {
  margin: 0 0 12px;
  color: var(--cooking);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
}

.location-picker h1 {
  margin: 0;
  font-size: 64px;
  line-height: 1;
}

.location-picker-status {
  min-height: 24px;
  margin: 18px 0 28px;
  color: var(--screen-muted);
  font-size: 18px;
}

.location-picker-list {
  display: grid;
  gap: 12px;
}

.location-picker-item {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid var(--screen-line);
  border-radius: 8px;
  color: var(--screen-ink);
  background: var(--screen-panel);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.location-picker-item:hover,
.location-picker-item:focus-visible {
  border-color: var(--cooking);
  outline: none;
}

.location-picker-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
}

.location-picker-dot.is-online {
  background: var(--ready);
}

.location-picker-name {
  overflow-wrap: anywhere;
  font-size: 24px;
  font-weight: 800;
}

.location-picker-details {
  color: var(--screen-muted);
  font-size: 15px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .location-picker {
    padding: 20px;
  }

  .location-picker-item {
    grid-template-columns: 14px minmax(0, 1fr);
  }

  .location-picker h1 {
    font-size: 40px;
  }

  .location-picker-details {
    grid-column: 2;
    white-space: normal;
  }
}
