:root {
    --navy: #003d66;
    --navy-dark: #002540;
    --teal: #008f86;
    --red: #c41c3b;
    --ink: #14212b;
    --muted: #5c6b75;
    --line: #d8e1e6;
    --surface: #ffffff;
    --canvas: #edf3f5;
    --success: #137a4d;
    --warning: #9a5b00;
    --danger: #a61b32;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--ink);
    background: linear-gradient(160deg, #f7fafb 0%, var(--canvas) 62%, #e2eef0 100%);
    font-family: "Trebuchet MS", "Avenir Next", sans-serif;
    letter-spacing: 0;
}

button, input, select { font: inherit; letter-spacing: 0; }

.app-header {
    min-height: 72px;
    padding: 10px max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--red); font-weight: 800; text-decoration: none; }
.brand img { width: 52px; height: 52px; object-fit: contain; }
.test-mode-badge { padding: 6px 9px; border: 1px solid #d79600; color: #835600; background: #fff4cf; font-size: 11px; }
.icon-button { width: 48px; height: 48px; border: 1px solid var(--line); background: white; color: var(--navy); font-size: 24px; cursor: pointer; }

.app-shell { width: min(100%, 760px); margin: 0 auto; padding: 34px 18px 64px; }
.auth-view { max-width: 430px; margin: 7vh auto 0; }
.eyebrow { color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: 0.12em; }
h1 { margin: 8px 0 28px; color: var(--navy-dark); font-size: clamp(28px, 8vw, 42px); line-height: 1.05; letter-spacing: 0; }
.workspace-heading { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.technician-name { color: var(--muted); font-size: 13px; text-align: right; }

label { display: block; margin: 18px 0 7px; font-weight: 700; font-size: 14px; }
.optional-label { color: var(--muted); font-size: 12px; font-weight: 400; }
input, select {
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    border: 1px solid #afbec7;
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
}
input:focus, select:focus { outline: 3px solid rgba(0, 143, 134, 0.22); border-color: var(--teal); }
.phone-input { display: grid; grid-template-columns: 60px 1fr; align-items: center; border: 1px solid #afbec7; border-radius: 6px; background: white; overflow: hidden; }
.phone-input span { text-align: center; color: var(--navy); font-weight: 800; }
.phone-input input { border: 0; border-left: 1px solid var(--line); border-radius: 0; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.primary-button, .secondary-button, .activate-button {
    width: 100%; min-height: 52px; margin-top: 24px; padding: 12px 16px; border-radius: 6px;
    border: 0; font-weight: 800; cursor: pointer;
}
.primary-button { background: var(--navy); color: white; }
.secondary-button { background: white; color: var(--navy); border: 1px solid var(--navy); }
.activate-button { background: var(--red); color: white; }
button:disabled { opacity: 0.55; cursor: wait; }
.button-row { display: grid; grid-template-columns: 1fr 1.45fr; gap: 10px; }

.progress { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); padding: 0; margin: 0 0 30px; border-bottom: 2px solid var(--line); }
.progress li { padding: 0 2px 10px; color: var(--muted); font-size: 11px; text-align: center; overflow: hidden; }
.progress li.active { color: var(--navy); font-weight: 800; border-bottom: 3px solid var(--teal); margin-bottom: -2px; }

.message { padding: 12px 14px; border-left: 4px solid; background: white; }
.error { color: var(--danger); border-color: var(--danger); }
.warning { color: var(--warning); border-color: var(--warning); }
.success { color: var(--success); border-color: var(--success); }
.field-note, .privacy-note { color: var(--muted); font-size: 13px; line-height: 1.45; }
.status-panel { padding: 18px; border-left: 5px solid var(--line); background: white; }
.status-panel.captured { border-color: var(--success); }
.status-panel p { margin: 6px 0 0; color: var(--muted); line-height: 1.5; }
.package-detail { margin-top: 14px; padding: 16px; background: white; border-left: 5px solid var(--teal); }

.review-list { margin: 0; display: grid; grid-template-columns: minmax(105px, 0.65fr) 1.35fr; border-top: 1px solid var(--line); }
.review-list dt, .review-list dd { margin: 0; padding: 11px 4px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.review-list dt { color: var(--muted); font-size: 13px; }
.review-list dd { font-weight: 700; }
.result-view { text-align: center; }
.result-view .review-list { text-align: left; margin-top: 24px; }
.result-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; color: white; background: var(--success); font-size: 30px; }
.result-view p { color: var(--muted); line-height: 1.55; }
.hidden { display: none !important; }

@media (max-width: 699px) {
    .field-row { grid-template-columns: 1fr; gap: 0; }
    .button-row { grid-template-columns: 1fr; gap: 0; }
    .review-list { grid-template-columns: 1fr; }
    .review-list dt { padding-bottom: 2px; border-bottom: 0; }
    .review-list dd { padding-top: 2px; }
    .brand span { font-size: 14px; }
    .progress li { font-size: 9px; }
    .app-shell { padding-left: 14px; padding-right: 14px; }
}

@media (min-width: 700px) {
    .app-shell { padding-top: 52px; }
    #onboarding-form, .result-view { padding: 28px 34px 34px; background: rgba(255, 255, 255, 0.72); border: 1px solid var(--line); }
}
