:root {
  color-scheme: dark;
  --bg: #0b1120;
  --card: rgba(30, 41, 59, 0.55);
  --card-border: rgba(148, 163, 184, 0.14);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --radius: 20px;
}

* {
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(56, 189, 248, 0.12), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(139, 92, 246, 0.1), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  max-width: 36rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px 10px;
}

#auth-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  color: #fecdd3;
  background: rgba(190, 18, 60, 0.35);
  border-bottom: 1px solid rgba(251, 113, 133, 0.35);
  backdrop-filter: blur(12px);
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(14px);
}

.label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.input::placeholder {
  color: #64748b;
}

select.input {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #94a3b8 50%),
    linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 20px,
    calc(100% - 13px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease, background 0.15s ease;
  user-select: none;
}

.btn-primary {
  color: #05121f;
  background: linear-gradient(180deg, #7dd3fc, #38bdf8);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.25);
}

.btn-secondary {
  color: #e0f2fe;
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.32);
}

.btn-ghost {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.18);
}

.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active {
  transform: scale(0.97);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled {
  opacity: 0.55;
  cursor: wait;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.5s ease;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.dot-online {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.16), 0 0 18px rgba(52, 211, 153, 0.6);
}

.dot-offline {
  background: var(--bad);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.16), 0 0 18px rgba(251, 113, 133, 0.55);
}

.dot-unknown {
  background: #64748b;
  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.16);
}

.stat {
  padding: 10px 6px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-label {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 6px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.chip:active {
  transform: scale(0.97);
}

.chip-value {
  font-size: 15px;
  font-weight: 700;
}

.chip-label {
  font-size: 10px;
  color: var(--muted);
}

.metric {
  padding: 10px 4px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.metric-value {
  font-size: 16px;
  font-weight: 700;
}

.metric-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 40rem;
  transform: translateX(-50%);
  padding: 6px 8px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: rgba(11, 17, 32, 0.9);
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  backdrop-filter: blur(18px);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.tab-icon {
  font-size: 20px;
  line-height: 1;
  filter: grayscale(0.7) opacity(0.7);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.tab-active {
  color: #e0f2fe;
  background: rgba(56, 189, 248, 0.12);
}

.tab-active .tab-icon {
  filter: none;
  transform: translateY(-1px);
}

.toast {
  pointer-events: auto;
  max-width: 22rem;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.18s ease;
}

.toast-ok {
  border-color: rgba(52, 211, 153, 0.4);
}

.toast-error {
  border-color: rgba(251, 113, 133, 0.45);
  color: #ffe4e6;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section[data-screen] {
  animation: fade-in 0.18s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.spin {
  animation: spin 0.9s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.done-title {
  text-decoration: line-through;
  color: #64748b;
}

.parcel-card {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.45);
  padding: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-sky {
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.16);
}

.badge-green {
  color: #bbf7d0;
  background: rgba(52, 211, 153, 0.16);
}

.badge-amber {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.16);
}

.badge-rose {
  color: #fecdd3;
  background: rgba(251, 113, 133, 0.16);
}

.badge-slate {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.14);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
  font-size: 14px;
  cursor: pointer;
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn-danger {
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.25);
  background: rgba(251, 113, 133, 0.08);
}

.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1.5px solid rgba(148, 163, 184, 0.45);
  background: transparent;
  color: transparent;
  font-size: 13px;
  cursor: pointer;
}

.check-on {
  border-color: var(--ok);
  background: rgba(52, 211, 153, 0.18);
  color: var(--ok);
}

.meter-row {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.4);
  padding: 12px;
}

.meter-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.meter-input:focus {
  border-color: rgba(56, 189, 248, 0.7);
}

.skeleton {
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.1), rgba(148, 163, 184, 0.2), rgba(148, 163, 184, 0.1));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
