/* ==========================================================================
   LAAVI 24H — Agendamento, acompanhamento e painel
   Complementa main.css (tokens, botões, cartões e ícones são reaproveitados).
   Organização: 1 Estrutura · 2 Formulário · 3 Confirmação · 4 Acompanhamento · 5 Painel
   ========================================================================== */

/* 1. ESTRUTURA ============================================================ */
[hidden] { display: none !important; }
.app-grid.is-single { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
.app { min-height: 100svh; display: flex; flex-direction: column; background: var(--c-paper); }
.app-top { background: var(--c-ink); color: var(--c-text-inv); }
.app-top__inner { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.app-top__logo img { width: 92px; height: auto; }
.app-top__nav { display: flex; align-items: center; gap: var(--sp-2); }
.app-top__link { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem; font-size: var(--fs-sm); font-weight: 600; color: var(--c-muted-inv); border-radius: var(--r-pill); transition: color var(--t-fast); }
.app-top__link:hover { color: #fff; }
.app-top__link .icon { width: 1.05em; height: 1.05em; }
.app-top .btn--sm { min-height: 40px; }
@media (max-width: 520px) { .app-top__link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

.app-hero { background: var(--c-ink); color: var(--c-text-inv); padding: clamp(2.2rem, 5vw, 4rem) 0 clamp(6.5rem, 11vw, 8.5rem); position: relative; overflow: hidden; isolation: isolate; }
.app-hero::before {
  content: ""; position: absolute; inset: auto -10% -60% auto; width: min(680px, 90vw); aspect-ratio: 1; z-index: -1;
  background: radial-gradient(closest-side, rgba(43,191,176,.22), transparent 70%);
}
.app-hero .eyebrow { color: var(--c-teal); }
.app-hero .h1 { font-size: clamp(2.3rem, 3.6vw + 1rem, 4rem); max-width: 18ch; margin-top: var(--sp-4); }
.app-hero .h1 em { color: var(--c-teal); }
.app-hero .lead { color: var(--c-muted-inv); margin-top: var(--sp-4); }

.app-main { flex: 1; margin-top: clamp(-5.5rem, -9vw, -4rem); padding-bottom: var(--sp-9); position: relative; }
.app-grid { display: grid; gap: var(--sp-5); align-items: start; }
@media (min-width: 980px) { .app-grid { grid-template-columns: minmax(0, 1fr) 360px; gap: var(--sp-6); } .app-aside { position: sticky; top: var(--sp-5); } }

.panel { background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: clamp(1.35rem, 3.4vw, 2.5rem); }
.panel--ink { background: var(--c-ink); color: var(--c-text-inv); border-color: transparent; }
.panel + .panel { margin-top: var(--sp-5); }
.panel__title { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.5rem, 1.4vw + 1rem, 2rem); letter-spacing: -.02em; line-height: 1.15; }

.app-foot { padding: var(--sp-6) 0 calc(var(--sp-6) + env(safe-area-inset-bottom)); background: #070F1B; color: var(--c-muted-inv); font-size: var(--fs-sm); }
.app-foot__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-3); }
.app-foot a { color: var(--c-text-inv); font-weight: 600; }

/* Estados de carregamento e mensagens */
.state { display: grid; justify-items: center; gap: var(--sp-4); padding: var(--sp-8) var(--sp-4); text-align: center; }
.state .icon { width: 40px; height: 40px; color: var(--c-teal-deep); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--c-teal-soft); border-top-color: var(--c-teal-deep); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .9rem 1.1rem; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600; background: #FDECEC; color: #8A1C1C; }
.alert .icon { margin-top: .1rem; }
.alert[hidden] { display: none; }
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .6rem; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; border-radius: var(--r-pill); background: var(--c-teal-soft); color: var(--c-teal-deep); }
.badge--muted { background: var(--c-paper-2); color: var(--c-muted); }
.badge--ink { background: var(--c-ink); color: var(--c-teal); }

/* 2. FORMULÁRIO =========================================================== */
.form { display: grid; gap: clamp(2rem, 4vw, 2.75rem); }
.fstep { display: grid; gap: var(--sp-5); border: 0; margin: 0; padding: 0; min-width: 0; }
.fstep + .fstep { padding-top: clamp(2rem, 4vw, 2.75rem); border-top: 1px solid var(--c-line); }
.fstep__head { display: flex; gap: var(--sp-4); align-items: baseline; padding: 0; }
.fstep__num { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--c-ink); color: var(--c-teal); font-size: .8rem; font-weight: 800; transform: translateY(-2px); }
.fstep__title { font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; }
.fstep__hint { display: block; margin-top: .15rem; font-size: var(--fs-sm); font-weight: 500; color: var(--c-muted); }

.fields { display: grid; gap: var(--sp-4); }
@media (min-width: 640px) { .fields--2 { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: .45rem; min-width: 0; }
.field label, .field__label { font-size: var(--fs-sm); font-weight: 700; }
.field .opt { font-weight: 500; color: var(--c-muted); }
.input {
  width: 100%; min-height: 54px; padding: .85rem 1rem; font: inherit; font-size: 1rem; color: var(--c-text);
  background: var(--c-paper); border: 1px solid var(--c-line); border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.input::placeholder { color: #8E97A6; }
.input:hover { border-color: rgba(19,33,58,.28); }
.input:focus { outline: none; background: #fff; border-color: var(--c-teal-deep); box-shadow: 0 0 0 4px rgba(43,191,176,.18); }
textarea.input { min-height: 104px; resize: vertical; line-height: 1.5; }
.field__err { font-size: var(--fs-xs); font-weight: 700; color: #B42318; }
.field__err:empty { display: none; }
.is-invalid .input, .is-invalid .chips { border-color: #D92D20; }
.is-invalid .input { box-shadow: 0 0 0 4px rgba(217,45,32,.1); }

/* Seletor de dia (rolagem horizontal) e horário (grade) */
.days { display: flex; gap: .6rem; overflow-x: auto; scroll-snap-type: x proximity; padding: 4px 2px 10px; margin: -4px -2px 0; scrollbar-width: thin; }
.day, .slot {
  position: relative; flex: none; display: grid; place-items: center; text-align: center;
  border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-paper); cursor: pointer;
  transition: border-color var(--t-fast), background-color var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease);
}
.day { width: 76px; padding: .7rem .4rem; gap: .1rem; scroll-snap-align: start; }
.day__wd { font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--c-muted); }
.day__n { font-family: var(--f-display); font-size: 1.7rem; line-height: 1.1; }
.day__m { font-size: .75rem; font-weight: 600; color: var(--c-muted); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .6rem; }
.slot { min-height: 52px; padding: .6rem; font-weight: 700; font-size: .95rem; }
.day input, .slot input { position: absolute; opacity: 0; pointer-events: none; }
.day:hover, .slot:hover { border-color: rgba(19,33,58,.3); transform: translateY(-1px); }
.day:has(input:checked), .slot:has(input:checked) { background: var(--c-ink); border-color: var(--c-ink); color: #fff; }
.day:has(input:checked) .day__wd, .day:has(input:checked) .day__m { color: var(--c-teal); }
.day:has(input:focus-visible), .slot:has(input:focus-visible) { outline: 2px solid var(--c-teal); outline-offset: 3px; }
.slots__empty { padding: 1rem; font-size: var(--fs-sm); color: var(--c-muted); background: var(--c-paper); border-radius: var(--r-sm); }

/* Opção de passadoria (cartão-checkbox) */
.choice { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-4); align-items: center; padding: 1.1rem 1.2rem; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-paper); cursor: pointer; transition: border-color var(--t-fast), background-color var(--t-fast); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice__ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #fff; color: var(--c-teal-deep); border: 1px solid var(--c-line); }
.choice__txt strong { display: block; font-weight: 700; }
.choice__txt span { font-size: var(--fs-sm); color: var(--c-muted); }
.choice__box { width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid rgba(19,33,58,.3); display: grid; place-items: center; color: transparent; transition: background-color var(--t-fast), border-color var(--t-fast); }
.choice__box .icon { width: 15px; height: 15px; stroke-width: 2.6; }
.choice:hover { border-color: rgba(19,33,58,.3); }
.choice:has(input:checked) { border-color: var(--c-teal-deep); background: #F0FAF8; }
.choice:has(input:checked) .choice__box { background: var(--c-teal-deep); border-color: var(--c-teal-deep); color: #fff; }
.choice:has(input:focus-visible) { outline: 2px solid var(--c-teal); outline-offset: 3px; }

.form__submit { display: grid; gap: var(--sp-3); }
.form__submit .btn { width: 100%; min-height: 58px; font-size: 1.02rem; }
.form__legal { font-size: var(--fs-xs); color: var(--c-muted); text-align: center; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.btn.is-loading .icon { animation: spin .9s linear infinite; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Resumo lateral */
.summary { display: grid; gap: var(--sp-5); }
.summary dl { display: grid; gap: var(--sp-3); margin: 0; }
.summary dl div { display: flex; justify-content: space-between; gap: var(--sp-4); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--c-line-inv); font-size: var(--fs-sm); }
.summary dt { color: var(--c-muted-inv); }
.summary dd { margin: 0; font-weight: 700; text-align: right; color: #fff; }
.summary dd.is-empty { color: var(--c-muted-inv); font-weight: 500; }
.flow { display: grid; gap: var(--sp-4); counter-reset: f; }
.flow li { counter-increment: f; display: grid; grid-template-columns: 28px 1fr; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--c-muted-inv); }
.flow li::before { content: counter(f); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--c-line-inv); color: var(--c-teal); font-size: .75rem; font-weight: 800; }
.flow strong { display: block; color: #fff; font-weight: 700; }

/* 3. CONFIRMAÇÃO ========================================================== */
.done { display: grid; gap: var(--sp-6); justify-items: start; }
.done__check { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--c-teal-soft); color: var(--c-teal-deep); }
.done__check .icon { width: 30px; height: 30px; stroke-width: 2.4; }
.done__code { font-family: var(--f-display); font-size: clamp(2.2rem, 4vw, 3rem); letter-spacing: .02em; line-height: 1; }
.done__facts { display: grid; gap: var(--sp-3); width: 100%; margin: 0; }
@media (min-width: 640px) { .done__facts { grid-template-columns: repeat(3, 1fr); } }
.done__facts div { padding: .9rem 1rem; background: var(--c-paper); border-radius: var(--r-sm); }
.done__facts dt { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); }
.done__facts dd { margin: .2rem 0 0; font-weight: 700; }
.linkbox { width: 100%; display: grid; gap: var(--sp-3); padding: var(--sp-5); border: 1px dashed rgba(15,122,112,.45); border-radius: var(--r-md); background: #F0FAF8; }
.linkbox__label { font-size: var(--fs-sm); font-weight: 700; color: var(--c-teal-deep); display: flex; gap: .5rem; align-items: center; }
.linkbox__row { display: flex; gap: var(--sp-2); }
.linkbox__row .input { min-height: 48px; font-size: .9rem; background: #fff; text-overflow: ellipsis; }
.linkbox__row .btn { flex: none; min-height: 48px; }
.done .btn-row { width: 100%; }
@media (max-width: 560px) { .done .btn-row .btn { width: 100%; } .linkbox__row { flex-direction: column; } }

/* 4. ACOMPANHAMENTO ======================================================= */
.track-head { display: grid; gap: var(--sp-5); }
@media (min-width: 760px) { .track-head { grid-template-columns: 1fr auto; align-items: end; } }
.track-head__code { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-top: var(--sp-4); }
.progress { display: grid; gap: var(--sp-3); margin-top: var(--sp-6); }
.progress__bar { height: 8px; border-radius: var(--r-pill); background: rgba(255,255,255,.1); overflow: hidden; }
.progress__fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--c-teal-deep), var(--c-teal)); transition: width 1s var(--ease); }
.progress__meta { display: flex; justify-content: space-between; gap: var(--sp-4); font-size: var(--fs-sm); color: var(--c-muted-inv); }
.progress__meta strong { color: #fff; }

.timeline { display: grid; }
.tl { position: relative; display: grid; grid-template-columns: 48px 1fr; gap: var(--sp-4); padding-bottom: var(--sp-6); }
.tl:last-child { padding-bottom: 0; }
.tl::before { content: ""; position: absolute; left: 23px; top: 50px; bottom: 4px; width: 2px; border-radius: 2px; background: var(--c-line); }
.tl:last-child::before { display: none; }
.tl__dot { position: relative; z-index: 1; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--c-paper); border: 1px solid var(--c-line); color: #9AA3B2; }
.tl__dot .icon { width: 21px; height: 21px; }
.tl__body { padding-top: .55rem; display: grid; gap: .25rem; }
.tl__top { display: flex; flex-wrap: wrap; gap: .4rem var(--sp-3); align-items: center; }
.tl__label { font-weight: 700; font-size: 1.05rem; color: var(--c-muted); }
.tl__desc { font-size: var(--fs-sm); color: var(--c-muted); }
.tl__at { font-size: var(--fs-xs); font-weight: 600; color: var(--c-muted); }
.tl.is-done::before { background: var(--c-teal-deep); }
.tl.is-done .tl__dot { background: var(--c-teal-deep); border-color: var(--c-teal-deep); color: #fff; }
.tl.is-done .tl__label { color: var(--c-text); }
.tl.is-current .tl__dot { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-teal); box-shadow: 0 0 0 6px rgba(43,191,176,.2); }
.tl.is-current .tl__dot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--c-teal); animation: ring 2.2s var(--ease) infinite; }
@keyframes ring { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.tl.is-current .tl__label { color: var(--c-text); font-size: 1.2rem; }
.tl.is-current .tl__desc { color: var(--c-text); }
.tl.is-todo .tl__desc { display: none; }

.track-aside { display: grid; gap: var(--sp-5); }
.track-aside dl { display: grid; gap: var(--sp-4); margin: 0; }
.track-aside dt { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted-inv); }
.track-aside dd { margin: .2rem 0 0; font-weight: 700; color: #fff; }
.track-aside .btn { width: 100%; }
.live { display: inline-flex; align-items: center; gap: .55rem; font-size: var(--fs-xs); font-weight: 700; color: var(--c-muted-inv); }
.ready { display: grid; gap: var(--sp-3); padding: var(--sp-5); border-radius: var(--r-md); background: var(--c-teal-soft); color: var(--c-ink); margin-bottom: var(--sp-6); }
.ready strong { font-size: 1.15rem; }

/* 5. PAINEL =============================================================== */
.login { max-width: 440px; margin-inline: auto; }
.login .form { gap: var(--sp-5); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; margin-bottom: var(--sp-5); padding: var(--sp-3); background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.toolbar .tabs { background: var(--c-paper); border-color: transparent; }
.tabs { display: inline-flex; padding: 4px; gap: 2px; background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-pill); }
.tabs button { min-height: 40px; padding: .4rem 1rem; font-size: var(--fs-sm); font-weight: 700; color: var(--c-muted); border-radius: var(--r-pill); }
.tabs button[aria-pressed="true"] { background: var(--c-ink); color: #fff; }
.tabs .count { margin-left: .35rem; opacity: .7; font-weight: 600; }
.toolbar__right { display: flex; gap: var(--sp-2); flex: 1; justify-content: flex-end; min-width: 240px; }
.toolbar .input { min-height: 44px; max-width: 320px; background: #fff; }
.toolbar .btn--sm { flex: none; }

.orders { display: grid; gap: var(--sp-4); }
.group-title { margin-top: var(--sp-4); font-size: var(--fs-xs); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--c-muted); }
.order { display: grid; gap: var(--sp-4); padding: clamp(1.1rem, 2.4vw, 1.5rem); background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-md); }
.order__top { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; justify-content: space-between; }
.order__id { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; }
.order__code { font-weight: 800; letter-spacing: .04em; }
.order__name { font-size: 1.1rem; font-weight: 700; }
.order__meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); font-size: var(--fs-sm); color: var(--c-muted); }
.order__meta span, .order__meta a { display: inline-flex; gap: .4rem; align-items: center; }
.order__meta a { color: var(--c-teal-deep); font-weight: 700; }
.order__notes { padding: .7rem .9rem; font-size: var(--fs-sm); background: var(--c-paper); border-radius: var(--r-sm); }
.stepper { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.stepper button { display: grid; gap: .35rem; justify-items: start; padding: .55rem .6rem .5rem; text-align: left; font-size: .78rem; font-weight: 700; color: var(--c-muted); border-radius: 10px; transition: background-color var(--t-fast); }
.stepper button::before { content: ""; width: 100%; height: 5px; border-radius: 3px; background: var(--c-paper-2); }
.stepper button:hover { background: var(--c-paper); }
.stepper .is-done::before { background: var(--c-teal-deep); }
.stepper .is-current { color: var(--c-text); }
.stepper .is-current::before { background: var(--c-teal); }
.stepper button[disabled] { opacity: .5; }
@media (max-width: 600px) { .stepper button { font-size: 0; gap: 0; } .stepper .is-current { font-size: .75rem; gap: .35rem; } }
.order__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.order__actions .btn--primary { margin-right: auto; }
@media (max-width: 600px) { .order__actions .btn { flex: 1 1 auto; } .order__actions .btn--primary { flex-basis: 100%; } }
.empty { padding: var(--sp-8) var(--sp-4); text-align: center; color: var(--c-muted); background: var(--c-white); border: 1px dashed var(--c-line); border-radius: var(--r-md); }

.toast { position: fixed; left: 50%; bottom: max(var(--sp-5), env(safe-area-inset-bottom)); z-index: 120; transform: translate(-50%, 160%); padding: .8rem 1.2rem; border-radius: var(--r-pill); background: var(--c-ink); color: #fff; font-size: var(--fs-sm); font-weight: 700; box-shadow: var(--shadow-2); transition: transform .45s var(--ease); }
.toast.is-on { transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .tl.is-current .tl__dot::after, .spinner, .btn.is-loading .icon { animation: none; }
  .progress__fill, .toast { transition: none; }
}
