/* ============================================
   SISTEMA DE VISTORIA - DESIGN SYSTEM ÚNICO
   Tech moderno / Dark mode
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    /* Cores base */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-elevated: #1f1f2e;
    --border: #2a2a3a;
    --border-hover: #3a3a50;

    /* Texto */
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a85;

    /* Acentos */
    --accent: #2d6a9f;
    --accent-dim: #1e5a8a;
    --accent-glow: rgba(45, 106, 159, 0.18);
    --accent-soft: rgba(45, 106, 159, 0.10);

    /* Estados */
    --warning: #ffaa00;
    --warning-glow: rgba(255, 170, 0, 0.15);
    --danger: #ff3860;
    --danger-glow: rgba(255, 56, 96, 0.15);
    --info: #3eb8ff;
    --edit: #3eb8ff;
    --edit-glow: rgba(62, 184, 255, 0.15);

    /* Tipografia */
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Espaçamento */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;

    /* Transições */
    --t-fast: 0.15s ease;
    --t: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background decorativo - glow sutil (sem grid) */
body {
    background-image:
        radial-gradient(circle at 20% 0%, rgba(45, 106, 159, 0.10) 0%, transparent 40%),
        radial-gradient(circle at 80% 100%, rgba(62, 184, 255, 0.05) 0%, transparent 40%);
}

/* ===== LAYOUT ===== */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    border-bottom: 1px solid var(--border);
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-decoration: none;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
    display: grid;
    place-items: center;
    color: #ffffff;
    font-weight: 800;
    font-size: 14px;
    box-shadow: 0 0 20px var(--accent-glow);
}

.brand small {
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 4px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

main {
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
    width: 100%;
}

/* ===== TIPOGRAFIA ===== */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.4; }

.eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
}

.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.mono { font-family: var(--font-mono); }

/* ===== PAGE HEADER ===== */
.page-head {
    margin-bottom: 28px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-head-text { display: flex; flex-direction: column; gap: 6px; }

/* Quando o primeiro filho do page-head é um botão (ex: "← Voltar"),
   alinha o TEXTO do botão com o ponto onde o texto de "Olá, cliente" /
   "Visão geral" / eyebrow começaria, compensando o padding interno do btn-sm. */
.page-head-text > button:first-child { margin-top: -9px; margin-bottom: 4px; margin-left: -10px; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color var(--t);
}

.card:hover { border-color: var(--border-hover); }

.card-pad-lg { padding: 32px; }
.card-pad-sm { padding: 16px; }

/* ===== GRID ===== */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.flex { display: flex; gap: 12px; }
.flex-col { display: flex; flex-direction: column; gap: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-end { display: flex; justify-content: flex-end; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }

/* ===== STATS ===== */
.stat {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--t);
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform var(--t);
}

.stat:hover { border-color: var(--border-hover); }
.stat:hover::before { transform: scaleY(1); }

.stat-label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-value.accent { color: var(--accent); }
.stat-value.warning { color: var(--warning); }

/* ===== BOTÕES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--t);
    text-decoration: none;
    user-select: none;
    white-space: nowrap;
}

.btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    font-weight: 600;
    box-shadow: 0 0 0 0 var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-dim);
    border-color: var(--accent-dim);
    box-shadow: 0 0 24px var(--accent-glow);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: transparent;
    border-color: var(--warning);
    color: var(--warning);
}

.btn-warning:hover {
    background: var(--warning);
    color: var(--bg-primary);
}

.btn-success {
    background: transparent;
    border-color: var(--accent);
    color: var(--accent);
}

.btn-success:hover {
    background: var(--accent);
    color: #ffffff;
}

.btn-edit {
    background: transparent;
    border-color: var(--edit);
    color: var(--edit);
}

.btn-edit:hover {
    background: var(--edit);
    color: #ffffff;
}

.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== INPUTS / FORMS ===== */
.field { display: flex; flex-direction: column; gap: 6px; }

.label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 500;
}

.input, .select, .textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 14px;
    transition: var(--t);
    outline: none;
}

.input:hover, .select:hover, .textarea:hover { border-color: var(--border-hover); }

.input:focus, .select:focus, .textarea:focus {
    border-color: var(--accent);
    background-color: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.input::placeholder { color: var(--text-muted); }
.input.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

/* Select: substitui a setinha nativa por uma SVG com respiro adequado */
select.input, .select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1 6 6 11 1'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}
select.input::-ms-expand, .select::-ms-expand { display: none; }

.textarea { resize: vertical; min-height: 80px; }

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
}

.input-group .input { padding-left: 42px; }

/* ===== TABELAS ===== */
.table-wrap {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    text-align: left;
    padding: 14px 18px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--bg-tertiary); cursor: pointer; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-success { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.badge-warning { color: var(--warning); border-color: var(--warning); background: var(--warning-glow); }
.badge-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-glow); }

.badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: fit-content;
}

.tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--t);
}

.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--bg-elevated); color: var(--accent); }

/* ===== MODAL ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-lg { max-width: 720px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 20px;
    line-height: 1;
    transition: color var(--t-fast);
}
.modal-close:hover { color: var(--text-primary); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    border: 1px solid;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 14px;
}

.alert-info { background: rgba(62, 184, 255, 0.08); border-color: rgba(62, 184, 255, 0.3); color: var(--info); }
.alert-success { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.alert-warning { background: var(--warning-glow); border-color: var(--warning); color: var(--warning); }
.alert-danger { background: var(--danger-glow); border-color: var(--danger); color: var(--danger); }

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 300;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 18px;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: slideInRight 0.3s ease;
    font-size: 14px;
}

.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== AUTH SCREEN (login admin) ===== */
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.auth-head { text-align: center; margin-bottom: 28px; }
.auth-head .brand-mark { margin: 0 auto 16px; width: 48px; height: 48px; font-size: 20px; }

.code-input {
    font-family: var(--font-mono);
    font-size: 24px;
    text-align: center;
    letter-spacing: 0.5em;
    font-weight: 600;
    padding: 16px;
}

.qr-frame {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    margin: 0 auto;
    width: fit-content;
}

.secret-box {
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-hover);
    padding: 14px;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 13px;
    word-break: break-all;
    text-align: center;
    color: var(--accent);
}

/* ===== EMPTY STATE ===== */
.empty {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: grid;
    place-items: center;
    color: var(--text-muted);
}

/* ===== SEARCH BAR ===== */
.search-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    transition: var(--t);
}

.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.search-bar .input {
    border: none;
    background: transparent;
    padding: 8px 12px;
    flex: 1;
    font-size: 15px;
}

.search-bar .input:focus { box-shadow: none; background: transparent; }

.search-filter {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.search-filter button {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--t-fast);
}

.search-filter button:hover { color: var(--text-primary); }
.search-filter button.active { background: var(--bg-elevated); color: var(--accent); }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }

.divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

.kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== HERO (página cliente) ===== */
.hero {
    text-align: center;
    padding: 0 24px 40px;
}

.hero h1 {
    font-size: 48px;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}

.hero h1 .accent { color: var(--accent); }

.hero p {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 32px;
}

@media (max-width: 640px) {
    .hero { padding: 0 16px 32px; }
    .hero h1 { font-size: 32px; }
    main { padding: 20px 16px; }
    .topbar-inner { padding: 14px 16px; }

    /* ÁREA DO CLIENTE — Cards de vistoria empilham em mobile
       (endereço em cima, badge embaixo, alinhados à esquerda). */
    .vist-card .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Badge de status ainda menor em mobile pra economizar espaço horizontal */
    .badge {
        font-size: 10px;
        padding: 3px 8px;
        letter-spacing: 0.02em;
    }

    /* page-head com ações à direita: empilha em vez de espremer */
    .page-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .page-head > .flex,
    .page-head > div:last-child:not(.page-head-text) {
        width: 100%;
    }

    /* Cards com menos padding em mobile */
    .card { padding: 18px; }
    .card-pad-lg { padding: 22px; }

    /* Ações do header (área do cliente: revistoria, cancelar) ocupam linha inteira */
    #acoesRevistoria { width: 100%; }
    #acoesRevistoria > .btn { width: 100%; }   /* botão único (Cancelar / Solicitar) */
    #acoesRevistoria > .flex { width: 100%; }  /* container do "Solicitar + i" */
    /* Quando há botão + ícone "i" no mesmo container, o botão cresce e o "i" fica fixo ao lado */
    #acoesRevistoria > .flex > .btn { flex: 1; }
    #acoesRevistoria > .flex > #infoRevistoria { flex-shrink: 0; }

    /* Search bar em mobile: lupa + input continuam lado a lado (linha 1)
       e os filtros descem pra linha 2 ocupando largura total. */
    .search-bar {
        flex-wrap: wrap;
        row-gap: 6px;
    }
    .search-filter {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .search-filter::-webkit-scrollbar { display: none; }
    .search-filter button {
        flex: 1 0 auto;
        white-space: nowrap;
    }

    /* Paginação do admin (vistorias / clientes) empilha contador em cima e
       botões embaixo centralizados, pra não quebrar em tela estreita. */
    .flex-between:has(> .flex > #prev),
    .flex-between:has(> .flex > #prevCli) {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
}

/* ============================================
   PÁGINA DE ARQUIVOS DA VISTORIA
   ============================================ */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    transition: all var(--t);
    background: var(--bg-tertiary);
    cursor: default;
}

.dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.dropzone-icon {
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.dropzone.dragover .dropzone-icon { color: var(--accent); }

.dropzone-text {
    color: var(--text-secondary);
    font-size: 15px;
}

.dropzone-link {
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.dropzone-link:hover { color: var(--accent-dim); }

.upload-item {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.arquivo-item {
    display: grid;
    grid-template-columns: auto auto 64px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    transition: all var(--t-fast);
}

.arquivo-item:hover { border-color: var(--border-hover); }

.arquivo-item.selected {
    border-color: var(--edit);
    background: rgba(62, 184, 255, 0.04);
}

.arquivo-item.dragging { opacity: 0.5; }

.arquivo-item.drop-target {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.arquivo-handle {
    color: var(--text-muted);
    cursor: grab;
    user-select: none;
    font-size: 18px;
    padding: 0 4px;
    letter-spacing: -3px;
}

.arquivo-handle:active { cursor: grabbing; }

.arquivo-check {
    width: 18px;
    height: 18px;
    accent-color: var(--edit);
    cursor: pointer;
}

.arquivo-info { min-width: 0; }

.arquivo-nome {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    word-break: break-word;
}

.arquivo-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}

.arquivo-acoes {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.file-icon {
    width: 64px;
    height: 64px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

@media (max-width: 640px) {
    .arquivo-item {
        grid-template-columns: auto auto 1fr;
        grid-template-rows: auto auto;
    }
    .arquivo-item img, .file-icon {
        grid-column: 3;
        grid-row: 1;
    }
    .arquivo-info {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    .arquivo-acoes {
        grid-column: 1 / -1;
        grid-row: 3;
        justify-content: flex-end;
    }
}


.fade-in-up { animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both; }
[data-delay="1"] { animation-delay: 0.06s; }
[data-delay="2"] { animation-delay: 0.12s; }
[data-delay="3"] { animation-delay: 0.18s; }
[data-delay="4"] { animation-delay: 0.24s; }

/* ============================================
   SEGMENTED CONTROL (toggle vistoria/revistoria)
   ============================================ */
.seg-control {
    display: inline-flex;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3px;
    gap: 2px;
}

.seg-btn {
    padding: 7px 14px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: calc(var(--radius) - 3px);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--t-fast);
    font-family: inherit;
}

.seg-btn:hover { color: var(--text-primary); }

.seg-btn.active {
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
}

/* ============================================
   SEÇÃO POR ETAPA (vistoria / revistoria)
   ============================================ */
.etapa-section {
    border-left: 3px solid var(--border);
    padding-left: 16px;
    margin-bottom: 24px;
}

.etapa-section-vistoria {
    border-left-color: var(--accent);
}

.etapa-section-revistoria {
    border-left-color: var(--info, #3eb8ff);
}

.etapa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
}

.etapa-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.etapa-section-vistoria .etapa-label { color: var(--accent); }
.etapa-section-revistoria .etapa-label { color: var(--info, #3eb8ff); }
/* ============================================
   CHECKOUT — Contratação pública
   Modal de múltiplos passos para Mercado Pago
   ============================================ */
.co-steps {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 12px 4px 0;
}

.co-step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    opacity: 0.55;
    transition: opacity var(--t);
}

.co-step.active,
.co-step.done {
    opacity: 1;
}

.co-step-num {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    display: grid;
    place-items: center;
    transition: var(--t);
}

.co-step.active .co-step-num {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.co-step.done .co-step-num {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.co-step.done .co-step-num::before {
    content: '✓';
}
.co-step.done .co-step-num > * { display: none; }

.co-step-lbl {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
}

.co-step.active .co-step-lbl { color: var(--text-primary); }
.co-step.done .co-step-lbl { color: var(--accent); }

.co-step-bar {
    flex: 1;
    height: 1px;
    background: var(--border);
    min-width: 8px;
}

@media (max-width: 520px) {
    .co-step-lbl { display: none; }
    .co-steps { gap: 6px; }
}

/* Brick do Mercado Pago — combina com tema dark */
#cardPaymentBrick_container {
    min-height: 360px;
}

/* ============================================
   MOBILE — Evitar zoom automático do iOS Safari
   ao focar inputs (acontece quando font-size < 16px)
   ============================================ */
@media (max-width: 768px) {
    .input,
    .select,
    .textarea,
    select.input,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    input[type="search"],
    input[type="date"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* ============================================
   SEARCH — Botão X para limpar input
   ============================================ */
.search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}
.search-input-wrap .input {
    width: 100%;
    padding-right: 36px; /* espaço pro X */
}

.search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    transition: var(--t-fast);
}
.search-clear:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}
.search-clear[hidden] { display: none; }

/* ============================================
   FOOTER — Copyright
   ============================================ */
/* Main mantém flex:1 (sticky-footer pattern). Reduzimos seu padding-bottom
   quando há footer logo após, pra que a soma com o padding interno do
   footer dê um respiro confortável (não exagerado). */
main:has(+ .site-footer) { padding-bottom: 32px; }

.site-footer {
    margin-top: 0;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

.site-footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 16px;
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

@media (max-width: 768px) {
    .site-footer { padding: 14px 16px; }
    .site-footer-inner {
        padding: 0;
        font-size: 11px;
    }
    /* Força quebra de linha antes de "Todos os direitos..." em telas estreitas */
    .footer-br { display: block; height: 0; font-size: 0; }
}

/* ============================================
   TOPBAR — Nome do usuário (área do cliente)
   ============================================ */
/* Quando há nome de usuário na topbar, reduzir o gap entre ele
   e o botão sair pra dar mais espaço para o nome. */
.topbar-actions:has(#topUserName:not([hidden])) { gap: 4px; }

.top-user-name {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    max-width: 320px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@media (max-width: 768px) {
    /* Mobile: ocultar "/ área do cliente" no brand pra dar espaço */
    .brand .brand-sub { display: none; }
    .top-user-name {
        /* Com gap de 4px e padding 16px do container, sobra basicamente
           tudo entre a brand (~150px) e o botão sair (~36px). */
        max-width: calc(100vw - 210px);
        font-size: clamp(9px, 3.2vw, 12px);
        letter-spacing: 0.04em;
    }
}