:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --ink: #17211d;
  --muted: #77817c;
  --line: #e5e7e2;
  --green: #1e8060;
  --green-dark: #17684e;
  --mint: #dff3e9;
  --blue: #e2effb;
  --amber: #f6ead0;
  --red: #f9e3df;
  --shadow: 0 18px 50px rgba(31, 52, 43, 0.12);
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }

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

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

.app-shell { width: min(100%, 620px); min-height: 100vh; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 104px); }

.topbar, .sheet-header, .section-heading { display: flex; align-items: center; justify-content: space-between; }
.topbar { margin-bottom: 22px; }
.topbar h1, .sheet-header h2 { margin: 3px 0 0; font-size: 29px; letter-spacing: -.8px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.72); }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.close-sheet { font-size: 27px; font-weight: 300; }

.summary-card { position: relative; min-height: 158px; overflow: hidden; display: flex; justify-content: space-between; padding: 25px 23px; border-radius: 26px; color: #fff; background: linear-gradient(145deg, #257c5e 0%, #166347 100%); box-shadow: 0 18px 42px rgba(22, 99, 71, .22); }
.summary-card::after { content: ""; position: absolute; width: 170px; height: 170px; right: -55px; bottom: -90px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 28px rgba(255,255,255,.045), 0 0 0 58px rgba(255,255,255,.03); }
.summary-card > div:first-child { position: relative; z-index: 1; max-width: 72%; }
.summary-kicker { margin: 0 0 9px; font-size: 12px; font-weight: 700; letter-spacing: .1em; color: rgba(255,255,255,.68); }
.summary-card h2 { margin: 0; font-size: 22px; line-height: 1.25; letter-spacing: -.35px; }
.summary-card p:last-child { margin: 11px 0 0; color: rgba(255,255,255,.72); font-size: 13px; line-height: 1.45; }
.summary-mark { position: relative; z-index: 1; align-self: center; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 17px; background: rgba(255,255,255,.13); }
.summary-mark svg { width: 31px; fill: none; stroke: white; stroke-width: 1.5; stroke-linejoin: round; }

.filters { display: flex; gap: 9px; overflow-x: auto; margin: 25px -20px 24px; padding: 0 20px 3px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 99px; padding: 9px 13px; background: rgba(255,255,255,.72); font-size: 13px; }
.filter-chip b { min-width: 19px; height: 19px; display: grid; place-items: center; padding: 0 5px; border-radius: 99px; background: #e9ece8; font-size: 10px; }
.filter-chip.active { color: white; background: var(--ink); border-color: var(--ink); }
.filter-chip.active b { color: var(--ink); background: white; }

.section-heading { margin: 0 2px 14px; }
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.text-button { border: 0; padding: 8px; background: transparent; color: var(--green); font-size: 13px; font-weight: 700; }

.package-list { display: grid; gap: 12px; }
.package-card { width: 100%; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 13px; padding: 17px 15px; text-align: left; border: 1px solid rgba(225,228,222,.85); border-radius: 20px; background: rgba(255,255,255,.92); box-shadow: 0 7px 22px rgba(33,50,43,.045); }
.carrier-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; background: var(--mint); color: var(--green-dark); font-size: 14px; font-weight: 800; }
.package-card h3 { margin: 0 0 5px; font-size: 16px; letter-spacing: -.2px; }
.package-meta { display: flex; align-items: center; gap: 6px; margin: 0 0 7px; color: var(--muted); font-size: 11px; }
.package-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.package-event { margin: 0; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #535e58; font-size: 12px; }
.status-pill { align-self: start; border-radius: 99px; padding: 6px 9px; color: var(--green-dark); background: var(--mint); font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-delivering, .status-pickup { background: var(--amber); color: #87611c; }
.status-exception { background: var(--red); color: #a14a3d; }
.status-pending { background: #ececea; color: #6e736f; }

.empty-state { padding: 48px 25px; text-align: center; border: 1px dashed #d7dbd5; border-radius: 24px; background: rgba(255,255,255,.44); }
.empty-icon { width: 66px; height: 66px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 22px; background: var(--mint); }
.empty-icon svg { width: 34px; fill: none; stroke: var(--green); stroke-width: 1.5; stroke-linejoin: round; }
.empty-state h3 { margin: 0; font-size: 17px; }
.empty-state p { margin: 8px auto 19px; max-width: 250px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.secondary-button { border: 1px solid var(--line); border-radius: 13px; padding: 11px 17px; background: white; font-size: 13px; font-weight: 700; }

.bottom-nav { position: fixed; z-index: 10; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 12px); transform: translateX(-50%); width: min(calc(100% - 32px), 480px); height: 72px; display: grid; grid-template-columns: 1fr 88px 1fr; align-items: center; padding: 0 17px; border: 1px solid rgba(225,228,222,.9); border-radius: 25px; background: rgba(255,255,255,.93); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.nav-item { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: #949b97; font-size: 10px; font-weight: 700; }
.nav-item svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.active { color: var(--green); }
.add-button { width: 58px; height: 58px; display: grid; place-items: center; justify-self: center; border: 0; border-radius: 20px; color: white; background: var(--green); box-shadow: 0 11px 24px rgba(30,128,96,.28); }
.add-button svg { width: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.sheet-backdrop { position: fixed; z-index: 20; inset: 0; background: rgba(21,31,27,.42); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet { position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 620px); max-height: 92vh; overflow-y: auto; padding: 10px 22px calc(env(safe-area-inset-bottom) + 25px); border-radius: 29px 29px 0 0; background: #fafaf7; box-shadow: 0 -15px 55px rgba(20,35,29,.18); }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 19px; border-radius: 99px; background: #d7dad6; }
.sheet-header { margin-bottom: 22px; }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-actions button, .quick-action { min-height: 82px; display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 17px; text-align: left; background: white; cursor: pointer; }
.quick-actions strong, .quick-actions small { display: block; }
.quick-actions strong { margin-bottom: 4px; font-size: 13px; }
.quick-actions small { color: var(--muted); font-size: 10px; }
.quick-icon { flex: 0 0 auto; width: 39px; height: 39px; display: grid; place-items: center; border-radius: 13px; }
.quick-icon.mint { background: var(--mint); color: var(--green); }
.quick-icon.blue { background: var(--blue); color: #3976a6; }
.quick-icon svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.divider { display: flex; align-items: center; gap: 10px; margin: 21px 0 17px; color: #a2a8a4; font-size: 10px; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }

form { display: grid; gap: 14px; }
form label > span { display: block; margin: 0 0 7px 2px; color: #5c6661; font-size: 11px; font-weight: 700; }
form label em { color: #9ba19e; font-style: normal; font-weight: 400; }
input, select { width: 100%; height: 48px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; outline: none; background: white; color: var(--ink); font-size: 14px; }
input:focus, select:focus { border-color: #76ac99; box-shadow: 0 0 0 3px rgba(30,128,96,.09); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary-button { width: 100%; min-height: 50px; border: 0; border-radius: 15px; color: white; background: var(--green); font-size: 14px; font-weight: 800; box-shadow: 0 9px 20px rgba(30,128,96,.2); }

.detail-hero { padding: 19px; border-radius: 20px; background: var(--mint); }
.detail-status { display: flex; align-items: center; justify-content: space-between; }
.detail-status strong { font-size: 19px; }
.detail-number { margin: 8px 0 0; color: #527064; font-size: 12px; letter-spacing: .05em; }
.detail-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 13px 0 25px; }
.detail-actions button, .detail-actions a { min-height: 42px; display: grid; place-items: center; padding: 0 5px; border: 1px solid var(--line); border-radius: 12px; background: white; color: inherit; font-size: 12px; font-weight: 700; text-decoration: none; }
.detail-actions .danger-action { color: #a14a3d; background: #fff8f6; }
.detail-actions button:disabled, .text-button:disabled { opacity: .55; }
.detail-refresh-time { margin: -13px 0 23px; color: var(--muted); text-align: center; font-size: 10px; }
.timeline-title { margin: 0 0 15px; font-size: 14px; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding: 0 0 22px 25px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 4px; width: 8px; height: 8px; border: 3px solid #fafaf7; border-radius: 50%; background: #c6cbc7; box-shadow: 0 0 0 1px #c6cbc7; }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 16px; bottom: 2px; width: 1px; background: #dfe2de; }
.timeline li:first-child { color: var(--ink); }
.timeline li:first-child::before { background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; margin-top: 3px; color: #a0a7a3; font-size: 10px; }

.settings-list { overflow: hidden; border: 1px solid var(--line); border-radius: 19px; background: white; }
.settings-list button, .settings-button { width: 100%; min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left; cursor: pointer; }
.settings-list > *:last-of-type { border-bottom: 0; }
.settings-list strong, .settings-list small { display: block; }
.settings-list strong { margin-bottom: 4px; font-size: 13px; }
.settings-list small { color: var(--muted); font-size: 10px; }
.settings-list b { color: var(--green); font-size: 11px; }
.privacy-note { display: flex; gap: 13px; margin-top: 16px; padding: 16px; border-radius: 17px; background: var(--mint); }
.privacy-note svg { flex: 0 0 23px; width: 23px; fill: none; stroke: var(--green); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.privacy-note strong { font-size: 12px; }
.privacy-note p { margin: 5px 0 0; color: #5f776d; font-size: 10px; line-height: 1.55; }

.dialog { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(21,31,27,.5); }
.dialog-card { width: min(100%, 340px); padding: 28px 23px 22px; border-radius: 24px; background: white; text-align: center; box-shadow: var(--shadow); }
.dialog-icon { width: 56px; height: 56px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 18px; color: var(--green); background: var(--mint); }
.dialog-icon svg { width: 27px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dialog h2 { margin: 0; font-size: 20px; }
.dialog p { margin: 10px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 98px); transform: translate(-50%, 20px); max-width: calc(100% - 40px); padding: 11px 16px; border-radius: 99px; opacity: 0; pointer-events: none; color: white; background: #17211d; font-size: 12px; box-shadow: var(--shadow); transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

[hidden] { display: none !important; }

@media (min-width: 620px) {
  .app-shell { padding-left: 28px; padding-right: 28px; }
  .filters { margin-left: -28px; margin-right: -28px; padding-left: 28px; }
}

@media (prefers-reduced-motion: no-preference) {
  .package-card, .filter-chip, .primary-button, .add-button { transition: transform .16s ease, box-shadow .16s ease; }
  .package-card:active, .filter-chip:active, .primary-button:active, .add-button:active { transform: scale(.975); }
}
