/* ===== SERP Tracker — card UI (light theme, modeled on legacy dashboard) ===== */

:root {
  --st-bg: #eef1f9;
  --st-card: #ffffff;
  --st-navy: #2f3a8f;
  --st-ink: #23272f;
  --st-muted: #8b93a7;
  --st-blue: #4f6ef7;
  --st-green: #3d8f4e;
  --st-yellow: #e6b422;
  --st-lightblue: #4aa8d8;
  --st-red: #d64545;
  --st-radius: 10px;
  --st-shadow: 0 1px 3px rgba(35, 46, 89, .08), 0 4px 14px rgba(35, 46, 89, .05);
}

body {
  background: var(--st-bg);
  color: var(--st-ink);
}
main.container, nav.container { max-width: 1380px; }

/* ---------- cards ---------- */
.card {
  background: var(--st-card);
  border-radius: var(--st-radius);
  box-shadow: var(--st-shadow);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.25rem;
}
.card-title { margin: 0 0 .9rem; font-size: 1.05rem; color: var(--st-navy); }
.card-title a { color: var(--st-blue); text-decoration: none; }

/* ---------- stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-grid-small { grid-template-columns: repeat(auto-fit, minmax(190px, 240px)); }
.stat-card {
  background: var(--st-card);
  border-radius: var(--st-radius);
  box-shadow: var(--st-shadow);
  padding: .9rem 1.1rem;
}
.stat-head { font-size: .85rem; margin-bottom: .6rem; }
.stat-head strong { color: var(--st-navy); }
.stat-head span { color: var(--st-muted); font-weight: 500; }
.stat-body { display: flex; align-items: center; gap: .8rem; }
.stat-icon {
  width: 42px; height: 42px; flex: none;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
.stat-icon svg { width: 22px; height: 22px; display: block; }
.icon-gray      { background: #6c757d; }
.icon-blue      { background: var(--st-blue); }
.icon-green     { background: var(--st-green); }
.icon-yellow    { background: var(--st-yellow); }
.icon-lightblue { background: var(--st-lightblue); }
.icon-red       { background: var(--st-red); }
.stat-number {
  font-size: 1.9rem; font-weight: 700; color: var(--st-navy);
  line-height: 1; display: inline-flex; flex-direction: column; gap: .15rem;
}
.stat-number small { font-size: .78rem; font-weight: 600; }
.delta-up   { color: var(--st-green); }
.delta-down { color: var(--st-red); }
.delta-zero { color: var(--st-muted); }

/* ---------- progress bar ---------- */
.progress-card { padding: 1rem 1.3rem 1.2rem; }
.progress-title { color: var(--st-navy); margin-bottom: .7rem; font-size: .95rem; }
.progress-title strong { font-weight: 700; }
.progress-track {
  background: #dfe4f5;
  border-radius: 8px;
  height: 30px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  min-width: 2.5rem;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .85rem; font-weight: 600;
  background: repeating-linear-gradient(
    -55deg,
    #5b78f6 0 12px,
    #4059e8 12px 24px
  );
}

/* ---------- dashboard rankings ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.rank-table { margin: 0; font-size: .9rem; }
.rank-table td, .rank-table th { padding: .5rem .6rem; }
.rank-table a { text-decoration: none; color: var(--st-blue); }
.rank-table td:first-child a { color: var(--st-ink); }
.rank-table tbody tr:nth-child(odd) { background: #f6f7fc; }

/* ---------- position matrix ---------- */
.matrix-card { padding-bottom: .8rem; }
.matrix-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem;
}
.matrix-header .card-title { margin: 0; }
.month-nav { display: flex; align-items: center; gap: .5rem; }
.month-nav [role="button"] { padding: .15rem .7rem; margin: 0; }
.month-label { font-weight: 700; color: var(--st-navy); min-width: 5.5rem; text-align: center; }
.matrix-scroll { overflow-x: auto; }
table.matrix { margin: 0; font-size: .82rem; border-collapse: collapse; }
.matrix th, .matrix td { padding: .35rem .3rem; }
.matrix thead th {
  color: var(--st-navy); font-size: .72rem; white-space: nowrap;
  border-bottom: 2px solid #e3e7f4;
}
.matrix tbody tr:nth-child(odd) { background: #f6f7fc; }
.matrix .phrase-col {
  text-align: left; min-width: 220px; max-width: 300px;
  position: sticky; left: 0; background: inherit;
  background-clip: padding-box;
}
.matrix thead .phrase-col { background: var(--st-card); }
.matrix tbody tr:nth-child(odd) .phrase-col { background: #f6f7fc; }
.matrix tbody tr:nth-child(even) .phrase-col { background: var(--st-card); }
.matrix .phrase-col a { color: var(--st-blue); text-decoration: none; font-weight: 600; }
.kw-url { color: var(--st-muted); font-size: .72rem; margin-top: .1rem; word-break: break-all; }
.pos-cell { text-align: center; min-width: 34px; font-variant-numeric: tabular-nums; }
.pos-cell.empty { color: #c3c9da; }
.pos-cell.better { background: #d9ecdb !important; color: #256631; font-weight: 700; }
.pos-cell.worse  { background: #f4d9d9 !important; color: #8f2626; font-weight: 700; }
.matrix-legend { font-size: .78rem; margin: .7rem 0 0; }
.legend-swatch {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px;
}
.legend-swatch.better { background: #d9ecdb; }
.legend-swatch.worse  { background: #f4d9d9; }
.tag {
  font-size: .65rem; background: #e6e9f6; color: var(--st-muted);
  border-radius: 4px; padding: .05rem .35rem; margin-left: .3rem;
}
.actions-col { width: 4.5rem; }
.row-actions { display: flex; gap: .3rem; justify-content: center; }
.row-actions form { margin: 0; }
button.mini {
  padding: .1rem .45rem; font-size: .7rem; margin: 0; line-height: 1.4;
  background: #eef1f9; border: 1px solid #d6dbee; color: var(--st-navy);
}
button.mini.danger { color: var(--st-red); }

/* ---------- general / legacy ---------- */
.login-box { max-width: 26rem; margin: 4rem auto; background: var(--st-card);
  border-radius: var(--st-radius); box-shadow: var(--st-shadow); }
.error { color: var(--st-red); }
.ok { color: var(--st-green); }
.up { color: var(--st-green); }
.down { color: var(--st-red); }
.muted { color: var(--st-muted); }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.page-header h1 { margin-bottom: .25rem; }
.page-title { font-size: 1.5rem; color: var(--st-navy); }
.actions { display: flex; gap: .5rem; align-items: center; }
.actions form { margin: 0; }
nav form { margin: 0; }
nav button { padding: .2rem .6rem; font-size: .85rem; margin: 0; }
nav.container a { text-decoration: none; }
tr.paused td { opacity: .55; }
.chart-wrap { height: 320px; margin-bottom: 2rem; background: var(--st-card);
  border-radius: var(--st-radius); box-shadow: var(--st-shadow); padding: 1rem; }
.found-url { max-width: 24rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pico table override inside cards */
.card table { --pico-background-color: transparent; }

/* sortable headers */
.sort-link { text-decoration: none; color: var(--st-navy); font-weight: 600; }
.sort-link:hover { color: var(--st-blue); }
.sort-link.sorted { color: var(--st-blue); }
.sort-arrow { font-size: .7rem; }
