:root {
  --bg: #07121c;
  --panel: rgba(17, 31, 42, 0.88);
  --card: rgba(49, 65, 74, 0.92);
  --card-hot: linear-gradient(135deg, #2aa84a, #06461f 72%);
  --text: #f8fafc;
  --muted: #a8b3c0;
  --line: rgba(255, 255, 255, 0.16);
  --green: #4ade80;
  --blue: #28a7ff;
  --danger: #ff7979;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(50, 205, 110, 0.2), transparent 28%),
    linear-gradient(180deg, #08131e 0%, #0b1722 45%, #07111a 100%);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei",
    Arial,
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.app-shell {
  display: flex;
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
}

.topbar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
}

.topbar h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(23px, 5vw, 34px);
  font-weight: 900;
  letter-spacing: 0;
}

.back-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: white;
  font-size: 48px;
  line-height: 1;
  text-decoration: none;
}

.sync-pill {
  display: inline-flex;
  min-width: 78px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: white;
  font-weight: 900;
  background: linear-gradient(180deg, #64e883, #28a852);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 6px 18px rgba(34, 197, 94, 0.22);
}

.sync-pill.syncing {
  background: linear-gradient(180deg, #60a5fa, #2563eb);
}

.sync-pill.error {
  background: linear-gradient(180deg, #fb7185, #dc2626);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 86px 96px auto auto;
  gap: 8px;
  margin: 18px 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.toolbar input,
.toolbar select,
.toolbar button {
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  color: var(--text);
  outline: none;
  background: rgba(255, 255, 255, 0.1);
}

.toolbar input {
  min-width: 0;
  padding: 0 13px;
}

.toolbar input::placeholder {
  color: #9aa7b5;
}

.toolbar select {
  padding: 0 9px;
}

.toolbar button {
  padding: 0 16px;
  font-weight: 900;
}

.auto-row {
  display: inline-flex;
  height: 44px;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.auto-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.order-list {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 4px 0 14px;
}

.empty {
  display: grid;
  min-height: 280px;
  place-items: center;
  color: var(--muted);
  font-size: 16px;
}

.order-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  align-items: center;
  gap: 18px;
  min-height: 154px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 26px;
  background: var(--card);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.06);
}

.order-card:first-child {
  border-color: rgba(185, 255, 189, 0.9);
  background: var(--card-hot);
  box-shadow:
    0 0 0 2px rgba(185, 255, 189, 0.6),
    0 0 28px rgba(74, 222, 128, 0.35),
    0 18px 36px rgba(0, 0, 0, 0.35);
}

.order-main {
  min-width: 0;
}

.order-main time {
  display: block;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: clamp(18px, 4.2vw, 28px);
  font-weight: 800;
}

.order-card:first-child time {
  color: rgba(255, 255, 255, 0.88);
}

.order-content {
  color: var(--text);
  font-size: clamp(24px, 6vw, 42px);
  font-weight: 900;
  line-height: 1.38;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.phone-inline {
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

.order-content .phone-inline {
  color: #ffffff;
}

.order-card:not(:first-child) .phone-inline {
  color: #f8fafc;
}

.order-content::first-letter {
  letter-spacing: 0;
}

.call-button {
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  border-radius: 999px;
  color: white;
  font-size: 40px;
  text-decoration: none;
  background: linear-gradient(180deg, #48b8ff, #1e80ff);
  box-shadow: 0 12px 26px rgba(30, 128, 255, 0.38), inset 0 0 0 2px rgba(255, 255, 255, 0.24);
}

.call-button.disabled {
  color: rgba(255, 255, 255, 0.42);
  background: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.pager {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  color: var(--muted);
}

.pager button {
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.pager span {
  text-align: center;
  font-size: 16px;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(380px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.login-box h1 {
  margin: 0 0 18px;
  font-size: 24px;
}

.login-box label,
.login-box span {
  display: block;
}

.login-box span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-box input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  color: var(--text);
  outline: none;
  background: rgba(255, 255, 255, 0.1);
}

.login-box button {
  width: 100%;
  height: 44px;
  margin-top: 14px;
  border: 0;
  border-radius: 12px;
  color: white;
  font-weight: 900;
  background: linear-gradient(180deg, #64e883, #28a852);
}

.error-message {
  display: none;
  margin-top: 12px;
  color: #fecaca;
  font-size: 13px;
}

.error-message.visible {
  display: block;
}

@media (max-width: 560px) {
  .app-shell {
    padding-inline: 10px;
  }

  .topbar {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .back-button {
    width: 34px;
    height: 34px;
    font-size: 42px;
  }

  .sync-pill {
    min-width: 70px;
    height: 34px;
    font-size: 14px;
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .order-card {
    grid-template-columns: minmax(0, 1fr) 68px;
    gap: 12px;
    min-height: 142px;
    padding: 20px 16px;
    border-radius: 22px;
  }

  .call-button {
    width: 68px;
    height: 68px;
    font-size: 34px;
  }
}
