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

:root {
  --bg-0: #0b0d12;
  --bg-1: #0f1117;
  --bg-2: #141720;
  --bg-3: #1c2030;
  --bg-4: #242840;
  --border: #1e2235;
  --border-light: #2a2f45;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #4a5568;
  --green: #4ade80;
  --green-bg: #0a2d1a;
  --green-border: #1a4a2d;
  --blue: #60a5fa;
  --blue-bg: #0d1a2d;
  --blue-border: #1a2d4a;
  --amber: #fbbf24;
  --amber-bg: #2d1f0a;
  --amber-border: #4a3010;
  --red: #f87171;
  --red-bg: #2d0a0a;
  --red-border: #4a1a1a;
  --gray-bg: #1c2030;
  --accent: #818cf8;
  --font-mono: 'Courier New', monospace;
}

body {
  background: var(--bg-0);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- NAVBAR ---- */
.navbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.5rem;
  height: 52px;
  background: var(--bg-1);
  border-bottom: 0.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}
.nav-brand svg { color: var(--accent); }
.nav-links { display: flex; gap: 0.25rem; flex: 1; }
.nav-link {
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.15s;
}
.nav-link:hover { background: var(--bg-3); color: var(--text-primary); }
.nav-link.active { background: var(--bg-3); color: var(--text-primary); }
.btn-run-all {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 7px;
  border: 0.5px solid var(--border-light);
  background: var(--bg-3);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-run-all:hover { background: var(--bg-4); border-color: var(--accent); color: var(--accent); }

/* ---- MAIN ---- */
.main-content { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

/* ---- ALERTS ---- */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 13px;
  border: 0.5px solid;
}
.alert-success { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.alert-error { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.alert-info { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-border); }

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 20px; font-weight: 600; }
.page-sub { font-size: 13px; color: var(--text-muted); font-family: var(--font-mono); }
.report-header-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  flex-wrap: wrap;
}
.btn-back {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 6px;
  display: block;
}
.btn-back:hover { color: var(--text-primary); }

/* ---- STATS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-2);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 600; color: var(--text-primary); }
.text-green { color: var(--green); }
.text-blue { color: var(--blue); }
.text-amber { color: var(--amber); }
.text-muted { color: var(--text-muted); }
.text-mono { font-family: var(--font-mono); }

/* ---- SECTION BLOCKS ---- */
.section-block {
  background: var(--bg-1);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.section-header h2 { font-size: 15px; font-weight: 600; flex: 1; }
.section-icon { font-size: 16px; }
.report-body {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-secondary);
  max-height: 200px;
  overflow: hidden;
  position: relative;
}
.report-body::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 50px;
  background: linear-gradient(transparent, var(--bg-1));
}
.link-more { font-size: 12px; color: var(--blue); text-decoration: none; display: inline-block; margin-top: 8px; }
.link-more:hover { text-decoration: underline; }

/* ---- COMPANY GRID ---- */
.company-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.company-card {
  background: var(--bg-2);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  transition: border-color 0.15s;
}
.company-card:hover { border-color: var(--border-light); }
.company-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.company-ticker { font-size: 16px; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }
.company-name { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.company-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.company-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- BADGES ---- */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); border: 0.5px solid var(--green-border); }
.badge-blue { background: var(--blue-bg); color: var(--blue); border: 0.5px solid var(--blue-border); }
.badge-amber { background: var(--amber-bg); color: var(--amber); border: 0.5px solid var(--amber-border); }
.badge-gray { background: var(--bg-3); color: var(--text-secondary); border: 0.5px solid var(--border-light); }

/* ---- DOTS ---- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-green { background: var(--green); }
.dot-blue { background: var(--blue); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }
.dot-gray { background: var(--text-muted); }

/* ---- BUTTONS ---- */
.btn-primary {
  padding: 8px 18px;
  background: var(--accent);
  color: #0b0d12;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-secondary {
  padding: 8px 18px;
  background: transparent;
  color: var(--text-secondary);
  border: 0.5px solid var(--border-light);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.15s;
}
.btn-secondary:hover { background: var(--bg-3); color: var(--text-primary); }
.btn-small {
  padding: 5px 12px;
  background: transparent;
  color: var(--accent);
  border: 0.5px solid var(--accent);
  border-radius: 6px;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-small:hover { background: var(--bg-4); }
.btn-xs {
  padding: 3px 10px;
  background: transparent;
  color: var(--text-secondary);
  border: 0.5px solid var(--border-light);
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-xs:hover { background: var(--bg-3); color: var(--text-primary); }
.btn-accent { border-color: var(--accent); color: var(--accent); }
.btn-accent:hover { background: rgba(129,140,248,0.1); }
.btn-danger { border-color: var(--red-border); color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }

/* ---- TABLES ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 0.5px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg-2); }
.row-inactive td { opacity: 0.45; }
.ticker-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.company-name-cell { color: var(--text-primary); }
.actions-cell { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.link-table { font-size: 11px; color: var(--blue); text-decoration: none; }
.link-table:hover { text-decoration: underline; }

/* ---- REPORTS ---- */
.filter-bar { margin-bottom: 1rem; }
.filter-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-form select, .filter-form input[type="date"] {
  padding: 6px 10px;
  background: var(--bg-2);
  border: 0.5px solid var(--border-light);
  border-radius: 7px;
  color: var(--text-primary);
  font-size: 13px;
}
.reports-list { display: flex; flex-direction: column; gap: 10px; }
.report-card {
  background: var(--bg-1);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.15s;
}
.report-card:hover { border-color: var(--border-light); }
.report-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.report-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-right { display: flex; align-items: center; gap: 8px; }
.report-date { font-size: 12px; color: var(--text-secondary); }
.report-time { font-size: 11px; color: var(--text-muted); }
.report-preview { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin: 6px 0; }
.report-company-name { font-size: 12px; color: var(--text-secondary); }
.report-card-footer { margin-top: 8px; }

/* ---- REPORT DETAIL ---- */
.report-full { display: flex; flex-direction: column; gap: 1rem; }
.report-section {
  background: var(--bg-1);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}
.report-section h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.report-text {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
}
.news-list { font-size: 12px; }
.collapsed { display: none; }
.toggle-arrow { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.report-actions { display: flex; gap: 10px; margin-top: 1rem; flex-wrap: wrap; }

/* ---- FORMS ---- */
.form-card {
  background: var(--bg-1);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.form-section { margin-bottom: 1.5rem; }
.form-section:last-child { margin-bottom: 0; }
.form-section-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 0.75rem; padding-bottom: 8px; border-bottom: 0.5px solid var(--border); }
.form-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.form-hint { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.form-hint a, .link-ext { color: var(--blue); text-decoration: none; }
.form-hint a:hover { text-decoration: underline; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  padding: 8px 10px;
  background: var(--bg-2);
  border: 0.5px solid var(--border-light);
  border-radius: 7px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
input[readonly] { opacity: 0.6; cursor: not-allowed; }
textarea { resize: vertical; }
select option { background: var(--bg-2); }
.toggle-row { display: flex; align-items: center; gap: 10px; }
.toggle-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.toggle-label { font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.time-inputs { display: flex; align-items: center; gap: 6px; }
.time-sep { font-size: 18px; color: var(--text-muted); font-weight: 700; }
.telegram-tip {
  background: var(--bg-3);
  border: 0.5px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.75;
  margin-top: 0.75rem;
}
.telegram-tip strong { color: var(--text-secondary); }
.telegram-tip code { background: var(--bg-4); padding: 1px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 11px; color: var(--blue); }
.form-actions { display: flex; gap: 10px; margin-top: 1rem; flex-wrap: wrap; align-items: center; }

/* ---- SETTINGS ---- */
.settings-layout { max-width: 680px; }
.settings-status {
  display: flex;
  gap: 1.5rem;
  padding: 1rem;
  background: var(--bg-2);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.status-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 13px;
}
.empty-state.large { padding: 4rem; }
.empty-icon { font-size: 32px; margin-bottom: 1rem; }
.empty-state a { color: var(--blue); text-decoration: none; margin-left: 4px; }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 999;
  transition: opacity 0.3s;
}
.toast.hidden { display: none; }
.toast-success { background: var(--green-bg); color: var(--green); border: 0.5px solid var(--green-border); }
.toast-error { background: var(--red-bg); color: var(--red); border: 0.5px solid var(--red-border); }
