/* ============================================================
   CAMAMU ADVENTURE LOGISTICS — Design System
   Identidade: azul-marinho + dourado · estética náutica
   ============================================================ */

:root {
    /* Azul-marinho */
    --navy-900: #0A1626;
    --navy-800: #0E1E33;
    --navy-700: #14294A;
    --navy-600: #1B355E;
    --navy-500: #24426B;

    /* Dourado */
    --gold:        #C9A24B;
    --gold-light:  #E3C77E;
    --gold-dark:   #A07D2E;

    /* Neutros */
    --cream:   #F5F1E8;
    --paper:   #FFFFFF;
    --bg:      #F2F0E9;
    --ink:     #16222E;
    --ink-soft:#3A4754;
    --muted:   #6B7785;
    --line:    #E5E1D6;
    --line-cool:#E7EAEF;

    /* Status */
    --ok:#2E7D5B;      --ok-bg:#E6F2EB;
    --warn:#B07D1F;    --warn-bg:#F8EFD7;
    --info:#2F6DA8;    --info-bg:#E4EEF7;
    --transit:#2C7A8C; --transit-bg:#E1F0F2;
    --danger:#B23A48;  --danger-bg:#F8E6E8;
    --neutral:#5B6B73; --neutral-bg:#ECEFF1;

    /* Tipografia */
    --font-sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --font-display: 'Marcellus', 'Cormorant Garamond', Georgia, serif;

    /* Forma */
    --r-sm: 8px;
    --r:    12px;
    --r-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(14,30,51,.06), 0 1px 3px rgba(14,30,51,.05);
    --shadow:    0 6px 24px rgba(14,30,51,.08), 0 2px 6px rgba(14,30,51,.05);
    --shadow-lg: 0 24px 60px rgba(10,22,38,.18);

    --sidebar-w: 264px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
svg { display: block; }

/* ---------- Utilitários ---------- */
.muted { color: var(--muted); }
.gold  { color: var(--gold-dark); }
.tnum  { font-variant-numeric: tabular-nums; }
.eyebrow {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: .22em;
    font-size: .68rem;
    color: var(--gold-dark);
}
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; }
.center { display: flex; align-items: center; gap: .55rem; }
.grow { flex: 1; }
.wrap { flex-wrap: wrap; }

/* ============================================================
   APP SHELL  (sidebar + conteúdo)
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
    color: #D9E1EC;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid rgba(201,162,75,.18);
}
.sidebar__brand {
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar__base {
    margin: 16px 16px 6px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(201,162,75,.22);
    border-radius: var(--r);
    padding: 10px 12px;
}
.sidebar__base label {
    display: block;
    font-size: .62rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--gold-light);
    margin-bottom: 4px;
}
.sidebar__base .base-current { display: flex; align-items: center; gap: .5rem; color: #fff; font-weight: 500; }
.sidebar__base .base-current svg { color: var(--gold); }
.sidebar__base .chev { margin-left: auto; opacity: .5; }

.nav { padding: 12px 12px 24px; overflow-y: auto; flex: 1; }
.nav-section {
    font-size: .6rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: rgba(217,225,236,.4);
    padding: 16px 12px 6px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    color: #C6D0DE;
    font-size: .92rem;
    font-weight: 500;
    margin-bottom: 2px;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}
.nav-link svg { width: 19px; height: 19px; flex: 0 0 19px; opacity: .85; }
.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-link.active {
    background: linear-gradient(90deg, rgba(201,162,75,.18), rgba(201,162,75,.02));
    color: #fff;
    border-left-color: var(--gold);
}
.nav-link.active svg { color: var(--gold-light); opacity: 1; }
.nav-link .tag {
    margin-left: auto;
    background: var(--gold);
    color: var(--navy-900);
    font-size: .66rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
}
.sidebar__foot {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,.07);
    font-size: .72rem;
    color: rgba(217,225,236,.55);
    display: flex; align-items: center; gap: .5rem;
}
.sidebar__foot svg { color: var(--gold); opacity: .8; }

/* ---------- Main column ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 64px;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 20;
}
.topbar__crumb { font-size: .8rem; color: var(--muted); }
.topbar__crumb b { color: var(--ink); font-weight: 600; }
.topbar__search {
    margin-left: 8px;
    display: flex; align-items: center; gap: .5rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 14px;
    color: var(--muted);
    font-size: .85rem;
    min-width: 240px;
}
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid var(--line); background: #fff;
    display: grid; place-items: center; color: var(--ink-soft);
    position: relative;
}
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: .6rem; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-600), var(--navy-800));
    color: var(--gold-light);
    display: grid; place-items: center;
    font-family: var(--font-display); font-size: .9rem;
    border: 1.5px solid var(--gold);
}
.user-chip .u-name { font-size: .82rem; font-weight: 600; line-height: 1.1; }
.user-chip .u-role { font-size: .7rem; color: var(--muted); }

.page { padding: 28px; max-width: 1320px; width: 100%; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-family: var(--font-display); font-size: 1.7rem; font-weight: 400; letter-spacing: .01em; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: .9rem; }

/* ============================================================
   COMPONENTES
   ============================================================ */

/* ---------- Cards ---------- */
.card {
    background: var(--paper);
    border: 1px solid var(--line-cool);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
}
.card__head {
    display: flex; align-items: center; gap: .6rem;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-cool);
}
.card__head h3 { font-size: 1rem; font-weight: 600; }
.card__head .eyebrow { margin-right: auto; }
.card__head .link { margin-left: auto; color: var(--info); font-size: .82rem; font-weight: 600; }
.card__body { padding: 20px; }
.card--navy {
    background: linear-gradient(150deg, var(--navy-700), var(--navy-900));
    color: #E7ECF3; border-color: var(--navy-600);
}
.card--navy .card__head { border-color: rgba(255,255,255,.08); }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.kpi {
    background: var(--paper);
    border: 1px solid var(--line-cool);
    border-radius: var(--r);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.kpi::after { content:""; position:absolute; right:-30px; top:-30px; width:90px; height:90px; border-radius:50%; background: radial-gradient(circle, rgba(201,162,75,.10), transparent 70%); }
.kpi__top { display: flex; align-items: center; gap: .6rem; margin-bottom: 12px; }
.kpi__icon {
    width: 40px; height: 40px; border-radius: 11px;
    display: grid; place-items: center; color: var(--navy-700);
    background: var(--cream); border: 1px solid var(--line);
}
.kpi__icon svg { width: 21px; height: 21px; }
.kpi__icon.is-gold { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: var(--navy-900); border-color: var(--gold-dark); }
.kpi__label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.kpi__value { font-family: var(--font-display); font-size: 2rem; font-weight: 400; color: var(--ink); line-height: 1; }
.kpi__value small { font-size: .9rem; color: var(--muted); font-family: var(--font-sans); }
.kpi__delta { font-size: .76rem; font-weight: 600; margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
.kpi__delta.up { color: var(--ok); }
.kpi__delta.down { color: var(--danger); }
.kpi__delta.flat { color: var(--muted); }

/* ---------- Badges de status ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .74rem; font-weight: 600;
    padding: 4px 10px; border-radius: 999px;
    background: var(--neutral-bg); color: var(--neutral);
    white-space: nowrap;
}
.badge::before { content:""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--neutral { background: var(--neutral-bg); color: var(--neutral); }
.badge--info    { background: var(--info-bg);    color: var(--info); }
.badge--warn    { background: var(--warn-bg);    color: var(--warn); }
.badge--transit { background: var(--transit-bg); color: var(--transit); }
.badge--ok      { background: var(--ok-bg);      color: var(--ok); }
.badge--danger  { background: var(--danger-bg);  color: var(--danger); }
.badge--solid   { background: var(--gold); color: var(--navy-900); }
.badge--solid::before { background: var(--navy-900); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: .88rem; font-weight: 600;
    padding: 10px 18px; border-radius: var(--r-sm);
    border: 1px solid transparent; background: var(--bg); color: var(--ink);
    transition: filter .15s, box-shadow .15s, background .15s;
}
.btn svg { width: 17px; height: 17px; }
.btn--gold { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: var(--navy-900); box-shadow: 0 2px 10px rgba(201,162,75,.35); }
.btn--gold:hover { filter: brightness(1.04); }
.btn--navy { background: var(--navy-800); color: #fff; }
.btn--navy:hover { background: var(--navy-700); }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink-soft); }
.btn--ghost:hover { border-color: var(--gold); color: var(--navy-800); }
.btn--sm { padding: 7px 12px; font-size: .8rem; }

/* ---------- Tabelas ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .87rem; }
.tbl thead th {
    text-align: left; font-weight: 600; color: var(--muted);
    font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
    padding: 12px 16px; border-bottom: 1px solid var(--line-cool); white-space: nowrap;
}
.tbl tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line-cool); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #FAFBFC; }
.tbl .code { font-family: var(--font-display); letter-spacing: .04em; color: var(--navy-700); font-size: .92rem; }
.tbl .strong { font-weight: 600; }
.tbl .right { text-align: right; }
.cell-2 { display: flex; flex-direction: column; }
.cell-2 small { color: var(--muted); font-size: .76rem; }
.route { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: .82rem; }
.route svg { color: var(--gold-dark); width: 15px; height: 15px; }

/* ---------- Mini chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 8px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar .col { width: 100%; max-width: 30px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--navy-500), var(--navy-700)); transition: height .3s; }
.bar.is-peak .col { background: linear-gradient(180deg, var(--gold-light), var(--gold)); }
.bar .lbl { font-size: .7rem; color: var(--muted); }

/* ---------- Donut / ring stat ---------- */
.ring { --p: 70; width: 120px; height: 120px; border-radius: 50%;
    background: conic-gradient(var(--gold) calc(var(--p)*1%), rgba(201,162,75,.15) 0);
    display: grid; place-items: center; position: relative; }
.ring::before { content:""; position:absolute; inset:14px; border-radius:50%; background:#fff; }
.ring span { position: relative; font-family: var(--font-display); font-size: 1.5rem; color: var(--navy-800); }

/* ---------- Alertas ---------- */
.alert { display: flex; gap: .8rem; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid; margin-bottom: 10px; font-size: .85rem; }
.alert svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.alert b { display: block; }
.alert--warn   { background: var(--warn-bg);   border-color: #EAD49B; color: #6E5113; }
.alert--danger { background: var(--danger-bg); border-color: #EBC2C7; color: #7C2530; }
.alert--info   { background: var(--info-bg);   border-color: #C3DAEC; color: #1E4670; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 20px; }
.section-title { display: flex; align-items: center; gap: .6rem; margin: 6px 0 4px; }
.section-title .n { width: 26px; height: 26px; border-radius: 8px; background: var(--navy-800); color: var(--gold-light); display: grid; place-items: center; font-size: .8rem; font-family: var(--font-display); }
.section-title h3 { font-size: .98rem; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.col-2 { grid-column: span 2; }
.field label { font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.field label .req { color: var(--danger); }
.input, .select, textarea.input {
    border: 1px solid var(--line-cool); border-radius: var(--r-sm);
    padding: 11px 13px; font-size: .9rem; font-family: inherit; color: var(--ink);
    background: #fff; width: 100%;
}
.input::placeholder { color: #A9B2BC; }
.input:focus, .select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,75,.15); }
.hint { font-size: .74rem; color: var(--muted); }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 6px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--navy-800); box-shadow: var(--shadow-sm); }

/* service picker cards */
.svc-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.svc {
    border: 1.5px solid var(--line-cool); border-radius: var(--r); padding: 16px;
    display: flex; flex-direction: column; gap: 6px; position: relative; background: #fff;
}
.svc.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,75,.12); }
.svc .svc-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--cream); display: grid; place-items: center; color: var(--navy-700); }
.svc.on .svc-ico { background: linear-gradient(135deg,var(--gold-light),var(--gold)); color: var(--navy-900); }
.svc h4 { font-size: .92rem; }
.svc p { font-size: .76rem; color: var(--muted); }
.svc .tick { position: absolute; top: 12px; right: 12px; color: var(--gold-dark); opacity: 0; }
.svc.on .tick { opacity: 1; }

/* price summary */
.summary { position: sticky; top: 84px; }
.summary .line { display: flex; justify-content: space-between; padding: 9px 0; font-size: .88rem; border-bottom: 1px dashed var(--line); }
.summary .line.total { border-bottom: 0; border-top: 2px solid var(--navy-800); margin-top: 6px; padding-top: 14px; }
.summary .line.total .v { font-family: var(--font-display); font-size: 1.5rem; color: var(--navy-800); }
.summary .v { font-weight: 600; }

/* ---------- Timeline rastreio ---------- */
.timeline { position: relative; padding-left: 8px; }
.timeline__item { display: flex; gap: 16px; padding-bottom: 22px; position: relative; }
.timeline__item::before { content:""; position: absolute; left: 11px; top: 26px; bottom: -4px; width: 2px; background: var(--line); }
.timeline__item:last-child::before { display: none; }
.tl-dot { width: 24px; height: 24px; border-radius: 50%; flex: 0 0 24px; display: grid; place-items: center; background: #fff; border: 2px solid var(--line); z-index: 1; }
.tl-dot svg { width: 12px; height: 12px; color: #fff; }
.timeline__item.done .tl-dot { background: var(--ok); border-color: var(--ok); }
.timeline__item.current .tl-dot { background: var(--gold); border-color: var(--gold-dark); box-shadow: 0 0 0 4px rgba(201,162,75,.2); }
.timeline__item.current .tl-dot svg { color: var(--navy-900); }
.timeline__item.pending .tl-dot { background: #fff; }
.timeline__item.pending .tl-body { opacity: .5; }
.tl-body { padding-top: 1px; }
.tl-body h4 { font-size: .92rem; }
.tl-body .meta { font-size: .76rem; color: var(--muted); margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.tl-body .meta .who { color: var(--ink-soft); font-weight: 500; }
/* Foto opcional de uma etapa (miniatura na linha do tempo / histórico) */
.tl-foto { display: block; margin-top: 8px; width: 132px; }
.tl-foto img { width: 100%; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: var(--bg); }
.tl-foto--sm { margin-top: 0; width: 56px; }
.tl-foto--sm img { height: 40px; border-radius: 6px; }

/* data list */
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; font-size: .88rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; color: var(--ink); }

/* ---------- Etiqueta ---------- */
.label-sheet { display: flex; justify-content: center; padding: 30px; background: #E9E6DD; border-radius: var(--r); }
.label {
    width: 384px; background: #fff; border-radius: 10px;
    box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line);
}
.label__top { background: var(--navy-800); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.label__top .ttl { font-family: var(--font-display); letter-spacing: .14em; font-size: .78rem; }
.label__top .ttl b { color: var(--gold-light); }
.label__band { background: var(--gold); color: var(--navy-900); padding: 6px 16px; font-weight: 700; font-size: .82rem; letter-spacing: .12em; display: flex; justify-content: space-between; }
.label__body { padding: 16px; display: flex; gap: 14px; }
.label__qr { width: 132px; height: 132px; flex: 0 0 132px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background:#fff; }
.label__qr svg, .label__qr img { width: 100%; height: 100%; }
.label__info { flex: 1; font-size: .82rem; }
.label__info .code { font-family: var(--font-display); font-size: 1.35rem; color: var(--navy-800); letter-spacing: .03em; }
.label__info .row { margin-top: 8px; }
.label__info .k { font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.label__info .val { font-weight: 600; color: var(--ink); }
.label__route { border-top: 1px dashed var(--line); margin-top: 12px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.label__route .pt { text-align: center; }
.label__route .pt .city { font-weight: 700; font-size: .9rem; }
.label__route .pt .tag { font-size: .64rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.label__route .arrow { color: var(--gold-dark); }
.label__foot { background: var(--cream); padding: 8px 16px; font-size: .64rem; color: var(--muted); display: flex; justify-content: space-between; border-top: 1px solid var(--line); }
.label__obs { border-top: 1px dashed var(--line); padding: 8px 16px 0; font-size: .74rem; color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.label__obs .k { font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin-right: 4px; }
/* Barras da etiqueta: desenhadas em SVG inline no componente (imprime sem depender
   de "gráficos de segundo plano" do navegador) — aqui só o posicionamento */
.barcode { display: block; height: 38px; width: 100%; margin-top: 10px; }

/* ---------- Phone / Scanner ---------- */
.phone { width: 340px; background: var(--navy-900); border-radius: 38px; padding: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--navy-600); }
.phone__screen { background: #0C1726; border-radius: 28px; overflow: hidden; position: relative; height: 660px; display: flex; flex-direction: column; }
.phone__notch { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 120px; height: 22px; background: #000; border-radius: 999px; z-index: 5; }
.scan-head { padding: 30px 18px 14px; color: #fff; text-align: center; }
.scan-head .eyebrow { color: var(--gold-light); }
.scan-head h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; margin-top: 4px; }
.scan-view { flex: 1; margin: 6px 18px; border-radius: 18px; position: relative;
    background: linear-gradient(160deg,#16324a,#0d2236);
    overflow: hidden; display: grid; place-items: center; }
.scan-view .frame { width: 200px; height: 200px; position: relative; }
.scan-view .frame span { position: absolute; width: 34px; height: 34px; border: 3px solid var(--gold); }
.scan-view .frame span:nth-child(1){ top:0; left:0; border-right:0; border-bottom:0; border-radius:8px 0 0 0; }
.scan-view .frame span:nth-child(2){ top:0; right:0; border-left:0; border-bottom:0; border-radius:0 8px 0 0; }
.scan-view .frame span:nth-child(3){ bottom:0; left:0; border-right:0; border-top:0; border-radius:0 0 0 8px; }
.scan-view .frame span:nth-child(4){ bottom:0; right:0; border-left:0; border-top:0; border-radius:0 0 8px 0; }
.scan-view .laser { position: absolute; left: 8%; right: 8%; height: 2px; background: var(--gold-light); box-shadow: 0 0 12px var(--gold); top: 50%; }
.scan-view .qr-ghost { width: 120px; height: 120px; opacity: .35; }
.scan-result { background: #fff; margin: 0 0 0 0; padding: 16px 18px 22px; border-radius: 22px 22px 0 0; }
.scan-result .ok-ico { width: 44px; height: 44px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; margin-bottom: 8px; }
.scan-result .code { font-family: var(--font-display); font-size: 1.2rem; color: var(--navy-800); }
.scan-step { display:flex; align-items:center; gap:10px; background: var(--bg); border:1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top:12px; }
.scan-step .arr { margin-left:auto; color: var(--ok); }
.tabbar { display:flex; background:#0C1726; padding: 8px 0 14px; flex: 0 0 auto; }
.tabbar a { flex:1; text-align:center; color: rgba(255,255,255,.5); font-size:.62rem; display:flex; flex-direction:column; align-items:center; gap:3px; }
.tabbar a.on { color: var(--gold-light); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login__brand {
    position: relative; overflow: hidden; color: #fff;
    background: linear-gradient(150deg, var(--navy-700) 0%, var(--navy-900) 100%);
    display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
}
.login__brand .compass-bg { position: absolute; right: -90px; bottom: -90px; width: 460px; height: 460px; opacity: .10; color: var(--gold-light); }
.login__brand .top { position: relative; z-index: 1; }
.login__brand .pitch { position: relative; z-index: 1; max-width: 420px; }
.login__brand .pitch h2 { font-family: var(--font-display); font-weight: 400; font-size: 2.2rem; line-height: 1.2; }
.login__brand .pitch p { color: rgba(231,236,243,.75); margin-top: 14px; font-size: 1rem; line-height: 1.6; }
.login__brand .vals { display: flex; gap: 26px; margin-top: 30px; position: relative; z-index: 1; }
.login__brand .vals div { font-family: var(--font-display); letter-spacing: .14em; font-size: .72rem; color: var(--gold-light); text-transform: uppercase; }
.login__brand .foot { position: relative; z-index: 1; font-size: .76rem; color: rgba(231,236,243,.5); }
.login__form { display: grid; place-items: center; padding: 40px; background: var(--paper); }
.login__card { width: 100%; max-width: 380px; }
.login__card h1 { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; }
.login__card .sub { color: var(--muted); margin: 6px 0 26px; font-size: .9rem; }
.login__card .field { margin-bottom: 16px; }
.login__card .between-row { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; margin-bottom: 22px; }
.login__card .btn { width: 100%; justify-content: center; padding: 13px; }
.login__card .sso { text-align: center; margin-top: 20px; font-size: .82rem; color: var(--muted); }

/* ---------- Portal cliente ---------- */
.portal-top { background: linear-gradient(120deg, var(--navy-700), var(--navy-900)); color: #fff; }
.portal-hero { max-width: 1100px; margin: 0 auto; padding: 22px 28px; }
.portal-nav { display: flex; align-items: center; gap: 14px; }
.portal-nav .links { margin-left: auto; display: flex; gap: 22px; font-size: .88rem; color: rgba(255,255,255,.8); }
.portal-nav .links a.on { color: var(--gold-light); }
.portal-wrap { max-width: 1100px; margin: 0 auto; padding: 26px 28px 40px; }
.track-box { background: rgba(255,255,255,.06); border: 1px solid rgba(201,162,75,.3); border-radius: var(--r); padding: 18px; display: flex; gap: 12px; align-items: center; }
.track-box .input { background: rgba(255,255,255,.95); border: 0; flex: 1; min-width: 0; }

/* Portal no celular: nav e caixa de rastreio quebram linha em vez de estourar a largura */
@media (max-width: 640px) {
    .portal-hero { padding: 16px; }
    .portal-wrap { padding: 20px 16px 32px; }
    .portal-nav { flex-wrap: wrap; row-gap: 12px; }
    /* logo + botões (Entrar/Criar conta ou avatar/Sair) na 1ª linha; links descem para a 2ª */
    .portal-nav > .center { margin-left: auto; }
    .portal-nav .links { order: 3; flex-basis: 100%; margin-left: 0; justify-content: center; gap: 18px; }
    .track-box { flex-wrap: wrap; padding: 14px; }
    .track-box .input { flex: 1 1 100%; }
    .track-box .btn { flex: 1; justify-content: center; }
}
.order-card { display: flex; gap: 16px; align-items: center; padding: 16px 18px; }
.order-card .oc-ico { width: 48px; height: 48px; border-radius: 12px; background: var(--cream); display: grid; place-items: center; color: var(--navy-700); flex:0 0 48px; }

/* ---------- Caixa postal mini ---------- */
.mailbox { display:flex; align-items:center; gap:14px; padding:14px 16px; border:1px solid var(--line-cool); border-radius: var(--r); background:#fff; }
.mailbox .mb-ico { width:44px; height:44px; border-radius:50%; background: linear-gradient(135deg,var(--gold-light),var(--gold)); color:var(--navy-900); display:grid; place-items:center; }

/* ---------- Grids ---------- */
.cols { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: 2fr 1fr; }
.cols-2b { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3,1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Print (etiqueta) ---------- */
/* Bobina térmica 100x150mm (10x15cm / 4x6"), padrão Zebra/Melhor Envio/Correios */
@page { size: 100mm 150mm; margin: 0; }
@media print {
    .no-print { display: none !important; }
    body, html { background: #fff; margin: 0; }
    .label-sheet { padding: 0; background: #fff; border-radius: 0; }
    .label { width: 100mm; box-shadow: none; border: none; border-radius: 0; }
    .print-only { display: block !important; }
}

/* ---------- Leitor QR: câmera + modo app no celular ---------- */
/* O vídeo do html5-qrcode preenche a área de leitura (centralizado; o excesso é cortado) */
#leitor-camera { display: flex; align-items: center; justify-content: center; background: #000; }
#leitor-camera video { width: 100% !important; max-width: none; display: block; }
#leitor-camera:empty { background: transparent; }

/* Seletor de base dentro da tela do celular — só aparece no modo app */
.seg--leitor-mobile { display: none; }

@media (max-width: 760px) {
    /* Shell: some sidebar e topbar — o leitor vira a tela inteira */
    .app-shell--leitor .sidebar, .app-shell--leitor .topbar { display: none; }
    .app-shell--leitor .main { min-height: 100vh; min-height: 100dvh; }

    .page.leitor-page { padding: 0; max-width: none; } /* .page.x vence o .page {padding:18px} abaixo */
    .leitor-page .page-head, .leitor-page .leitor-lateral { display: none; }
    .leitor-page .leitor-cols { display: block; }
    .leitor-page .leitor-celular { padding: 0 !important; display: block !important; }

    .leitor-page .phone { width: 100%; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
    .leitor-page .phone__screen { height: 100vh; height: 100dvh; border-radius: 0; }
    .leitor-page .phone__notch { display: none; }
    .leitor-page .scan-head { padding: calc(14px + env(safe-area-inset-top)) 18px 10px; }
    .leitor-page .scan-head h3 { font-size: 1.05rem; }
    .leitor-page .scan-view { margin: 4px 12px; min-height: 40vh; }
    .leitor-page .scan-result { max-height: 46vh; overflow-y: auto; flex: 0 0 auto; }
    .leitor-page .tabbar { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    /* Ícone fantasma sobreposto à moldura (a área é alta no celular) */
    .leitor-page .scan-view .qr-ghost { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
    /* Mensagens de erro (câmera negada etc.) quebram linha em vez de estourar a tela */
    .leitor-page .scan-result .badge { white-space: normal; height: auto; line-height: 1.35; align-items: flex-start; text-align: left; max-width: calc(100% - 28px); margin-left: 14px; margin-right: 14px; }
    .leitor-page .scan-result .badge::before { flex: 0 0 6px; margin-top: 5px; }

    .seg--leitor-mobile {
        display: inline-flex; flex-wrap: wrap; justify-content: center;
        margin-top: 10px; max-width: 100%;
        background: rgba(255,255,255,.08); border-color: rgba(201,162,75,.35);
    }
    .seg--leitor-mobile button { color: rgba(255,255,255,.7); padding: 7px 12px; font-size: .8rem; }
    .seg--leitor-mobile button.on { background: var(--gold); color: var(--navy-900); box-shadow: none; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
    :root { --sidebar-w: 76px; }
    .sidebar__brand .brand-text, .sidebar__base, .nav-section, .nav-link span, .nav-link .tag, .sidebar__foot span { display: none; }
    .nav-link { justify-content: center; }
    .cols-2, .cols-2b, .cols-3, .form-grid, .svc-grid { grid-template-columns: 1fr; }
    /* Sem isto, o "span 2" cria uma 2ª coluna implícita e os campos ficam
       espremidos em larguras tortas — o grid de 1 coluna precisa do span neutro */
    .field.col-2 { grid-column: auto; }
    .summary { position: static; }
}
@media (max-width: 760px) {
    .topbar__search { display: none; }
    .login { grid-template-columns: 1fr; }
    .login__brand { display: none; }
    .page { padding: 18px; }
}
.blazor-error-ui { display: none; }
