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

:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #22263a;
  --border: #2e3248;
  --text: #e8eaf0;
  --text2: #9ba3c0;
  --green: #00c97a;
  --red: #ff4d6a;
  --blue: #4f8ef7;
  --yellow: #f7c948;
  --radius: 12px;
  --font: 'Inter', system-ui, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }

/* HEADER */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-logo { font-size: 18px; font-weight: 700; color: var(--blue); }
.header-user { display: flex; align-items: center; gap: 10px; }
.header-user img { width: 32px; height: 32px; border-radius: 50%; }
.header-user span { color: var(--text2); font-size: 13px; }

/* CONTAINER */
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px; }

/* CARDS */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

/* RESUMO TOPO */
.resumo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.resumo-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.resumo-item .label { color: var(--text2); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.resumo-item .valor { font-size: 20px; font-weight: 700; }

/* LISTA DE ATIVOS */
.ativo-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color .15s;
}
.ativo-item:hover { border-color: var(--blue); }
.ativo-left { display: flex; flex-direction: column; gap: 4px; }
.ativo-ticker { font-size: 16px; font-weight: 700; }
.ativo-qty { color: var(--text2); font-size: 12px; }
.ativo-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ativo-valor { font-size: 16px; font-weight: 600; }
.ativo-rentab { font-size: 13px; font-weight: 600; }

/* CORES */
.green { color: var(--green); }
.red   { color: var(--red); }
.blue  { color: var(--blue); }
.gray  { color: var(--text2); }

/* BOTÃO + */
.fab {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 26px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(79,142,247,.4);
  transition: transform .15s;
  z-index: 200;
}
.fab:hover { transform: scale(1.08); }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  display: none;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 420px;
}
.modal h2 { margin-bottom: 20px; font-size: 18px; }

/* FORM */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; color: var(--text2); font-size: 12px; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.form-group input, .form-group select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--blue); }

/* BOTÕES */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-danger  { background: var(--red);  color: #fff; }
.btn-ghost   { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* DETALHES */
.detalhe-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.detalhe-campo { display: flex; flex-direction: column; gap: 4px; }
.detalhe-campo .label { color: var(--text2); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.detalhe-campo .valor { font-size: 15px; font-weight: 600; }

/* LOGIN */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
}
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  text-align: center;
  max-width: 360px;
  width: 100%;
}
.login-card h1 { font-size: 24px; margin-bottom: 8px; }
.login-card p  { color: var(--text2); margin-bottom: 32px; font-size: 14px; }
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  background: #fff;
  color: #333;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: opacity .15s;
}
.btn-google:hover { opacity: .9; }

/* VAZIO */
.empty { text-align: center; color: var(--text2); padding: 48px 0; font-size: 15px; }

/* SPINNER */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 48px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* MENU CONTEXTO */
.ctx-menu {
  position: fixed;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 0;
  min-width: 200px;
  z-index: 400;
  display: none;
}
.ctx-menu.open { display: block; }
.ctx-item {
  padding: 10px 18px;
  cursor: pointer;
  font-size: 14px;
  transition: background .1s;
}
.ctx-item:hover { background: var(--bg3); }
.ctx-item.danger { color: var(--red); }

/* TOAST */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 14px;
  z-index: 500;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

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