/* ============================================
   ESTILO PRINCIPAL - SISTEMA DE ORÇAMENTOS
   Responsivo e moderno
   ============================================ */

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

body {
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  background: #f4f7fc;
  color: #1e2a3a;
  line-height: 1.5;
  padding-bottom: 30px;
}

a {
  text-decoration: none;
  color: #0056b3;
}
a:hover {
  text-decoration: underline;
}

/* ----- Topbar (cabeçalho) ----- */
.topbar {
  background: #0b1a2e;
  color: #f8c75d;
  padding: 18px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.topbar h1 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar h1 small {
  font-weight: 300;
  font-size: 0.8rem;
  color: #c0d0e0;
  margin-left: 8px;
}

.topbar a {
  background: #f8c75d;
  color: #0b1a2e;
  padding: 8px 18px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s;
  white-space: nowrap;
}
.topbar a:hover {
  background: #f5b82e;
  text-decoration: none;
}

/* ----- Container principal ----- */
.container {
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 20px;
}

.container h2 {
  font-size: 1.6rem;
  margin-bottom: 18px;
  color: #0b1a2e;
  border-left: 6px solid #f8c75d;
  padding-left: 14px;
}

/* ----- Tabelas (lista de orçamentos) ----- */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

table th {
  background: #0b1a2e;
  color: #fff;
  font-weight: 600;
  padding: 14px 12px;
  text-align: left;
  font-size: 0.9rem;
}

table td {
  padding: 12px;
  border-bottom: 1px solid #e9edf2;
  vertical-align: middle;
}

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

table tr:hover td {
  background: #f8fafc;
}

/* Ações (botões) dentro da tabela */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.actions a {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s;
  text-align: center;
}
.actions a.editar {
  background: #e8f0fe;
  color: #1a5ba8;
}
.actions a.editar:hover {
  background: #d0e0fc;
}
.actions a.pdf {
  background: #f0f0f0;
  color: #333;
}
.actions a.pdf:hover {
  background: #ddd;
}
.actions a.excluir {
  background: #fee9e7;
  color: #b3362a;
}
.actions a.excluir:hover {
  background: #fdd5d0;
}

/* ----- Formulários (novo / editar) ----- */
form {
  background: #fff;
  padding: 28px 30px;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

label {
  display: block;
  font-weight: 600;
  margin: 16px 0 4px 0;
  font-size: 0.95rem;
  color: #1e2a3a;
}

input[type="text"],
input[type="tel"],
input[type="date"],
input[type="email"],
input[type="password"],
input[type="color"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.2s;
}
input:focus {
  border-color: #f8c75d;
  outline: none;
  box-shadow: 0 0 0 3px rgba(248, 199, 93, 0.2);
}

/* Layout em duas colunas para campos */
.linha-dupla {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.linha-dupla > div {
  display: flex;
  flex-direction: column;
}
.linha-dupla > div label {
  margin-top: 12px;
}

/* Tabela de itens (dentro do form) */
#itens-table {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
}
#itens-table th {
  background: #eef2f7;
  color: #1e2a3a;
  padding: 10px 8px;
  font-size: 0.9rem;
  text-align: left;
}
#itens-table td {
  padding: 6px 4px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
}
#itens-table input[type="text"] {
  padding: 10px 10px;
  font-size: 0.95rem;
  width: 100%;
  border: 1px solid #d0d7e2;
  border-radius: 6px;
}

/* Botões de adicionar/remover item */
.btn-add,
.btn-salvar {
  background: #0b1a2e;
  color: #f8c75d;
  border: none;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 16px;
}
.btn-add:hover,
.btn-salvar:hover {
  background: #1c3452;
}
.btn-add {
  background: #eef2f7;
  color: #0b1a2e;
  margin-right: 8px;
}
.btn-add:hover {
  background: #d5dde8;
}
.btn-remove {
  background: transparent;
  border: none;
  color: #b3362a;
  font-size: 1.3rem;
  font-weight: bold;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}
.btn-remove:hover {
  background: #fee9e7;
}

/* Pré-visualização do total */
.total-preview {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 20px 0 10px 0;
  color: #0b1a2e;
  background: #f8fafc;
  padding: 12px 18px;
  border-radius: 10px;
  border-left: 6px solid #f8c75d;
}

/* ========== PÁGINAS DE LOGIN / REGISTRO ========== */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0b1a2e 0%, #1a2f4a 100%);
  padding: 20px;
}

.login-box {
  background: #fff;
  padding: 40px 35px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 420px;
}

.login-box h1 {
  text-align: center;
  font-size: 2rem;
  color: #0b1a2e;
  margin-bottom: 2px;
}
.login-box .subtitle {
  text-align: center;
  color: #6b7a8a;
  font-size: 0.95rem;
  margin-bottom: 25px;
}

.login-box label {
  margin-top: 12px;
}

.login-box .btn-salvar {
  width: 100%;
  margin-top: 20px;
}

.login-box .erro,
.login-box .sucesso,
.mensagem {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 15px;
  font-weight: 500;
}
.erro {
  background: #fee9e7;
  color: #b3362a;
  border: 1px solid #fdd5d0;
}
.sucesso {
  background: #e6f7e6;
  color: #1a6b1a;
  border: 1px solid #b8e0b8;
}
.mensagem {
  background: #e8f0fe;
  color: #1a5ba8;
}

.registro-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.95rem;
}

/* ========== DASHBOARD ========== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 20px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  text-align: center;
}
.card .rotulo {
  display: block;
  font-size: 0.9rem;
  color: #6b7a8a;
}
.card .numero {
  display: block;
  font-size: 2.4rem;
  font-weight: 700;
  color: #0b1a2e;
  margin: 6px 0;
}
.card .variacao {
  font-size: 0.9rem;
  font-weight: 600;
}
.card .variacao.positivo {
  color: #1a7a1a;
}
.card .variacao.negativo {
  color: #b3362a;
}

.graficos-linha {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  margin-top: 20px;
}

.grafico-box {
  background: #fff;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.grafico-box h3 {
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.top-clientes {
  width: 100%;
  border-collapse: collapse;
}
.top-clientes td {
  padding: 8px 4px;
  border-bottom: 1px solid #eef2f7;
}

/* ========== RESPONSIVIDADE ========== */
@media (max-width: 820px) {
  .topbar h1 {
    font-size: 1.1rem;
  }
  .topbar a {
    padding: 6px 14px;
    font-size: 0.85rem;
  }
  .container {
    padding: 0 16px;
  }
  .linha-dupla {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .linha-dupla > div label {
    margin-top: 8px;
  }
  form {
    padding: 20px 18px;
  }
  .graficos-linha {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 14px 16px;
  }
  .topbar h1 {
    font-size: 1rem;
    justify-content: center;
  }
  .topbar h1 small {
    display: block;
    font-size: 0.7rem;
    margin-left: 0;
  }
  .topbar a {
    align-self: center;
    width: 100%;
    max-width: 200px;
    text-align: center;
  }

  .container table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .container table th,
  .container table td {
    padding: 10px 8px;
    font-size: 0.85rem;
  }
  .actions {
    flex-direction: column;
    gap: 4px;
  }
  .actions a {
    width: 100%;
    text-align: center;
    padding: 8px 0;
  }

  #itens-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  #itens-table th,
  #itens-table td {
    padding: 6px 4px;
    font-size: 0.85rem;
  }
  #itens-table input[type="text"] {
    font-size: 0.9rem;
    padding: 8px 6px;
    min-width: 100px;
  }
  .btn-remove {
    font-size: 1.1rem;
    padding: 2px 8px;
  }

  .btn-add,
  .btn-salvar {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 14px;
    font-size: 1rem;
  }

  .total-preview {
    font-size: 1.2rem;
    padding: 10px 14px;
  }

  form {
    padding: 16px 14px;
  }

  .login-box {
    padding: 30px 20px;
  }
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}