/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #c85a16;
    --primary-dark: #9e3f08;
    --secondary-color: #ea842d;
    --danger-color: #d32f2f;
    --text-color: #0f172a;
    --text-light: #5f6b85;
    --border-color: #cfd8e5;
    --bg-light: #fff7f0;
    --white: #fff;
    --shadow: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--bg-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.hero {
    background: linear-gradient(135deg, rgba(234,132,45,0.08), rgba(200,90,22,0.12));
    padding: 40px;
    border-radius: 14px;
    margin-bottom: 32px;
    box-shadow: var(--shadow);
}

.hero h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    gap: 20px;
}

.header-login {
    box-shadow: none;
    border-bottom: 1px solid rgba(13, 71, 161, 0.08);
}

.header-content-login {
    justify-content: center;
    padding: 18px 0;
}

.header-login-text {
    color: var(--text-light);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    display: block;
    border-radius: 12px;
    object-fit: contain;
    flex: 0 0 auto;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-brand {
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.logo-text small {
    color: var(--text-light);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.search-form {
    flex: 1;
    max-width: 500px;
    display: flex;
    gap: 10px;
}

.search-form input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.search-form button {
    padding: 10px 20px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.search-form button:hover {
    background: var(--primary-dark);
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-carrinho {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
}

.btn-carrinho .icon {
    font-size: 20px;
}

.btn-carrinho .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: var(--white);
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.btn-acompanhar {
    padding: 8px 15px;
    color: var(--text-color);
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.peso-aviso,
.peso-aviso-detalhe,
.peso-nota-global {
    background: rgba(255, 140, 0, 0.12);
    color: #5a3d00;
    border-left: 4px solid var(--secondary-color);
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.peso-aviso-detalhe {
    margin-bottom: 18px;
}

.peso-nota-global {
    margin-top: 20px;
}

.btn-acompanhar:hover {
    background: var(--bg-light);
}

/* Navigation */
.navbar {
    background: var(--primary-color);
    color: var(--white);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 20px;
    padding: 10px 0;
    overflow-x: auto;
}

.nav-menu a {
    color: var(--white);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
}

.nav-menu a:hover {
    background: var(--primary-dark);
}

/* Messages */
.messages-container {
    padding: 15px 0;
}

.alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.close-alert {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
}

.close-alert:hover {
    opacity: 1;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 30px 0;
}

/* Hero */
.hero {
    background: var(--white);
    padding: 40px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.hero h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Categorias */
.categorias-section {
    margin-bottom: 40px;
}

.categorias-section h2 {
    margin-bottom: 20px;
}

.categorias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.categoria-card {
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.categoria-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Produtos Grid */
.produtos-destaque h2,
.produtos-section h2 {
    margin-bottom: 20px;
}

.produtos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.produto-card {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    position: relative;
}

.produto-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.produto-img,
.produto-img-placeholder {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.badge-destaque {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--secondary-color);
    color: var(--white);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.produto-info {
    padding: 15px;
}

.produto-info h3 {
    font-size: 16px;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.produto-categoria,
.produto-codigo {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.produto-preco {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.preco-antigo {
    text-decoration: line-through;
    color: var(--text-light);
    font-size: 14px;
}

.preco-atual {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.preco-promocao {
    color: var(--danger-color);
}

.unidade {
    font-size: 13px;
    color: var(--text-light);
}

.desconto-badge {
    background: var(--danger-color);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.estoque-info {
    font-size: 13px;
    color: var(--text-light);
    margin: 5px 0;
}

.estoque-info.sem-estoque {
    color: var(--danger-color);
}

.produto-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font-weight: 500;
    transition: all 0.2s;
}

.login-section {
    min-height: calc(100vh - 210px);
    display: grid;
    place-items: center;
    padding: 40px 0;
}

.login-card {
    width: min(100%, 460px);
    background: var(--white);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    padding: 36px 32px;
    border: 1px solid #e8eef7;
}

.login-card h2 {
    margin-bottom: 4px;
    font-size: 28px;
    color: var(--primary-color);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.login-brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
}

.login-brand h2 {
    margin: 0;
    font-size: 24px;
}

.login-brand p {
    margin: 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-light);
}

.login-card h3 {
    margin-bottom: 8px;
    font-size: 20px;
    color: var(--text-color);
}

.login-card p {
    margin-bottom: 26px;
    color: var(--text-light);
    line-height: 1.7;
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-form .form-group {
    display: grid;
    gap: 8px;
}

.login-form label {
    font-weight: 600;
    color: var(--text-color);
}

.login-form input[type='text'],
.login-form input[type='tel'],
.login-form input[type='email'] {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--text-color);
    background: #f8fbff;
}

.login-form input[type='text']:focus,
.login-form input[type='tel']:focus,
.login-form input[type='email']:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.08);
}

.login-divider {
    position: relative;
    text-align: center;
    margin: 18px 0;
}

.login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 40%;
    height: 1px;
    background: var(--border-color);
}

.login-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 40%;
    height: 1px;
    background: var(--border-color);
}

.login-divider span {
    position: relative;
    display: inline-block;
    padding: 0 18px;
    background: var(--white);
    color: var(--text-light);
    font-size: 14px;
}

.role-options {
    display: grid;
    gap: 12px;
    padding: 18px 16px;
    border: 1px solid #eef3fb;
    border-radius: 14px;
    background: #fbfcff;
}

.role-options label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.role-options input[type='radio'] {
    accent-color: var(--primary-color);
    width: 18px;
    height: 18px;
}

.role-options label:hover {
    background: rgba(13, 71, 161, 0.04);
}

.role-options input[type='radio']:checked + span {
    color: var(--primary-color);
    font-weight: 700;
}

.role-options input[type='radio']:checked ~ span {
    color: var(--primary-color);
    font-weight: 700;
}

.login-card .btn-secondary {
    width: 100%;
}

.login-card .info-text {
    font-size: 14px;
    color: var(--text-light);
    margin-top: -6px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--white);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-light);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-success {
    background: #16803d;
    color: var(--white);
}

.btn-warning {
    background: #c86d00;
    color: var(--white);
}

.btn-disabled {
    background: #ccc;
    color: #999;
    cursor: not-allowed;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 16px;
}

.btn-block {
    display: block;
    width: 100%;
}

.text-center {
    text-align: center;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}

.page-link {
    padding: 8px 15px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-color);
}

.page-link:hover {
    background: var(--primary-color);
    color: var(--white);
}

.page-current {
    padding: 8px 15px;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: 8px;
}

.empty-state p {
    margin-bottom: 20px;
    color: var(--text-light);
}

/* Footer */
.footer {
    background: var(--text-color);
    color: var(--white);
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    margin-bottom: 15px;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: var(--white);
    text-decoration: none;
    opacity: 0.8;
}

.footer-section a:hover {
    opacity: 1;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,.82);
}

.developer-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, .82);
    font-size: 13px;
    text-decoration: none;
    border-radius: 6px;
    padding: 6px 8px;
    transition: color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.developer-link strong {
    color: #f6a15d;
}

.developer-link:hover,
.developer-link:focus-visible {
    color: var(--white);
    background: rgba(234, 132, 45, .1);
    box-shadow: 0 0 0 3px rgba(234, 132, 45, .18);
    outline: none;
}

.developer-link:hover strong,
.developer-link:focus-visible strong {
    color: #ffd0a8;
}

.developer-link:active {
    transform: translateY(1px);
}

/* Panel Section */
.panel-section {
    padding: 20px 0;
}

.panel-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 28px 24px;
    border: 1px solid #e8eef7;
}

.panel-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.panel-toolbar h2 {
    color: var(--primary-color);
    font-size: 22px;
    margin-bottom: 4px;
}

.panel-toolbar p {
    color: var(--text-light);
    font-size: 14px;
}

.batch-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 0;
}

.filter-input,
.quantity-input {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 9px 10px;
    background: var(--white);
}

.filter-input {
    flex: 1 1 260px;
    min-width: 220px;
}

.quantity-input {
    width: 78px;
}

.batch-counter {
    color: var(--text-light);
    white-space: nowrap;
}

.selected-row {
    background: #fff8df;
}

.batch-dialog {
    border: 0;
    border-radius: 10px;
    max-width: 520px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}

.batch-dialog::backdrop {
    background: rgba(0, 0, 0, .45);
}

.batch-dialog textarea {
    width: 100%;
    margin-top: 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
}

.batch-preview-card h3 {
    margin: 22px 0 8px;
}

.batch-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.batch-summary-grid > div {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
}

.batch-summary-grid small,
.batch-summary-grid strong {
    display: block;
}

.batch-summary-grid small {
    color: var(--text-light);
}

.batch-summary-grid strong {
    overflow-wrap: anywhere;
}

.label-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.label-preview {
    min-height: 150px;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #ffdd33;
    color: #111;
}

.label-preview b {
    color: var(--primary-color);
    font-size: 18px;
}

.label-preview span,
.label-preview small,
.label-preview em {
    color: #3f3500;
    font-size: 12px;
}

.barcode-preview {
    height: 36px;
    margin-top: 6px;
    background: repeating-linear-gradient(90deg, #111 0, #111 2px, #fff 2px, #fff 4px, #111 4px, #111 5px, #fff 5px, #fff 8px);
}

.batch-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.batch-actions form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.print-instruction {
    color: var(--text-light);
    font-size: 13px;
    margin-top: 14px;
}

.panel-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-logout {
    padding: 8px 18px;
    background: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
    cursor: pointer;
}

.logout-form {
    display: inline;
    margin: 0;
}

.btn-logout:hover {
    background: var(--danger-color);
    color: var(--white);
}

.btn-consultar-preco {
    padding: 8px 18px;
    background: transparent;
    color: #b8860b;
    border: 1px solid #f0ad00;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-consultar-preco:hover {
    background: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-login {
    padding: 8px 18px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-login:hover {
    background: var(--primary-dark);
}

.cliente-logado {
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
}

/* Admin Cards Grid */
.admin-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.admin-card {
    display: block;
    background: var(--bg-light);
    border: 1px solid #e8eef7;
    border-radius: 14px;
    padding: 24px 20px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s;
}

.admin-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.admin-card-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.admin-card h3 {
    color: var(--primary-color);
    font-size: 18px;
    margin-bottom: 8px;
}

.admin-card p {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eef3fb;
}

.table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-color);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table tr:hover td {
    background: #f8fbff;
}

/* Admin Filters */
.admin-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-form {
    flex: 1;
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-color);
    background: #f8fbff;
    min-width: 200px;
    flex: 1;
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.08);
}

.filter-select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-color);
    background: #f8fbff;
    min-width: 160px;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.08);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-pendente {
    background: #fff3cd;
    color: #856404;
}

.status-confirmado {
    background: #cce5ff;
    color: #004085;
}

.status-em_separacao {
    background: #d1ecf1;
    color: #0c5460;
}

.status-entregue {
    background: #d4edda;
    color: #155724;
}

.status-cancelado {
    background: #f8d7da;
    color: #721c24;
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 6px;
}

.product-status-form {
    display: inline;
}

.empty-cell {
    text-align: center;
    padding: 40px 20px !important;
    color: var(--text-light);
    font-style: italic;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.detail-card {
    background: var(--bg-light);
    border: 1px solid #e8eef7;
    border-radius: 14px;
    padding: 20px;
}

.detail-card h3 {
    color: var(--primary-color);
    font-size: 16px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8eef7;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    gap: 12px;
}

.detail-row + .detail-row {
    border-top: 1px solid #eef3fb;
}

.detail-label {
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    min-width: 100px;
}

.detail-value {
    color: var(--text-color);
    font-size: 14px;
    text-align: right;
    word-break: break-word;
}

/* Admin Form */
.admin-form {
    max-width: 800px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: grid;
    gap: 6px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.form-group textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--text-color);
    background: #f8fbff;
    font-family: inherit;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.08);
}

.form-group .errorlist {
    list-style: none;
    color: var(--danger-color);
    font-size: 13px;
    margin-top: 4px;
}

.form-checkboxes {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-checkbox input[type='checkbox'] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.form-checkbox label {
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 992px) {
    .panel-toolbar,
    .admin-filters,
    .filter-group,
    .form-actions,
    .detail-grid {
        flex-direction: column;
        align-items: stretch;
    }

    .panel-toolbar {
        text-align: left;
    }

    .admin-filters {
        gap: 12px;
    }

    .filter-input,
    .filter-select,
    .filter-form {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    /* Header compacto: logo + ações na mesma linha, busca embaixo */
    .header-content {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 0;
    }

    .logo {
        flex: 1;
        min-width: 0;
    }

    .brand-logo {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .logo-brand {
        font-size: 16px;
    }

    .logo-text small {
        font-size: 10px;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
    }

    .cliente-logado {
        width: 100%;
        order: -1;
        text-align: right;
        font-size: 12px;
    }

    .btn-login,
    .btn-logout,
    .btn-consultar-preco,
    .btn-acompanhar,
    .btn-carrinho {
        padding: 7px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .search-form {
        order: 10;
        flex-basis: 100%;
        max-width: 100%;
        gap: 8px;
    }

    .search-form input,
    .search-form button {
        padding: 8px 12px;
    }

    .produtos-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .nav-menu {
        gap: 10px;
        padding: 8px 0;
    }

    .hero {
        padding: 20px 16px;
        margin-bottom: 20px;
    }

    .hero h2 {
        font-size: 1.2rem;
    }

    .hero p {
        font-size: 14px;
    }

    .admin-cards-grid,
    .detail-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .panel-card,
    .admin-card,
    .login-card {
        padding: 20px;
    }

    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
    }

    .login-card {
        padding: 28px 20px;
    }

    .table th,
    .table td {
        padding: 10px 12px;
    }
}

@media (max-width: 992px) {
    /* Produtos administrativos: ações e dados adaptados sem alterar o desktop. */
    .admin-products-page {
        min-width: 0;
    }

    .admin-products-page .panel-card,
    .admin-products-page .panel-toolbar > div,
    .admin-products-page .admin-filters,
    .admin-products-page .filter-form,
    .admin-products-page .filter-group {
        width: 100%;
        min-width: 0;
    }

    .admin-products-page .products-panel-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 10px;
        align-items: stretch;
    }

    .admin-products-page .products-panel-actions > .btn,
    .admin-products-page .products-panel-actions > .btn-login,
    .admin-products-page .products-panel-actions > .logout-form,
    .admin-products-page .products-panel-actions .btn-logout,
    .admin-products-page .filter-group > .btn,
    .admin-products-page .pagination-actions .btn {
        width: 100%;
        min-width: 0;
        min-height: 44px;
    }

    .admin-products-page .products-panel-actions > .btn,
    .admin-products-page .products-panel-actions > .btn-login,
    .admin-products-page .products-panel-actions .btn-logout,
    .admin-products-page .filter-group > .btn,
    .admin-products-page .pagination-actions .btn {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 9px 12px;
        text-align: center;
        line-height: 1.25;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .admin-products-page .products-panel-actions > .logout-form {
        display: block;
    }

    .admin-products-page .filter-input,
    .admin-products-page .filter-select {
        max-width: 100%;
        min-height: 44px;
    }

    .admin-products-page .products-table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: visible;
    }

    .admin-products-page .products-table,
    .admin-products-page .products-table tbody {
        display: block;
        width: 100%;
    }

    .admin-products-page .products-table thead {
        display: none;
    }

    .admin-products-page .products-table tbody tr {
        display: grid;
        width: 100%;
        min-width: 0;
        margin-bottom: 14px;
        overflow: hidden;
        border: 1px solid #e8eef7;
        border-radius: 12px;
        background: var(--white);
        box-shadow: var(--shadow);
    }

    .admin-products-page .products-table tbody tr:hover td {
        background: transparent;
    }

    .admin-products-page .products-table tbody td {
        display: grid;
        grid-template-columns: minmax(88px, 36%) minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        width: 100%;
        min-width: 0;
        padding: 9px 12px;
        text-align: right;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .admin-products-page .products-table tbody td::before {
        content: attr(data-label);
        min-width: 0;
        color: var(--text-light);
        font-size: 11px;
        font-weight: 700;
        line-height: 1.25;
        letter-spacing: 0.04em;
        text-align: left;
        text-transform: uppercase;
    }

    .admin-products-page .products-table .actions-cell {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        white-space: normal;
    }

    .admin-products-page .products-table .actions-cell::before {
        grid-column: 1 / -1;
    }

    .admin-products-page .products-table .actions-cell .btn,
    .admin-products-page .products-table .product-status-form,
    .admin-products-page .products-table .product-status-form .btn {
        width: 100%;
        min-width: 0;
        min-height: 44px;
    }

    .admin-products-page .products-table .actions-cell .btn {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 7px 8px;
        line-height: 1.2;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .admin-products-page .products-table .product-status-form {
        display: block;
    }

    .admin-products-page .products-table .empty-cell {
        display: block;
        text-align: center;
    }

    .admin-products-page .products-table .empty-cell::before {
        content: none;
    }

    .admin-products-page .pagination-bar,
    .admin-products-page .pagination-actions {
        display: grid;
        gap: 10px;
        width: 100%;
        text-align: center;
    }

    .admin-products-page .pagination-bar {
        margin-top: 18px;
    }

    .admin-products-page .pagination-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 576px) {
    .panel-toolbar,
    .admin-filters,
    .filter-group,
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .header-login,
    .hero,
    .panel-card,
    .login-card {
        border-radius: 16px;
    }

    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        padding: 12px 18px;
    }

    /* Grade de produtos: 2 colunas compactas */
    .produtos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .produto-img,
    .produto-img-placeholder {
        height: 130px;
    }

    .produto-info {
        padding: 10px;
    }

    .produto-info h3 {
        font-size: 14px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-height: 1.3;
        min-height: 2.6em;
    }

    .produto-categoria,
    .produto-codigo {
        font-size: 11px;
    }

    .produto-preco {
        margin: 6px 0;
        gap: 5px;
    }

    .preco-atual {
        font-size: 16px;
    }

    .preco-antigo,
    .unidade {
        font-size: 11px;
    }

    .produto-actions {
        flex-direction: column;
        gap: 6px;
        margin-top: 8px;
    }

    .produto-actions .btn {
        padding: 8px 10px;
        font-size: 13px;
    }

    /* Categorias compactas */
    .categorias-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .categoria-card {
        padding: 16px 12px;
    }

    .categoria-card h3 {
        font-size: 14px;
    }

    .categoria-card p {
        font-size: 12px;
    }
}

@media (max-width: 420px) {
    .admin-products-page .products-panel-actions,
    .admin-products-page .products-table .actions-cell,
    .admin-products-page .pagination-actions {
        grid-template-columns: 1fr;
    }

    .admin-products-page .products-table tbody td {
        grid-template-columns: minmax(76px, 34%) minmax(0, 1fr);
        padding-inline: 10px;
    }
}

/* Scanner de código de barras (tamanho fixo em todas as telas) */
.scanner-viewport {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 250px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto;
}

.scanner-viewport video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px solid rgba(0, 123, 255, 0.5);
    border-radius: 8px;
    pointer-events: none;
}

.scanner-line {
    position: absolute;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #007bff;
    animation: scan 2s ease-in-out infinite;
}

@keyframes scan {
    0%, 100% { top: 10%; }
    50% { top: 90%; }
}

.scanner-controls {
    text-align: center;
    margin-top: 0.5rem;
}

@media (max-width: 576px) {
    .scanner-viewport {
        max-width: 100%;
        height: 220px;
    }
}

/* Central de ofertas do cliente */
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 22px;
}

.btn-ofertas-header,
.btn-ofertas-hero {
    background: linear-gradient(135deg, #d32f2f, #a91515);
    color: #fff;
    border: 0;
    box-shadow: 0 6px 16px rgba(169, 21, 21, 0.22);
}

.btn-ofertas-header {
    padding: 9px 14px;
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    cursor: pointer;
    white-space: nowrap;
}

.btn-ofertas-header:hover,
.btn-ofertas-hero:hover {
    background: linear-gradient(135deg, #b71c1c, #870d0d);
    color: #fff;
    transform: translateY(-1px);
}

body.offers-dialog-open {
    overflow: hidden;
}

.offers-dialog {
    width: min(1120px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: transparent;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.34);
    overflow: hidden;
}

.offers-dialog.offers-dialog-fallback {
    position: fixed;
    inset: 16px;
    z-index: 1000;
    margin: auto;
}

.offers-dialog::backdrop {
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(3px);
}

.offers-dialog-shell {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 32px);
    background: #fffaf5;
}

.offers-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 22px 26px;
    color: #fff;
    background: linear-gradient(135deg, #a91515, #d32f2f 55%, #ea842d);
}

.offers-dialog-header h2 {
    margin: 2px 0 2px;
    font-size: clamp(1.45rem, 3vw, 2rem);
}

.offers-dialog-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
}

.offers-dialog-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.offers-dialog-close {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.offers-dialog-close:hover {
    background: rgba(255, 255, 255, 0.26);
}

.offers-dialog-content {
    min-height: 260px;
    padding: 22px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.offers-loading {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-light);
    font-weight: 700;
}

.offers-loading span {
    width: 24px;
    height: 24px;
    border: 3px solid #f0c7aa;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: offers-spin 0.8s linear infinite;
}

@keyframes offers-spin {
    to { transform: rotate(360deg); }
}

.offers-campaign-list {
    display: grid;
    gap: 22px;
}

.offers-campaign-card {
    padding: 20px;
    border: 1px solid #f0d8c8;
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}

.offers-campaign-card.is-featured {
    border-color: #e9a276;
    box-shadow: 0 10px 28px rgba(200, 90, 22, 0.13);
}

.offers-campaign-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 260px);
    gap: 20px;
    align-items: center;
    margin-bottom: 18px;
}

.offers-campaign-heading > div:only-child {
    grid-column: 1 / -1;
}

.offers-campaign-heading h3 {
    margin: 7px 0 4px;
    font-size: 1.35rem;
}

.offers-campaign-heading p {
    margin: 0 0 7px;
    color: var(--text-light);
}

.offers-campaign-heading > img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 14px;
    background: var(--bg-light);
}

.offers-campaign-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.offers-type-badge,
.offers-highlight-badge {
    display: inline-flex;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.offers-type-badge {
    color: #8b1b13;
    background: #ffe5d7;
}

.offers-highlight-badge {
    color: #624200;
    background: #ffedb3;
}

.offers-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.offers-product-card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px;
    min-width: 0;
    padding: 12px;
    border: 1px solid #e8dcd3;
    border-radius: 14px;
    background: #fffdfb;
}

.offers-product-image,
.offers-product-image img,
.offers-product-placeholder {
    width: 92px;
    height: 112px;
    display: block;
    border-radius: 10px;
}

.offers-product-image img {
    object-fit: cover;
    background: var(--bg-light);
}

.offers-product-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    background: linear-gradient(145deg, #fff2e8, #ffe1cb);
    font-size: 15px;
    font-weight: 900;
    line-height: 1.05;
}

.offers-product-placeholder small {
    font-size: 10px;
    letter-spacing: 0.08em;
}

.offers-product-info {
    min-width: 0;
}

.offers-product-info > small {
    display: block;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.offers-product-info h4 {
    margin: 3px 0 6px;
    font-size: 14px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.offers-product-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 7px;
}

.offers-product-price > span {
    color: var(--text-light);
    font-size: 11px;
    text-decoration: line-through;
}

.offers-product-price > strong {
    color: var(--danger-color);
    font-size: 19px;
}

.offers-product-price > small,
.offers-limit {
    color: var(--text-light);
    font-size: 11px;
}

.offers-limit {
    margin: 4px 0 0;
}

.offers-product-actions {
    display: flex;
    gap: 6px;
    margin-top: 9px;
}

.offers-product-actions .btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 12px;
}

.offers-empty-products {
    grid-column: 1 / -1;
    color: var(--text-light);
}

.offers-empty-state {
    min-height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px;
    text-align: center;
}

.offers-empty-state > span {
    font-size: 44px;
}

.offers-empty-state p {
    color: var(--text-light);
}

@media (max-width: 768px) {
    .btn-ofertas-header {
        padding: 7px 10px;
        font-size: 12px;
    }

    .offers-dialog {
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .offers-dialog-shell {
        max-height: 100vh;
    }

    .offers-dialog-header {
        padding: 16px;
    }

    .offers-dialog-content {
        padding: 12px;
    }

    .offers-campaign-card {
        padding: 14px;
    }

    .offers-campaign-heading {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .offers-campaign-heading > img {
        height: 140px;
    }

    .offers-products-grid {
        grid-template-columns: 1fr;
    }

    .offers-product-actions .btn {
        width: auto;
    }
}

@media (max-width: 420px) {
    .offers-product-card {
        grid-template-columns: 78px minmax(0, 1fr);
    }

    .offers-product-image,
    .offers-product-image img,
    .offers-product-placeholder {
        width: 78px;
        height: 100px;
    }
}

/* CRUD administrativo de produtos */
.product-image-fieldset {
    margin: 24px 0;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
}

.product-image-fieldset legend {
    padding: 0 8px;
    color: var(--primary-color);
    font-weight: 800;
}

.product-image-editor,
.product-admin-detail {
    display: grid;
    grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.product-image-preview-wrap,
.product-admin-photo {
    padding: 12px;
    border: 1px solid #e4eaf2;
    border-radius: 14px;
    background: var(--white);
    text-align: center;
}

.product-image-preview-wrap img,
.product-admin-photo img {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: block;
    object-fit: contain;
    border-radius: 10px;
    background: var(--bg-light);
}

.product-image-preview-wrap span,
.product-admin-photo p {
    display: block;
    margin-top: 8px;
    color: var(--text-light);
    font-size: 13px;
}

.product-image-controls {
    display: grid;
    gap: 14px;
}

.product-image-buttons,
.product-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.native-image-inputs {
    margin-top: 4px;
}

.js-image-enhanced .native-image-inputs {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.image-help {
    padding: 10px 12px;
    border-left: 4px solid var(--secondary-color);
    border-radius: 8px;
    color: var(--text-light);
    background: #fff7ef;
}

.product-remove-image {
    display: flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    cursor: pointer;
}

.product-wide-field {
    margin-top: 18px;
}

.product-admin-data {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
}

.product-admin-data dl,
.product-admin-text dl {
    display: grid;
    grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
    gap: 6px 12px;
}

.product-admin-data dt {
    font-weight: 700;
}

.product-admin-data dd {
    min-width: 0;
    overflow-wrap: anywhere;
}

.product-admin-text,
.product-admin-relations,
.product-admin-actions {
    margin-top: 22px;
}

.product-admin-text h3:not(:first-child) {
    margin-top: 18px;
}

.product-admin-relations {
    padding: 18px 20px;
    border: 1px solid #f0d8c8;
    border-radius: 14px;
    background: #fffaf5;
}

.product-admin-relations ul {
    columns: 2;
    margin: 10px 0 0 20px;
}

.danger-disclosure {
    padding: 12px 14px;
    border: 1px solid #efb8b8;
    border-radius: 10px;
    background: #fff7f7;
}

.danger-disclosure summary {
    color: var(--danger-color);
    font-weight: 800;
    cursor: pointer;
}

.danger-disclosure form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

@media (max-width: 768px) {
    .product-image-editor,
    .product-admin-detail,
    .product-admin-data {
        grid-template-columns: 1fr;
    }

    .product-image-preview-wrap,
    .product-admin-photo {
        max-width: 320px;
        margin: 0 auto;
    }

    .product-image-buttons .btn,
    .product-admin-actions > form,
    .product-admin-actions > details {
        width: 100%;
    }

    .product-admin-relations ul {
        columns: 1;
    }
}
