/* ==============================================================================
   MY STOCKS - DESIGN SYSTEM & MASTER STYLESHEET
   Identidade Visual compartilhada com o Stocks Monitor
   ============================================================================== */

:root, [data-theme="light"] {
  --bg: #f0efe9;
  --surface: #fafaf7;
  --surface-2: #f3f2ec;
  --surface-3: #e8e7e0;
  --border: rgba(0,0,0,.09);
  --divider: rgba(0,0,0,.05);
  --text: #1a1a18;
  --muted: #666660;
  --faint: #888881;
  --notes: #91908b;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --primary: #01696f;
  --primary-h: #0c4e54;
  --primary-bg: rgba(1,105,111,.1);
  --primary-border: rgba(1,105,111,.3);
  --zone-best: #0f5c1a;
  --zone-best-bg: rgba(15,92,26,.13);
  --zone-best-bdr: rgba(15,92,26,.3);
  --zone-good: #1a6e3a;
  --zone-good-bg: rgba(26,110,58,.11);
  --zone-good-bdr: rgba(26,110,58,.25);
  --zone-watch: #8a5a00;
  --zone-watch-bg: rgba(138,90,0,.12);
  --zone-watch-bdr: rgba(138,90,0,.28);
  --zone-alert: #a11e1e;
  --zone-alert-bg: rgba(161,30,30,.13);
  --zone-alert-bdr: rgba(161,30,30,.3);
  --success: #217a2f;
  --success-bg: rgba(33,122,47,.12);
  --warning: #9a5f00;
  --warning-bg: rgba(154,95,0,.12);
  --danger: #b52222;
  --danger-bg: rgba(181,34,34,.12);
  --info: #00608a;
  --info-bg: rgba(0,96,138,.1);
  --neutral-bg: rgba(0,0,0,.05);
  --row-hover-bg: #e6e4d8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 3px 10px rgba(0,0,0,.09), 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.11), 0 2px 6px rgba(0,0,0,.07);
  --shadow-modal: 0 20px 40px rgba(0,0,0,.25);
  --r-sm: 4px;
  --r-md: 7px;
  --r-lg: 12px;
  --r-xl: 18px;
  --header-height: 48px;
  --bottom-nav-height: 56px;
}

[data-theme="dark"] {
  --bg: #0f0f0d;
  --surface: #181816;
  --surface-2: #1f1f1c;
  --surface-3: #282825;
  --border: rgba(255,255,255,.07);
  --divider: rgba(255,255,255,.04);
  --text: #dddcd5;
  --muted: #7a7972;
  --faint: #6e6d62;
  --notes: #8a8980;
  --primary: #4f9ca8;
  --primary-h: #2d8490;
  --primary-bg: rgba(79,156,168,.12);
  --primary-border: rgba(79,156,168,.35);
  --zone-best: #1a7a2a;
  --zone-best-bg: rgba(26,122,42,.18);
  --zone-best-bdr: rgba(26,122,42,.4);
  --zone-good: #1e8048;
  --zone-good-bg: rgba(30,128,72,.15);
  --zone-good-bdr: rgba(30,128,72,.35);
  --zone-watch: #c48800;
  --zone-watch-bg: rgba(196,136,0,.16);
  --zone-watch-bdr: rgba(196,136,0,.38);
  --zone-alert: #c93030;
  --zone-alert-bg: rgba(201,48,48,.18);
  --zone-alert-bdr: rgba(201,48,48,.4);
  --success: #3a9e50;
  --success-bg: rgba(58,158,80,.15);
  --warning: #c89010;
  --warning-bg: rgba(200,144,16,.15);
  --danger: #d94040;
  --danger-bg: rgba(217,64,64,.16);
  --info: #3d95c8;
  --info-bg: rgba(61,149,200,.12);
  --neutral-bg: rgba(255,255,255,.04);
  --row-hover-bg: #303029;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 3px 10px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);
  --shadow-modal: 0 20px 50px rgba(0,0,0,.7);
}

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

html {
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

input, select, textarea {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--primary-bg);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ==============================================================================
   HEADER (DESKTOP / MOBILE ADAPTIVE)
   ============================================================================== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2.5vw;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 300;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -.3px;
  white-space: nowrap;
  user-select: none;
}

.logo svg {
  color: var(--primary);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  transition: all .15s ease;
  border: 1px solid transparent;
}

.nav-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-tab.active {
  color: var(--primary);
  background: var(--primary-bg);
  border-color: var(--primary-border);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.vault-status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--neutral-bg);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
  border: 1px solid var(--border);
}

.vault-status-pill:hover {
  background: var(--surface-2);
  color: var(--text);
}

.vdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  flex-shrink: 0;
}

.vdot.unlocked {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-bg);
  animation: pulse 2s infinite;
}

.vdot.locked {
  background: var(--warning);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .6; transform: scale(1.1); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-md);
  font-size: 11px;
  font-weight: 600;
  transition: all .15s ease;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-3);
  border-color: var(--border);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}

.btn-primary:hover {
  background: var(--primary-h);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(217,64,64,.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-icon {
  padding: 6px 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.btn-icon:hover {
  color: var(--text);
  background: var(--surface-3);
}

.badge-admin {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(124, 58, 237, 0.35);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ==============================================================================
   MAIN CONTAINER & TABS LAYOUT
   ============================================================================== */
.main-content {
  flex: 1;
  max-width: 95vw;
  width: 95%;
  margin: 0 auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn .2s ease;
}

.tab-pane.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==============================================================================
   TYPOGRAPHY & NUMBERS
   ============================================================================== */
.mono {
  font-family: var(--font-mono);
}

.val-up {
  color: var(--success);
}

.val-down {
  color: var(--danger);
}

.val-neutral {
  color: var(--muted);
}

/* ==============================================================================
   TABLES & STICKY HEADERS
   ============================================================================== */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.table-wrapper thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

