@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --bg: #111827;
  --surface: #1f2937;
  --surface2: #374151;
  --border: #4b5563;
  --accent: #6b7280;
  --accent2: #f87171;
  --accent3: #4ade80;
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --radius: 12px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* SIDEBAR */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
}

.logo {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 32px;
  padding-left: 8px;
  letter-spacing: -0.5px;
  text-decoration: none;
  display: block;
}
.logo span { color: var(--accent); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 4px;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-spacer { flex: 1; }

.sidebar-user {
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 12px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MAIN */
.main {
  margin-left: 220px;
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.page-title {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  font-weight: 700;
}

/* CARDS */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.dash-card .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.dash-card .value {
  font-family: 'Syne', sans-serif;
  font-size: 34px;
  font-weight: 700;
}

.dash-card.c1 .value { color: var(--accent); }
.dash-card.c2 .value { color: var(--accent2); }
.dash-card.c3 .value { color: var(--accent3); }
.dash-card.c4 .value { color: #ffd700; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #4b5563; }
.btn-danger  { background: #ff4757; color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #e03545; }
.btn-ghost   { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled)   { border-color: var(--accent); color: var(--accent); }
.btn-success { background: var(--accent3); color: #000; }
.btn-success:hover:not(:disabled) { background: #35d469; }
.btn-sm      { padding: 6px 12px; font-size: 13px; }
.btn-logout  { background: transparent; border: 1px solid var(--border); color: var(--text-muted); width: 100%; justify-content: center; margin-top: 6px; }
.btn-logout:hover { border-color: var(--accent2); color: var(--accent2); }

/* TABLE */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--surface2);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
}
tbody tr { border-top: 1px solid var(--border); transition: background 0.1s; }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 14px 16px; font-size: 14px; }

/* BADGES */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
/* proposal status */
.badge-draft    { background: #374151; color: var(--text-muted); }
.badge-sent     { background: #1e3a5f; color: #60a5fa; }
.badge-approved { background: #14532d; color: var(--accent3); }
.badge-rejected { background: #4c1c1c; color: var(--accent2); }
/* customer type */
.badge-pj { background: #374151; color: var(--text); }
.badge-pf { background: #2d2f45; color: #a5b4fc; }

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* FORM */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 10px 12px;
  transition: border-color 0.15s;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--surface2); }

/* Radio group */
.radio-group {
  display: flex;
  gap: 20px;
  margin-top: 4px;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.radio-label input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* PROPOSAL ITEMS */
.item-linha {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.total-proposal {
  text-align: right;
  margin-top: 16px;
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent3);
}

/* STATES */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty .empty-text { font-size: 15px; }

/* SEARCH */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
}
.search-bar input { flex: 1; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent3);
  border-radius: 8px;
  padding: 14px 20px;
  font-size: 14px;
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}
.toast.show  { transform: translateY(0); opacity: 1; }
.toast.error { border-left-color: var(--accent2); }

/* PAGE LOADER */
#page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.4s ease;
}
#page-loader.fade-out { opacity: 0; pointer-events: none; }

.loader-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* LOGIN */
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
}
.login-logo span { color: var(--accent); }

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 36px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-error {
  background: #2a1010;
  border: 1px solid #ff4757;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--accent2);
  display: none;
  margin-bottom: 4px;
}
.login-error.show { display: block; }

.turnstile-wrap { display: flex; justify-content: center; margin: 4px 0; }

.login-btn {
  width: 100%;
  padding: 14px;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
}

/* KANBAN PIPELINE */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}

.kanban-col {
  flex: 0 0 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 300px;
  transition: background 0.15s, border-color 0.15s;
}

.kanban-col.drag-over {
  background: var(--surface2);
  border-color: var(--accent);
}

.kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.kanban-col-title {
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kanban-col-count {
  background: var(--surface2);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.col-prospecting   .kanban-col-title { color: #a78bfa; }
.col-qualification .kanban-col-title { color: #fbbf24; }
.col-proposal      .kanban-col-title { color: #60a5fa; }
.col-negotiation   .kanban-col-title { color: #fb923c; }
.col-won           .kanban-col-title { color: var(--accent3); }
.col-lost          .kanban-col-title { color: var(--accent2); }

.kanban-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: border-color 0.15s, transform 0.1s;
  user-select: none;
}

.kanban-card:active  { cursor: grabbing; }
.kanban-card:hover   { border-color: var(--accent); }
.kanban-card.dragging { opacity: 0.4; transform: rotate(1deg); }

.kanban-card-title  { font-size: 13px; font-weight: 500; margin-bottom: 4px; line-height: 1.3; }
.kanban-card-client { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.kanban-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.kanban-card-value  { font-size: 13px; color: var(--accent3); font-weight: 600; }
.kanban-card-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.kanban-card:hover .kanban-card-actions { opacity: 1; }

.kanban-add {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 4px;
  text-align: center;
}
.kanban-add:hover { border-color: var(--accent); color: var(--accent); background: var(--surface2); }

/* SUMMARY LAYOUT */
.summary-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-muted);
}
