:root {
  --bg: #f6f4ed;
  --ink: #111111;
  --muted: #706f68;
  --line: rgba(17, 17, 17, 0.12);
  --panel: rgba(255, 255, 255, 0.84);
  --green: #21c95c;
  --yellow: #ffc83d;
  --red: #d33532;
  --blue: #16a3ff;
  --orange: #ff7a1a;
  --pink: #ff2e93;
  --violet: #7657ff;
  --shadow: 0 18px 45px rgba(17, 17, 17, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 46, 147, 0.16), transparent 24rem),
    radial-gradient(circle at 85% 8%, rgba(22, 163, 255, 0.16), transparent 26rem),
    linear-gradient(135deg, #fbfaf4 0%, var(--bg) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.mode-computer {
  grid-template-columns: 320px minmax(0, 1fr);
}

.app-shell.mode-field {
  --touch-size: 52px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #111111;
  color: #ffffff;
  overflow: hidden;
}

.sidebar::before {
  content: "FAST / MT / 90";
  position: absolute;
  left: -18px;
  top: 110px;
  color: rgba(255, 255, 255, 0.06);
  font-size: 54px;
  font-weight: 1000;
  line-height: 0.9;
  transform: rotate(-10deg);
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #111111;
  background: var(--yellow);
  border: 4px solid #ffffff;
  box-shadow: 7px 7px 0 var(--pink);
  font-weight: 1000;
  transform: rotate(-5deg);
}

.brand p {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
}

.brand strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.company-logo {
  position: relative;
  display: block;
  flex: 0 0 auto;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(17, 17, 17, 0.12);
}

.company-logo::after {
  content: "";
  position: absolute;
  inset: auto 10px 8px;
  height: 4px;
  background: var(--red);
}

.company-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transform: scale(1.18);
}

.company-logo-small {
  width: 72px;
  height: 58px;
  box-shadow: 7px 7px 0 var(--pink);
  transform: rotate(-3deg);
}

.courier-stage {
  position: relative;
  min-height: 240px;
  margin: 8px 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.08), transparent),
    repeating-linear-gradient(-12deg, transparent 0 22px, rgba(255, 255, 255, 0.04) 23px 25px);
  overflow: hidden;
}

.speed-lines,
.speed-lines::before,
.speed-lines::after {
  position: absolute;
  width: 120px;
  height: 8px;
  background: var(--blue);
  box-shadow: 0 24px 0 var(--pink), 24px 48px 0 var(--yellow);
  transform: skewX(-28deg);
  opacity: 0.72;
}

.speed-lines {
  left: 18px;
  bottom: 34px;
  animation: slideLines 1.2s linear infinite;
}

.speed-lines::before {
  content: "";
  left: 108px;
  bottom: 74px;
  background: var(--green);
}

.speed-lines::after {
  content: "";
  left: -72px;
  bottom: 142px;
  background: var(--orange);
}

.courier-character {
  position: relative;
  width: 118px;
  height: 190px;
  filter: drop-shadow(0 18px 10px rgba(0, 0, 0, 0.26));
  z-index: 1;
  transform-origin: 50% 100%;
}

.cap {
  position: absolute;
  left: 34px;
  top: 6px;
  width: 58px;
  height: 25px;
  background: #111111;
  border-radius: 24px 24px 10px 10px;
}

.cap::after {
  content: "";
  position: absolute;
  right: -20px;
  top: 11px;
  width: 28px;
  height: 8px;
  background: #111111;
  border-radius: 999px;
  transform: rotate(8deg);
}

.head {
  position: absolute;
  left: 37px;
  top: 25px;
  width: 50px;
  height: 56px;
  background: #f0b98a;
  border-radius: 46% 46% 50% 50%;
}

.head span {
  position: absolute;
  left: 16px;
  top: 31px;
  width: 18px;
  height: 8px;
  border-bottom: 3px solid #111111;
  border-radius: 50%;
}

.head::before,
.head::after {
  content: "";
  position: absolute;
  top: 22px;
  width: 5px;
  height: 5px;
  background: #111111;
  border-radius: 50%;
}

.head::before {
  left: 14px;
}

.head::after {
  right: 14px;
}

.body {
  position: absolute;
  left: 27px;
  top: 80px;
  width: 70px;
  height: 72px;
  background: #ffffff;
  border-radius: 18px 18px 12px 12px;
  border-bottom: 9px solid #111111;
}

.collar {
  position: absolute;
  left: 25px;
  top: 0;
  width: 20px;
  height: 18px;
  background: linear-gradient(135deg, transparent 50%, #111111 52%);
}

.arm {
  position: absolute;
  top: 12px;
  width: 18px;
  height: 62px;
  background: #f0b98a;
  border-radius: 999px;
  transform-origin: 50% 8px;
}

.arm.left {
  left: -14px;
  transform: rotate(16deg);
}

.arm.right {
  right: -14px;
  transform: rotate(-16deg);
}

.parcel {
  position: absolute;
  left: 14px;
  top: 32px;
  width: 44px;
  height: 33px;
  background: #c78943;
  border: 3px solid #8f5921;
  opacity: 0;
  transform: translateY(10px);
}

.parcel::before {
  content: "";
  position: absolute;
  left: 16px;
  top: -3px;
  width: 4px;
  height: 33px;
  background: #8f5921;
}

.legs {
  position: absolute;
  left: 37px;
  top: 144px;
  display: flex;
  gap: 12px;
}

.legs div {
  width: 17px;
  height: 42px;
  background: #111111;
  border-radius: 999px;
  transform-origin: 50% 0;
}

.shoes {
  position: absolute;
  left: 31px;
  top: 180px;
  display: flex;
  gap: 10px;
}

.shoes div {
  width: 28px;
  height: 11px;
  background: var(--blue);
  border-radius: 999px;
}

.courier-running {
  animation: courierRun 0.55s ease-in-out infinite;
}

.courier-running .parcel,
.courier-delivering .parcel {
  opacity: 1;
  transform: translateY(0);
}

.courier-running .legs div:first-child {
  animation: legA 0.55s ease-in-out infinite;
}

.courier-running .legs div:last-child {
  animation: legB 0.55s ease-in-out infinite;
}

.courier-waiting {
  animation: courierBounce 1.1s ease-in-out infinite;
}

.courier-returning {
  animation: courierWalk 1.4s ease-in-out infinite;
}

.courier-late {
  animation: courierLate 0.9s ease-in-out infinite;
}

.courier-success .arm.right {
  animation: thumbUp 1.2s ease-in-out infinite;
}

.nav-tabs {
  display: grid;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.nav-tab,
.period-button,
.ghost-button,
.primary-button,
.danger-button,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 900;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.nav-tab {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
  padding: 0 14px;
}

.nav-tab.active {
  color: #111111;
  background: #ffffff;
  box-shadow: 6px 6px 0 var(--pink);
}

.role-panel {
  position: relative;
  z-index: 1;
  margin-top: auto;
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sidebar label {
  color: rgba(255, 255, 255, 0.62);
}

select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 850;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--pink);
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(38px, 6vw, 76px);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.05;
}

h3 {
  margin-bottom: 8px;
}

.top-actions,
.create-form,
.warehouse-tools,
.run-actions,
.order-actions,
.mini-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.date-panel {
  display: grid;
  gap: 2px;
  min-width: 210px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 6px solid var(--blue);
}

.date-panel span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
}

.date-panel strong {
  display: none;
}

.shift-message {
  max-width: 360px;
  min-height: 44px;
  padding: 10px 12px;
  color: #111111;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 6px solid var(--yellow);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
}

.period-switch {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 14px;
  padding: 8px;
  background: rgba(17, 17, 17, 0.05);
}

.period-button {
  padding: 0 16px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
}

.period-button.active {
  color: #ffffff;
  background: #111111;
  box-shadow: 4px 4px 0 var(--blue);
}

.ghost-button {
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
}

.primary-button {
  padding: 0 18px;
  color: #111111;
  background: var(--yellow);
  box-shadow: 5px 5px 0 #111111;
}

.danger-button {
  padding: 0 14px;
  color: #ffffff;
  background: var(--red);
}

.icon-button {
  width: 42px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 46, 147, 0.16), transparent 24rem),
    radial-gradient(circle at 85% 8%, rgba(22, 163, 255, 0.16), transparent 26rem),
    linear-gradient(135deg, #fbfaf4 0%, var(--bg) 100%);
}

.login-card {
  width: min(500px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.company-logo-large {
  width: min(210px, 62vw);
  height: 108px;
  box-shadow: 7px 7px 0 var(--yellow), 13px 13px 0 var(--pink);
  transform: none;
}

.company-logo-large::after {
  height: 6px;
}

.login-card h1 {
  font-size: 46px;
}

.install-card {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 14px;
  background: #f8f8f8;
  border: 1px solid var(--line);
  border-left: 6px solid var(--blue);
}

.install-card h2 {
  font-size: 20px;
}

.install-link {
  margin: 0;
  padding: 10px 12px;
  overflow-wrap: anywhere;
  color: #111111;
  background: #ffffff;
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 900;
}

.install-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.install-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.3;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-weight: 900;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel,
.quick-create,
.column,
.run-card,
.order-card,
.metric-card,
.courier-row {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.panel,
.quick-create {
  padding: 18px;
}

.rules-hero {
  margin-bottom: 16px;
}

.rules-hero p:last-child {
  max-width: 820px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.role-guide {
  margin-bottom: 16px;
}

.role-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.role-guide-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 7px solid var(--yellow);
}

.role-guide-card:nth-child(2) {
  border-left-color: var(--green);
}

.role-guide-card:nth-child(3) {
  border-left-color: var(--blue);
}

.role-guide-card:nth-child(4) {
  border-left-color: var(--orange);
}

.role-guide-card:nth-child(5) {
  border-left-color: var(--pink);
}

.role-guide-card:nth-child(6) {
  border-left-color: var(--violet);
}

.role-guide-card b {
  font-size: 18px;
}

.role-guide-card ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 820;
  line-height: 1.28;
}

.role-guide-card strong {
  display: block;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.3;
}

.rule-card-install {
  border-left-color: var(--pink);
}

.password-panel {
  margin-bottom: 16px;
}

.password-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.password-note {
  padding: 14px;
  background: #fff4cc;
  border: 1px solid #ffd45f;
}

.password-note span,
.password-note p {
  display: block;
  margin: 0;
  color: var(--muted);
  font-weight: 900;
}

.password-note strong {
  display: block;
  margin: 4px 0;
  font-size: 30px;
}

.rule-card {
  position: relative;
  min-height: 210px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 7px solid var(--blue);
  box-shadow: var(--shadow);
}

.rule-card span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #111111;
  background: var(--yellow);
  border: 2px solid #111111;
  border-radius: 50%;
  font-weight: 1000;
}

.rule-card h3 {
  margin: 12px 0 8px;
  font-size: 18px;
}

.rule-card p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
}

.rule-card strong {
  display: block;
  font-size: 13px;
  line-height: 1.3;
}

.quick-create {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.quick-create select {
  min-width: 240px;
}

.inline-field {
  min-width: 150px;
}

.deferred-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  background: rgba(22, 163, 255, 0.1);
  border: 1px solid rgba(22, 163, 255, 0.3);
  border-radius: 8px;
  font-weight: 1000;
}

.deferred-field input {
  width: auto;
  min-height: 0;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-weight: 850;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-weight: 750;
  resize: vertical;
}

textarea:focus {
  border-color: var(--red);
  outline: 3px solid rgba(255, 59, 48, 0.16);
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  position: relative;
  padding: 16px;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 6px;
  background: var(--accent, var(--blue));
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
}

.metric-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.metric-card.issue-metric p {
  color: var(--red);
  font-weight: 1000;
}

.board {
  display: grid;
  grid-template-columns: minmax(250px, 0.9fr) minmax(360px, 1.6fr) minmax(250px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.column {
  min-width: 0;
  padding: 14px;
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.column-head span {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  color: #ffffff;
  background: #111111;
  font-weight: 1000;
}

.column-head .head-note {
  display: block;
  place-items: initial;
  width: min(100%, 340px);
  height: auto;
  min-height: 32px;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  line-height: 1.15;
  white-space: normal;
}

.warehouse-tools {
  padding: 12px;
  margin-bottom: 12px;
  background: rgba(17, 17, 17, 0.05);
}

.warehouse-tools label {
  flex: 1;
  min-width: 130px;
}

.history-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(17, 17, 17, 0.05);
}

.selection-chip,
.select-chip {
  display: inline-grid;
  place-items: center;
  min-height: 36px;
  padding: 0 11px;
  color: #111111;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 1000;
  white-space: nowrap;
}

.select-chip {
  background: var(--blue);
  border-color: transparent;
  color: #ffffff;
}

.select-chip.blocked {
  background: var(--yellow);
  color: #111111;
}

.order-list,
.run-list,
.history-list,
.courier-stats {
  display: grid;
  gap: 12px;
}

.bonus-panel {
  margin-bottom: 16px;
}

.bonus-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.bonus-tools {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  background: rgba(17, 17, 17, 0.05);
}

.bonus-group h3 {
  margin-bottom: 10px;
  font-size: 17px;
}

.bonus-list {
  display: grid;
  gap: 10px;
}

.bonus-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  background: rgba(17, 17, 17, 0.04);
  border-left: 6px solid var(--score-color, var(--green));
}

.bonus-row > div:first-child strong {
  display: block;
  font-size: 16px;
}

.bonus-row > div:first-child span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.bonus-score {
  align-self: start;
  padding: 7px 10px;
  color: #111111;
  background: var(--score-color, var(--green));
  border-radius: 999px;
  font-weight: 1000;
}

.bonus-meta {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.bonus-meta div {
  padding: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.bonus-meta span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 1000;
  text-transform: uppercase;
}

.bonus-meta strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.bonus-detail {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(22, 163, 255, 0.08);
  border-left: 6px solid var(--blue);
}

.bonus-detail > strong {
  font-size: 16px;
}

.bonus-detail > span,
.bonus-detail-head span,
.bonus-detail-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.bonus-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bonus-detail-head strong {
  display: block;
  font-size: 18px;
}

.bonus-detail-head b {
  display: inline-grid;
  place-items: center;
  min-width: 58px;
  min-height: 38px;
  padding: 0 10px;
  color: #111111;
  background: var(--score-color, var(--green));
  border-radius: 999px;
  font-size: 18px;
}

.bonus-detail-list {
  display: grid;
  gap: 9px;
}

.bonus-detail-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
  border-left: 5px solid var(--score-color, var(--green));
}

.bonus-detail-row strong {
  display: block;
}

.bonus-detail-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.bonus-detail-meta div {
  padding: 7px;
  background: rgba(17, 17, 17, 0.05);
}

.bonus-detail-meta span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 1000;
  text-transform: uppercase;
}

.bonus-detail-meta strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.run-list.compact {
  gap: 10px;
}

.completed-simple-run {
  padding: 12px;
}

.completed-simple-run .card-title {
  font-size: 16px;
}

.completed-simple-run .completed-order-strip {
  margin-top: 10px;
}

.order-card,
.run-card,
.courier-row {
  position: relative;
  padding: 14px;
  overflow: hidden;
}

.order-card::before,
.run-card::before,
.courier-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--status-color, var(--green));
}

.order-card.selected {
  outline: 3px solid var(--blue);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 17px;
  line-height: 1.1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  color: #111111;
  background: var(--status-color, var(--green));
  border-radius: 999px;
  font-size: 12px;
  font-weight: 1000;
  white-space: nowrap;
}

.timer {
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
}

.deferred-timer {
  color: var(--blue);
  font-size: 22px;
  line-height: 1.1;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.meta {
  padding: 8px;
  background: rgba(17, 17, 17, 0.05);
}

.status-meta {
  border-left: 5px solid var(--metric-color, var(--green));
}

.deferred-meta {
  grid-column: 1 / -1;
  border-left: 5px solid var(--blue);
}

.courier-sla-focus,
.courier-return-focus {
  background: #fff1b8;
  border: 3px solid var(--yellow);
  box-shadow: 6px 6px 0 rgba(17, 17, 17, 0.16);
}

.courier-sla-focus strong,
.courier-return-focus strong {
  font-size: 24px;
  line-height: 1;
  color: #111111;
}

.courier-sla-focus.warning {
  background: #ffe08a;
  border-color: var(--orange);
}

.courier-sla-focus.late,
.courier-return-focus[style*="red"] {
  color: #ffffff;
  background: var(--red);
  border-color: #111111;
}

.courier-sla-focus.late span,
.courier-sla-focus.late strong,
.courier-return-focus[style*="red"] span,
.courier-return-focus[style*="red"] strong {
  color: #ffffff;
}

.completed-order-strip {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(17, 17, 17, 0.05);
  border-left: 5px solid var(--blue);
}

.completed-order-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
}

.completed-order-strip strong {
  font-size: 14px;
  font-weight: 1000;
  line-height: 1.25;
}

.courier-package-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 16px;
  color: #111111;
  background: #ffcc33;
  border: 4px solid #111111;
  box-shadow: 7px 7px 0 rgba(17, 17, 17, 0.22);
  font-weight: 950;
  text-transform: uppercase;
}

.courier-package-alert span {
  text-align: right;
  font-size: 20px;
  line-height: 1;
}

.meta[style*="--return-color"] {
  border-left: 5px solid var(--return-color);
}

.meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.meta strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}

.route {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.route span {
  padding: 7px 9px;
  color: #111111;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 1000;
}

.run-card {
  --status-color: var(--blue);
}

.run-card .run-main {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 12px;
  align-items: center;
}

.tiny-courier {
  width: 76px;
  height: 80px;
  position: relative;
  justify-self: end;
}

.tiny-courier::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 4px;
  width: 30px;
  height: 34px;
  background: #f0b98a;
  border-radius: 50%;
  box-shadow: 0 -10px 0 -2px #111111;
}

.tiny-courier::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 38px;
  width: 42px;
  height: 38px;
  background: #ffffff;
  border-bottom: 8px solid #111111;
  border-radius: 14px;
}

.tiny-courier.run {
  animation: courierRun 0.7s ease-in-out infinite;
}

.tiny-courier.late {
  animation: courierLate 0.8s ease-in-out infinite;
}

.run-details {
  display: none;
  margin-top: 14px;
}

.run-card.open .run-details {
  display: grid;
  gap: 10px;
}

.run-actions,
.order-actions {
  margin-top: 12px;
}

.picking-panel {
  margin-top: 12px;
  padding: 12px;
  background: rgba(17, 17, 17, 0.05);
  border-left: 5px solid var(--picking-color, var(--blue));
}

.picking-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 1000;
}

.picking-head span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.picking-sla {
  margin-bottom: 10px;
  color: var(--picking-color, var(--blue));
  font-size: 12px;
  font-weight: 1000;
  text-transform: uppercase;
}

.package-inputs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.package-inputs label {
  color: var(--muted);
}

.package-inputs input {
  min-width: 0;
  font-size: 18px;
  font-weight: 1000;
}

.package-inputs input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(22, 163, 255, 0.18);
}

.return-note,
.return-comment,
.issue-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(17, 17, 17, 0.05);
  border-left: 5px solid var(--return-color, var(--green));
  font-size: 13px;
  font-weight: 900;
}

.return-note span,
.return-comment span,
.issue-note span {
  color: var(--muted);
  text-align: right;
}

.return-comment,
.issue-note {
  align-items: flex-start;
  border-left-color: var(--red);
}

.return-note.courier-return-focus {
  border-left-width: 9px;
  font-size: 16px;
}

.return-note.courier-return-focus span {
  color: inherit;
  font-size: 18px;
}

.received-orders-panel {
  margin-bottom: 16px;
}

.received-order-list,
.picked-order-list {
  display: grid;
  gap: 10px;
}

.received-order-item,
.picked-order-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: rgba(33, 201, 92, 0.12);
  border-left: 7px solid var(--green);
}

.received-order-item.with-issue,
.picked-order-item.late {
  background: rgba(255, 59, 48, 0.1);
  border-left-color: var(--red);
}

.picked-orders-panel {
  margin-bottom: 16px;
}

.received-order-item strong,
.received-order-item span,
.picked-order-item strong,
.picked-order-item span {
  display: block;
}

.received-order-item span,
.picked-order-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.partial-panel,
.return-comment-panel {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 59, 48, 0.08);
  border-left: 5px solid var(--red);
}

.return-comment-panel {
  background: rgba(255, 200, 61, 0.14);
}

.mini-actions {
  justify-content: flex-end;
}

.mini-remove-button {
  min-height: 42px;
  padding: 0 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.courier-row {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 14px;
  align-items: center;
}

.courier-avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #111111;
  background: var(--yellow);
  border: 3px solid #111111;
  font-weight: 1000;
}

.bars {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.bar {
  height: 8px;
  background: rgba(17, 17, 17, 0.1);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: var(--value);
  background: var(--accent, var(--green));
}

.score-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.history-item {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-left: 5px solid var(--accent, var(--blue));
  background: rgba(17, 17, 17, 0.04);
}

.history-item strong {
  font-size: 14px;
}

.history-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 160px;
  color: var(--muted);
  border: 2px dashed var(--line);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: #111111;
  background: var(--yellow);
  border: 3px solid #111111;
  font-weight: 1000;
  transform: rotate(-7deg);
}

.hidden {
  display: none !important;
}

@keyframes slideLines {
  from {
    transform: translateX(0) skewX(-28deg);
  }
  to {
    transform: translateX(58px) skewX(-28deg);
  }
}

@keyframes courierRun {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}

@keyframes courierBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes courierWalk {
  0%,
  100% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(4px);
  }
}

@keyframes courierLate {
  0%,
  100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

@keyframes legA {
  0%,
  100% {
    transform: rotate(22deg);
  }
  50% {
    transform: rotate(-22deg);
  }
}

@keyframes legB {
  0%,
  100% {
    transform: rotate(-22deg);
  }
  50% {
    transform: rotate(22deg);
  }
}

@keyframes thumbUp {
  0%,
  100% {
    transform: rotate(-70deg) translateY(-10px);
  }
  50% {
    transform: rotate(-92deg) translateY(-14px);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    display: grid;
    grid-template-columns: 1fr 220px;
  }

  .mode-computer.app-shell {
    display: block;
  }

  .mode-computer .sidebar {
    position: relative;
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 14px;
    row-gap: 10px;
    padding: 12px 18px;
    overflow: visible;
  }

  .mode-computer .sidebar::before,
  .mode-computer .courier-stage {
    display: none;
  }

  .mode-computer .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 190px;
  }

  .mode-computer .company-logo-small {
    width: 56px;
    height: 44px;
    box-shadow: 4px 4px 0 var(--pink);
  }

  .mode-computer .nav-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    min-width: 0;
  }

  .mode-computer .nav-tab {
    min-width: 0;
    text-align: center;
  }

  .mode-computer .role-panel {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: end;
    gap: 10px;
    margin-top: 0;
    white-space: nowrap;
  }

  .mode-computer .role-panel label {
    min-width: 230px;
  }

  .mode-computer .workspace {
    width: 100%;
    padding: 18px;
  }

  .nav-tabs,
  .role-panel {
    grid-column: 1 / -1;
  }

  .courier-stage {
    min-height: 190px;
    margin: 0;
  }

  .board,
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mode-computer .board {
    grid-template-columns: minmax(320px, 0.85fr) minmax(430px, 1.35fr);
  }

  .mode-computer .board > .column:last-child {
    grid-column: 1 / -1;
  }

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

@media (max-width: 760px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body.mode-field {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  body,
  .app-shell,
  .workspace {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .workspace {
    padding: 14px;
  }

  .sidebar {
    padding: 16px;
    grid-template-columns: 1fr;
  }

  .mode-field .app-shell {
    display: block;
  }

  .mode-field .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    height: auto;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
    overflow: visible;
  }

  .mode-field .sidebar::before,
  .mode-field .courier-stage {
    display: none;
  }

  .mode-field .brand {
    display: flex;
    min-width: 0;
  }

  .mode-field .company-logo-small {
    width: 48px;
    height: 38px;
    box-shadow: 4px 4px 0 var(--pink);
  }

  .mode-field .brand p {
    font-size: 12px;
  }

  .mode-field .brand strong {
    font-size: 18px;
  }

  .mode-field .role-panel {
    display: grid;
    grid-template-columns: auto;
    grid-column: auto;
    margin-top: 0;
    gap: 8px;
  }

  .mode-field .role-panel > label:first-child {
    display: none;
  }

  .mode-field .role-panel .ghost-button {
    width: auto;
    min-height: 40px;
    padding: 0 14px;
    color: #111111;
    background: #ffffff;
  }

  .mode-field .nav-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
    gap: 6px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: #111111;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 -12px 30px rgba(17, 17, 17, 0.22);
  }

  .mode-field .nav-tab {
    min-height: 56px;
    padding: 0 8px;
    text-align: center;
    font-size: 12px;
    line-height: 1.05;
    background: rgba(255, 255, 255, 0.1);
  }

  .mode-field .nav-tab.active {
    color: #111111;
    background: #ffffff;
    box-shadow: none;
  }

  .mode-field .workspace {
    padding: 12px 10px 18px;
  }

  .mode-field .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .mode-field .topbar h1 {
    font-size: 34px;
    line-height: 0.95;
  }

  .mode-field .top-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mode-field .date-panel,
  .mode-field .shift-message {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .mode-field .shift-message {
    line-height: 1.2;
  }

  .courier-stage {
    display: none;
  }

  .topbar,
  .quick-create {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 44px;
  }

  .mode-field h2 {
    font-size: 22px;
  }

  .kpi-strip,
  .board,
  .dashboard-grid,
  .history-layout {
    grid-template-columns: 1fr;
  }

  .quick-create select,
  .create-form,
  .create-form .primary-button {
    width: 100%;
  }

  .mode-field .quick-create {
    gap: 12px;
  }

  .mode-field .create-form {
    grid-template-columns: 1fr;
  }

  .mode-field .kpi-strip {
    gap: 8px;
    margin-bottom: 12px;
  }

  .mode-field .metric-card {
    padding: 13px;
  }

  .mode-field .metric-card strong {
    font-size: 38px;
  }

  .mode-field .column,
  .mode-field .panel,
  .mode-field .quick-create,
  .mode-field .order-card,
  .mode-field .run-card {
    padding: 12px;
  }

  .mode-field .column {
    border-left-width: 0;
  }

  .mode-field.role-warehouse .board {
    gap: 22px;
  }

  .mode-field.role-warehouse .board > .column {
    padding: 0;
    overflow: visible;
    background: #ffffff;
    border: 2px solid rgba(17, 17, 17, 0.12);
    box-shadow: 0 16px 34px rgba(17, 17, 17, 0.13);
  }

  .mode-field.role-warehouse .board > .column:first-child {
    border-color: rgba(255, 200, 61, 0.72);
  }

  .mode-field.role-warehouse .board > .column::before {
    display: none;
  }

  .mode-field.role-warehouse .board > .column .column-head {
    margin: 0;
    padding: 14px 14px 12px;
    color: #111111;
    background: rgba(255, 200, 61, 0.2);
    border-bottom: 4px solid var(--yellow);
  }

  .mode-field.role-warehouse .board > .column:nth-child(2) .column-head {
    background: rgba(22, 163, 255, 0.16);
    border-bottom-color: var(--blue);
  }

  .mode-field.role-warehouse .board > .column:nth-child(3) .column-head {
    background: rgba(118, 87, 255, 0.14);
    border-bottom-color: var(--violet);
  }

  .mode-field.role-warehouse .board > .column .column-head h2 {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }

  .mode-field.role-warehouse .board > .column .column-head h2::before {
    content: "1";
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    color: #111111;
    background: var(--yellow);
    border: 2px solid #111111;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 1000;
  }

  .mode-field.role-warehouse .board > .column:nth-child(2) .column-head h2::before {
    content: "2";
    background: var(--blue);
  }

  .mode-field.role-warehouse .board > .column:nth-child(3) .column-head h2::before {
    content: "3";
    color: #ffffff;
    background: var(--violet);
  }

  .mode-field.role-warehouse .warehouse-tools,
  .mode-field.role-warehouse .order-list,
  .mode-field.role-warehouse .run-list,
  .mode-field.role-warehouse .history-filter {
    margin: 12px;
  }

  .mode-field.role-warehouse .warehouse-tools {
    padding: 12px;
    background: rgba(255, 200, 61, 0.14);
    border: 1px solid rgba(255, 200, 61, 0.55);
  }

  .mode-field.role-warehouse .order-list,
  .mode-field.role-warehouse .run-list {
    padding-top: 2px;
  }

  .mode-field.role-warehouse .board > .column:first-child .order-list {
    max-height: none;
    overflow: visible;
  }

  .mode-field.role-warehouse .board > .column:first-child .order-card {
    padding: 10px 10px 12px;
  }

  .mode-field.role-warehouse .board > .column:first-child .card-top {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .mode-field.role-warehouse .board > .column:first-child .card-title {
    font-size: 16px;
  }

  .mode-field.role-warehouse .board > .column:first-child .timer {
    margin-top: 6px;
    font-size: 30px;
  }

  .mode-field.role-warehouse .board > .column:first-child .select-chip {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  .mode-field.role-warehouse .board > .column:first-child .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .mode-field.role-warehouse .board > .column:first-child .meta {
    padding: 7px;
  }

  .mode-field.role-warehouse .board > .column:first-child .meta span {
    font-size: 10px;
  }

  .mode-field.role-warehouse .board > .column:first-child .meta strong {
    font-size: 14px;
  }

  .mode-field.role-warehouse .order-card,
  .mode-field.role-warehouse .run-card {
    border: 1px solid rgba(17, 17, 17, 0.14);
    box-shadow: 0 8px 18px rgba(17, 17, 17, 0.08);
  }

  .mode-field .meta-grid {
    grid-template-columns: 1fr;
  }

  .mode-field .bonus-stats,
  .mode-field .bonus-tools,
  .mode-field .bonus-meta,
  .mode-field .bonus-detail-meta {
    grid-template-columns: 1fr;
  }

  .mode-field .timer {
    font-size: 36px;
  }

  .mode-field .primary-button,
  .mode-field .danger-button,
  .mode-field .ghost-button,
  .mode-field select,
  .mode-field input,
  .mode-field textarea {
    font-size: 16px;
    min-height: var(--touch-size);
  }

  .mode-field .order-actions,
  .mode-field .run-actions,
  .mode-field .warehouse-tools,
  .mode-field .create-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .mode-field .order-actions button,
  .mode-field .run-actions button,
  .mode-field .warehouse-tools button {
    width: 100%;
  }

  .mode-field .card-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mode-field .status-pill {
    justify-self: start;
    min-height: 32px;
    font-size: 13px;
  }

  .mode-field .history-filter {
    grid-template-columns: 1fr;
  }

  .mode-field .courier-package-alert {
    display: grid;
    gap: 8px;
    text-align: left;
  }

  .mode-field .courier-package-alert span {
    text-align: left;
    font-size: 24px;
  }

  .run-card .run-main,
  .courier-row {
    grid-template-columns: 1fr;
  }

  .tiny-courier {
    display: none;
  }
}

@media (max-width: 520px) {
  .login-screen {
    align-items: start;
    padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
  }

  .login-card {
    padding: 16px;
  }

  .login-card h1 {
    font-size: 38px;
  }

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

  .company-logo-large {
    width: min(174px, 68vw);
    height: 92px;
  }

  .mode-field .topbar h1 {
    font-size: 32px;
  }

  .mode-field .metric-card strong {
    font-size: 34px;
  }

  .mode-field .timer {
    font-size: 34px;
  }
}
