:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --border: #d1d5db;
  --border-strong: #9ca3af;
  --text: #1e3a8a;
  --text-muted: #475569;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #b91c1c;
  --success: #15803d;
  --warning: #b45309;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  background: var(--text);
  color: #fff;
  font-weight: 700;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  letter-spacing: 0.5px;
}
.brand-name { font-weight: 600; color: var(--text); }

.lang-toggle { display: inline-flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: var(--radius); }
.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.intro { margin-bottom: 28px; }
.intro h1 { font-size: 28px; margin: 0 0 6px; color: var(--text); font-weight: 700; }
.intro p { margin: 0; color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 14px;
}

input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.combobox { position: relative; }
.combobox-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 20;
}
.combobox-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}
.combobox-item:hover, .combobox-item.active { background: #eff6ff; }
.combobox-item .code { color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.combobox-empty { padding: 12px 14px; color: var(--text-muted); font-size: 13px; }

.radio-group { display: flex; gap: 16px; flex-wrap: wrap; }
.radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; }
.radio input { accent-color: var(--accent); }

.btn-primary, .btn-secondary {
  border: none;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e5e7eb; }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 6px; }

.disclaimer-short {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
  text-align: center;
}
.disclaimer-full {
  font-size: 12px;
  color: var(--text-muted);
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 24px;
}

.loading-card, .error-card { text-align: center; }
.loading-card h2, .error-card h2 { margin: 12px 0 8px; color: var(--text); font-size: 20px; }
.loading-card p, .error-card p { margin: 0 0 16px; color: var(--text-muted); }

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #dbeafe;
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.result-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.result-section h2 {
  margin: 0 0 14px;
  font-size: 18px;
  color: var(--text);
  border-bottom: 2px solid var(--bg);
  padding-bottom: 8px;
}
.result-section h3 {
  margin: 16px 0 8px;
  font-size: 15px;
  color: var(--text);
}
.result-section p { margin: 0 0 10px; color: var(--text); }
.result-section ul { margin: 0 0 10px; padding-left: 22px; color: var(--text); }
.result-section li { margin-bottom: 4px; }

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 8px 0 4px;
}
.kv {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.kv-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.kv-value { font-weight: 600; color: var(--text); font-size: 15px; }

.comp-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 14px;
}
.comp-table th, .comp-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.comp-table th { background: var(--bg); font-weight: 600; color: var(--text); font-size: 13px; }

.rating-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
}
.rating-buy, .rating-strong-buy { background: #dcfce7; color: var(--success); }
.rating-hold { background: #fef3c7; color: var(--warning); }
.rating-sell, .rating-strong-sell { background: #fee2e2; color: var(--danger); }
.rating-neutral { background: var(--bg); color: var(--text-muted); }

.sources-list { font-size: 13px; }
.sources-list a { color: var(--accent); word-break: break-all; }

.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  margin-top: 40px;
}
.footer .disclaimer-short { margin: 0; }

@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  .container { padding: 20px 16px 48px; }
  .card { padding: 20px; }
  .intro h1 { font-size: 22px; }
  .result-actions { flex-direction: column; }
  .result-actions button { width: 100%; }
}
