/* ══════════════════════════════════════════════
   AdminPanel — Professional Light Theme
   Tipografia: Plus Jakarta Sans (display)
               DM Sans (body)
   Paleta:    Branco / Azul profissional
   ══════════════════════════════════════════════ */

/* ── Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg:            #f3f5f9;
    --bg-subtle:     #edf0f5;
    --surface:       #ffffff;
    --surface-2:     #f8f9fc;
    --border:        #e1e5ee;
    --border-light:  #edf0f5;

    --accent:        #2563eb;
    --accent-dim:    #1d4ed8;
    --accent-light:  #eff6ff;
    --accent-border: #bfdbfe;

    --green:         #059669;
    --green-light:   #ecfdf5;
    --green-border:  #a7f3d0;

    --red:           #dc2626;
    --red-light:     #fef2f2;
    --red-border:    #fecaca;

    --blue:          #2563eb;
    --amber:         #d97706;
    --amber-light:   #fffbeb;
    --amber-border:  #fde68a;
    --purple:        #7c3aed;
    --purple-light:  #f5f3ff;
    --purple-border: #ddd6fe;

    --text:          #1e293b;
    --text-secondary:#475569;
    --text-muted:    #64748b;
    --text-dim:      #94a3b8;

    --shadow-sm:     0 1px 2px rgba(0,0,0,0.04);
    --shadow:        0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:     0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg:     0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);

    --radius:        8px;
    --radius-lg:     12px;

    --font-display:  'Plus Jakarta Sans', sans-serif;
    --font-body:     'DM Sans', sans-serif;

    --sidebar-w:     260px;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    width: 100%;
    height: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100%;
    width: 100%;
    margin: 0;
}

a { color: var(--accent); text-decoration: none; }

code {
    background: var(--bg);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85em;
    border: 1px solid var(--border);
}

/* ══════════════════════════════
   LOGIN PAGE
   ══════════════════════════════ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(37, 99, 235, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(5, 150, 105, 0.03) 0%, transparent 50%),
        var(--bg);
}

.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: min(920px, 92vw);
    min-height: 560px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.6s ease forwards;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Lado da marca */
.login-brand {
    background:
        linear-gradient(160deg, #1e3a5f 0%, #0f2847 100%);
    padding: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 60px,
            rgba(255, 255, 255, 0.02) 60px,
            rgba(255, 255, 255, 0.02) 61px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 60px,
            rgba(255, 255, 255, 0.02) 60px,
            rgba(255, 255, 255, 0.02) 61px
        );
}

.brand-content {
    position: relative;
    z-index: 1;
}

.brand-icon { margin-bottom: 2rem; }

.brand-icon svg rect {
    stroke: rgba(255, 255, 255, 0.3);
}

.brand-icon svg path {
    fill: rgba(255, 255, 255, 0.8);
}

.login-brand h1 {
    font-family: var(--font-display);
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: #ffffff;
    margin-bottom: 1rem;
}

.login-brand p {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.9rem;
    max-width: 280px;
    line-height: 1.7;
}

.brand-deco {
    width: 48px;
    height: 3px;
    background: var(--accent);
    margin-top: 2rem;
    border-radius: 2px;
}

/* Lado do formulário */
.login-form-side {
    padding: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-form-wrapper {
    width: 100%;
    max-width: 340px;
}

.login-form-wrapper h2 {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.login-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.login-footer p {
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* ══════════════════════════════
   FORMULÁRIOS
   ══════════════════════════════ */

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder {
    color: var(--text-dim);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.5rem;
}

.form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea::placeholder {
    color: var(--text-dim);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ══════════════════════════════
   BOTÕES
   ══════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.3rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--accent-dim);
    border-color: var(--accent-dim);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.btn-ghost {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--surface-2);
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 0.75rem;
}

.btn-sm {
    padding: 0.45rem 0.85rem;
    font-size: 0.78rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--surface-2);
}

.btn-icon.btn-danger:hover {
    color: var(--red);
    border-color: var(--red-border);
    background: var(--red-light);
}

/* ══════════════════════════════
   ALERTAS
   ══════════════════════════════ */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1.2rem;
    border: 1px solid;
}

.alert-error {
    background: var(--red-light);
    border-color: var(--red-border);
    color: var(--red);
}

.alert-info {
    background: rgba(71, 144, 232, 0.1);
    color: #2a6bb5;
    border: 1px solid rgba(71, 144, 232, 0.35);
}

.alert-success {
    background: var(--green-light);
    border-color: var(--green-border);
    color: var(--green);
}

/* ══════════════════════════════
   ADMIN LAYOUT
   ══════════════════════════════ */

body.admin-page {
    margin: 0;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    grid-template-rows: 1fr;
    align-content: stretch;
    overflow-x: hidden;
    overflow-x: clip;
}

/* Modais/toasts são filhos diretos do body — ocupam a tela inteira, não só a coluna do menu */
body.admin-page > .modal,
body.admin-page > .pedido-toast-stack {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
}

body.admin-page > .modal {
    z-index: 20000;
}

body.admin-page > .modal.formula-catalog-modal {
    z-index: 21000;
}

body.admin-page > .pedido-toast-stack {
    z-index: 19500;
}

/* ── Sidebar ── */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: stretch;
    min-height: 100%;
    height: auto;
    max-height: none;
    overflow-y: auto;
    min-width: 0;
}

.sidebar-header {
    padding: 1.4rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    letter-spacing: -0.01em;
}

.sidebar-brand-name {
    display: block;
    max-width: 10.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--text);
}

.sidebar-logo svg rect {
    stroke: var(--accent);
}

.sidebar-logo svg path {
    fill: var(--accent);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.15s ease;
    margin-bottom: 0.2rem;
}

.nav-item:hover {
    color: var(--text);
    background: var(--bg);
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-light);
    font-weight: 600;
}

.nav-item.active svg {
    color: var(--accent);
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-bottom: 0.2rem;
}

/* Submenu: mesmo padding e ícone do item pai */
.nav-item.nav-subitem {
    margin-bottom: 0;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8rem;
    color: #ffffff;
    flex-shrink: 0;
}

.user-info strong {
    display: block;
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.user-info span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.btn-logout {
    color: var(--text-dim);
    transition: color 0.2s;
    padding: 0.4rem;
    border-radius: 6px;
}

.btn-logout:hover {
    color: var(--red);
}

/* ── Main Content ── */
.main-content {
    padding: 2rem 2.5rem;
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    align-self: stretch;
    box-sizing: border-box;
    animation: fadeInMain 0.4s ease forwards;
}

@keyframes fadeInMain {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Largura total da coluna principal (administrador e editor usam a mesma folha style.css) */
body.painel-admin > .main-content,
body.painel-editor > .main-content {
    width: 100%;
    max-width: 100%;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 0.15rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.badge {
    padding: 0.3rem 0.75rem;
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 600;
}

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.3rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-sm);
    animation: fadeUp 0.5s ease forwards;
    opacity: 0;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.stat-card:hover {
    border-color: var(--accent-border);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card:nth-child(1) .stat-icon { background: var(--accent-light); color: var(--accent); }
.stat-card:nth-child(2) .stat-icon { background: var(--green-light); color: var(--green); }
.stat-card:nth-child(3) .stat-icon { background: var(--red-light); color: var(--red); }
.stat-card:nth-child(4) .stat-icon { background: var(--purple-light); color: var(--purple); }

.stat-number {
    display: block;
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.2rem;
    color: var(--text);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ── Panels ── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    width: 100%;
    box-sizing: border-box;
}

.panel-header {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.panel-body {
    padding: 0.75rem 1.4rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

/* ── User List (Dashboard) ── */
.user-list {
    display: flex;
    flex-direction: column;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border-light);
}

.user-row:last-child { border-bottom: none; }

.avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.72rem;
    color: #ffffff;
    flex-shrink: 0;
}

.user-row-info {
    flex: 1;
    min-width: 0;
}

.user-row-info strong {
    display: block;
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-row-info span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.user-row-meta {
    text-align: right;
    flex-shrink: 0;
}

.time-ago {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.15rem;
}

/* ── Activity List ── */
.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-green { background: var(--green); }
.dot-red   { background: var(--red); }
.dot-blue  { background: var(--blue); }

.activity-content {
    flex: 1;
    font-size: 0.8rem;
}

.activity-content strong {
    font-family: var(--font-display);
    font-weight: 600;
    margin-right: 0.3rem;
    color: var(--text);
}

.activity-content span {
    color: var(--text-muted);
}

.activity-item time {
    font-size: 0.7rem;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
}

.activity-list-full .activity-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
}

.activity-list-full .activity-content .role-badge {
    font-size: 0.65rem;
}

.activity-ip {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-family: ui-monospace, monospace;
}

/* ── Role Badges ── */
.role-badge {
    display: inline-block;
    padding: 0.18rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-family: var(--font-display);
    font-weight: 600;
    border: 1px solid;
}

.role-superadmin {
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.35);
}

.role-admin {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent-border);
}

.role-editor {
    background: var(--green-light);
    color: var(--green);
    border-color: var(--green-border);
}

/* ── Status Dot ── */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
}

.status-dot.active   { background: var(--green); }
.status-dot.inactive { background: var(--text-dim); }

/* ══════════════════════════════
   DATA TABLE
   ══════════════════════════════ */

.table-wrapper {
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.data-table th {
    padding: 0.8rem 1.2rem;
    text-align: left;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--surface-2);
}

.data-table td {
    padding: 0.75rem 1.2rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.12s ease;
}

.data-table tbody tr:hover {
    background: var(--bg);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.row-muted { opacity: 0.5; }

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.user-cell strong {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

.user-cell .text-muted {
    display: block;
    font-size: 0.72rem;
}

.text-muted { color: var(--text-muted); }

.action-btns {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.action-btns .inline-form {
    display: inline;
    margin: 0;
}

.btn-enviar-pedido {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    background: var(--green);
    border: 1px solid var(--green);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-enviar-pedido:hover {
    background: #047857;
    border-color: #047857;
}

.empty-state {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* ── Search (users.php) ── */
.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    padding: 0.5rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
    width: 180px;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--accent);
}

/* ══════════════════════════════
   FILTROS (manipulados.php)
   ══════════════════════════════ */

/* ── Botões de orçamento (manipulados.php) ── */
.orcamento-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-end;
}

.input-maiusculas {
    text-transform: uppercase;
}

.origem-badge {
    display: inline-block;
    padding: 0.1rem 0.2rem;
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

.origem-fora {
    background: rgba(71, 144, 232, 0.12);
    color: #4790e8;
    border-color: rgba(71, 144, 232, 0.35);
}

.origem-fst {
    background: rgba(232, 199, 71, 0.12);
    color: #c9a830;
    border-color: rgba(232, 199, 71, 0.35);
}

.th-label-short {
    display: none;
}

.contato-cell {
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
}

/* Campo vendedor com prefixo V fixo */
.input-prefix-wrap {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    transition: border-color 0.2s;
}

.input-prefix-wrap:focus-within {
    border-color: var(--accent);
}

.input-prefix {
    display: flex;
    align-items: center;
    padding: 0 0.85rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent);
    background: var(--accent-light);
    border-right: 1px solid var(--border);
    user-select: none;
}

.input-prefix-field {
    flex: 1;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    min-width: 0;
}

.input-prefix-field:focus {
    outline: none;
    box-shadow: none !important;
}

.filters-bar {
    margin-bottom: 1.25rem;
    width: 100%;
}

.filters-form {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    width: 100%;
}

.filter-search {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.filter-search svg {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.filter-input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.filter-input::placeholder {
    color: var(--text-dim);
}

.filter-select {
    padding: 0.65rem 2.5rem 0.65rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    transition: border-color 0.2s ease;
}

.filter-select:focus {
    border-color: var(--accent);
}

.filter-date-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.filter-date-label span {
    white-space: nowrap;
}

.filter-date {
    padding: 0.6rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
}

.filter-date:focus {
    border-color: var(--accent);
}

.filter-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.filter-check input {
    accent-color: var(--accent);
}

.btn-clear-filters {
    color: var(--red) !important;
    border-color: var(--red) !important;
}

.backup-last-info {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
}

.backup-filename {
    font-size: 0.8rem;
    word-break: break-all;
}

.inline-form {
    display: inline;
}

.btn-icon-done {
    color: var(--green);
    border-color: rgba(71, 232, 181, 0.35);
    background: rgba(71, 232, 181, 0.08);
}

.import-steps {
    margin: 0 0 1rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.import-progress-wrap {
    margin-bottom: 1rem;
}

.import-progress-bar {
    height: 10px;
    background: var(--border-light);
    border-radius: 999px;
    overflow: hidden;
}

.import-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.import-progress-text {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.import-log {
    margin: 0 0 1rem;
    font-size: 0.8rem;
    font-family: ui-monospace, monospace;
    color: var(--text-dim);
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.import-csv-example {
    margin: 0.75rem 0 1rem;
    padding: 0.85rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.78rem;
    overflow-x: auto;
}

.import-upload-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.import-file-input {
    max-width: 100%;
    font-size: 0.85rem;
}

.import-upload-status {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
}

.import-csv-path {
    margin: 0.5rem 0 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.78rem;
    word-break: break-all;
}

.import-staged-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.import-staged-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
}

.import-staged-item:last-child {
    border-bottom: none;
}

/* ══════════════════════════════
   TABELA MANIPULADOS
   ══════════════════════════════ */

.col-id {
    width: 50px;
    text-align: center;
}

.date-cell {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.83rem;
    white-space: nowrap;
    color: var(--text);
}

.client-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.client-cell strong,
.client-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

.manipulado-name {
    font-size: 0.83rem;
    color: var(--text-secondary);
    display: block;
    max-width: 420px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
}

.field-manipulado-grande {
    width: 100%;
    min-height: 5.5rem;
    resize: vertical;
    line-height: 1.45;
}

.form-group-full {
    grid-column: 1 / -1;
}

.vendedor-badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.situacao-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.65rem;
    border-radius: 20px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.7rem;
    white-space: nowrap;
}

.situacao-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ══════════════════════════════
   PAGINAÇÃO
   ══════════════════════════════ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.4rem;
    border-top: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 0.45rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.78rem;
    text-decoration: none;
    transition: all 0.15s ease;
}

.page-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--surface-2);
}

.page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.page-dots {
    color: var(--text-dim);
    padding: 0 0.3rem;
    font-size: 0.82rem;
}

/* ══════════════════════════════
   MODAL
   ══════════════════════════════ */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 12000;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.modal.open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    z-index: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: min(460px, 92vw);
    padding: 1.75rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.12);
    animation: modalIn 0.25s ease forwards;
    max-height: min(92vh, 100dvh);
    overflow-y: auto;
}

.modal-wide {
    width: min(580px, 94vw);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.97) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
    transition: color 0.15s;
    border-radius: 4px;
}

.modal-close:hover {
    color: var(--text);
    background: var(--bg);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.fst-confirm-content {
    width: min(420px, 92vw);
    padding: 1.5rem 1.75rem 1.35rem;
    text-align: center;
}

.fst-confirm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.fst-confirm-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.5rem;
}

.fst-confirm-message {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.fst-confirm-detail {
    margin: 0.85rem 0 0;
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.fst-confirm-actions {
    justify-content: center;
    margin-top: 1.35rem;
    padding-top: 1.15rem;
}

.fst-confirm-actions .btn {
    min-width: 7.5rem;
}

/* ══════════════════════════════
   RESPONSIVE
   ══════════════════════════════ */

/* Notebook ~1200px — sidebar + tabela larga */
@media (max-width: 1320px) {
    body.admin-page {
        --sidebar-w: 220px;
    }

    .main-content {
        padding: 1.25rem 1.15rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 1.25rem;
        gap: 0.85rem;
    }

    .page-header h1 {
        font-size: 1.45rem;
    }

    .page-subtitle {
        font-size: 0.82rem;
        line-height: 1.45;
    }

    .header-actions.orcamento-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .filters-form {
        display: grid;
        grid-template-columns: 1fr auto auto;
        gap: 0.5rem 0.55rem;
        align-items: center;
    }

    .filter-search {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .data-table th,
    .data-table td {
        padding: 0.55rem 0.5rem;
    }

    .data-table th {
        font-size: 0.68rem;
        letter-spacing: 0.04em;
    }

    .data-table td {
        font-size: 0.8rem;
    }

    .data-table-orcamentos {
        table-layout: fixed;
        width: 100%;
    }

    .data-table-orcamentos .col-hide-wide {
        display: none;
    }

    .data-table-orcamentos th {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .data-table-orcamentos .th-label-short {
        display: none;
    }

    .data-table-orcamentos .th-label-full {
        display: inline;
    }

    .data-table-orcamentos .col-id {
        width: 3%;
    }

    .data-table-orcamentos .col-datetime {
        width: 10%;
        min-width: 5.75rem;
    }

    .data-table-orcamentos .col-cliente {
        width: 24%;
    }

    .data-table-orcamentos .col-desc {
        width: 20%;
    }

    .data-table-orcamentos .col-vendedor {
        width: 9%;
        min-width: 3.25rem;
    }

    .data-table-orcamentos .col-preco {
        width: 10%;
        min-width: 4.75rem;
    }

    .data-table-orcamentos .col-origem {
        width: 9%;
        min-width: 3.5rem;
    }

    .data-table-orcamentos .col-acoes {
        width: 15%;
        min-width: 6.5rem;
    }

    .data-table-orcamentos .col-datetime,
    .data-table-orcamentos .col-vendedor,
    .data-table-orcamentos .col-preco,
    .data-table-orcamentos .col-origem {
        white-space: nowrap;
    }

    .data-table-orcamentos .date-cell {
        font-size: 0.72rem;
        line-height: 1.2;
        white-space: nowrap;
    }

    .data-table-orcamentos .col-preco {
        white-space: nowrap;
    }

    .data-table-orcamentos .contato-cell {
        white-space: nowrap;
    }

    .data-table-orcamentos .client-name {
        font-size: 0.78rem;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: break-word;
    }

    .data-table-orcamentos .manipulado-name {
        max-width: none;
        font-size: 0.75rem;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .data-table-orcamentos .vendedor-badge {
        font-size: 0.72rem;
        padding: 0.15rem 0.35rem;
    }

    .data-table-orcamentos .origem-badge {
        font-size: 0.62rem;
    }

    .data-table-orcamentos .btn-enviar-pedido {
        font-size: 0.68rem;
        padding: 0.28rem 0.4rem;
    }

    .data-table-orcamentos .action-btns {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .table-wrapper {
        overflow-x: auto;
    }
}

@media (max-width: 1180px) {
    .data-table-orcamentos .th-label-full {
        display: none;
    }

    .data-table-orcamentos .th-label-short {
        display: inline;
    }
}

@media (max-width: 900px) {
    .login-container {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .login-brand {
        padding: 2rem;
    }

    .login-brand h1 {
        font-size: 2rem;
    }

    body.admin-page {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        min-height: 100vh;
        min-height: 100svh;
        min-height: 100dvh;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        z-index: 100;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        padding: 1.5rem;
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        box-sizing: border-box;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
    }

    .header-actions {
        flex-wrap: wrap;
    }

    .orcamento-actions {
        width: 100%;
        justify-content: stretch;
    }

    .orcamento-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .filters-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-search {
        min-width: 100%;
    }

    .filter-select {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .search-input {
        width: 120px;
    }

    .data-table th:nth-child(4),
    .data-table td:nth-child(4),
    .data-table th:nth-child(5),
    .data-table td:nth-child(5) {
        display: none;
    }

    .pagination {
        flex-direction: column;
        align-items: center;
    }
}

/* ── Notificações admin (pedido recebido) ── */
.nav-item-with-badge {
    position: relative;
}

.nav-badge {
    margin-left: auto;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.25rem;
    text-align: center;
    color: #fff;
    background: var(--red);
    border-radius: 999px;
}

.nav-badge[hidden] {
    display: none;
}

/* Card de pedidos — alinhado ao painel (surface + borda) */
.pedidos-recebidos-banner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.1rem 1.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    position: relative;
    z-index: 1;
}

.pedidos-recebidos-icon-wrap {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid var(--amber-border);
    color: #b45309;
}

.pedidos-recebidos-bell {
    flex-shrink: 0;
}

.pedidos-recebidos-body {
    flex: 1;
    min-width: 0;
}

.pedidos-recebidos-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.pedidos-recebidos-text {
    flex: 1;
    min-width: min(100%, 220px);
}

.pedidos-recebidos-title {
    display: block;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.pedidos-recebidos-desc {
    display: block;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

/* Link no dashboard — destaque vermelho (pedido novo) */
a.pedidos-recebidos-banner--clickable {
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
    align-items: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 50%, #fecaca 100%);
    border: 2px solid var(--red);
    box-shadow:
        0 0 0 1px rgba(220, 38, 38, 0.12),
        0 8px 28px rgba(220, 38, 38, 0.14);
}

a.pedidos-recebidos-banner--clickable:hover {
    border-color: #b91c1c;
    box-shadow:
        0 0 0 1px rgba(220, 38, 38, 0.2),
        0 12px 32px rgba(185, 28, 28, 0.22);
    transform: translateY(-2px);
}

a.pedidos-recebidos-banner--clickable:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 3px;
}

a.pedidos-recebidos-banner--clickable .pedidos-recebidos-icon-wrap {
    background: linear-gradient(145deg, #fecaca 0%, #f87171 100%);
    border: 1px solid #dc2626;
    color: #7f1d1d;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

a.pedidos-recebidos-banner--clickable .pedidos-recebidos-title {
    color: #991b1b;
    font-size: 1.1rem;
}

a.pedidos-recebidos-banner--clickable .pedidos-recebidos-desc {
    color: #7f1d1d;
    font-weight: 500;
}

a.pedidos-recebidos-banner--clickable .pedidos-recebidos-cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    align-self: center;
    padding: 0.55rem 1rem;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius);
    white-space: nowrap;
    background: var(--red);
    color: #fff;
    border: 1px solid #b91c1c;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

a.pedidos-recebidos-banner--clickable:hover .pedidos-recebidos-cta {
    background: #b91c1c;
    border-color: #991b1b;
    color: #fff;
}

a.pedidos-recebidos-banner--clickable .pedidos-recebidos-cta svg {
    stroke: currentColor;
}

.pedidos-recebidos-banner--with-actions {
    align-items: flex-start;
}

.pedidos-recebidos-banner--with-actions .pedidos-recebidos-actions {
    flex-shrink: 0;
    margin: 0;
    align-self: center;
}

.pedidos-recebidos-actions {
    flex-shrink: 0;
    margin: 0;
}

.pedidos-recebidos-list {
    margin: 0.65rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.84rem;
    color: var(--text);
    line-height: 1.45;
}

.pedidos-recebidos-list li {
    margin-bottom: 0.3rem;
}

.pedidos-recebidos-list li:last-child {
    margin-bottom: 0;
}

@media (max-width: 700px) {
    a.pedidos-recebidos-banner--clickable {
        flex-wrap: wrap;
    }

    a.pedidos-recebidos-banner--clickable .pedidos-recebidos-cta {
        width: 100%;
        justify-content: center;
    }

    .pedidos-recebidos-banner--with-actions .pedidos-recebidos-main {
        flex-direction: column;
        align-items: stretch;
    }

    .pedidos-recebidos-banner--with-actions .pedidos-recebidos-actions {
        align-self: stretch;
    }

    .pedidos-recebidos-banner--with-actions .pedidos-recebidos-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

.row-novo-pedido {
    background: var(--amber-light) !important;
    animation: novo-pedido-pulse 2s ease-in-out 2;
}

.row-inserido-live {
    outline: 2px solid var(--red);
    outline-offset: -2px;
    animation: row-inserido-live 1.5s ease-out 1;
}

@keyframes row-inserido-live {
    0% {
        background: #fef2f2 !important;
    }
    40% {
        background: #fecaca !important;
    }
    100% {
        background: transparent;
    }
}

@keyframes novo-pedido-pulse {
    0%, 100% { background: var(--amber-light); }
    50% { background: #fef3c7; }
}

.badge-novo-pedido {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.45rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--amber);
    background: #fff;
    border: 1px solid var(--amber-border);
    border-radius: 4px;
    vertical-align: middle;
}

.pedido-toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 11500;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: min(380px, calc(100vw - 2rem));
    pointer-events: none;
}

.pedido-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 2px solid var(--amber);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(120%);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.pedido-toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.pedido-toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.pedido-toast-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.pedido-toast-body strong {
    color: var(--amber);
    font-size: 0.95rem;
}

.pedido-toast-body small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pedido-toast-link {
    flex-shrink: 0;
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    border-radius: 6px;
    background: var(--accent-light);
}

.pedido-toast-link:hover {
    background: var(--accent-border);
}

.modal-intro {
    margin: 0 0 1.25rem;
    padding: 0 0 0.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-intro strong {
    color: var(--text);
}

.label-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.85em;
}

.enviar-resumo {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.1rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.enviar-resumo-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.enviar-resumo-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.enviar-resumo-valor {
    font-size: 0.92rem;
    color: var(--text);
    font-weight: 500;
}

.btn-enviar-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.pedido-detalhe {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pedido-detalhe-grid {
    margin-bottom: 1rem;
}

.pedido-detalhe-texto {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text);
}

.pedido-detalhe-obs,
.pedido-detalhe-multiline {
    white-space: pre-wrap;
    word-break: break-word;
}

.panel-danger-zone {
    border-color: rgba(232, 71, 122, 0.35);
}

.panel-danger-zone .panel-header h2 {
    color: #e8477a;
}

.purge-stats {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.purge-all-form {
    max-width: 28rem;
}

.purge-confirm-input {
    max-width: 12rem;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.btn-danger {
    background: #e8477a;
    color: #fff;
    border: 1px solid #c73562;
}

.btn-danger:hover:not(:disabled) {
    background: #c73562;
}

.btn-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── Fórmulas ── */
.formulas-header-actions {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.formulas-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.data-table-formulas .formula-obs-line {
    display: block;
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 0.2rem;
    max-width: 280px;
}

.formula-tipo-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    white-space: nowrap;
}

.formula-tipo-capsula {
    background: rgba(71, 144, 232, 0.15);
    color: #4790e8;
}

.formula-tipo-sache {
    background: rgba(232, 197, 71, 0.15);
    color: #c9a830;
}

.formula-tipo-liquido {
    background: rgba(71, 232, 181, 0.12);
    color: #2db88a;
}

.formula-tipo-pomada {
    background: rgba(166, 109, 232, 0.12);
    color: #8b5cf6;
}

.formula-tipo-creme {
    background: rgba(244, 114, 182, 0.12);
    color: #db2777;
}

.formula-tipo-solucao {
    background: rgba(56, 189, 248, 0.12);
    color: #0284c7;
}

.formula-tipo-gel {
    background: rgba(52, 211, 153, 0.12);
    color: #059669;
}

.formula-precos-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.formula-precos-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    font-size: 0.82rem;
    padding: 0.15rem 0;
}

.formula-preco-qtd {
    color: var(--text-secondary);
    min-width: 5.5rem;
}

.formula-preco-valor {
    font-weight: 600;
    color: var(--text);
}

.formula-variacoes-block {
    margin-top: 0.5rem;
}

.field-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin: 0.35rem 0 0.5rem;
}

.formula-variacoes-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.formula-variacoes-table {
    width: 100%;
    border-collapse: collapse;
}

.formula-variacoes-table th,
.formula-variacoes-table td {
    padding: 0.5rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.formula-variacoes-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    background: var(--bg-elevated, rgba(0, 0, 0, 0.03));
}

.formula-variacoes-table input {
    width: 100%;
    min-width: 5rem;
}

.formula-variacoes-table .btn-remove-var {
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-dim);
}

.formula-ativo-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.formula-picker-block {
    margin: 0.75rem 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: var(--bg-elevated, rgba(0, 0, 0, 0.02));
}

.formula-picker-title {
    margin: 0 0 0.5rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.formula-picker-block .label-hint {
    font-weight: 400;
    color: var(--text-dim);
}

.formula-picker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.formula-picker-selected {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.modal-catalog-formulas {
    width: min(640px, 96vw);
    max-height: min(88vh, 100dvh);
    display: flex;
    flex-direction: column;
}

.formula-catalog-intro {
    margin-bottom: 1rem;
}

.formula-catalog-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.formula-catalog-search {
    width: 100%;
}

.formula-catalog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.formula-filter-chip {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.formula-filter-chip:hover {
    border-color: var(--accent);
    color: var(--text);
}

.formula-filter-chip.active {
    background: rgba(232, 197, 71, 0.2);
    border-color: rgba(232, 197, 71, 0.55);
    color: var(--text);
}

.formula-catalog-list-wrap {
    flex: 1;
    min-height: 12rem;
    max-height: min(50vh, 420px);
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated, rgba(0, 0, 0, 0.02));
}

.formula-catalog-list {
    list-style: none;
    margin: 0;
    padding: 0.35rem;
}

.formula-catalog-item {
    border-radius: 8px;
    margin-bottom: 0.35rem;
}

.formula-catalog-item-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
}

.formula-catalog-item-head:hover {
    background: rgba(71, 144, 232, 0.08);
}

.formula-catalog-item-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.formula-catalog-item-main strong {
    font-size: 0.92rem;
    color: var(--text);
}

.formula-catalog-item-meta {
    font-size: 0.78rem;
    color: var(--text-dim);
    white-space: nowrap;
}

.formula-catalog-empty {
    padding: 2rem 1rem;
}

.formula-catalog-back {
    margin-bottom: 0.75rem;
}

.formula-catalog-var-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.formula-catalog-var-name {
    margin: 0;
    font-size: 1.05rem;
    font-family: var(--font-display);
}

.formula-catalog-var-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
    max-height: min(40vh, 320px);
    overflow-y: auto;
}

.formula-var-pick-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.formula-var-pick-btn span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.formula-var-pick-btn strong {
    font-size: 0.95rem;
    color: var(--text);
}

.formula-var-pick-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.formula-catalog-footer {
    margin-top: 1rem;
    flex-shrink: 0;
}

.cliente-historico-title {
    margin: 1.25rem 0 0.75rem;
    font-size: 0.95rem;
    font-family: var(--font-display);
    font-weight: 700;
}

.data-table-compact td,
.data-table-compact th {
    font-size: 0.82rem;
    padding: 0.45rem 0.55rem;
}

.cliente-ac-wrap {
    position: relative;
}

.cliente-ac-list {
    position: fixed;
    z-index: 25000;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    max-height: 220px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.cliente-ac-item {
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.cliente-ac-item:last-child {
    border-bottom: none;
}

.cliente-ac-item:hover,
.cliente-ac-item.is-active {
    background: rgba(71, 144, 232, 0.1);
}

.cliente-ac-item strong {
    display: block;
    font-size: 0.88rem;
    color: var(--text);
}

.cliente-ac-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.15rem;
}

.cliente-ac-empty {
    padding: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: center;
}

.cliente-ac-list--historico {
    max-height: 320px;
}

.cliente-ac-historico-header {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    cursor: default;
}

.cliente-ac-historico-title {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-bottom: 0.5rem;
}

.cliente-ac-historico-title strong {
    font-size: 0.82rem;
    color: var(--text);
}

.cliente-ac-historico-title span {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.cliente-ac-historico-skip {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
    font-family: inherit;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.cliente-ac-historico-skip:hover {
    background: rgba(71, 144, 232, 0.08);
}

.cliente-ac-pedido .cliente-ac-pedido-hint {
    display: block;
    font-size: 0.68rem;
    color: var(--accent);
    margin-top: 0.2rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.cliente-ac-pedido:hover .cliente-ac-pedido-hint,
.cliente-ac-pedido.is-active .cliente-ac-pedido-hint {
    opacity: 1;
}

.formula-catalog-inline-vars {
    display: none;
}

@media (max-width: 600px) {
    .enviar-resumo {
        grid-template-columns: 1fr;
    }
}

/* ── Chat interno ── */
.chat-page .chat-panel {
    display: flex;
    flex-direction: column;
    min-height: min(70vh, calc(100dvh - 12rem));
    max-height: calc(100dvh - 10rem);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: var(--bg-subtle);
    min-height: 320px;
}

.chat-msg {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    max-width: 92%;
}

.chat-msg-mine {
    flex-direction: row-reverse;
    align-self: flex-end;
    margin-left: auto;
}

.chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
}

.chat-msg-bubble {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.55rem 0.85rem;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.chat-msg-mine .chat-msg-bubble {
    background: var(--accent-light);
    border-color: var(--accent-border);
}

.chat-msg-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    align-items: baseline;
}

.chat-msg-meta strong {
    color: var(--text);
    font-size: 0.8rem;
}

.chat-msg-role {
    font-weight: 600;
    color: var(--accent);
}

.chat-msg-mine .chat-msg-role {
    color: var(--accent-dim);
}

.chat-msg-body {
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text);
    word-break: break-word;
}

.chat-form {
    display: flex;
    gap: 0.65rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    align-items: flex-end;
    background: var(--surface);
}

.chat-form textarea {
    flex: 1;
    resize: vertical;
    min-height: 2.75rem;
    max-height: 8rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
}

.chat-settings-panel,
.backup-settings-panel,
.cupom-print-settings-panel {
    margin-bottom: 1.5rem;
}

.cupom-print-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 640px) {
    .cupom-print-fields {
        grid-template-columns: 1fr;
    }
}

.cupom-color-picker {
    display: block;
    margin-top: 0.5rem;
    width: 100%;
    max-width: 120px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}

.cupom-print-preview-wrap {
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.cupom-print-preview-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cupom-print-preview {
    background: #fff;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-family: var(--cupom-font, Arial, Helvetica, sans-serif);
    color: var(--cupom-color, #000);
    font-weight: 700;
    font-size: 13px;
    line-height: 1.45;
    max-width: 320px;
    box-shadow: var(--shadow-sm);
}

.cupom-print-actions {
    margin-bottom: 0.75rem;
}

.cupom-print-reset-form {
    display: inline;
}

/* Dashboard: respiro entre painéis de gestão e cards de estatísticas */
.painel-admin .backup-settings-panel + .stats-grid {
    margin-top: 1.25rem;
}

.chat-settings-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.chat-settings-form {
    display: flex;
    align-items: center;
}

.chat-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.chat-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.chat-toggle-slider {
    width: 48px;
    height: 26px;
    background: var(--border);
    border-radius: 999px;
    position: relative;
    transition: background 0.2s;
}

.chat-toggle-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: var(--shadow-sm);
}

.chat-toggle input:checked + .chat-toggle-slider {
    background: var(--green);
}

.chat-toggle input:checked + .chat-toggle-slider::after {
    transform: translateX(22px);
}

.chat-toggle-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.chat-badge-off {
    background: var(--bg-subtle);
    color: var(--text-muted);
    border-color: var(--border);
}
