:root {
  color-scheme: light;
  --bg: #fff;
  --panel: #fff;
  --ink: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --soft: #f8fafd;
  --accent: #3b82f6;
  --link: #1a0dab;
  --success: #0f9d58;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318;
  --panel: #181b22;
  --ink: #eef2f7;
  --muted: #a8b0bc;
  --line: #303642;
  --soft: #20242d;
  --accent: #8ab4ff;
  --link: #8ab4ff;
  --success: #67d391;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
.site-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-height: 58px;
  padding: 12px clamp(16px, 4vw, 52px);
}
.brand { display: none; }
.site-header nav { display: flex; align-items: center; gap: 14px; font-size: 14px; }
button, .btn, .theme-toggle {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--ink);
  padding: 0 13px;
  cursor: pointer;
}
button.primary, .btn.primary {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
  font-weight: 700;
}
.page { width: min(1160px, calc(100% - 32px)); margin: 0 auto 56px; }
.home {
  min-height: calc(100vh - 90px);
  display: grid;
  align-content: center;
  justify-items: center;
  transform: translateY(-7vh);
}
.home-logo-img {
  width: min(560px, 92vw);
  max-height: 230px;
  object-fit: contain;
  margin-bottom: 24px;
}
.search-form { width: min(660px, 100%); }
.search-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  width: 100%;
}
.search-bar input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 22px;
  outline: none;
}
.search-bar input:focus,
.search-bar input:hover { box-shadow: 0 2px 8px rgba(60,64,67,.22); }
.top-search {
  display: grid;
  grid-template-columns: 150px minmax(260px, 690px);
  align-items: center;
  gap: 24px;
  padding: 12px 0 18px;
  border-bottom: 1px solid var(--line);
}
.result-logo img { width: 150px; height: 60px; object-fit: contain; }
.search-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 14px 0 22px 174px;
  color: var(--muted);
  font-size: 13px;
}
.serp {
  display: grid;
  gap: 20px;
  max-width: 760px;
  margin-left: 174px;
}
.serp-result h2 {
  margin: 4px 0;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
}
.serp-result p { margin: 0; color: var(--muted); line-height: 1.48; }
.serp-url {
  color: var(--success);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.ad-label {
  display: inline-flex;
  margin-right: 8px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.promoted { padding-bottom: 2px; }
.pagination {
  display: flex;
  gap: 18px;
  margin: 34px 0 0 174px;
  color: var(--muted);
}
.panel, .table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-span { grid-column: 1 / -1; }
.form-grid { display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 12px;
}
textarea { min-height: 96px; resize: vertical; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.stat strong { display: block; font-size: 28px; }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; background: var(--soft); }
.flash.error { border: 1px solid #ef4444; }
.empty { color: var(--muted); padding: 18px 0; }
@media (max-width: 820px) {
  .top-search, .search-bar, .grid-2, .grid-3, .stats { grid-template-columns: 1fr; }
  .search-meta, .serp, .pagination { margin-left: 0; }
  .site-header { justify-content: flex-start; }
}
