* { box-sizing: border-box; }

body {
  min-height: 100vh;
  color: var(--vf-text);
  background: var(--vf-bg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.app-container { max-width: var(--vf-max-width); }
.app-header { background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px); }
.app-logo { border-radius: 0.75rem; }

.app-card {
  border: 1px solid var(--vf-border);
  border-radius: var(--vf-radius);
  box-shadow: var(--vf-shadow);
}

.app-card .card-body { padding: 1.25rem; }
.section-title { margin-bottom: 1rem; font-size: 1rem; font-weight: 700; }
.section-title .bi { color: var(--vf-primary); margin-right: 0.4rem; }

.form-control, .form-select { border-color: var(--vf-border); border-radius: 0.75rem; }
.form-control:focus, .form-select:focus { border-color: var(--vf-primary); box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.15); }
.btn { border-radius: 0.75rem; font-weight: 600; }
.btn-success { background-color: var(--vf-primary); border-color: var(--vf-primary); }
.btn-success:hover { background-color: var(--vf-primary-dark); border-color: var(--vf-primary-dark); }

.loading-area[hidden], [hidden] { display: none !important; }
.product-details > div { display: grid; grid-template-columns: 7rem 1fr; gap: 0.75rem; padding: 0.7rem 0; border-bottom: 1px solid var(--vf-border); }
.product-details > div:last-child { border-bottom: 0; }
.product-details dt { color: var(--vf-muted); font-weight: 500; }
.product-details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.status-message { min-height: 4rem; }
.toast { color: #fff; background-color: var(--vf-primary); }
.toast.is-error { background-color: #b02a37; }

@media (min-width: 576px) {
  .app-card .card-body { padding: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Dashboard */
.dashboard-loading { min-height: 16rem; }
.dashboard-kpi {
  position: relative; min-height: 8.5rem; padding: 1rem; overflow: hidden;
  border: 1px solid var(--vf-border); border-radius: var(--vf-radius);
  background: #fff; box-shadow: var(--vf-shadow);
}
.dashboard-kpi span { display: block; max-width: 75%; color: var(--vf-muted); font-size: 0.82rem; font-weight: 600; }
.dashboard-kpi strong { display: block; margin-top: 0.35rem; font-size: 2rem; line-height: 1; color: var(--vf-primary); }
.dashboard-kpi > .bi { position: absolute; right: 0.85rem; bottom: 0.65rem; color: rgba(25, 135, 84, 0.16); font-size: 2.4rem; }
.dashboard-kpi-danger strong { color: #b02a37; }
.dashboard-kpi-danger > .bi { color: rgba(176, 42, 55, 0.16); }
.dashboard-kpi-warning strong { color: #b58105; }
.dashboard-kpi-warning > .bi { color: rgba(181, 129, 5, 0.18); }
.dashboard-kpi-info strong { color: #0b7285; }
.dashboard-kpi-info > .bi { color: rgba(11, 114, 133, 0.16); }
.dashboard-kpi-muted strong { color: #6c757d; }
.dashboard-kpi-muted > .bi { color: rgba(108, 117, 125, 0.16); }
.dashboard-view .table { font-size: 0.9rem; }
.dashboard-view .table thead th { color: var(--vf-muted); font-size: 0.78rem; white-space: nowrap; text-transform: uppercase; }
.dashboard-recent-table td:nth-child(2) { min-width: 15rem; }
.dashboard-spin { animation: dashboard-spin 0.8s linear infinite; }
@keyframes dashboard-spin { to { transform: rotate(360deg); } }

/* Histórico */
.history-loading { min-height: 16rem; }
.history-view .input-group-text { border-color: var(--vf-border); border-radius: 0.75rem 0 0 0.75rem; color: var(--vf-muted); }
.history-view .input-group .form-control { border-left: 0; border-radius: 0 0.75rem 0.75rem 0; }
.history-summary { padding: 1rem 1.15rem; border: 1px solid var(--vf-border); border-radius: var(--vf-radius); background: #fff; box-shadow: var(--vf-shadow); }
.history-summary span { display: block; color: var(--vf-muted); font-size: 0.82rem; font-weight: 600; }
.history-summary strong { display: block; margin-top: 0.25rem; color: var(--vf-primary); font-size: 1.8rem; line-height: 1; }
.history-table { font-size: 0.88rem; }
.history-table thead th { color: var(--vf-muted); font-size: 0.75rem; white-space: nowrap; text-transform: uppercase; }
.history-table td { white-space: nowrap; }
.history-table td:nth-child(2) { min-width: 16rem; white-space: normal; }
.history-table td:nth-child(3) { min-width: 10rem; white-space: normal; }
.history-empty-icon { color: rgba(25, 135, 84, 0.3); font-size: 3rem; }
.history-spin { animation: history-spin 0.8s linear infinite; }
@keyframes history-spin { to { transform: rotate(360deg); } }

/* Configurações */
.settings-details > div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--vf-border); }
.settings-details > div:last-child { border-bottom: 0; }
.settings-details dt { color: var(--vf-muted); font-weight: 600; }
.settings-details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.settings-services { margin-bottom: 1.25rem; }
.settings-service { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--vf-border); }
.settings-service:first-child { padding-top: 0; }
.settings-service:last-child { border-bottom: 0; }
.settings-service strong, .settings-service small { display: block; }
.settings-service small { margin-top: 0.2rem; color: var(--vf-muted); }
.settings-service .badge { flex: 0 0 auto; }
.barcode-scanner {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.78);
}

.barcode-scanner__panel {
    width: min(100%, 34rem);
    padding: 1rem;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.35);
}

.barcode-scanner__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.barcode-scanner__viewport {
    position: relative;
    overflow: hidden;
    min-height: 16rem;
    margin-bottom: 0.75rem;
    border-radius: 0.75rem;
    background: #111;
}

.barcode-scanner__viewport video {
    display: block;
    width: 100%;
    height: min(60vh, 28rem);
    object-fit: cover;
}

.barcode-scanner__guide {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 82%;
    height: 34%;
    border: 3px solid #20c997;
    border-radius: 0.75rem;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.22);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.barcode-scanner__message {
    color: #495057;
    text-align: center;
}
