/* seo.meistarpro.lv — визуальная система «вентфасад»:
   карточки-кассеты на видимых швах, слева монтажный профиль. */

:root {
  --bg:      #101a24;
  --panel:   #16222f;
  --raise:   #1c2c3c;
  --seam:    #26384c;
  --ink:     #e6eff7;
  --muted:   #86a0b8;
  --zinc:    #9fb8cc;
  --signal:  #f5a524;
  --grow:    #45c48a;
  --drop:    #e8695c;
  --violet:  #9d8df1;
  --cyan:    #4fb6d9;
  --r: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(900px 500px at 15% -10%, rgba(79,182,217,.10), transparent 60%),
    radial-gradient(700px 400px at 95% 0%, rgba(245,165,36,.07), transparent 55%);
  background-attachment: fixed;
  padding-bottom: 72px;
}

h1, h2, h3, .display {
  font-family: 'Bricolage Grotesque', 'Manrope', sans-serif;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0;
}

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

a { color: var(--cyan); text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* --- Шапка --- */
.top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(16,26,36,.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--seam);
}
.brand { display: flex; align-items: center; gap: 9px; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; letter-spacing: -.03em; }
.mark {
  width: 24px; height: 24px; border-radius: 5px; flex: none;
  background: linear-gradient(150deg, var(--zinc), #55708a 55%, var(--signal));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.top .spacer { flex: 1; }

.ghost {
  background: var(--raise); color: var(--ink);
  border: 1px solid var(--seam); border-radius: 8px;
  padding: 7px 12px; font-size: 13px; font-weight: 600;
  transition: border-color .15s, transform .15s;
}
.ghost:hover { border-color: var(--zinc); }
.ghost:active { transform: translateY(1px); }
.ghost.primary { background: linear-gradient(180deg, #2b4056, #223447); border-color: #3b5975; }
.ghost:disabled { opacity: .5; cursor: default; }

/* --- Вкладки --- */
.tabs {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding: 10px 16px 0; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; background: transparent; border: 0; color: var(--muted);
  padding: 8px 12px; border-radius: 8px 8px 0 0; font-size: 14px; font-weight: 600;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--signal); background: rgba(255,255,255,.03); }

main { padding: 16px; max-width: 1100px; margin: 0 auto; }

/* --- Кассеты (сетка на швах) --- */
.grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.cassette {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--panel), #13202c);
  border: 1px solid var(--seam); border-radius: var(--r);
  padding: 14px 14px 14px 20px;
  animation: rise .35s cubic-bezier(.2,.7,.3,1) both;
  transition: transform .18s, border-color .18s;
}
.cassette::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--rail, var(--zinc)); opacity: .85;
}
.cassette:hover { transform: translateY(-2px); border-color: #35506b; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .cassette { animation: none; }
  .cassette:hover { transform: none; }
}

.c-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.c-name { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 17px; margin: 2px 0 10px; }
.c-num { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.c-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.delta { font-size: 13px; font-weight: 700; }
.delta.up { color: var(--grow); }
.delta.down { color: var(--drop); }
.delta.flat { color: var(--muted); }
.c-sub { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.spark { display: block; margin-top: 10px; width: 100%; height: 30px; }

/* --- Точки роста --- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  background: var(--raise); border: 1px solid var(--seam); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600;
  transition: color .15s, border-color .15s;
}
.chip[aria-pressed="true"] { color: var(--ink); border-color: var(--zinc); background: #24374a; }

.ops { display: flex; flex-direction: column; gap: 6px; }

.op {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start;
  background: linear-gradient(160deg, var(--panel), #13202c);
  border: 1px solid var(--seam); border-radius: var(--r);
  padding: 13px 14px 13px 20px;
  animation: rise .3s cubic-bezier(.2,.7,.3,1) both;
}
.op::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--rail); }
.op-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
.op-type { color: var(--ink); }
.op-site { background: var(--raise); border: 1px solid var(--seam); border-radius: 999px; padding: 2px 8px; font-size: 11px; }
.op-q { font-family: 'Bricolage Grotesque', sans-serif; font-size: 16px; font-weight: 700; margin: 6px 0 4px; word-break: break-word; }
.op-url { font-size: 12px; color: var(--muted); word-break: break-all; }
.op-action { font-size: 13px; color: #b9cddf; margin-top: 8px; line-height: 1.5; }
.op-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.op-stats b { color: var(--ink); font-weight: 700; }
.op-gain { text-align: right; flex: none; }
.op-gain .n { font-size: 22px; font-weight: 800; color: var(--signal); letter-spacing: -.02em; }
.op-gain .l { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* --- Таблицы --- */
.tablewrap { border: 1px solid var(--seam); border-radius: var(--r); overflow: auto; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid rgba(38,56,76,.7); }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; position: sticky; top: 0; background: var(--raise); }
td.num, th.num { text-align: right; font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }

/* --- Пусто / состояния --- */
.empty {
  border: 1px dashed var(--seam); border-radius: var(--r);
  padding: 32px 20px; text-align: center; color: var(--muted);
}
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.err { background: rgba(232,105,92,.12); border: 1px solid rgba(232,105,92,.4); color: #ffc9c3; padding: 11px 13px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.ok { background: rgba(69,196,138,.12); border: 1px solid rgba(69,196,138,.4); color: #b6f0d5; padding: 11px 13px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }

.sectionhead { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 12px; }
.sectionhead h2 { font-size: 19px; }
.sectionhead .count { color: var(--muted); font-size: 13px; }

select, input[type="text"], input[type="email"], input[type="password"] {
  background: var(--raise); border: 1px solid var(--seam); color: var(--ink);
  border-radius: 8px; padding: 9px 11px; font: inherit; width: 100%;
}
select:focus, input:focus, button:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--signal); outline-offset: 2px;
}

/* --- Вход --- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.loginbox { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--seam); border-radius: 14px; padding: 26px; }
.loginbox h1 { font-size: 22px; margin-bottom: 4px; }
.loginbox p { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.loginbox button { width: 100%; padding: 11px; margin-top: 6px; }

@media (max-width: 560px) {
  main { padding: 12px; }
  .op { grid-template-columns: 1fr; }
  .op-gain { text-align: left; display: flex; align-items: baseline; gap: 6px; }
}

/* --- Модалка правки --- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8,14,20,.72); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px;
  animation: fade .18s ease both;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal-box {
  position: relative; width: 100%; max-width: 640px; max-height: 86vh; overflow: auto;
  background: linear-gradient(160deg, var(--panel), #13202c);
  border: 1px solid var(--seam); border-radius: 14px; padding: 22px;
}
.modal-x {
  position: absolute; top: 10px; right: 12px; background: none; border: 0;
  color: var(--muted); font-size: 26px; line-height: 1; padding: 4px 8px; border-radius: 6px;
}
.modal-x:hover { color: var(--ink); background: var(--raise); }
.modal h3 { font-size: 18px; margin-bottom: 10px; }
.sug-block { border: 1px solid var(--seam); border-radius: 10px; padding: 13px; margin-bottom: 10px; background: rgba(255,255,255,.02); }
.sug-block .k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.sug-block .v { font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.sug-block .len { font-size: 11px; color: var(--muted); margin-top: 5px; font-family: 'JetBrains Mono', monospace; }
.copybtn { margin-top: 8px; }

.op-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.mini { padding: 5px 10px; font-size: 12px; }

.vis-bar { height: 6px; border-radius: 3px; background: var(--raise); overflow: hidden; margin-top: 8px; }
.vis-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--grow), var(--cyan)); }

.modal[hidden] { display: none !important; }

/* analytics-module */
/* ===== Вкладка «Трафик» ===== */
.an-bar {
  display: flex; height: 6px; border-radius: 3px; overflow: hidden;
  margin-top: 10px; background: var(--raise);
}
.an-bar span { display: block; height: 100%; }
.an-legend {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 7px; font-size: 11px; color: var(--muted);
}
.an-dot { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.an-dot::before {
  content: ''; width: 7px; height: 7px; border-radius: 2px;
  background: var(--c, var(--zinc)); flex: none;
}

.an-gsc {
  margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--seam);
  display: grid; gap: 4px; font-size: 12px;
}
.an-gsc > div { display: flex; justify-content: space-between; align-items: baseline; }
.an-gsc span { color: var(--muted); }
.an-gsc .hi b { color: var(--signal); }
.an-gsc.none {
  display: block; color: var(--muted); font-size: 12px; line-height: 1.5;
}

.an-note {
  background: var(--raise); border: 1px solid var(--seam); border-left: 3px solid var(--signal);
  border-radius: 8px; padding: 11px 13px; margin-bottom: 12px;
  font-size: 13px; line-height: 1.55; color: var(--zinc);
}
.an-note b { color: var(--ink); }

.an-code {
  background: #0d151e; border: 1px solid var(--seam); border-radius: 8px;
  padding: 11px 13px; font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px; overflow-x: auto; margin: 0 0 10px; color: var(--ink);
  white-space: pre-wrap; word-break: break-all;
}

.ghost.mini { padding: 3px 9px; font-size: 12px; }

.an-legend span[title] { cursor: default; }
