:root {
  --ink: #1a1a2e;
  --muted: #7a8494;
  --line: #e5e8ef;
  --soft: #f3f5f8;
  --panel: #ffffff;
  --brand: #c0392b;
  --brand-dark: #1a1a2e;
  --blue: #1976d2;
  --green: #388e3c;
  --amber: #e67e22;
  --purple: #7b1fa2;
  --red: #d32f2f;
  --shadow: 0 1px 5px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  color: var(--ink);
  background: #eef1f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.phone-shell {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  overflow-x: hidden;
  background: #f5f6f8;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 28px;
  background: linear-gradient(160deg, #1a1a2e 0%, #16213e 52%, #0f3460 100%);
}

.login-logo {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  font-size: 34px;
  font-weight: 900;
}

.login-screen h1 {
  margin: 0 0 4px;
  color: #fff;
  font-size: 22px;
}

.login-screen p {
  margin: 0 0 34px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 13px;
}

.login-box {
  width: 100%;
  display: grid;
  gap: 14px;
  padding: 24px 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.login-box label {
  display: grid;
  gap: 5px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 700;
}

.login-box input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.login-box input:focus {
  outline: none;
  border-color: var(--brand);
  background: rgba(255, 255, 255, 0.08);
}

.login-box input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.login-btn {
  min-height: 46px;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}

.login-error {
  display: none;
  color: #ff9b9b;
  font-size: 13px;
  text-align: center;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 16px;
  color: #fff;
  background: var(--brand-dark);
}

.app-header h1 {
  margin: 0;
  font-size: 16px;
}

.driver-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 800;
}

.dot {
  width: 8px;
  height: 8px;
  background: #27ae60;
  border-radius: 50%;
}

.tab-content {
  min-height: calc(100vh - 54px);
  padding-bottom: 68px;
}

.tab-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 100;
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  transform: translateX(-50%);
  background: #fff;
  border-top: 1px solid var(--line);
}

.tab-bar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 58px;
  border: 0;
  color: #999;
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.tab-bar button.active {
  color: var(--brand);
}

.tab-icon {
  font-size: 19px;
  line-height: 1;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 12px;
}

.summary-card {
  padding: 10px;
  text-align: center;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-card strong {
  display: block;
  font-size: 21px;
  line-height: 1.1;
}

.summary-card span {
  color: #888;
  font-size: 11px;
  font-weight: 800;
}

.filter-row {
  display: flex;
  gap: 8px;
  padding: 0 12px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.filter-row button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #666;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.filter-row button.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.order-card,
.card,
.profile-header,
.profile-info {
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.order-card {
  margin: 8px 12px;
  padding: 14px 16px;
  border-left: 3px solid var(--brand);
}

.order-card:active {
  transform: scale(0.99);
}

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

.order-card .id {
  color: #999;
  font-size: 12px;
  font-weight: 700;
}

.order-card .customer {
  margin-bottom: 3px;
  font-size: 14px;
  font-weight: 900;
}

.order-card .route {
  color: #666;
  font-size: 12px;
}

.order-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 7px;
  color: #888;
  font-size: 11px;
}

.status,
.st-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.st-pending {
  color: var(--amber);
  background: #fff3e0;
}

.st-dispatched {
  color: var(--blue);
  background: #e3f2fd;
}

.st-in_transit {
  color: var(--green);
  background: #e8f5e9;
}

.st-completed {
  color: var(--purple);
  background: #f3e5f5;
}

.st-cancelled {
  color: var(--red);
  background: #fbe9e7;
}

.empty {
  padding: 42px 20px;
  color: #999;
  text-align: center;
  font-size: 13px;
}

.empty .icon {
  margin-bottom: 8px;
  font-size: 34px;
}

.detail-page {
  position: fixed;
  inset: 0 auto auto 50%;
  z-index: 200;
  display: none;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  transform: translateX(-50%);
  background: #f5f6f8;
}

.detail-page.show {
  display: flex;
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  color: #fff;
  background: var(--brand-dark);
}

.back-button {
  width: 34px;
  height: 34px;
  border: 0;
  color: #fff;
  background: transparent;
  font-size: 28px;
  line-height: 1;
}

.detail-header h2 {
  margin: 0;
  font-size: 16px;
}

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 88px;
}

.card {
  margin: 10px 12px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid #f1f2f5;
}

.card-header h3 {
  margin: 0;
  font-size: 14px;
}

.card-body {
  padding: 14px 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.info-grid .full {
  grid-column: 1 / -1;
}

.label {
  margin-bottom: 2px;
  color: #888;
  font-size: 11px;
}

.value {
  color: #333;
  font-size: 13px;
  font-weight: 800;
}

.cargo-item {
  margin-bottom: 8px;
  padding: 12px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
}

.cargo-row {
  display: flex;
  gap: 8px;
  margin-bottom: 7px;
}

.cargo-row:last-child {
  margin-bottom: 0;
}

.cargo-item input,
.cargo-item select {
  min-width: 0;
  width: 100%;
  min-height: 36px;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0 9px;
  font-size: 12px;
}

.name-input {
  flex: 2;
}

.qty-input,
.unit-input {
  flex: 1;
}

.price-input {
  flex: 0 1 96px;
}

.currency-input {
  flex: 0 0 58px;
}

.item-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.del-btn {
  min-width: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--red);
  background: #fbe9e7;
}

.add-cargo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-bottom: 8px;
  border: 1px dashed #ccc;
  border-radius: 8px;
  color: #777;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}

.cargo-summary {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  background: #fafafa;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
}

.cargo-summary .total {
  color: var(--brand);
  font-size: 15px;
}

.action-stack {
  display: grid;
  gap: 8px;
}

.action-stack button,
.logout-btn {
  min-height: 42px;
  border-radius: 8px;
  border: 0;
  font-size: 13px;
  font-weight: 900;
}

.btn-accept {
  color: #fff;
  background: var(--brand);
}

.btn-transit {
  color: #fff;
  background: var(--blue);
}

.btn-complete {
  color: #fff;
  background: var(--green);
}

.btn-save {
  color: var(--green);
  background: #e8f5e9;
  border: 1px solid #c8e6c9 !important;
}

.profile-header {
  margin: 10px 12px;
  padding: 28px 16px 20px;
  text-align: center;
}

.profile-avatar {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  margin: 0 auto 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-dark), #0f3460);
  border-radius: 50%;
  font-size: 24px;
  font-weight: 900;
}

.profile-header .name {
  font-size: 17px;
  font-weight: 900;
}

.profile-header .phone {
  margin-top: 2px;
  color: #888;
  font-size: 12px;
}

.profile-info {
  margin: 10px 12px;
  padding: 0 16px;
}

.profile-info .row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f2f5;
  font-size: 13px;
}

.profile-info .row:last-child {
  border-bottom: 0;
}

.profile-info .val {
  color: #555;
  text-align: right;
  font-weight: 800;
}

.logout-btn {
  width: calc(100% - 24px);
  margin: 18px 12px;
  color: var(--red);
  background: #fbe9e7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 78px;
  z-index: 300;
  max-width: calc(100% - 40px);
  padding: 10px 18px;
  color: #fff;
  background: var(--brand-dark);
  border-radius: 8px;
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  transition: all 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  font-size: 12px;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 480px) {
  .phone-shell {
    border-left: 1px solid #e8e8e8;
    border-right: 1px solid #e8e8e8;
  }
}
