:root {
  --bg: #0f1014;
  --panel: #181a21;
  --panel-2: #20232c;
  --line: #2a2e3a;
  --ink: #e8e9ee;
  --muted: #9aa0ad;
  --green: #22c55e;
  --red: #ef4444;
  --accent: #f7c948;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 14px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 10px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.brand { font-size: 20px; font-weight: 700; }
.updated { font-size: 12px; color: var(--muted); }

/* --- Cotações --- */
.quotes { margin-bottom: 14px; }
.quotes-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.qcard {
  flex: 0 0 auto;
  min-width: 130px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  position: relative;
}
.qcard .sym { font-weight: 700; font-size: 14px; }
.qcard .price { font-size: 18px; margin: 2px 0; }
.qcard .chg { font-size: 13px; font-weight: 600; }
.qcard .chg.up { color: var(--green); }
.qcard .chg.down { color: var(--red); }
.qcard .spark { display: block; margin-top: 6px; }
.qcard .rm {
  position: absolute; top: 4px; right: 6px;
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 14px; line-height: 1;
}
.qcard .rm:hover { color: var(--red); }
.qcard.err { color: var(--muted); }

.add-ticker { display: flex; gap: 6px; margin-top: 4px; }
.add-ticker input {
  flex: 1; max-width: 220px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 8px; padding: 8px 10px;
}
.add-ticker button {
  background: var(--accent); color: #1a1a1a; border: none;
  border-radius: 8px; padding: 0 14px; font-weight: 700; cursor: pointer;
}

/* --- Sugestões --- */
.add-ticker #suggestBtn {
  background: var(--panel); border: 1px solid var(--line);
  color: var(--accent); border-radius: 8px; padding: 0 14px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.add-ticker #suggestBtn:hover { border-color: var(--accent); }
.add-ticker #suggestBtn:disabled { opacity: .5; cursor: wait; }
.suggest-panel {
  margin-top: 10px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
}
.s-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.s-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.s-close:hover { color: var(--red); }
.s-loading { color: var(--muted); font-size: 13px; }
.scard { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.s-top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.s-top .sym { font-weight: 700; }
.s-name { color: var(--muted); font-size: 13px; }
.s-top .price { font-size: 15px; }
.s-top .chg { font-size: 13px; font-weight: 600; }
.s-top .chg.up { color: var(--green); }
.s-top .chg.down { color: var(--red); }
.s-add {
  margin-left: auto; background: none; border: 1px solid var(--line);
  color: var(--accent); border-radius: 999px; padding: 2px 10px;
  font-size: 12px; cursor: pointer;
}
.s-add:hover { border-color: var(--accent); }
.s-add:disabled { color: var(--green); cursor: default; }
.s-rationale { margin-top: 6px; font-size: 13px; color: var(--muted); }
.s-sources { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.s-sources a {
  color: var(--ink); opacity: .85; font-size: 12px; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.s-sources a:hover { color: var(--accent); }
.s-disclaimer { font-size: 11px; color: var(--muted); }

/* --- Controlos --- */
.controls {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.regions { display: flex; gap: 6px; }
.regions button {
  background: var(--panel); border: 1px solid var(--line);
  color: var(--muted); border-radius: 999px; padding: 6px 14px;
  cursor: pointer; font-size: 13px;
}
.regions button.active { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 600; }
.regions button:disabled { opacity: .4; cursor: not-allowed; }
.focus {
  background: var(--panel); border: 1px solid var(--line);
  color: var(--muted); border-radius: 999px; padding: 6px 14px;
  cursor: pointer; font-size: 13px; white-space: nowrap;
}
.focus.active { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 600; }
.controls input[type=search] {
  flex: 1; min-width: 180px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 8px; padding: 9px 12px;
}

/* --- Notícias --- */
.news { display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.ncard {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.ncard a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.ncard a:hover { color: var(--accent); }
.ncard .meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--muted); }
.ncard .snippet { margin-top: 6px; font-size: 13px; color: var(--muted); }
.pill { padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill.us { background: #1e3a8a33; color: #93c5fd; }
.pill.eu { background: #14532d33; color: #86efac; }

.foot { margin-top: 28px; font-size: 11px; color: var(--muted); text-align: center; }
