/* =========================================================================
   Vitrio · Design system "Ultra Clean Premium"
   Base, tokens e componentes compartilhados por vitrine, painel e administração.
   ========================================================================= */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/inter-700.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 800; font-display: swap; src: url("/fonts/inter-800.woff2") format("woff2"); }

:root {
    --brand: #0E5A43;
    --accent: #F2B33D;
    --brand-strong: color-mix(in srgb, var(--brand) 82%, black);
    --brand-soft: color-mix(in srgb, var(--brand) 9%, white);
    --brand-softer: color-mix(in srgb, var(--brand) 5%, white);
    --brand-line: color-mix(in srgb, var(--brand) 22%, white);
    --on-brand: #fff;

    --bg: #FAFAF7;
    --surface: #FFFFFF;
    --surface-2: #F5F6F2;
    --ink: #14201B;
    --ink-2: #34413A;
    --muted: #66726B;
    --faint: #98A29C;
    --line: #E6E8E2;
    --line-2: #EFF0EB;

    --deal: #9A5B00;
    --deal-bg: #FFF3D6;
    --ok: #17784F;
    --ok-bg: #E7F5EE;
    --warn: #8A5300;
    --warn-bg: #FFF4DE;
    --danger: #A23A2C;
    --danger-bg: #FBECE9;
    --info: #1F5D8C;
    --info-bg: #E9F2FA;

    --r-xs: 6px;
    --r-sm: 8px;
    --r: 12px;
    --r-lg: 16px;
    --r-xl: 22px;
    --shadow-xs: 0 1px 2px rgba(20, 32, 27, .05);
    --shadow-sm: 0 1px 2px rgba(20, 32, 27, .04), 0 2px 8px rgba(20, 32, 27, .04);
    --shadow: 0 2px 6px rgba(20, 32, 27, .05), 0 10px 30px rgba(20, 32, 27, .07);
    --shadow-lg: 0 12px 48px rgba(20, 32, 27, .16);
    --focus: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent);

    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "cv11", "ss01";
    font-variant-numeric: tabular-nums;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 1.6rem; line-height: 1.2; font-weight: 750; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1rem; line-height: 1.35; font-weight: 650; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-xs); }
::selection { background: var(--brand-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: .6rem; }
.row.wrap { flex-wrap: wrap; }
.row.sm { gap: .4rem; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.stack.lg { gap: 1.25rem; }
.stack.sm { gap: .4rem; }
.mt { margin-top: 1rem; }
.mt-sm { margin-top: .5rem; }
.mt-lg { margin-top: 1.75rem; }
.mb { margin-bottom: 1rem; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hidden, [hidden] { display: none !important; }
.divider { height: 1px; background: var(--line); border: 0; margin: 1rem 0; }

/* -------------------------------------------------------------- ícones */
.i { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -0.2em; }
.i.fill { fill: currentColor; stroke: none; }
.i-lg { width: 1.4em; height: 1.4em; }
.i-sm { width: 1em; height: 1em; }
.i-xs { width: .85em; height: .85em; }

/* -------------------------------------------------------------- botões */
.btn {
    --btn-bg: var(--surface); --btn-ink: var(--ink); --btn-line: var(--line);
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 40px; padding: 0 1rem;
    border-radius: var(--r-sm); border: 1px solid var(--btn-line); background: var(--btn-bg); color: var(--btn-ink);
    font-weight: 600; font-size: .92rem; line-height: 1; white-space: nowrap; user-select: none;
    transition: background-color .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .08s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn.primary { --btn-bg: var(--brand); --btn-ink: var(--on-brand); --btn-line: var(--brand); box-shadow: var(--shadow-xs); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.soft { --btn-bg: var(--brand-soft); --btn-ink: var(--brand-strong); --btn-line: transparent; }
.btn.soft:hover { background: color-mix(in srgb, var(--brand) 14%, white); }
.btn.ghost { --btn-bg: transparent; --btn-line: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { --btn-ink: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 30%, white); }
.btn.danger.solid { --btn-bg: var(--danger); --btn-ink: #fff; --btn-line: var(--danger); }
.btn.sm { min-height: 32px; padding: 0 .7rem; font-size: .85rem; border-radius: var(--r-xs); }
.btn.lg { min-height: 48px; padding: 0 1.4rem; font-size: 1rem; border-radius: var(--r); }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: 40px; }
.btn.icon.sm { width: 32px; }
.btn.wa { --btn-bg: #1F8F55; --btn-ink: #fff; --btn-line: #1F8F55; }
.btn.wa:hover { background: #18774A; }
.btn .spin { width: 16px; height: 16px; }
.link { color: var(--brand); font-weight: 600; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-group { display: inline-flex; gap: .4rem; flex-wrap: wrap; }

/* -------------------------------------------------------------- formulários */
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field > label, .label { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .78rem; color: var(--muted); }
.field .error, .validation-message { font-size: .8rem; color: var(--danger); font-weight: 500; }
.input, .select, .textarea {
    width: 100%; min-height: 42px; padding: .55rem .8rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface);
    font-size: .95rem; transition: border-color .15s, box-shadow .15s; appearance: none;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select {
    padding-right: 2.2rem; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366726B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .7rem center;
}
.input:hover, .select:hover, .textarea:hover { border-color: #D3D7CF; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.input.invalid, .invalid > .input, .input[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); }
.input.sm, .select.sm { min-height: 34px; font-size: .88rem; padding: .3rem .6rem; }
.select.sm { padding-right: 2rem; background-position: right .55rem center; }
.input.money { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .i { position: absolute; left: .8rem; color: var(--faint); pointer-events: none; }
.input-wrap > .input { padding-left: 2.35rem; }
.input-wrap > .prefix { position: absolute; left: .8rem; color: var(--muted); font-size: .9rem; font-weight: 600; pointer-events: none; }
.input-wrap > .prefix + .input { padding-left: 2.4rem; }
.input-wrap > .suffix { position: absolute; right: .8rem; color: var(--muted); font-size: .9rem; pointer-events: none; }
.input-wrap > .input:has(+ .suffix) { padding-right: 2.2rem; }
.input-wrap > .action { position: absolute; right: 4px; }
.input-group { display: flex; align-items: stretch; min-width: 0; }
.input-group > .addon { display: block; align-content: center; flex: 0 0 auto; padding: 0 .75rem; border: 1px solid var(--line); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); background: var(--surface-2); color: var(--muted); font-size: .88rem; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.input-group > .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; min-width: 0; flex: 1 1 0; width: auto; }
.field > label .opt, .opt { font-weight: 500; color: var(--faint); font-size: .76rem; margin-left: .25rem; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.grid-form { display: grid; gap: 1rem; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.grid-form > * { grid-column: span 12; }
@media (min-width: 720px) {
    .grid-form > .c-6 { grid-column: span 6; }
    .grid-form > .c-4 { grid-column: span 4; }
    .grid-form > .c-3 { grid-column: span 3; }
    .grid-form > .c-8 { grid-column: span 8; }
    .grid-form > .c-9 { grid-column: span 9; }
    .grid-form > .c-5 { grid-column: span 5; }
    .grid-form > .c-7 { grid-column: span 7; }
}
.check { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; font-size: .92rem; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex: none; }
.switch { display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; user-select: none; font-size: .92rem; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: #D5D9D2; position: relative; margin: 0; flex: none; transition: background .15s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform .18s var(--ease); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { box-shadow: var(--focus); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); flex-wrap: wrap; }
.segmented button, .segmented a, .segmented label { border: 0; background: transparent; padding: .38rem .8rem; border-radius: 6px; font-size: .86rem; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.segmented .on, .segmented button[aria-pressed="true"], .segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }
.segmented label { padding: 0; }
.segmented label span { padding: .38rem .8rem; border-radius: 6px; display: inline-flex; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.color-field { display: flex; align-items: center; gap: .5rem; }
.color-field input[type=color] { width: 42px; height: 42px; padding: 3px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }

/* -------------------------------------------------------------- superfícies */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card.pad { padding: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line-2); }
.card-head h2, .card-head h3 { font-size: 1rem; }
.card-body { padding: 1.25rem; }
.card-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--line-2); display: flex; gap: .6rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.section-title { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* -------------------------------------------------------------- badges e chips */
.badge { display: inline-flex; align-items: center; gap: .3rem; height: 22px; padding: 0 .55rem; border-radius: 999px; font-size: .74rem; font-weight: 650; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); }
.badge.deal { background: var(--deal-bg); color: var(--deal); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip { display: inline-flex; align-items: center; gap: .4rem; min-height: 34px; padding: 0 .85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .86rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: all .15s; }
.chip:hover { border-color: #D3D7CF; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* -------------------------------------------------------------- tabelas */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: .7rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 1; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--brand-softer); }
.table tr.selected { background: var(--brand-soft); }
.table .num, .table .right { text-align: right; }
.table .thumb { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-2); border: 1px solid var(--line-2); }
.table .check-col { width: 44px; padding-right: 0; }

/* -------------------------------------------------------------- estados */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; padding: 2.75rem 1.5rem; color: var(--muted); }
.empty .empty-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--brand-soft); color: var(--brand); margin-bottom: .3rem; }
.empty .empty-icon .i { width: 24px; height: 24px; }
.empty h3 { color: var(--ink); font-size: 1.02rem; }
.empty p { max-width: 42ch; font-size: .9rem; }
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--r); font-size: .9rem; border: 1px solid transparent; }
.alert .i { margin-top: .12rem; }
.alert.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 18%, white); }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 18%, white); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 18%, white); }
.alert.danger { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 18%, white); }
.alert strong { font-weight: 650; }
.skeleton { background: linear-gradient(90deg, var(--line-2) 25%, #F7F8F4 50%, var(--line-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--brand); animation: spin .7s linear infinite; }

/* -------------------------------------------------------------- toasts */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; width: min(440px, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: .65rem; padding: .8rem 1rem; border-radius: var(--r); background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: .9rem; font-weight: 500; animation: toast-in .25s var(--ease); }
.toast .i { flex: none; }
.toast.ok .i { color: #7BE0AE; }
.toast.error { background: #3B1F1A; }
.toast.error .i { color: #FFB4A6; }
.toast button { margin-left: auto; background: transparent; border: 0; color: #fff; opacity: .7; padding: 0; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* -------------------------------------------------------------- modal e gaveta */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(15, 22, 19, .42); backdrop-filter: blur(2px); display: grid; place-items: center; padding: 1rem; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 2rem); overflow: auto; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: pop .2s var(--ease); display: flex; flex-direction: column; }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h2 { font-size: 1.08rem; }
.modal-body { padding: 1.25rem 1.35rem; }
.modal-foot { display: flex; gap: .6rem; justify-content: flex-end; padding: 1rem 1.35rem; border-top: 1px solid var(--line-2); position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
@media (max-width: 640px) {
    .overlay { place-items: end center; padding: 0; }
    .modal { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92dvh; animation: sheet .25s var(--ease); }
    @keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
}

/* -------------------------------------------------------------- paginação */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.25rem; border-top: 1px solid var(--line-2); font-size: .86rem; color: var(--muted); flex-wrap: wrap; }

/* -------------------------------------------------------------- utilidades de imagem */
.ph { background: var(--surface-2); display: grid; place-items: center; color: var(--faint); }
.ph .i { width: 28%; height: 28%; min-width: 18px; min-height: 18px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* -------------------------------------------------------------- reconexão do Blazor */
#components-reconnect-modal { border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 1.5rem 1.75rem; max-width: 340px; font-family: var(--font); color: var(--ink); }
#components-reconnect-modal::backdrop { background: rgba(15, 22, 19, .35); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* -------------------------------------------------------------- usuários salvos no login */
.saved-users { margin: 0 0 1.1rem; }
.saved-label { display: block; margin-bottom: .4rem; font-size: .78rem; font-weight: 600; color: var(--muted); }
.saved-list { display: flex; flex-direction: column; gap: .4rem; }
.saved-chip { display: flex; align-items: center; gap: .15rem; }
.saved-user { flex: 1; min-width: 0; min-height: 36px; padding: 0 .75rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: .88rem; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-user:hover { border-color: var(--brand); background: var(--surface-2); }
.saved-x { width: 32px; height: 32px; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--muted); font-size: 1.15rem; line-height: 1; cursor: pointer; }
.saved-x:hover { background: var(--surface-2); color: var(--ink); }
