* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #e9edf2;
    color: #1f2937;
}

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
}

.sidebar-top {
    padding: 14px 18px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-box {
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 130px;
}

.logo-img {
    width: 100%;
    max-width: 125px;
    max-height: 125px;
    object-fit: contain;
    display: block;
}

.menu {
    padding: 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0;
}

.menu-brand,
.menu-item {
    text-decoration: none;
    color: white;
    padding: 11px 14px;
    border-radius: 10px;
    transition: 0.2s ease;
    display: block;
    font-weight: 600;
}

.menu-brand {
    background: rgba(255,255,255,0.05);
}

.menu-item:hover,
.menu-item.active {
    background: #dc2626;
}

.sidebar-footer {
    padding: 4px 14px 10px;
    margin-top: 0;
}

.phone-box {
    margin-top: 12px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    font-size: 14px;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 18px;
    background: #e9edf2;
}

.topbar {
    background: linear-gradient(180deg, #374151 0%, #1f2937 100%);
    border-radius: 18px 18px 0 0;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: white;
    margin-bottom: 18px;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.phone-top {
    font-weight: 700;
    white-space: nowrap;
}

.content-grid {
    background: transparent;
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 20px 0 0;
    align-items: start;
    transition: all 0.3s ease;
    flex: 1;
}

.content-grid.form-open {
    grid-template-columns: 2fr 1fr;
}

.table-card,
.form-card {
    background: #f8fafc;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

#formCliente {
    display: none;
    opacity: 0;
    transform: translateX(30px);
}

#formCliente.show {
    display: block;
    opacity: 1;
    transform: translateX(0);
    transition: all 0.3s ease;
}

.search-row {
    margin-bottom: 18px;
}

.search-input,
.orcamento-form input,
.orcamento-form select,
.orcamento-form textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #cfd8e3;
    border-radius: 10px;
    outline: none;
    font-size: 15px;
    background: #ffffff;
    color: #111827;
}

.orcamento-form textarea {
    resize: vertical;
    min-height: 110px;
}

.orcamento-form label {
    display: block;
    margin-bottom: 8px;
    margin-top: 14px;
    font-weight: 700;
    color: #374151;
}

.form-card h2 {
    font-size: 20px;
    margin-bottom: 12px;
    color: #111827;
    font-weight: 800;
}

.save-btn {
    width: 100%;
    margin-top: 18px;
    background: #22a36a;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 15px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 14px;
}

thead th {
    background: linear-gradient(180deg, #374151 0%, #1f2937 100%);
    color: white;
    padding: 15px 14px;
    text-align: left;
    font-size: 15px;
}

tbody td {
    padding: 14px;
    border-bottom: 1px solid #dbe2ea;
    color: #111827;
    vertical-align: middle;
    background: #ffffff;
}

tbody tr:hover {
    background: #f9fafb;
}

.status-badge {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.status-aprovado {
    background: #43a047;
}

.status-pendente {
    background: #e3a622;
}

.status-recusado {
    background: #e53935;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.action-btn {
    display: inline-block;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    margin-right: 6px;
}

.edit-btn {
    background: #3b82f6;
    color: white;
}

.delete-btn {
    background: #ef4444;
    color: white;
}

.empty-state {
    text-align: center;
    padding: 24px;
    color: #6b7280;
}

.footer-bar {
    margin-top: 18px;
    background: white;
    border-radius: 0 0 18px 18px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    font-size: 14px;
}

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

    .topbar,
    .footer-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

.textured {
    background:
        linear-gradient(180deg, rgba(55,65,81,0.96) 0%, rgba(31,41,55,0.96) 100%),
        radial-gradient(circle at top left, rgba(255,255,255,0.06), transparent 35%),
        radial-gradient(circle at bottom right, rgba(255,255,255,0.04), transparent 30%);
}

.textured-sidebar {
    background:
        linear-gradient(180deg, rgba(31,41,55,0.98) 0%, rgba(17,24,39,0.98) 100%),
        radial-gradient(circle at top left, rgba(255,255,255,0.05), transparent 30%),
        radial-gradient(circle at bottom left, rgba(220,38,38,0.08), transparent 35%);
}

tbody tr:hover {
    background: rgba(255,255,255,0.03);
    transition: 0.2s;
}

.page-title {
    color: #111827;
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 10px;
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.btn-novo {
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 8px 18px rgba(34, 197, 94, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-novo:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 22px rgba(34, 197, 94, 0.35);
}

#contentGridCliente {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
    align-items: start;
}

#contentGridCliente.form-open {
    grid-template-columns: minmax(0, 1fr) 360px;
}

#formOrcamento {
    display: none;
    opacity: 0;
    transform: translateX(30px);
}

#formOrcamento.show {
    display: block;
    opacity: 1;
    transform: translateX(0);
    transition: all 0.3s ease;
}

/* SEGURA A TABELA PRA NÃO QUEBRAR O LAYOUT */
.table-card {
    min-width: 0;
}

/* FAZ A TABELA ROLAR AO INVÉS DE ESPREMER */
.table-wrapper {
    overflow-x: auto;
}

/* EVITA TEXTO GIGANTE EXPLODIR A TABELA */
table {
    min-width: 1250px;
}

/* NÃO QUEBRA TUDO À FORÇA */
td, th {
    word-break: normal;
    overflow-wrap: break-word;
}

/* TRAVA O TAMANHO DO FORM */
#formCliente {
    width: 360px;
    min-width: 360px;
    max-width: 360px;
}

.edit-actions {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #51627b;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 16px;
    transition: 0.2s;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(81, 98, 123, 0.25);
}

/* CORREÇÃO DOS BOTÕES NA TELA DE EDITAR */
.edit-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

.edit-actions .save-btn,
.edit-actions .back-btn {
    flex: 1;
    height: 55px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-top: 0; /* REMOVE o espaço extra do save-btn */
}

/* SOBRESCREVE O WIDTH 100% SÓ AQUI */
.edit-actions .save-btn {
    width: auto;
}

.orcamento-form {
    width: 100%;
}

.edit-actions {
    width: 100%;
}

.edit-actions .save-btn,
.edit-actions .back-btn {
    flex: 1;
    min-width: 0;
}

/* MODAL DE CONFIRMAÇÃO */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-box {
    width: 100%;
    max-width: 420px;
    background: #f8fafc;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.30);
    padding: 24px;
    animation: modalPop 0.18s ease;
}

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

.modal-box h3 {
    margin: 0 0 10px;
    font-size: 22px;
    color: #111827;
}

.modal-box p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: #4b5563;
}

.modal-actions {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-btn {
    min-height: 52px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.modal-btn:hover {
    transform: translateY(-2px);
}

.modal-cancel {
    background: #64748b;
    color: white;
}

.modal-confirm {
    background: #dc2626;
    color: white;
}

.pagamento-badge {
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

/* Pago */
.pagamento-pago {
    background-color: #16a34a; /* verde */
}

/* Não pago */
.pagamento-não-pago,
.pagamento-nao-pago {
    background-color: #dc2626; /* vermelho */
}


/* Colunas da tabela de orçamentos */
.table-wrapper table th,
.table-wrapper table td {
    vertical-align: middle;
}

.table-wrapper table th:nth-child(1),
.table-wrapper table td:nth-child(1) {
    width: 60px;
    white-space: nowrap;
}

.table-wrapper table th:nth-child(2),
.table-wrapper table td:nth-child(2) {
    white-space: normal;
    word-break: keep-all;
}

.table-wrapper table th:nth-child(3),
.table-wrapper table td:nth-child(3) {
    width: 320px;
}

.table-wrapper table th:nth-child(4),
.table-wrapper table td:nth-child(4) {
    width: 130px;
    white-space: nowrap;
}

.table-wrapper table th:nth-child(5),
.table-wrapper table td:nth-child(5) {
    width: 120px;
    white-space: nowrap;
}

.table-wrapper table th:nth-child(6),
.table-wrapper table td:nth-child(6) {
    width: 120px;
    white-space: nowrap;
}

.table-wrapper table th:nth-child(7),
.table-wrapper table td:nth-child(7) {
    width: 110px;
    white-space: nowrap;
}

.table-wrapper table th:nth-child(8),
.table-wrapper table td:nth-child(8) {
    width: 120px;
    white-space: nowrap;
}

.table-wrapper table th:nth-child(9),
.table-wrapper table td:nth-child(9) {
    width: 90px;
    white-space: nowrap;
}

.table-wrapper table th:nth-child(10),
.table-wrapper table td:nth-child(10) {
    width: 240px;
    white-space: nowrap;
}

.table-wrapper table td:nth-child(1),
.table-wrapper table td:nth-child(4),
.table-wrapper table td:nth-child(5),
.table-wrapper table td:nth-child(6),
.table-wrapper table td:nth-child(7),
.table-wrapper table td:nth-child(8),
.table-wrapper table td:nth-child(9) {
    text-align: center;
}

.table-wrapper table td:nth-child(3) {
    line-height: 1.4;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.dashboard-card {
    background: #f8fafc;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dashboard-card strong {
    font-size: 28px;
    color: #111827;
    font-weight: 800;
}

.dashboard-label {
    font-size: 15px;
    color: #4b5563;
    font-weight: 700;
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

.dashboard-card:nth-child(1) {
    border-left: 5px solid #f59e0b;
}

.dashboard-card:nth-child(2) {
    border-left: 5px solid #22c55e;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 20px;
}

.chart-card {
    background: #f8fafc;
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
    height: 320px;
    display: flex;
    flex-direction: column;
}

.chart-card h3 {
    margin-bottom: 12px;
    color: #111827;
    font-size: 17px;
    font-weight: 800;
}

.chart-card canvas {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-height: 260px;
}

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

.dashboard-filter-bar {
    margin-top: 18px;
    margin-bottom: 4px;
    display: flex;
    justify-content: flex-end;
}

.dashboard-filter-bar form {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.dashboard-filter-bar label {
    font-size: 14px;
    font-weight: 700;
    color: #374151;
}

.dashboard-filter-bar select {
    border: 1px solid #cfd8e3;
    border-radius: 10px;
    padding: 10px 12px;
    background: white;
    color: #111827;
    font-size: 14px;
    outline: none;
}

.chart-box {
    position: relative;
    width: 100%;
    height: 280px; /* controla o tamanho aqui */
}

.btn-exportar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: #1f2937;
    color: white;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    transition: 0.2s ease;
}

.btn-exportar:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(31, 41, 55, 0.25);
}

.relatorios-filtros {
    margin-top: 18px;
    margin-bottom: 4px;
    display: flex;
    justify-content: flex-end;
}

.relatorios-filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
    max-width: 100%;
}

.relatorios-filter-form label {
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    margin: 0;
}

.relatorios-filter-form select {
    min-width: 110px;
    border: 1px solid #cfd8e3;
    border-radius: 10px;
    padding: 10px 12px;
    background: white;
    color: #111827;
    font-size: 14px;
    outline: none;
}

.relatorio-chart-section {
    margin-top: 18px;
}

.relatorio-chart-card {
    width: 100%;
}

.relatorio-chart-card .chart-box {
    height: 280px;
}

.main {
    min-width: 0;
}

.table-card {
    min-width: 0;
}

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

@media (max-width: 1100px) {
    .relatorios-filter-form {
        justify-content: flex-start;
    }
}

.flash-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.flash-message {
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.flash-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #111827, #374151);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #f8fafc;
    border-radius: 22px;
    padding: 34px;
    box-shadow: 0 18px 45px rgba(0,0,0,0.25);
}

.login-logo {
    width: 110px;
    height: 110px;
    object-fit: contain;
    display: block;
    margin: 0 auto 16px;
}

.login-card h1 {
    text-align: center;
    color: #111827;
    margin-bottom: 6px;
}

.login-card p {
    text-align: center;
    color: #6b7280;
    margin-bottom: 24px;
}

.login-card label {
    display: block;
    font-weight: 700;
    margin: 14px 0 8px;
    color: #374151;
}

.login-card input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid #cfd8e3;
    font-size: 15px;
}

.login-card button {
    width: 100%;
    margin-top: 22px;
    padding: 15px;
    border: none;
    border-radius: 12px;
    background: #dc2626;
    color: white;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
}

.login-card button:hover {
    background: #b91c1c;
}

.usuario-box {
    margin: 10px 14px 8px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 12px;
    color: #f9fafb;
    display: block;
}

.usuario-box span {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.usuario-box strong {
    font-size: 14px;
    color: #e5e7eb;
    white-space: nowrap;
}

.usuario-linha {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.usuario-link {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #9ca3af;
    text-decoration: none;
    padding-left: 2px;
    transition: 0.2s;
}

.usuario-link:hover {
    color: #ffffff;
}

.filtro-logs {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.filtro-logs .campo {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: #374151;
}

.filtro-logs input {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    min-width: 150px;
}

.filtro-logs .acoes {
    display: flex;
    gap: 10px;
}

/* =========================
   RESPONSIVO MOBILE - SOS
========================= */
@media (max-width: 768px) {

  .app {
    flex-direction: column;
  }

  /* SIDEBAR VIRA TOPO */
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .menu {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .menu-item {
    flex: 1 1 45%;
    text-align: center;
    font-size: 14px;
  }

  .sidebar-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  /* CONTEÚDO */
  .main {
    padding: 12px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar-right {
    width: 100%;
  }

  .btn-novo {
    width: 100%;
  }

  /* GRID PRINCIPAL */
  .content-grid {
    grid-template-columns: 1fr !important;
  }

  .content-grid.form-open {
    grid-template-columns: 1fr !important;
  }

  /* CARDS */
  .table-card,
  .form-card {
    padding: 14px;
  }

  /* TABELA SCROLL */
  .table-wrapper {
    overflow-x: auto;
  }

  table {
    min-width: 700px;
  }

  /* BOTÕES */
  .actions {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    text-align: center;
  }

  /* FORM */
  .orcamento-form input,
  .orcamento-form select,
  .orcamento-form textarea {
    width: 100%;
  }

  /* DASHBOARD */
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

}