:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-alt: #f0f4f2;
  --ink: #0f1b18;
  --muted: #4b5d57;
  --border: #dce4e0;
  --emerald: #0b4635;
  --emerald-dark: #073024;
  --emerald-soft: #e6f2ee;
  --gold: #c68b2c;
  --gold-soft: #fdf5e6;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --success: #067647;
  --success-soft: #ecfdf3;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(15, 27, 24, 0.05);
  --shadow-lg: 0 18px 48px rgba(15, 27, 24, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--emerald);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand-domain {
  color: var(--gold);
  font-weight: 700;
}

.brand-tagline {
  font-size: 12px;
  color: var(--muted);
}

.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 10px;
}

.nav-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--ink);
}

.nav-tab.active {
  background: var(--surface);
  color: var(--emerald);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.lang-btn {
  border: none;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 11px;
  cursor: pointer;
}

.lang-btn.active {
  background: var(--emerald);
  color: #fff;
}

/* Macro Strip */
.macro-strip {
  background: var(--emerald-dark);
  color: #f3f7f5;
  padding: 14px 0;
}

.macro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
}

.macro-item {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  padding: 10px 12px;
}

.macro-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #b7d2c8;
}

.macro-value {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.macro-sub {
  font-size: 11px;
  color: #e6c486;
}

.macro-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: #d2e4dd;
}

/* Hero */
.main-content {
  padding-top: 28px;
  padding-bottom: 48px;
}

.hero {
  margin-bottom: 24px;
}

.hero-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--emerald);
  background: var(--emerald-soft);
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero-sub {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
  font-size: 15.5px;
}

/* Panels & Toolbar */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--emerald);
  color: var(--emerald);
}

.chip.active {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
}

.select-input,
.search-input,
input[type="number"],
input[type="email"],
textarea {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
}

.search-input {
  min-width: 240px;
}

.search-input.short {
  min-width: 130px;
  width: 150px;
}

/* Stock Cards */
.stocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.stock-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.stock-card:hover {
  transform: translateY(-2px);
  border-color: var(--emerald);
  box-shadow: 0 8px 24px rgba(11, 70, 53, 0.1);
}

.stock-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.ticker-badge {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--emerald);
}

.bmv-sub {
  font-size: 12px;
  color: var(--muted);
}

.stock-name {
  font-weight: 700;
  font-size: 15px;
}

.stock-summary {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
  flex: 1;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.pill-access {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.pill-theme {
  background: var(--gold-soft);
  color: #8c5d12;
}

.stock-footer {
  border-top: 1px solid var(--surface-alt);
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--emerald);
  font-weight: 600;
}

/* Card Panel */
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel-header h2 {
  margin: 0 0 6px;
  font-size: 21px;
}

.panel-header p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

/* Calculator */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 820px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }
}

.calc-inputs {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.calc-results {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.result-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.result-box.highlight {
  border-color: var(--emerald);
  background: var(--emerald-soft);
}

.result-label {
  font-size: 12px;
  color: var(--muted);
}

.result-val {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

.verdict-box {
  background: var(--surface);
  border-left: 4px solid var(--gold);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13.5px;
}

/* Workbench */
.preset-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.preset-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}

.wb-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.wb-editors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 780px) {
  .wb-editors {
    grid-template-columns: 1fr;
  }
}

textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.5;
}

.btn-primary,
.btn-gold {
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

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

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

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

.btn-gold:hover {
  filter: brightness(0.95);
}

.wb-output {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.status-pill.PASS {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.WARN {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-pill.FAIL {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-pill.neutral {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 13.5px;
  border-left: 4px solid;
}

.alert-item.critical {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: #7a1811;
}

.alert-item.warning {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: #7a2e0e;
}

.alert-item.ok {
  background: var(--success-soft);
  border-color: var(--success);
  color: #055534;
}

.prompt-preview {
  background: #101917;
  color: #dff0e9;
  padding: 14px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 240px;
}

/* Glossary */
.false-friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.trap-card {
  background: var(--warn-soft);
  border: 1px solid #f7d9a7;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
}

.trap-card strong {
  color: var(--warn);
}

.glossary-table-wrap {
  overflow-x: auto;
}

.glossary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.glossary-table th,
.glossary-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.glossary-table th {
  background: var(--surface-alt);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Newsletter */
.newsletter-banner {
  margin-top: 32px;
  background: var(--emerald);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  align-items: center;
}

@media (max-width: 820px) {
  .newsletter-banner {
    grid-template-columns: 1fr;
  }
}

.newsletter-banner h3 {
  margin: 0 0 4px;
  font-size: 19px;
}

.newsletter-banner p {
  margin: 0;
  color: #cde3da;
  font-size: 13.5px;
}

.newsletter-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.newsletter-form input[type="email"] {
  flex: 1;
  min-width: 180px;
}

.nl-feedback {
  grid-column: 1 / -1;
  font-size: 13px;
  color: #fde68a;
  min-height: 18px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 20px 0;
  font-size: 12.5px;
  color: var(--muted);
}

.footer-meta {
  margin: 6px 0 0;
  font-size: 12px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 18, 0.56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 80;
}

.modal-card {
  background: var(--surface);
  border-radius: 14px;
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: none;
  background: var(--surface-alt);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 22px;
  cursor: pointer;
  color: var(--ink);
}

.modal-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.modal-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--emerald);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.metric-chip {
  background: var(--surface-alt);
  padding: 10px 12px;
  border-radius: 8px;
}

.metric-chip .k {
  font-size: 11px;
  color: var(--muted);
}

.metric-chip .v {
  font-size: 13.5px;
  font-weight: 700;
  margin-top: 2px;
}

.yt-box {
  background: var(--gold-soft);
  border: 1px solid #f2d39c;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
}

.hidden {
  display: none !important;
}
