/* metric.vitold.org — вручную написанное подмножество Tailwind-утилит */
/* Тёмная тема (аналог tailwind gray/sky): не тянем сам Tailwind. */

:root {
  --bg:        #030712;  /* gray-950 */
  --bg-panel:  #111827;  /* gray-900 */
  --bg-input:  #1f2937;  /* gray-800 */
  --bg-hover:  #374151;  /* gray-700 */
  --border:    #1f2937;  /* gray-800 */
  --text:      #d1d5db;  /* gray-300 */
  --text-hi:   #f9fafb;  /* gray-50  */
  --muted:     #6b7280;  /* gray-500 */
  --muted-2:   #9ca3af;  /* gray-400 */
  --accent:    #0284c7;  /* sky-600  */
  --accent-hi: #0ea5e9;  /* sky-500  */
  --accent-a:  #7dd3fc;  /* sky-300  */
  --danger:    #ef4444;  /* red-500  */
  --danger-hi: #b91c1c;  /* red-700  */
  --ok:        #10b981;  /* emerald-500 */
  --warn:      #f59e0b;  /* amber-500 */
}

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

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

.app { min-height: 100vh; display: flex; flex-direction: column; }

.main { flex: 1; }

.container { width: 100%; max-width: 1152px; margin-left: auto; margin-right: auto; padding-left: 24px; padding-right: 24px; }

/* ---------- layout utilities (tailwind subset) ---------- */
.flex         { display: flex; }
.inline       { display: inline; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.center       { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.py-4  { padding-top: 16px; padding-bottom: 16px; }
.py-8  { padding-top: 32px; padding-bottom: 32px; }
.px-6  { padding-left: 24px; padding-right: 24px; }
.p-6   { padding: 24px; }

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

.grid       { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.w-20 { width: 80px; }
.w-28 { width: 112px; }
.h-6  { height: 24px; }
.h-10 { height: 40px; }

.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-white { color: var(--text-hi); }
.text-gray-400 { color: var(--muted-2); }
.text-gray-500 { color: var(--muted); }
.text-sky-400 { color: var(--accent-a); }
.text-emerald-400 { color: #34d399; }
.text-amber-400 { color: #fbbf24; }

.rounded-lg { border-radius: 8px; }
.rounded-xl { border-radius: 12px; }

@media (max-width: 768px) {
  .md\:grid-cols-2,
  .md\:grid-cols-3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
}

/* ---------- navbar / footer ---------- */
.nav {
  border-bottom: 1px solid var(--border);
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav .container { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; }
.brand { font-weight: 600; color: var(--text-hi); font-size: 18px; }
.nav-link { color: var(--muted); font-size: 14px; transition: color .15s; }
.nav-link:hover { color: var(--text-hi); }

.footer {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  padding-bottom: 24px;
  color: var(--muted);
  font-size: 13px;
  margin-top: 48px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hi); }

.btn-outline { border-color: var(--bg-hover); color: var(--text); }
.btn-outline:hover { border-color: var(--muted-2); color: var(--text-hi); }

.btn-ghost { color: var(--muted); }
.btn-ghost:hover { color: var(--text-hi); background: var(--bg-input); }

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

.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted-2); }
.input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--muted); }

.select { background: var(--bg-input); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.select:focus { border-color: var(--accent); }

.stack { display: flex; flex-direction: column; gap: 16px; }

.hint { font-size: 12px; color: var(--muted); margin-top: 12px; }

.alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--danger);
  color: #fca5a5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
}

/* ---------- cards ---------- */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-title { font-size: 18px; font-weight: 600; color: var(--text-hi); }
.card-desc { font-size: 14px; color: var(--muted-2); }
.card-head { font-size: 13px; font-weight: 600; color: var(--accent-a); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.card-head-minus { color: var(--warn); }
.card-head-plus { color: #34d399; }

.card-auth { width: 100%; max-width: 400px; }

/* ---------- section cards / breadcrumbs ---------- */
.card-link {
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: border-color .15s, transform .15s;
}
.card-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-link:hover .link-arrow { color: var(--accent); transform: translateX(3px); }
.link-arrow {
  font-size: 16px;
  color: var(--muted-2);
  transition: color .15s, transform .15s;
}

.breadcrumbs {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.breadcrumbs .container {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 13px;
  flex-wrap: wrap;
}
.crumb { color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--text-hi); }
.crumb-current { color: var(--text-hi); font-weight: 500; }
.crumb-sep { color: var(--muted-2); }

/* ---------- settings tabs ---------- */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin: 20px 0 24px;
  overflow-x: auto;
}
.tab {
  padding: 8px 14px 10px;
  color: var(--muted);
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.tab:hover { color: var(--text-hi); }
.tab.is-active { color: var(--text-hi); border-bottom-color: var(--accent); }

/* ---------- alerts / modal / avatar ---------- */
.alert-ok {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--ok);
  color: #6ee7b7;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--bg-hover);
  display: block;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 7, 18, 0.7);
  z-index: 60;
  padding: 24px;
}
.modal.open { display: flex; }
.modal-card { width: 100%; max-width: 420px; }

textarea.input { font: inherit; resize: vertical; }

/* ---------- typography ---------- */
.h1 { font-size: 40px; font-weight: 700; color: var(--text-hi); line-height: 1.15; }
.h1-sm { font-size: 28px; }
.h2 { font-size: 28px; font-weight: 700; color: var(--text-hi); line-height: 1.25; }
.lead { font-size: 18px; color: var(--muted-2); max-width: 720px; }
.sub { font-size: 15px; color: var(--muted); max-width: 720px; }

.list { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--text); padding: 0; }
.list li { padding-left: 20px; position: relative; }
.list li::before { content: '▸'; position: absolute; left: 0; color: var(--accent-a); }
.list-plus li::before { color: #34d399; }
.list-minus li::before { content: '▸'; color: var(--warn); }

/* ---------- badges / sections ---------- */
.badge {
  display: inline-block;
  border: 1px solid var(--bg-hover);
  color: var(--accent-a);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 12px;
  letter-spacing: .02em;
}

.hero { padding: 80px 0 32px; }
.hero .container { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }

.section { padding: 48px 0; }
.section .container { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }

.section-hybrid { border-top: 1px solid var(--border); }
.section-cta { border-top: 1px solid var(--border); }
.section-cta .container { align-items: center; text-align: center; }
.section-cta .sub { margin-left: auto; margin-right: auto; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.table td { color: var(--text); }
.table tr:last-child td { border-bottom: none; }

/* ---------- logos ---------- */
.logo-chip {
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.img-logo { display: block; max-height: 28px; width: auto; }
.logo-chip .img-logo { max-height: 24px; }

/* ---------- chart page ---------- */
.chart-container { position: relative; }
.chart-container canvas {
  display: block;
  width: 100%;
  height: 400px;
  cursor: crosshair;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}
.controls label { font-size: 13px; color: var(--muted-2); display: flex; align-items: center; gap: 8px; }
.controls .status { font-size: 12px; color: var(--muted); margin-left: auto; }

.tooltip {
  position: absolute;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  pointer-events: none;
  display: none;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.tooltip .t-ts { color: var(--muted); }
.tooltip .t-val { color: var(--text-hi); font-weight: 600; }

.series-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.series-card {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.series-card .select, .series-card .input { max-width: 180px; }
.series-letter { font-weight: 700; font-size: 14px; min-width: 18px; }
.color-input {
  width: 32px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 13px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-2); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }