:root {
  --blue: #4285f4;
  --red: #ea4335;
  --yellow: #fbbc05;
  --green: #34a853;
  --gray-100: #f8f9fa;
  --gray-200: #e8eaed;
  --gray-600: #5f6368;
  --gray-800: #202124;
  --gray-900: #1a1a1a;

  /* Admin surface & typography tokens */
  --surface-0: #ffffff;
  --surface-1: #f8fafc;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.04);
  --shadow-md: 0 4px 6px -1px rgb(15 23 42 / 0.06), 0 2px 4px -2px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 10px 15px -3px rgb(15 23 42 / 0.07), 0 4px 6px -4px rgb(15 23 42 / 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 999px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--gray-800);
  background: #fff;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* Home */
.home-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

.home-page .home {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 24px 24px;
  margin-top: calc(16vh - 24px);
}

.home-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 16px 24px;
  font-size: 13px;
}

.home-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.home-nav a {
  color: var(--gray-800);
  text-decoration: none;
}

.home-nav a:hover {
  text-decoration: underline;
}

.logo {
  font-family: "Product Sans", Arial, sans-serif;
  font-size: 92px;
  font-weight: 500;
  letter-spacing: -6px;
  margin-bottom: 28px;
  user-select: none;
}

.logo .b { color: var(--blue); }
.logo .r { color: var(--red); }
.logo .y { color: var(--yellow); }
.logo .g { color: var(--green); }

.search-form {
  width: 100%;
  max-width: 584px;
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  padding: 10px 14px 10px 16px;
  box-shadow: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  background: #fff;
}

.search-box:hover {
  background: #fff;
  border-color: transparent;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.18);
}

.search-box:focus-within {
  background: #fff;
  border-color: transparent;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}

.search-icon {
  flex: none;
  width: 20px;
  height: 20px;
  color: #9aa0a6;
  opacity: 0.9;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.search-box:focus-within .search-icon {
  opacity: 1;
  color: #4285f4;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  line-height: 24px;
  padding: 0 14px;
  background: transparent;
  color: var(--gray-800);
}

.search-box input::placeholder {
  color: #9aa0a6;
}

.search-box button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gray-600);
}

/* Voice search mic — shared by the home search box and the SERP box. */
.mic-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.mic-btn:hover { background: rgba(60, 64, 67, 0.08); }
.mic-btn svg { display: block; }

.mic-btn.listening {
  background: #fff;
  animation: mic-pulse 1.4s ease-out infinite;
}

@keyframes mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(234, 67, 53, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(234, 67, 53, 0); }
  100% { box-shadow: 0 0 0 0 rgba(234, 67, 53, 0); }
}

/* Why a voice search attempt produced no result — mic blocked, silent
   input device, offline. Anchored under the box like the suggestions. */
.mic-hint {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  margin-top: 6px;
  padding: 10px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  color: #b3261e;
  font-size: 14px;
  line-height: 1.4;
  z-index: 5;
}

.mic-hint.visible { display: block; }

.suggestions {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  background: #fff;
  overflow: hidden;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 10;
}

.suggestions li {
  padding: 10px 16px 10px 50px;
  cursor: pointer;
  font-size: 14px;
}

.suggestions li:hover,
.suggestions li.active {
  background: var(--gray-100);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
}

.btn-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid #f8f9fa;
  border-radius: 4px;
  background: #f8f9fa;
  color: #3c4043;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
}

.btn-search:hover {
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  background: #f8f9fa;
  border-color: #dadce0;
  color: #202124;
  text-decoration: none;
}

.home-meta {
  margin-top: 26px;
  font-size: 13px;
  color: var(--gray-600);
}

.home-warn { color: var(--red); }

.home-links {
  margin-top: 10px;
  font-size: 13px;
}

.home-footer {
  background: #f2f2f2;
  color: #70757a;
  font-size: 14px;
  margin-top: auto;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0 32px;
  border-top: 1px solid #dadce0;
  min-height: 46px;
}

.footer-meta span {
  padding: 12px 0;
}

.footer-group {
  display: flex;
  gap: 30px;
  padding: 12px 0;
}

.footer-group a {
  color: #70757a;
  text-decoration: none;
  white-space: nowrap;
}

.footer-group a:hover {
  text-decoration: underline;
}

/* Header */
.header {
  border-bottom: 1px solid #ebebeb;
  padding: 14px 0;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}

.header .container {
  display: flex;
  align-items: center;
  gap: 30px;
}

.header .logo-small {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -2px;
  flex: none;
  line-height: 1;
}

.header .logo-small .b { color: var(--blue); }
.header .logo-small .r { color: var(--red); }
.header .logo-small .y { color: var(--yellow); }
.header .logo-small .g { color: var(--green); }

/* ===================================================================== */
/* Search results (Google-style SERP)                                     */
/* ===================================================================== */

.search-page {
  --serp-offset: 180px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.serp-header {
  background: #fff;
}

.serp-top {
  display: flex;
  align-items: center;
  padding: 20px 24px 0;
}

.serp-logo {
  flex: none;
  width: calc(var(--serp-offset) - 24px);
  font-family: "Product Sans", Arial, sans-serif;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -1.5px;
  line-height: 1;
  text-decoration: none;
  user-select: none;
}

.serp-logo:hover { text-decoration: none; }

.serp-logo .b { color: var(--blue); }
.serp-logo .r { color: var(--red); }
.serp-logo .y { color: var(--yellow); }
.serp-logo .g { color: var(--green); }

.serp-form {
  flex: 1 1 auto;
  max-width: 692px;
  position: relative;
}

.serp-box {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 8px 0 20px;
  border: 1px solid transparent;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 2px 5px 1px rgba(64, 60, 67, 0.16);
  transition: box-shadow 0.2s ease;
}

.serp-box:hover,
.serp-box:focus-within {
  box-shadow: 0 2px 8px 1px rgba(64, 60, 67, 0.24);
}

.serp-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--gray-800);
  background: transparent;
  padding: 0 8px 0 0;
}

.serp-submit {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
}

.serp-submit:hover { background: rgba(66, 133, 244, 0.08); }
.serp-submit svg { display: block; }

/* --- tabs row --- */
.serp-nav {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 0 24px 0 var(--serp-offset);
  border-bottom: 1px solid #ebebeb;
}

.serp-tabs {
  display: flex;
  gap: 4px;
}

.serp-tab {
  display: inline-block;
  padding: 6px 12px 9px;
  font-size: 14px;
  line-height: 1.2;
  color: #5f6368;
  border-bottom: 3px solid transparent;
  cursor: default;
  user-select: none;
  white-space: nowrap;
}

a.serp-tab { text-decoration: none; cursor: pointer; }
a.serp-tab:hover { color: var(--gray-800); text-decoration: none; }

.serp-tab.active,
a.serp-tab.active:hover {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
}

.serp-tools {
  padding-bottom: 9px;
  font-size: 13px;
  white-space: nowrap;
}

.serp-safesearch {
  color: #5f6368;
  text-decoration: none;
}

.serp-safesearch:hover { color: var(--gray-800); text-decoration: none; }
.serp-safesearch strong { color: #1a73e8; font-weight: 600; }

/* --- results column --- */
.serp-main {
  flex: 1;
  width: 100%;
  padding: 0 24px 40px var(--serp-offset);
}

.serp-main .message {
  max-width: 600px;
  margin-top: 20px;
}

.serp-hint {
  color: #70757a;
  font-size: 14px;
  padding-top: 18px;
}

.serp-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: #70757a;
  font-size: 14px;
  padding-top: 18px;
  margin-bottom: 24px;
}

.serp-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 10px;
  font-size: 12px;
  color: #1557b0;
  background: #e8f0fe;
  border: 1px solid #c6dafc;
  border-radius: 999px;
  line-height: 1.5;
}

.serp-chip-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #1557b0;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  transition: background 0.15s;
}

.serp-chip-clear:hover {
  background: rgba(66, 133, 244, 0.18);
  text-decoration: none;
}

.serp-dym {
  font-size: 18px;
  color: var(--gray-800);
  margin: 0 0 20px;
}

.serp-dym a {
  color: #1a0dab;
  font-style: italic;
  font-weight: 700;
  text-decoration: none;
}

.serp-dym a:hover { text-decoration: underline; }

.serp-noresults {
  max-width: 600px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray-800);
}

.serp-noresults p { margin: 0 0 16px; }

.serp-noresults ul {
  margin: 0;
  padding-left: 28px;
}

.serp-noresults li {
  margin-bottom: 6px;
  font-size: 14px;
}

/* --- result --- */
.serp-result {
  max-width: 600px;
  margin-bottom: 30px;
}

.serp-result-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.serp-source {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.serp-source:hover { text-decoration: none; }

.serp-favicon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f1f3f4;
  overflow: hidden;
}

.serp-favicon img {
  display: block;
  width: 18px;
  height: 18px;
}

.serp-favicon.noicon {
  background: #f1f3f4 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%239aa0a6"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg>') center / 18px 18px no-repeat;
}

.serp-source-lines {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.serp-site {
  font-size: 14px;
  color: var(--gray-800);
}

.serp-cite {
  font-size: 12px;
  font-style: normal;
  color: #4d5156;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.serp-cite-sep { color: #4d5156; }

.serp-more {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #4d5156;
}

.serp-more:hover {
  background: #f1f3f4;
  text-decoration: none;
}

.serp-more svg { display: block; }

.serp-title {
  margin: 5px 0 3px;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
}

.serp-title a {
  color: #1a0dab;
  text-decoration: none;
}

.serp-title a:visited { color: #681da8; }
.serp-title a:hover { text-decoration: underline; }

.serp-snippet {
  font-size: 14px;
  line-height: 1.58;
  color: #4d5156;
  word-wrap: break-word;
}

.serp-title mark,
.serp-snippet mark {
  background: transparent;
  color: inherit;
  font-style: normal;
}

.serp-title mark { font-weight: inherit; }
.serp-snippet mark { font-weight: 700; }

/* --- pagination --- */
.serp-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 600px;
  margin: 20px 0 40px;
  font-size: 14px;
}

.serp-pagination a {
  color: #4285f4;
  text-decoration: none;
  padding: 6px 10px;
}

.serp-pagination a:hover { text-decoration: underline; }

.serp-page-current {
  color: var(--gray-800);
  font-weight: 600;
  padding: 6px 10px;
}

.serp-page-ellipsis {
  color: #70757a;
  padding: 6px 4px;
}

.serp-page-prev { margin-right: 8px; }
.serp-page-next { margin-left: 8px; }

@media (max-width: 768px) {
  .search-page { --serp-offset: 16px; }

  .serp-top {
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px 0;
  }

  .serp-logo { width: auto; }

  .serp-form {
    flex: 1 1 100%;
    max-width: none;
  }

  .serp-nav {
    padding-right: 0;
    gap: 10px;
    overflow-x: auto;
  }

  .serp-tools { padding-right: 16px; }

  .serp-main { padding-right: 16px; }
}

/* ===================================================================== */
/* Admin                                                                  */
/* ===================================================================== */

.admin-page {
  background: var(--surface-1);
  color: var(--text-primary);
}

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

/* --- header --- */
.admin-header {
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.admin-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.admin-brand {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: none;
}

.admin-brand .b { color: var(--blue); }
.admin-brand .r { color: var(--red); }
.admin-brand .y { color: var(--yellow); }
.admin-brand .g { color: var(--green); }

.admin-tag {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px 9px;
  font-weight: 600;
}

.admin-header-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  color: var(--text-secondary);
}

.admin-header-toggle:hover {
  background: var(--surface-1);
  color: var(--text-primary);
}

.admin-nav-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.admin-nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.admin-nav a:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  text-decoration: none;
}

.admin-nav a.active {
  background: rgba(66, 133, 244, 0.10);
  color: var(--blue);
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.admin-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  transition: background 0.15s, color 0.15s;
}

.admin-actions a:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  text-decoration: none;
}

.admin-actions .logout:hover {
  background: #fce8e6;
  color: var(--red);
}

.admin-actions .admin-actions-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

/* --- main --- */
.admin-main {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 64px;
  flex: 1;
}

.admin-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

.admin-col { min-width: 0; }

/* --- flash messages --- */
.admin-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}

.admin-toast.info  { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.admin-toast.success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.admin-toast.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

.admin-toast-icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.admin-toast-content { flex: 1; }

.admin-toast-close {
  flex: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.admin-toast-close:hover { opacity: 1; }

.admin-toast p { margin: 8px 0 0; }
.admin-toast pre { margin: 8px 0 0; background: rgba(255, 255, 255, 0.6); }

/* --- health banner --- */
.health {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 14px;
}

.health > div { display: flex; flex-direction: column; gap: 2px; }
.health strong { font-size: 13px; color: var(--text-primary); }
.health span { color: var(--text-secondary); }

.health-icon {
  flex: none;
  width: 22px;
  height: 22px;
}

.health-ok { border-left-color: var(--green); }
.health-ok .health-icon { color: var(--green); }
.health-warn { border-left-color: var(--yellow); }
.health-warn .health-icon { color: #b45309; }
.health-idle { border-left-color: var(--border-strong); }
.health-idle .health-icon { color: var(--text-tertiary); }

/* --- cards --- */
.card {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 24px;
  transition: box-shadow 0.15s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.card-head h2 { margin: 0; }

.count {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 13px;
  margin-left: 6px;
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.hint {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 14px;
}

.card-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 24px;
}

.card-empty-icon {
  width: 40px;
  height: 40px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 12px;
  overflow-x: auto;
  margin: 0 0 14px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
  line-height: 1.5;
}

code {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 2px 5px;
  font-size: 12px;
  color: var(--text-primary);
}

/* --- bot information card --- */
.bot-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px 32px;
  margin: 0 0 18px;
}

.bot-info-item {
  min-width: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.bot-info dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin: 0 0 6px;
}

.bot-info dd {
  margin: 0;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
}

.bot-info dd code { font-size: 12px; }
.bot-info dd a { color: var(--blue); }

/* --- stats --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  border-top: 3px solid transparent;
  transition: transform 0.12s, box-shadow 0.12s;
}

.stat:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.stat-primary { border-top-color: var(--blue); }
.stat-warn { border-top-color: #f59e0b; }
.stat-ok { border-top-color: var(--green); }
.stat-danger { border-top-color: var(--red); }
.stat-neutral { border-top-color: var(--border-strong); }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.stat-icon {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
}

.stat-primary .stat-icon { color: var(--blue); }
.stat-warn .stat-icon { color: #f59e0b; }
.stat-ok .stat-icon { color: var(--green); }
.stat-danger .stat-icon { color: var(--red); }

.crawler-stats { margin-bottom: 10px; }

.crawler-last-crawl {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.crawler-last-crawl-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.card-empty .hint { margin: 0; }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* --- forms --- */
.admin label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: none;
  letter-spacing: 0;
}

.admin textarea,
.admin select,
.admin input[type="password"],
.admin input[type="text"],
.admin input[type="search"],
.admin input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-0);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.admin textarea:focus,
.admin select:focus,
.admin input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.12);
}

.admin textarea { resize: vertical; }

.form-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.form-row > div { flex: 1; min-width: 140px; }
.form-row select { width: auto; min-width: 140px; }

/* --- crawler settings form --- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px 18px;
  margin-top: 14px;
}

.settings-field .hint {
  margin: 6px 0 0;
  font-size: 12px;
}

.settings-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.settings-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  cursor: pointer;
}

.settings-check input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--blue);
}

.settings-check .hint {
  display: block;
  margin: 2px 0 0;
  font-size: 12px;
}

.settings-override {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(66, 133, 244, 0.12);
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  cursor: help;
}

.filter-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-form input[type="search"] { width: 260px; }
.filter-form select { width: auto; }

/* --- buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}

.btn:hover {
  background: var(--surface-1);
  border-color: var(--border-strong);
  text-decoration: none;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn-primary:hover { background: #3367d6; border-color: #3367d6; }

.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-xs { padding: 5px 10px; font-size: 11px; }
.btn-block { width: 100%; margin-top: 14px; }
.btn-ghost { border-color: transparent; color: var(--text-secondary); background: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

.btn-danger {
  color: var(--red);
  border-color: rgba(234, 67, 53, 0.35);
  background: #fff;
}

.btn-danger:hover { background: #fef2f2; border-color: rgba(234, 67, 53, 0.55); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-row form { display: inline; }

/* --- action cards (maintenance) --- */
.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.action-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.action-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  flex: 1;
}

.action-card form { display: inline; }

/* --- danger zone --- */
.danger-zone {
  margin-top: 20px;
  border: 1px solid rgba(234, 67, 53, 0.25);
  border-radius: var(--radius-md);
  background: #fef2f2;
  padding: 16px;
}

.danger-zone summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.danger-zone summary::-webkit-details-marker { display: none; }

.danger-zone .form-row { margin-top: 14px; margin-bottom: 0; }
.danger-zone select { background: #fff; }

/* --- messages (legacy for login) --- */
.message {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid transparent;
}

.message.info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.message.success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.message.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.message p { margin: 8px 0 0; }
.message pre { margin: 8px 0; background: rgba(255, 255, 255, 0.6); }

/* --- tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 11px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface-1);
}

tbody tr:hover td { background: var(--surface-1); }
tbody tr:last-child td { border-bottom: none; }

.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

table.mini td { padding: 9px 6px; }
table.mini td:first-child { color: var(--text-primary); }

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.table-scroll table { margin-bottom: 0; }
.table-scroll th:first-child,
.table-scroll td:first-child { padding-left: 14px; }
.table-scroll th:last-child,
.table-scroll td:last-child { padding-right: 14px; }

.pages-table { min-width: 780px; }

.sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub.err { color: var(--red); font-weight: 500; }

.truncate {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions-col { width: 1%; white-space: nowrap; }

.row-actions { display: flex; gap: 6px; }
.row-actions form { display: inline; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-secondary);
  margin-right: 4px;
}

.pill-ok { background: #dcfce7; color: #166534; }
.pill-off { background: #fee2e2; color: #991b1b; }
.pill-warn { background: #fef3c7; color: #92400e; }

/* --- pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 48px;
  max-width: 680px;
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
}

.pagination a {
  color: var(--text-primary);
  border: 1px solid var(--border);
  background: var(--surface-0);
  transition: background 0.12s, border-color 0.12s;
}

.pagination a:hover { background: var(--surface-1); border-color: var(--border-strong); text-decoration: none; }

.pagination span.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- login --- */
.login-page { background: var(--surface-1); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface-0);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-logo {
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.login-logo .b { color: var(--blue); }
.login-logo .r { color: var(--red); }
.login-logo .y { color: var(--yellow); }
.login-logo .g { color: var(--green); }

.login-shield {
  width: 48px;
  height: 48px;
  color: var(--blue);
  margin: 0 auto 14px;
}

.login-card h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 24px;
}

.login-card label { text-align: left; }
.login-card .message { text-align: left; }

.login-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
}

.login-back:hover { color: var(--text-primary); text-decoration: none; }

/* --- platform toggle (maintenance cron docs) --- */
.platform-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.platform-tab {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface-0);
  color: var(--text-secondary);
  cursor: pointer;
}

.platform-tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.platform-panel { display: none; }
.platform-panel.active { display: block; }

/* --- icon utilities --- */
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  display: inline-block;
  vertical-align: text-bottom;
}

@media (max-width: 900px) {
  .admin-columns { grid-template-columns: 1fr; }
  .admin-header-inner { flex-wrap: wrap; }
  .admin-nav-wrap {
    display: none;
    width: 100%;
    order: 3;
    padding: 10px 0 14px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    justify-content: flex-start;
  }
  .admin-nav-wrap.open { display: flex; }
  .admin-header-toggle { display: inline-flex; }
  .admin-nav {
    flex-direction: column;
    width: 100%;
    gap: 2px;
  }
  .admin-nav a {
    width: 100%;
    border-radius: var(--radius-md);
    padding: 9px 12px;
    justify-content: flex-start;
  }
  .admin-actions {
    margin-left: auto;
  }
}

.lucky-page {
  background: #fff;
}

.lucky-main {
  padding-bottom: 64px;
}

.lucky-hero {
  max-width: 680px;
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 36px;
}

.lucky-hero h1 {
  font-size: 36px;
  font-weight: 500;
  margin: 0 0 18px;
  color: var(--gray-900);
}

.lucky-hero h1 strong {
  color: var(--red);
}

.lucky-lead {
  font-size: 18px;
  line-height: 1.6;
  margin: 0 0 12px;
  color: var(--gray-800);
}

.lucky-meta {
  font-size: 14px;
  color: var(--gray-600);
  margin: 0 0 22px;
  line-height: 1.5;
}

.lucky-list h2 {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--gray-900);
}

.lucky-note {
  font-size: 14px;
  color: var(--gray-600);
  margin: 0 0 24px;
}

.lucky-item {
  max-width: 680px;
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--gray-200);
}

.lucky-item h3 {
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 8px;
  color: var(--gray-900);
}

.lucky-item p {
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 12px;
  color: var(--gray-800);
}

.lucky-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
}

.lucky-sources a {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px dashed rgba(66, 133, 244, 0.5);
}

.lucky-sources a:hover {
  text-decoration: none;
  border-bottom-style: solid;
}

/* ===================================================================== */
/* About                                                                  */
/* ===================================================================== */

.about-page {
  background: #fff;
}

.about-main {
  padding-bottom: 64px;
}

/* The about header has no search form, so push the nav to the right edge. */
.about-nav {
  margin-left: auto;
  font-size: 14px;
  color: var(--gray-600);
}

.about-hero {
  max-width: 680px;
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 36px;
}

.about-kicker {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--blue);
  margin: 0 0 10px;
  font-weight: 500;
}

.about-hero h1 {
  font-size: 36px;
  font-weight: 500;
  margin: 0 0 18px;
  color: var(--gray-900);
  letter-spacing: -1px;
}

.about-lead {
  font-size: 18px;
  line-height: 1.6;
  margin: 0 0 14px;
  color: var(--gray-800);
}

.about-meta {
  font-size: 14px;
  color: var(--gray-600);
  margin: 0;
  line-height: 1.5;
}

.about-section {
  max-width: 680px;
  margin-bottom: 40px;
}

.about-section h2 {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 14px;
  color: var(--gray-900);
}

.about-section p {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 12px;
  color: var(--gray-800);
}

.about-section strong {
  color: var(--gray-900);
}

/* Mission / vision / promise cards */
.about-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.about-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 20px;
  border-top: 3px solid var(--blue);
}

.about-card h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-600);
  margin: 0 0 8px;
}

.about-card p {
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
  color: var(--gray-800);
}

/* Values + product lists share a look */
.about-values,
.about-products {
  list-style: none;
  margin: 0;
  padding: 0;
}

.about-values li,
.about-products li {
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--gray-200);
}

.about-values li:last-child,
.about-products li:last-child {
  border-bottom: none;
}

.about-values h3,
.about-products h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--gray-900);
}

.about-values p,
.about-products p {
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
  color: var(--gray-600);
}

.about-note {
  font-size: 14px;
  color: var(--gray-600);
  margin-top: 18px;
  line-height: 1.5;
}

/* Closing call to action */
.about-cta {
  max-width: 680px;
  margin-top: 8px;
  padding: 28px 0 0;
  border-top: 1px solid var(--gray-200);
}

.about-cta h2 {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 12px;
  color: var(--gray-900);
}

.about-cta p {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 18px;
  color: var(--gray-800);
}

/* Legal pages (privacy / terms) reuse the about layout with a few extras. */
.legal-updated {
  font-size: 13px;
  color: var(--gray-600);
  margin: 6px 0 0;
}

.legal-list {
  max-width: 680px;
  margin: 0 0 12px;
  padding-left: 20px;
}

.legal-list li {
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-800);
  margin-bottom: 10px;
}

.legal a {
  color: var(--blue);
  text-decoration: none;
}

.legal a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .home-page .home {
    margin-top: 10vh;
    padding: 0 16px 16px;
  }
  .logo { font-size: 52px; letter-spacing: -4px; }
  .home-header { padding: 12px 16px; }
  .search-box { padding: 8px 12px 8px 14px; }
  .search-buttons { flex-direction: column; gap: 10px; }
  .btn-search { width: 100%; }
  .footer-row { padding: 0 20px; }
  .footer-group { gap: 18px; width: 100%; justify-content: center; }
  .footer-links { flex-direction: column; }
  .header .container { flex-wrap: wrap; gap: 12px; }
  .admin-main { padding: 18px 14px 48px; }
  .card { padding: 18px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-cards { grid-template-columns: 1fr; }
  .filter-form { width: 100%; }
  .filter-form input[type="search"] { width: 100%; }
  .filter-form select { width: 100%; }
  .filter-form .btn { width: 100%; }
  .row-actions { flex-wrap: wrap; }
  .truncate { max-width: 200px; }
  .login-card { padding: 28px 22px; }
  .lucky-hero { padding: 28px 0 24px; }
  .lucky-hero h1 { font-size: 28px; }
  .lucky-lead { font-size: 16px; }
  .about-hero { padding: 28px 0 24px; }
  .about-hero h1 { font-size: 28px; }
  .about-lead { font-size: 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-header-inner { padding: 0 14px; }
  .admin-main { padding: 16px 12px 40px; }
  .card { padding: 16px; }
}
