:root {
  --bg-dark: #12202c;
  --bg-dark-2: #1d3143;
  --bg-surface: #f4f7f8;
  --line: #223748;
  --text: #f8fbff;
  --text-dark: #173041;
  --muted: #8ca0af;
  --green: #2ecc71;
  --red: #e74c3c;
  --orange: #f39c12;
  --blue: #3498db;
  --yellow: #f1c40f;
  --gray: #7f8c8d;
  --slot: #bdc3c7;
  --slot-border: #7f8c8d;
  --panel: rgba(12, 24, 35, 0.92);
  --shadow: 0 16px 40px rgba(7, 13, 19, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Bahnschrift", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(52, 152, 219, 0.22), transparent 25%),
    linear-gradient(145deg, #0f1b24 0%, #142634 48%, #1b2b37 100%);
}

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.topbar {
  height: 76px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(180deg, rgba(12, 25, 37, 0.96), rgba(18, 32, 44, 0.86));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
}

.header-legend {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 6px 14px;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #3aa86c, #265f45);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.brand h1,
.drawer-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.brand p,
.drawer-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary,
.ghost,
.action {
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
  transition: transform 0.16s ease, opacity 0.16s ease, filter 0.16s ease;
}

.primary:hover,
.ghost:hover,
.action:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.primary:disabled,
.ghost:disabled,
.action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
}

.primary {
  color: white;
  background: linear-gradient(145deg, #2f8cc8, #1b6ea4);
}

.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.user-chip {
  min-width: 170px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.user-chip span {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.app-layout {
  height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px auto;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.workspace-meta {
  display: flex;
  gap: 28px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(6, 15, 23, 0.48);
}

.workspace-meta strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.workspace-meta span {
  font-size: 0.94rem;
}

#viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05)),
    linear-gradient(90deg, rgba(31, 57, 75, 0.42) 1px, transparent 1px),
    linear-gradient(rgba(31, 57, 75, 0.42) 1px, transparent 1px),
    #e6edef;
  background-size: auto, 40px 40px, 40px 40px, auto;
  touch-action: none;
}

.zoom-controls {
  display: none;
}

.view-jump-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 20;
  display: inline-flex;
  gap: 8px;
}

.jump-btn {
  min-width: 86px;
  border: 2px solid rgba(15, 31, 43, 0.55);
  background: rgba(9, 22, 29, 0.84);
  backdrop-filter: blur(6px);
}

.jump-btn--active {
  background: linear-gradient(145deg, #2f8cc8, #1b6ea4);
  color: white;
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 8px 20px rgba(27, 110, 164, 0.3);
}

.zoom-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 900;
  background: rgba(9, 22, 29, 0.84);
  backdrop-filter: blur(6px);
}

#pan-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 4500px;
  height: 1800px;
  transform-origin: 0 0;
}

#world-decor,
#slot-layer,
#unit-layer {
  position: absolute;
  inset: 0;
}

#world-decor {
  pointer-events: none;
}

#slot-layer,
#unit-layer {
  pointer-events: none;
}

.unit-tooltip {
  position: absolute;
  z-index: 140;
  min-width: 180px;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(8, 19, 26, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
  color: var(--text);
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.unit-tooltip strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.86rem;
}

.unit-tooltip span {
  display: block;
  font-size: 0.78rem;
  color: rgba(248, 251, 255, 0.82);
}

.wall,
.building,
.building-label {
  position: absolute;
}

.wall {
  background: #7f8c8d;
  border: 1.5px solid black;
}

.building {
  background: white;
  border: 2px solid black;
}

.building-label {
  color: #34495e;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  text-align: center;
}

.glunz-outline,
.glunz-title,
.street-label {
  position: absolute;
}

.glunz-outline {
  overflow: visible;
  pointer-events: none;
  z-index: 5;
}

.glunz-outline polygon {
  fill: #ecf0f1;
  stroke: black;
  stroke-width: 4;
}

.glunz-title {
  color: rgba(17, 49, 66, 0.92);
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
}

.street-label {
  color: #7f8c8d;
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  transform: rotate(-8deg);
}

.slot,
.unit {
  position: absolute;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

.slot {
  width: 18px;
  height: 70px;
  background: var(--slot);
  border: 1px solid var(--slot-border);
  color: #243949;
  user-select: none;
  pointer-events: auto;
}

.slot--swap {
  width: 35px;
  height: 18px;
}

.slot--gate-swap {
  height: 70px;
}

.slot--gate::after {
  content: attr(data-code);
  position: absolute;
  bottom: -16px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(44, 62, 80, 0.52);
}

.slot--parking {
  background: rgba(189, 195, 199, 0.34);
  border-style: dashed;
}

.slot--glunz {
  background: rgba(189, 195, 199, 0.34);
  border: 1px dashed rgba(127, 140, 141, 0.9);
  color: #243949;
}

.slot--glunz .num-txt {
  margin-top: 6px;
  font-size: 9px;
  color: #243949;
  transform: rotate(180deg);
}

.unit--glunz .num-txt {
  transform: rotate(180deg);
}

.slot--workshop {
  background: rgba(241, 196, 15, 0.28);
  border: 2px solid rgba(196, 139, 11, 0.9);
  box-shadow: 0 0 0 2px rgba(241, 196, 15, 0.28);
}

.slot--workshop::after {
  content: "WS";
  position: absolute;
  bottom: -16px;
  font-size: 10px;
  font-weight: 900;
  color: rgba(143, 98, 11, 0.92);
  letter-spacing: 0.06em;
}

.slot--match {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8);
}

.slot .num-txt,
.unit .num-txt {
  margin-top: 2px;
  width: 100%;
  font-size: 8px;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
}

.unit .num-txt {
  position: absolute;
  inset: 2px 1px auto 1px;
  display: grid;
  place-items: center;
  margin-top: 0;
  line-height: 1;
  letter-spacing: 0.02em;
}

.unit .num-txt--vertical {
  top: 2px;
  bottom: 12px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 9px;
  letter-spacing: -0.08em;
}

.unit .num-txt--horizontal {
  top: 1px;
  left: 2px;
  right: 2px;
  bottom: auto;
  min-height: 16px;
  font-size: 9px;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.unit .slot-info-txt {
  position: absolute;
  left: 50%;
  top: 2px;
  transform: translateX(-50%);
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-size: 6px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.slot .order-txt {
  margin-top: auto;
  margin-bottom: 3px;
  padding: 1px 2px;
  font-size: 8px;
  font-weight: 900;
  text-align: center;
  color: inherit;
}

.slot--parking .num-txt {
  margin-top: 6px;
  font-size: 9px;
}

.unit {
  pointer-events: auto;
  z-index: 20;
  box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.32);
  border: 1px solid #233746;
  color: black;
}

.unit--trailer {
  width: 18px;
  height: 70px;
}

.unit--swap {
  width: 35px;
  height: 18px;
}

.unit--swap-vertical {
  width: 18px;
  height: 35px;
}

.status-leer {
  background: var(--green);
  color: white;
}

.status-voll {
  background: var(--red);
  color: white;
}

.status-werkstatt {
  background: var(--yellow);
  color: black;
}

.unit-ready {
  border: 3px solid white;
  animation: blink-ready 0.9s infinite;
}

.status-leer.unit-ready {
  background: var(--blue);
  color: white;
}

.status-voll.unit-ready {
  background: var(--blue);
  color: white;
}

.status-werkstatt.unit-ready {
  background: var(--blue);
  color: white;
}

.unit-match {
  z-index: 30;
}

.unit-search {
  box-shadow: 0 0 0 4px rgba(241, 196, 15, 0.88), 0 0 24px rgba(241, 196, 15, 0.66);
  z-index: 40;
}

.unit-new {
  background: rgba(46, 204, 113, 0.92);
  color: white;
  box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.9), 0 0 26px rgba(46, 204, 113, 0.72);
  animation: blink-new-unit 1s ease-in-out infinite;
  z-index: 45;
}

.unit-no-magnet {
  border-style: dashed;
}

.unit-dragging {
  z-index: 80;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.28);
}

.info-txt {
  margin-top: auto;
  position: relative;
  z-index: 1;
  margin-bottom: 2px;
  width: 90%;
  font-size: 6px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 0.5px solid rgba(0, 0, 0, 0.12);
  padding-top: 2px;
  pointer-events: none;
}

.sidebar {
  background: rgba(13, 25, 36, 0.96);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
}

.sidebar-head {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.06);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  font-weight: 800;
}

.sidebar-head--success {
  background: rgba(46, 204, 113, 0.18);
}

.search-box {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: rgba(248, 251, 255, 0.92);
  white-space: nowrap;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  flex: 0 0 14px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.legend-dot--leer { background: var(--green); }
.legend-dot--voll { background: var(--red); }
.legend-dot--werkstatt { background: var(--yellow); }
.legend-dot--bereit { background: var(--blue); }
.legend-dot--neu { background: rgba(46, 204, 113, 0.92); box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.32); }
.legend-dot--order { background: #2d9cdb; }

.search-box input,
.modal-card input,
.grid-form input,
.grid-form select,
.inline-form input {
  width: 100%;
  border: 1px solid rgba(15, 34, 49, 0.18);
  border-radius: 10px;
  padding: 12px 14px;
  background: white;
  color: #223748;
}

.search-results,
.monitor-list {
  overflow-y: auto;
}

.search-results {
  max-height: 140px;
  margin-top: 8px;
}

.search-item,
.monitor-item,
.admin-user-card,
.audit-item {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px;
}

.search-item {
  margin-bottom: 8px;
  cursor: pointer;
  color: #ffe789;
  font-size: 0.85rem;
  font-weight: 700;
}

.monitor-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.monitor-item {
  position: relative;
  border-left: 4px solid var(--orange);
  cursor: pointer;
  font-size: 0.88rem;
  line-height: 1.4;
}

.monitor-item small {
  display: block;
  margin-top: 4px;
  color: #b7c6d1;
}

.monitor-item.done {
  opacity: 0.7;
  border-left-color: var(--green);
}

.badge {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--red);
  text-align: center;
  font-size: 0.7rem;
  font-weight: 900;
}

.badge-blue {
  background: var(--blue);
}

.side-drawer,
.admin-drawer {
  overflow-y: auto;
  background: rgba(8, 17, 25, 0.98);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.24);
}

.admin-drawer {
  width: 420px;
}

.audit-drawer {
  width: 360px;
}

.drawer-head,
.admin-section {
  padding: 18px;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-section h3 {
  margin-top: 0;
}

.grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.grid-form label,
.admin-user-card label {
  display: block;
  font-size: 0.82rem;
  color: #c0ccd6;
}

.admin-list,
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-user-card {
  display: grid;
  gap: 10px;
}

.admin-list--fixed-trailers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-user-card--compact {
  gap: 8px;
  padding: 12px;
}

.admin-user-head--compact,
.admin-user-meta--compact {
  align-items: flex-start;
}

.admin-role-chip--compact {
  padding: 4px 8px;
  font-size: 0.66rem;
}

.admin-compact-label {
  font-size: 0.76rem;
}

.admin-user-actions--compact {
  gap: 8px;
}

.admin-user-actions--compact button {
  flex: 1 1 auto;
  min-width: 0;
  padding-inline: 10px;
}

.admin-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-user-head span {
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-user-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.audit-item {
  font-size: 0.85rem;
  line-height: 1.45;
}

.audit-item code {
  display: inline-block;
  margin-top: 4px;
  color: #b9d8ea;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 9, 14, 0.84);
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  width: min(420px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 20px;
  background: #f7fafc;
  color: var(--text-dark);
  box-shadow: var(--shadow);
}

.modal-section {
  padding: 24px;
}

.modal-card h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.modal-subtitle {
  color: #6c8191;
  margin: 0 0 14px;
}

.modal-card input {
  margin-bottom: 10px;
}

.unit-edit-fields {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.unit-edit-fields input {
  margin-bottom: 0;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.unit-edit-grid {
  margin-bottom: 12px;
}

#unit-menu .action {
  min-height: 48px;
}

#unit-menu .wide {
  min-height: 50px;
}

#unit-menu .button-grid:last-child {
  margin-bottom: 0;
}

.wide {
  grid-column: 1 / -1;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}

.inventory-sections {
  margin: 16px 0;
  display: grid;
  gap: 12px;
}

.inventory-group h4 {
  margin: 0 0 6px;
  font-size: 0.88rem;
}

.inventory-grid,
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.inventory-chip,
.catalog-chip {
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  font-weight: 800;
  font-size: 0.82rem;
  background: #edf2f5;
  border: 1px solid #ced7dd;
  color: #244257;
  cursor: pointer;
}

.catalog-chip.disabled {
  opacity: 0.35;
  cursor: default;
}

.inventory-chip.disabled {
  opacity: 0.45;
  cursor: default;
}

.prefix-button.is-active {
  background: var(--blue);
  border-color: rgba(45, 156, 219, 0.55);
  color: white;
  box-shadow: 0 10px 22px rgba(45, 156, 219, 0.24);
}

.btn-green { background: var(--green); color: white; }
.btn-red { background: var(--red); color: white; }
.btn-orange { background: var(--orange); color: white; }
.btn-blue { background: var(--blue); color: white; }
.btn-yellow { background: var(--yellow); color: black; }
.btn-gray { background: var(--gray); color: white; }
.btn-dark { background: #253948; color: white; }

#toast {
  position: fixed;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  max-width: min(80vw, 640px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(231, 76, 60, 0.96);
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1200;
}

#toast.visible {
  opacity: 1;
}

.login-shell {
  overflow: auto;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
  border-radius: 24px;
  background: rgba(9, 18, 27, 0.88);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand--login {
  margin-bottom: 24px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
}

.login-error {
  color: #ffb9ae;
  margin: 0;
}

.login-note {
  color: #afc0ca;
  font-size: 0.86rem;
  line-height: 1.5;
  margin-top: 18px;
}

@keyframes blink-ready {
  50% { opacity: 0.64; }
}

@keyframes blink-new-unit {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.9), 0 0 26px rgba(46, 204, 113, 0.72);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(46, 204, 113, 0.98), 0 0 36px rgba(46, 204, 113, 0.86);
    filter: brightness(1.18);
  }
}

@keyframes jobs-pill-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(39, 135, 200, 0.18), 0 4px 14px rgba(39, 135, 200, 0.24);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(39, 135, 200, 0.1), 0 7px 18px rgba(39, 135, 200, 0.32);
    transform: scale(1.04);
  }
}

@media (max-width: 1280px) {
  .app-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .admin-drawer {
    position: fixed;
    top: 76px;
    right: 0;
    bottom: 0;
    z-index: 950;
  }
}

@media (max-width: 960px) {
  .topbar {
    height: auto;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .app-layout {
    height: calc(100vh - 124px);
    grid-template-columns: 1fr;
  }

  .sidebar,
  .admin-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 42vh;
    z-index: 920;
  }

  .admin-drawer {
    top: 124px;
    width: auto;
    max-height: calc(100vh - 124px);
  }

  .admin-page-layout {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 12px;
  }
}


/* Codex UI refresh */
:root {
  --bg-dark: #102028;
  --bg-dark-2: #173645;
  --bg-surface: #f3efe6;
  --text-dark: #18333f;
  --muted: #8ea6b3;
  --panel: rgba(9, 22, 29, 0.95);
  --shadow: 0 18px 44px rgba(5, 13, 18, 0.28);
}

html,
body {
  background:
    radial-gradient(circle at top left, rgba(215, 134, 45, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(47, 143, 107, 0.18), transparent 22%),
    linear-gradient(145deg, #102028 0%, #173645 48%, #224655 100%);
}

.topbar {
  min-height: 82px;
  background: linear-gradient(180deg, rgba(9, 22, 29, 0.98), rgba(19, 41, 52, 0.88));
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(145deg, #d7862d, #2f8f6b);
}

.primary {
  background: linear-gradient(145deg, #2f8f6b, #1f6d53);
}

#viewport {
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05)),
    linear-gradient(90deg, rgba(31, 57, 75, 0.36) 1px, transparent 1px),
    linear-gradient(rgba(31, 57, 75, 0.36) 1px, transparent 1px),
    linear-gradient(180deg, #eae7dd 0%, #dfe7e8 100%);
}

.building {
  border: 2px solid #1b3d4d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.sidebar {
  background: rgba(9, 22, 29, 0.95);
}

.sidebar-head--success {
  background: rgba(47, 143, 107, 0.24);
}

.admin-drawer {
  width: 430px;
  background: rgba(7, 17, 24, 0.98);
}

.admin-note {
  margin: 0 0 12px;
  color: #b4c5cf;
  font-size: 0.84rem;
  line-height: 1.4;
}

.admin-user-card {
  gap: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.admin-user-head,
.admin-user-meta,
.admin-user-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-user-meta span,
.admin-user-head span {
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-role-chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(215, 134, 45, 0.18);
  color: #ffd89e;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.permission-grid,
.permission-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-option,
.permission-chip {
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #dbe7ec;
  font-size: 0.78rem;
}

.permission-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.permission-option input {
  width: auto;
  margin: 0;
}

.permission-option.is-base {
  opacity: 0.62;
}

.permission-chip {
  background: rgba(47, 143, 107, 0.18);
  color: #bce8d6;
}

.permission-help {
  margin: -2px 0 0;
  color: #9bb1bc;
  font-size: 0.78rem;
}

.login-card {
  width: min(480px, 100%);
  border-radius: 28px;
  background: rgba(8, 19, 26, 0.88);
  backdrop-filter: blur(10px);
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .app-layout {
    height: calc(100vh - 146px);
  }

  .admin-drawer {
    top: 146px;
    max-height: calc(100vh - 146px);
  }

  .admin-list--fixed-trailers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .admin-user-head,
  .admin-user-meta,
  .admin-user-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-menu-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-list--fixed-trailers {
    grid-template-columns: 1fr;
  }
}

.admin-user-actions .action {
  padding-inline: 14px;
}

#btn-left-yard {
  font-weight: 800;
}

.admin-page-shell {
  overflow: auto;
}

.admin-page-layout {
  min-height: calc(100vh - 82px);
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  gap: 18px;
  padding: 18px;
}

.admin-page-layout--single {
  grid-template-columns: minmax(0, 1fr);
}

.admin-page-main,
.admin-page-side {
  min-width: 0;
  display: grid;
  gap: 18px;
  align-content: start;
}

.admin-menu-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-menu-tab {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 17, 25, 0.94);
  color: #dbe7ec;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.admin-menu-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(52, 152, 219, 0.44);
}

.admin-menu-tab.is-active {
  background: rgba(52, 152, 219, 0.22);
  border-color: rgba(52, 152, 219, 0.62);
  color: #ffffff;
}

.admin-page-section,
.admin-section-card,
.admin-teaser-card {
  border-radius: 18px;
  background: rgba(8, 17, 25, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.admin-page-section {
  padding: 18px;
}

.admin-page-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-page-section-head h2 {
  margin: 0;
}

.admin-page-section-head p,
.admin-teaser-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.admin-section-card {
  padding: 16px;
}

.admin-page-section--teaser {
  padding-bottom: 0;
}

.admin-teaser-card {
  padding: 16px;
}



.unit .num-txt--cargo {
  font-size: 7px;
  letter-spacing: 0;
  padding: 1px;
}

.unit .num-txt--horizontal.num-txt--cargo {
  font-size: 7px;
}

.unit .num-txt--vertical.num-txt--cargo {
  font-size: 7px;
  letter-spacing: 0;
}


.sidebar {
  position: relative;
  min-width: 0;
  transition: width 0.18s ease, min-width 0.18s ease, opacity 0.18s ease;
}


.app-layout.sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr) 44px auto;
}

.sidebar.sidebar--collapsed {
  overflow: hidden;
}

.sidebar.sidebar--collapsed .sidebar-head,
.sidebar.sidebar--collapsed .search-box,
.sidebar.sidebar--collapsed .monitor-list {
  opacity: 0;
  pointer-events: none;
}

.sidebar.sidebar--collapsed .sidebar-head,
.sidebar.sidebar--collapsed .search-box,
.sidebar.sidebar--collapsed .monitor-list,
.sidebar.sidebar--collapsed .sidebar-head--success {
  display: none;
}

@media (max-width: 960px) {
  .sidebar.sidebar--collapsed {
    max-height: 52px;
  }
}


.btn-jobs-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: visible;
}

.jobs-badge {
  min-width: 22px;
  min-height: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(135, 205, 255, 0.92);
  background: radial-gradient(circle at 30% 30%, #49a9e8 0%, #2787c8 62%, #1d6ea7 100%);
  color: white;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(39, 135, 200, 0.35);
  animation: jobs-pill-pulse 1.8s ease-in-out infinite;
}

.btn-jobs-toggle.is-collapsed .jobs-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  margin: 0;
}


.mobile-panel-toggle {
  display: none;
}

.topbar-secondary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.mobile-panel {
  position: fixed;
  inset: 82px 12px auto 12px;
  z-index: 980;
}

.mobile-panel-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(8, 19, 26, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.32);
}

.mobile-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mobile-user-chip {
  min-width: 0;
}

.workspace-meta--mobile {
  display: none;
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 970;
    min-height: 106px;
    padding: 10px 10px 12px;
    gap: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .brand {
    min-width: 0;
    gap: 9px;
    grid-column: 1;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    font-size: 0.78rem;
    flex: 0 0 auto;
  }

  .brand h1 {
    font-size: 0.96rem;
    line-height: 1.15;
  }

  .brand p {
    display: none;
  }

  .brand > div:last-child {
    min-width: 0;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    grid-column: 1 / -1;
  }

  .header-legend {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 3px 8px;
    margin: 0;
    justify-content: end;
    align-content: center;
    grid-column: 2;
  }

  .header-legend .legend-item {
    min-width: 0;
    justify-content: flex-start;
    gap: 5px;
    font-size: 0.58rem;
    line-height: 1;
  }

  .header-legend .legend-dot {
    width: 10px;
    height: 10px;
    flex-basis: 10px;
  }

  .topbar-actions > .primary,
  .topbar-actions > .ghost {
    width: 100%;
    min-height: 44px;
    padding: 10px 8px;
    border-radius: 14px;
    font-size: 0.88rem;
  }

  .topbar-secondary {
    display: none;
  }

  .mobile-panel-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .workspace-meta {
    display: none;
  }

  .workspace-meta--mobile {
    display: flex;
    gap: 20px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .app-layout {
    height: calc(100dvh - 106px);
    grid-template-columns: 1fr;
  }

  .app-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 8px;
    gap: 0;
  }

  #viewport {
    border-radius: 18px;
    box-shadow: inset 0 0 0 1px rgba(17, 45, 58, 0.14);
  }

  .zoom-controls {
    display: none;
  }

  .sidebar,
  .admin-drawer,
  .audit-drawer {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 0;
    width: auto;
    max-height: min(76dvh, 700px);
    border-radius: 22px 22px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.28);
    z-index: 930;
  }

  .admin-drawer,
  .audit-drawer {
    top: auto;
    max-height: min(84dvh, 760px);
  }

  .sidebar {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar.sidebar--collapsed {
    max-height: 0;
    min-height: 0;
    padding: 0;
    border-width: 0;
    opacity: 0;
    pointer-events: none;
  }

  .mobile-panel-actions .ghost,
  .mobile-panel-head .ghost {
    width: 100%;
  }

  .jobs-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.68rem;
  }

  .mobile-panel {
    inset: 0;
    display: grid;
    align-items: end;
    padding: 12px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(3, 10, 16, 0.42);
    backdrop-filter: blur(4px);
  }

  .mobile-panel-card {
    gap: 12px;
    padding: 16px;
    border-radius: 22px 22px 16px 16px;
  }

  .mobile-panel-actions {
    grid-template-columns: 1fr;
  }

  .drawer-head,
  .admin-section {
    padding: 16px 14px;
  }

  .drawer-head {
    position: sticky;
    top: 0;
    background: rgba(7, 17, 24, 0.98);
    z-index: 2;
  }

  .sidebar-head {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .search-box {
    padding: 10px 12px;
  }

  .monitor-list {
    padding: 10px 12px 14px;
  }

  .monitor-item {
    font-size: 0.84rem;
  }

  .modal-card {
    width: min(100%, 520px);
    max-height: min(88dvh, 760px);
    border-radius: 22px 22px 16px 16px;
  }

  .modal-section {
    padding: 18px 16px;
  }

  .button-grid {
    grid-template-columns: 1fr;
  }

  #unit-menu .button-grid {
    grid-template-columns: 1fr 1fr;
  }

  #unit-menu .button-grid .wide {
    grid-column: 1 / -1;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .inventory-grid,
  .catalog-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-page-layout {
    padding: 8px;
    gap: 12px;
  }

  .admin-page-section,
  .admin-section-card,
  .admin-teaser-card {
    border-radius: 16px;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  .header-legend {
    grid-template-columns: repeat(3, auto);
    gap: 3px 8px;
  }

  .header-legend .legend-item {
    font-size: 0.56rem;
  }
}



