body {
    font-family: Arial, sans-serif;
    background: #f4f7fb;
    margin: 0;
    color: #1f2937;
}
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}
.topbar {
    background: #0f172a;
    color: #fff;
    padding: 18px 24px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.topbar h1 {
    margin: 0;
    font-size: 24px;
}
.topbar nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 16px;
    font-weight: bold;
}
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
    padding: 24px;
    margin-bottom: 24px;
}
label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}
input[type="file"],
input[type="text"] {
    width: 100%;
    max-width: 420px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin-bottom: 16px;
}
button, .btn {
    background: #2563eb;
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 12px 18px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
button:hover, .btn:hover {
    background: #1d4ed8;
}
.alert {
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    white-space: pre-line;
}
.alert.success { background: #eaf8ee; color: #166534; }
.alert.error { background: #feecec; color: #991b1b; }
.alert.info { background: #eaf3ff; color: #1d4ed8; }
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
th, td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 14px;
}
th {
    background: #f8fafc;
}
.small {
    color: #64748b;
    font-size: 13px;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.metric {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
}
.metric strong {
    display: block;
    font-size: 24px;
    margin-top: 6px;
}
@media (max-width: 768px) {
    .topbar {
        align-items: flex-start;
    }
    .topbar nav a {
        margin-left: 0;
        margin-right: 12px;
        display: inline-block;
    }
    table {
        display: block;
        overflow-x: auto;
    }
}

.btn-small { padding: 8px 12px; font-size: 12px; }
.btn-secondary { background: #475569; }
.btn-secondary:hover { background: #334155; }
.details-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:16px; }


.ean-principal {
    font-weight: 700;
    color: #0f172a;
}
.ean-alternativos-box {
    margin-top: 8px;
    padding: 10px 12px;
    background: #f1f5f9;
    border: 1px solid #dbe4ee;
    border-radius: 10px;
}
.ean-alternativos-box.detalhe {
    margin-top: 12px;
}
.ean-alternativos-titulo {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.ean-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ean-tag {
    display: inline-block;
    background: #e2e8f0;
    color: #334155;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
}


textarea {
    width: 100%;
    max-width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin-bottom: 16px;
    font-family: Arial, sans-serif;
}
.table-responsive {
    overflow-x: auto;
}
.toolbar {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}
.field-grow {
    flex: 1;
}
.pagination {
    margin-top: 18px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.disabled {
    opacity: .55;
    pointer-events: none;
}
.actions-cell {
    white-space: nowrap;
}
input#q {
    max-width: 100%;
}


.field-fixed {
    width: 160px;
}

.ean-alt-inline {
    margin-top: 6px;
    padding: 8px 10px;
    background: #f3f4f6;
    border-left: 3px solid #cbd5e1;
    border-radius: 8px;
}
.ean-alt-item {
    font-size: 12px;
    color: #475569;
    line-height: 1.5;
}


.fw-semibold {
    font-weight: 600;
    color: #0f172a;
}
.muted-note {
    color: #64748b;
    font-size: 12px;
    margin-top: 2px;
}
.sort-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}
.sort-link:hover {
    text-decoration: underline;
}

.fw-semibold {
    font-weight: 600;
    color: #0f172a;
}
.muted-note {
    color: #64748b;
    font-size: 12px;
    margin-top: 2px;
}
.ean-alt-note {
    font-size: 11px;
    color: #94a3b8;
}
.sort-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}
.sort-link:hover {
    text-decoration: underline;
}

.ean-alt-note {
    font-size: 11px;
    color: #94a3b8;
}

.login-page {
    background: #f5f7fa;
}
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    padding: 28px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
}
.login-subtitle {
    margin-top: -6px;
    margin-bottom: 18px;
    color: #64748b;
}
.login-form input {
    margin-bottom: 14px;
}

/* ===== Login BDTEC ===== */
.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 32%),
        radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.08), transparent 28%),
        #f8fafc;
}

.login-shell {
    min-height: 100vh;
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px;
    display: grid;
    grid-template-columns: 1.2fr .9fr;
    gap: 28px;
    align-items: center;
}

.login-brand {
    padding: 28px;
}

.login-brand-logo {
    margin-bottom: 24px;
}

.login-brand-logo img {
    max-width: 240px;
    height: auto;
    display: block;
}

.login-brand h1 {
    margin: 0 0 14px;
    font-size: 42px;
    line-height: 1.08;
    color: #0f172a;
}

.login-brand p {
    margin: 0 0 22px;
    font-size: 17px;
    line-height: 1.7;
    color: #475569;
    max-width: 700px;
}

.login-points {
    display: grid;
    gap: 12px;
}

.login-point {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #334155;
    font-size: 15px;
    font-weight: 500;
}

.login-point-bullet {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #2563eb;
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12);
    flex: 0 0 auto;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(10px);
}

.login-card-top {
    min-height: 42px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.login-card-top img {
    max-width: 180px;
    height: auto;
    display: block;
}

.login-card h2 {
    margin: 0 0 8px;
    font-size: 28px;
    color: #0f172a;
}

.login-card p {
    margin: 0 0 22px;
    color: #64748b;
    line-height: 1.6;
}

.notice {
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 14px;
}

.notice-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.field {
    margin-bottom: 16px;
}

.label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 13px 14px;
    font-size: 15px;
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.btn.btn-primary {
    width: 100%;
    border: 0;
    border-radius: 14px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.btn.btn-primary:hover {
    filter: brightness(1.03);
}

.login-foot {
    margin-top: 18px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .login-brand {
        padding: 8px 4px 0;
    }

    .login-brand h1 {
        font-size: 32px;
    }

    .login-brand p {
        font-size: 15px;
    }

    .login-card {
        padding: 22px;
    }
}

/* ===== Header interno ===== */
.app-topbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 30;
}
.app-topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
}
.app-brand a {
    text-decoration: none;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}
.app-nav {
    display: flex;
    gap: 16px;
}
.app-nav a {
    text-decoration: none;
    color: #475569;
    font-weight: 600;
    font-size: 14px;
}
.app-nav a:hover {
    color: #2563eb;
}
.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-user-meta {
    text-align: right;
}
.topbar-user-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}
.topbar-user-email {
    font-size: 12px;
    color: #64748b;
}
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

/* ===== Tela de usuários ===== */
.user-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.user-form-check {
    display: flex;
    align-items: end;
}
.check-inline {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-weight: 600;
    color: #334155;
}
.user-form-actions {
    grid-column: 1 / -1;
}

@media (max-width: 900px) {
    .app-topbar-inner {
        flex-wrap: wrap;
    }
    .app-nav {
        width: 100%;
        order: 3;
        flex-wrap: wrap;
    }
    .topbar-user {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }
    .user-form-grid {
        grid-template-columns: 1fr;
    }
}
.brand-logo {
    height: 32px;
    width: auto;
}

.brand-text {
    font-weight: 700;
    font-size: 18px;
    color: #0f172a;
}

.brand-link {
    display: flex;
    align-items: center;
}

/* ===== Tela de usuários - padrăo melhorado ===== */
.usuarios-card {
    border-radius: 18px;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.section-head h2 {
    margin: 0 0 6px;
    font-size: 22px;
    color: #0f172a;
}

.section-head p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.usuarios-form {
    display: block;
}

.form-grid-usuarios {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
}

.field-block {
    min-width: 0;
}

.field-span-2 {
    grid-column: 1 / -1;
}

.field-block label {
    display: block;
    margin-bottom: 8px;
    color: #0f172a;
    font-weight: 600;
    font-size: 14px;
}

.ui-input {
    width: 100%;
    min-height: 46px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    font-size: 14px;
    color: #0f172a;
    transition: border-color .2s ease, box-shadow .2s ease;
    box-sizing: border-box;
}

.ui-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.field-help {
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
}

.switch-line {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    font-weight: 600;
    color: #334155;
}

.form-actions-usuarios {
    margin-top: 22px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 900px) {
    .form-grid-usuarios {
        grid-template-columns: 1fr;
    }

    .field-span-2 {
        grid-column: auto;
    }
}
