:root {
  --bg: #0a0a0f;
  --panel: #14141c;
  --panel2: #1b1b25;
  --border: #26262e;
  --text: #e8e8ee;
  --muted: #9a9aa6;
  --accent: #ff8a2b;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --yellow: #eab308;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); font-family: 'Outfit', sans-serif; min-height: 100%; }
body { padding-bottom: 90px; }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 36px 28px; width: 100%; max-width: 360px; text-align: center; }
.login-card .logo { font-size: 44px; margin-bottom: 8px; }
.login-card h1 { font-size: 22px; font-weight: 700; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 4px 0 22px; }
.login-card input { width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel2); color: var(--text); font-size: 16px; margin-bottom: 14px; }
.login-card button { width: 100%; padding: 14px; border-radius: 12px; border: none; background: var(--accent); color: #14100b; font-weight: 700; font-size: 16px; cursor: pointer; }
.login-error { background: #ef444422; color: var(--red); border-radius: 10px; padding: 10px; font-size: 14px; margin-bottom: 14px; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: rgba(10,10,15,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font-size: 18px; cursor: pointer; text-decoration: none; }
.icon-btn:active { background: var(--panel2); }
.icon-btn.spinning { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

main { max-width: 760px; margin: 0 auto; padding: 16px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; }
.tab { flex: 1; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #14100b; }
.tab .count { opacity: .75; font-weight: 400; }

/* ---------- Parcel cards ---------- */
.parcel-list { display: flex; flex-direction: column; gap: 12px; }
.parcel-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px; cursor: pointer; transition: border-color .15s; }
.parcel-card:active { border-color: var(--accent); }
.pc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pc-name { font-size: 16px; font-weight: 700; }
.pc-num { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.badge { padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.InTransit, .badge.InfoReceived { background: #3b82f622; color: var(--blue); }
.badge.OutForDelivery, .badge.AvailableForPickup { background: #eab30822; color: var(--yellow); }
.badge.Delivered { background: #22c55e22; color: var(--green); }
.badge.DeliveryFailure, .badge.Exception, .badge.Expired { background: #ef444422; color: var(--red); }
.badge.NotFound, .badge.Pending { background: #9a9aa622; color: var(--muted); }
.pc-carrier { font-size: 12px; color: var(--accent); margin-top: 8px; }
.pc-event { font-size: 13px; color: var(--text); margin-top: 6px; line-height: 1.4; }
.pc-time { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); margin-top: 4px; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.hidden { display: none !important; }
.quota { text-align: center; color: var(--muted); font-size: 11px; margin-top: 26px; font-family: 'JetBrains Mono', monospace; }

/* ---------- FAB ---------- */
.fab { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 50%; border: none; background: var(--accent); color: #14100b; font-size: 30px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 24px #ff8a2b55; z-index: 30; }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(4px); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 20px 20px 0 0; padding: 22px; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; }
@media (min-width: 600px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 20px; }
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { font-size: 19px; }
.modal-card label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.modal-card label .hint { font-size: 11px; opacity: .8; }
.modal-card input[type=text] { width: 100%; padding: 13px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel2); color: var(--text); font-size: 16px; font-family: inherit; }
.primary-btn { width: 100%; margin-top: 18px; padding: 14px; border-radius: 12px; border: none; background: var(--accent); color: #14100b; font-weight: 700; font-size: 16px; cursor: pointer; }
.primary-btn:disabled { opacity: .5; }
.secondary-btn, .danger-btn { flex: 1; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel2); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; }
.danger-btn { color: var(--red); border-color: #ef444455; }
.form-error { background: #ef444422; color: var(--red); border-radius: 10px; padding: 10px; font-size: 13px; margin-top: 12px; }

.carrier-results { border: 1px solid var(--border); border-radius: 12px; margin-top: 6px; max-height: 180px; overflow-y: auto; background: var(--panel2); }
.carrier-item { padding: 12px 14px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.carrier-item:last-child { border-bottom: none; }
.carrier-item:hover, .carrier-item:active { background: var(--panel); color: var(--accent); }

/* ---------- Detail modal ---------- */
.detail-meta { font-size: 13px; color: var(--muted); line-height: 1.7; }
.detail-meta .mono { font-family: 'JetBrains Mono', monospace; color: var(--text); word-break: break-all; }
.detail-actions { display: flex; gap: 10px; margin: 16px 0; }
.timeline-title { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.timeline { border-left: 2px solid var(--border); margin-left: 8px; padding-left: 18px; }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before { content: ''; position: absolute; left: -24px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.tl-item:first-child::before { background: var(--accent); box-shadow: 0 0 10px #ff8a2b88; }
.tl-item.delivered::before { background: var(--green); box-shadow: 0 0 10px #22c55e88; }
.tl-desc { font-size: 14px; line-height: 1.4; }
.tl-meta { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); background: var(--panel2); border: 1px solid var(--accent); color: var(--text); padding: 12px 20px; border-radius: 12px; font-size: 14px; z-index: 60; max-width: 90vw; text-align: center; }
