/* ===========================================================
   SEO Rank Tracker — Ported from login-orijinal reference
   Outfit · teal + navy · 8px radius · soft grid background
   =========================================================== */

:root {
  --ink:         #18313b;
  --navy:        #10384e;
  --muted:       #6a7b82;
  --panel:       #ffffff;
  --page:        #f4f8f9;
  --soft:        #fbfdfd;
  --line:        #dbe7e9;
  --line-strong: #c8dbde;
  --teal:        #13aeb8;
  --teal-dark:   #087f89;
  --teal-soft:   #eaf8f9;
  --green:       #20b87c;
  --green-soft:  #e8f6ef;
  --orange:      #e7982d;
  --orange-soft: #fdf3e0;
  --red:         #d64f4f;
  --red-soft:    #fdecec;
  --blue:        #0b6fa4;
  --pink:        #c84d87;

  --shadow:     0 24px 64px rgba(16, 56, 78, 0.12);
  --shadow-sm:  0 12px 28px rgba(16, 56, 78, 0.07);
  --shadow-xs:  0 4px 12px rgba(16, 56, 78, 0.05);

  --radius:     8px;
  --ease:       cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}
html, body { margin: 0; padding: 0; }

html { background: var(--page); }

body {
  min-height: 100vh;
  font-family: "Outfit", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(19, 174, 184, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(19, 174, 184, 0.035) 1px, transparent 1px),
    var(--page);
  background-size: 38px 38px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--teal-dark); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--navy); }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; color: var(--ink); }
p { margin: 0; }

/* -----------------------------------------------------------
   App shell — admin-container pattern (single big card)
   ----------------------------------------------------------- */

.app-body { padding: 28px; }

.app-shell {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* App header — logo left, user right */

.app-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 22px 32px;
  background:
    linear-gradient(135deg, rgba(19, 174, 184, 0.09), transparent 42%),
    linear-gradient(315deg, rgba(16, 56, 78, 0.06), transparent 44%),
    #fbfefe;
  border-bottom: 1px solid var(--line);
}

.app-nav { justify-self: center; }

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--navy);
  background: #fff;
  font-size: 22px;
  cursor: pointer;
  justify-self: end;
  transition: all 0.18s var(--ease);
}
.nav-toggle:hover { background: var(--soft); }
.nav-toggle:active { background: var(--teal-soft); }

.app-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink) !important;
}

.app-brand .brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  font-size: 1.2rem;
  box-shadow: 0 8px 20px -6px rgba(8, 127, 137, 0.45);
}

.app-brand .brand-text strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
}
.app-brand .brand-text span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--teal-dark);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.app-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius);
  transition: all 0.18s var(--ease);
}
.app-nav a i { font-size: 14px; }
.app-nav a:hover { color: var(--ink); background: var(--soft); }
.app-nav a.active {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.app-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 8px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--teal-dark);
  background: var(--teal-soft);
  border: 1px solid #d6ecef;
  font-weight: 700;
  font-size: 13px;
}

.user-info-text strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.user-info-text span {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--teal-dark);
  line-height: 1.2;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: var(--navy);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s var(--ease);
  cursor: pointer;
}
.logout-btn:hover {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
  transform: translateY(-1px);
}

/* App content area */

.app-content {
  padding: 28px 32px 32px;
  background: #fff;
}

/* -----------------------------------------------------------
   Page header card (page-title + actions)
   ----------------------------------------------------------- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  margin-bottom: 18px;
  background:
    linear-gradient(135deg, rgba(19, 174, 184, 0.09), transparent 42%),
    linear-gradient(315deg, rgba(16, 56, 78, 0.06), transparent 44%),
    var(--panel);
  border: 1px solid var(--line);
  border-left: 6px solid var(--teal);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}
.page-header .lede {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.page-header .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* -----------------------------------------------------------
   Stats grid
   ----------------------------------------------------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  color: var(--teal-dark);
  background: var(--teal-soft);
  border: 1px solid #d6ecef;
  font-size: 18px;
}
.stat-card.green   .stat-icon { color: var(--green);  background: var(--green-soft);  border-color: #cdebda; }
.stat-card.orange  .stat-icon { color: var(--orange); background: var(--orange-soft); border-color: #f6dfbd; }
.stat-card.red     .stat-icon { color: var(--red);    background: var(--red-soft);    border-color: #f3cccc; }
.stat-card.navy    .stat-icon { color: var(--navy);   background: #e2edf2;            border-color: #c8d8df; }

.stat-text { min-width: 0; }
.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}
.stat-value {
  color: var(--navy);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
}

/* -----------------------------------------------------------
   Cards (panel-card pattern)
   ----------------------------------------------------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}
.card-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.card-header h2 i { color: var(--teal-dark); }
.card-header .sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.card-header .action {
  font-size: 12px;
  font-weight: 600;
  color: var(--teal-dark);
}

.card-body { padding: 20px; }

/* 2-col grid */
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

/* -----------------------------------------------------------
   Forms — soft, matches login-orijinal pattern
   ----------------------------------------------------------- */

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.form-input,
.form-control,
.form-select {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid #d3e0e3;
  border-radius: var(--radius);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.form-input::placeholder,
.form-control::placeholder { color: #96a5aa; }

.form-input:focus,
.form-control:focus,
.form-select:focus {
  background: #fff;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(19, 174, 184, 0.12);
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236a7b82'%3E%3Cpath d='M3.2 5.4a1 1 0 0 1 1.4 0L8 8.8l3.4-3.4a1 1 0 1 1 1.4 1.4l-4.1 4.1a1 1 0 0 1-1.4 0L3.2 6.8a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  padding-right: 40px;
}

/* Input with leading icon */
.input-group {
  position: relative;
}
.input-group .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #8d9da4;
  font-size: 14px;
  pointer-events: none;
  transition: color 0.2s var(--ease);
}
.input-group .form-input,
.input-group .form-control {
  padding-left: 42px;
}
.input-group .form-input:focus + .input-icon,
.input-group .form-control:focus + .input-icon { color: var(--teal-dark); }

/* Country select with flag */
.country-select-wrap { position: relative; }
.country-select-wrap .flag {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  pointer-events: none;
  z-index: 2;
}
.country-select-wrap select.form-select { padding-left: 44px; }

/* Segmented toggle */
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--soft);
  border: 1px solid var(--line);
  width: 100%;
  min-height: 46px;
  gap: 2px;
}
.segmented input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  user-select: none;
  margin: 0;
}
.segmented label i { font-size: 14px; opacity: 0.7; }
.segmented input[type="radio"]:checked + label {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(16, 56, 78, 0.10);
}
.segmented input[type="radio"]:checked + label i { color: var(--teal-dark); opacity: 1; }

/* Form layout */
.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}
.form-grid > .col-12 { grid-column: span 12; }
.form-grid > .col-6  { grid-column: span 6; }
.form-grid > .col-4  { grid-column: span 4; }
.form-grid > .col-3  { grid-column: span 3; }
.form-grid > .col-2  { grid-column: span 2; }

@media (max-width: 900px) {
  .form-grid > [class*="col-"] { grid-column: span 12; }
}

/* -----------------------------------------------------------
   Buttons
   ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.btn i { font-size: 14px; }

.btn-primary {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}
.btn-primary:hover {
  background: #0b2f44;
  border-color: #0b2f44;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(16, 56, 78, 0.20);
}
.btn-primary:active { transform: translateY(0); }

.btn-teal {
  color: #fff;
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}
.btn-teal:hover { background: #066b73; border-color: #066b73; }

.btn-ghost {
  color: var(--navy);
  background: #fff;
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--soft); border-color: var(--line-strong); }

.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 8px 14px; font-size: 13px; }

/* -----------------------------------------------------------
   Tables
   ----------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table thead th {
  padding: 12px 16px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
table.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}
table.data-table tbody tr:last-child td { border-bottom: 0; }
table.data-table tbody tr { transition: background 0.15s var(--ease); }
table.data-table tbody tr:hover { background: var(--soft); }
table.data-table a { color: var(--ink); font-weight: 600; }
table.data-table a:hover { color: var(--teal-dark); }
table.data-table .muted { color: var(--muted); }

/* -----------------------------------------------------------
   Badges + pills
   ----------------------------------------------------------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.status-success { color: #14613e; background: var(--green-soft); }
.status-success::before { background: var(--green); box-shadow: 0 0 0 3px rgba(32, 184, 124, 0.18); }
.status-not_found { color: #845014; background: var(--orange-soft); }
.status-not_found::before { background: var(--orange); box-shadow: 0 0 0 3px rgba(231, 152, 45, 0.18); }
.status-error, .status-blocked, .status-captcha_detected {
  color: #8a2b2b; background: var(--red-soft);
}
.status-error::before, .status-blocked::before, .status-captcha_detected::before {
  background: var(--red); box-shadow: 0 0 0 3px rgba(214, 79, 79, 0.18);
}

.pos-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  background: var(--teal-soft);
  color: var(--teal-dark);
}
.pos-pill.pos-top10 { background: var(--green-soft); color: #14613e; }
.pos-pill.pos-top3  { background: linear-gradient(135deg, #d1f3df, #b6e8c8); color: #0f5232; }
.pos-pill.pos-none  { background: var(--soft); color: var(--muted); }

/* -----------------------------------------------------------
   Rank result block
   ----------------------------------------------------------- */

.result-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.rank-card {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  border-radius: var(--radius);
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.rank-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: 0.35;
}
.rank-card > * { position: relative; }
.rank-card p, .rank-card span {
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-size: 11px;
  opacity: 0.88;
}
.rank-card strong {
  margin: 4px 0;
  font-size: clamp(2.6rem, 7vw, 3.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.95;
  display: block;
}
.rank-found {
  background:
    radial-gradient(400px 200px at 0% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(135deg, var(--green) 0%, #0f8d5a 100%);
}
.rank-missing {
  background:
    radial-gradient(400px 200px at 0% 0%, rgba(255, 255, 255, 0.10), transparent 60%),
    linear-gradient(135deg, var(--navy) 0%, #0b2538 100%);
}

.result-summary {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.summary-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.summary-row:last-child { border-bottom: 0; padding-bottom: 0; }
.summary-row span { color: var(--muted); font-weight: 600; font-size: 12px; }
.summary-row strong { min-width: 0; overflow-wrap: anywhere; color: var(--ink); font-weight: 700; font-size: 14px; }

/* SERP list */
.serp-list { display: grid; gap: 10px; padding: 4px; }
.serp-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  transition: all 0.18s var(--ease);
}
.serp-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.serp-row.target-hit {
  border-color: rgba(32, 184, 124, 0.5);
  background: linear-gradient(135deg, var(--green-soft) 0%, #ffffff 100%);
  box-shadow: 0 10px 26px -10px rgba(32, 184, 124, 0.32);
}
.serp-position {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-weight: 700;
  font-size: 13px;
}
.target-hit .serp-position {
  background: linear-gradient(135deg, var(--green), #0f8d5a);
  color: #fff;
  box-shadow: 0 6px 14px -4px rgba(32, 184, 124, 0.5);
}
.serp-title {
  display: inline-block;
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.serp-url { margin-top: 3px; color: var(--green); font-size: 12px; overflow-wrap: anywhere; }
.serp-content p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* -----------------------------------------------------------
   Empty + alerts
   ----------------------------------------------------------- */

.empty-state {
  padding: 36px 24px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.empty-state i {
  display: block;
  font-size: 28px;
  color: var(--line-strong);
  margin-bottom: 10px;
}

.alert {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--soft);
  color: var(--ink);
}
.alert-danger {
  color: #8a2b2b;
  background: #fff2f2;
  border-color: #f0caca;
  border-left: 4px solid var(--red);
}
.alert-warning {
  color: #845014;
  background: #fdf6e7;
  border-color: #f6dfbd;
  border-left: 4px solid var(--orange);
}

/* -----------------------------------------------------------
   Login — split screen (mirrors login-orijinal index.php)
   ----------------------------------------------------------- */

.login-body {
  background: linear-gradient(180deg, #f8fbfb 0%, #eef5f6 100%);
}

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

.login-shell {
  width: min(1080px, 100%);
  min-height: 640px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 430px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 26px 70px rgba(16, 56, 78, 0.13);
  overflow: hidden;
}

.brand-side {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px;
  background:
    linear-gradient(90deg, rgba(19, 174, 184, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(19, 174, 184, 0.045) 1px, transparent 1px),
    #fbfefe;
  background-size: 38px 38px;
  border-right: 1px solid var(--line);
}

.brand-logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
}
.brand-logo-wrap .mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  font-size: 18px;
  box-shadow: 0 8px 20px -4px rgba(8, 127, 137, 0.45);
}
.brand-logo-wrap .sub {
  display: block;
  margin-top: 4px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.brand-center { max-width: 520px; margin-top: 8px; }
.brand-rule {
  width: 44px;
  height: 3px;
  background: var(--teal);
  margin-bottom: 24px;
}
.brand-title {
  max-width: 430px;
  color: var(--navy);
  font-size: 36px;
  line-height: 1.08;
  font-weight: 700;
  margin-bottom: 16px;
}
.brand-copy {
  max-width: 470px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.68;
}

.preview-card {
  width: min(520px, 100%);
  margin-top: 36px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 46px rgba(16, 56, 78, 0.08);
  overflow: hidden;
}
.preview-top {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.preview-dot { width: 7px; height: 7px; border-radius: 50%; background: #b9c9ce; }
.preview-body { padding: 18px; }
.preview-row {
  display: grid;
  grid-template-columns: 38px 1fr 66px;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  border-bottom: 1px solid #eef4f5;
}
.preview-row:last-child { border-bottom: 0; }
.preview-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius);
  background: var(--teal-soft);
  border: 1px solid #d6ecef;
}
.preview-line { height: 9px; border-radius: 999px; background: #d9e7ea; }
.preview-line.short { width: 70%; }
.preview-status { height: 9px; border-radius: 999px; background: var(--teal); opacity: 0.82; }

.brand-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #7f9096;
  font-size: 13px;
  margin-top: 30px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(32, 184, 124, 0.13);
}

.login-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--panel);
}
.form-box { width: 100%; max-width: 350px; }
.form-head { margin-bottom: 30px; }
.form-kicker {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.form-title {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
  margin-bottom: 8px;
}
.form-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.error-message {
  margin: 0 0 18px;
  padding: 12px 13px;
  color: #8f2222;
  background: #fff2f2;
  border: 1px solid #f0caca;
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.45;
}

.form-button {
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--navy);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.form-button:hover {
  background: #0b2f44;
  transform: translateY(-1px);
  box-shadow: 0 15px 30px rgba(16, 56, 78, 0.20);
}

.form-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: #87969c;
  text-align: center;
  font-size: 12px;
}

/* -----------------------------------------------------------
   Responsive — tablet · mobile-landscape · mobile-portrait
   ----------------------------------------------------------- */

/* ≤ 1100: narrower tablet */
@media (max-width: 1100px) {
  .app-body { padding: 18px; }
  .app-header { padding: 18px 24px; gap: 16px; }
  .app-content { padding: 22px 24px 28px; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid > .col-4 { grid-column: span 6; }
  .form-grid > .col-3, .form-grid > .col-2 { grid-column: span 6; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
}

/* ≤ 820: mobile mode — hamburger appears, header restacks */
@media (max-width: 820px) {
  body { font-size: 14.5px; }
  .app-body { padding: 12px; }
  .app-shell { border-radius: var(--radius); }

  /* Header: brand + hamburger only; nav and user become drawer */
  .app-header {
    grid-template-columns: 1fr auto;
    padding: 14px 18px;
    gap: 12px;
  }
  .nav-toggle { display: inline-flex; }
  .app-brand .brand-text strong { font-size: 16px; }
  .app-brand .brand-text span { font-size: 11px; }
  .app-brand .brand-mark { width: 40px; height: 40px; font-size: 1.1rem; }

  .app-nav {
    display: none;
    grid-column: 1 / -1;
    justify-self: stretch;
    flex-direction: column;
    gap: 2px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    margin-top: 6px;
  }
  .app-nav a {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border-radius: var(--radius);
  }

  .app-user {
    display: none;
    grid-column: 1 / -1;
    justify-self: stretch;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-top: 4px;
  }
  .user-profile { width: 100%; }
  .user-profile { padding: 10px 12px; }
  .user-info-text { flex: 1; }
  .logout-btn { width: 100%; justify-content: center; min-height: 48px; }

  body.nav-open .app-nav,
  body.nav-open .app-user {
    display: flex;
  }

  /* Page header stacks */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    padding: 18px 18px;
    gap: 14px;
  }
  .page-header h1 { font-size: 19px; }
  .page-header .header-actions { width: 100%; }
  .page-header .header-actions .btn { width: 100%; min-height: 48px; }

  /* Stats: 2-up */
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 22px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-icon { width: 40px; height: 40px; font-size: 16px; }

  /* Cards padding tighter */
  .card-header { padding: 12px 16px; }
  .card-body { padding: 16px; }

  /* Form grid → single column */
  .form-grid > .col-12,
  .form-grid > .col-6,
  .form-grid > .col-4,
  .form-grid > .col-3,
  .form-grid > .col-2 { grid-column: span 12; }

  /* Result card stacks */
  .result-grid { grid-template-columns: 1fr; }
  .rank-card { min-height: 170px; padding: 20px; }
  .rank-card strong { font-size: 3rem; }
  .summary-row { grid-template-columns: 1fr; gap: 4px; }
  .summary-row span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }

  /* SERP row stacks */
  .serp-row {
    grid-template-columns: auto 1fr;
    gap: 12px;
    padding: 12px 14px;
  }
  .serp-position { width: 40px; height: 40px; font-size: 12px; }
  .serp-title { font-size: 13.5px; }
  .serp-url { font-size: 11.5px; }
  .serp-content p { font-size: 12.5px; }

  /* Inputs taller for touch */
  .form-input, .form-control, .form-select {
    min-height: 48px;
    padding: 13px 14px;
    font-size: 15px; /* avoids iOS zoom-on-focus */
  }
  .segmented { min-height: 48px; }
  .segmented label { font-size: 14px; padding: 9px; }
  .btn { min-height: 48px; font-size: 15px; }
  .form-button { font-size: 16px; }

  /* Table → smaller font + scrolls horizontally already via .table-wrap */
  table.data-table { font-size: 12.5px; min-width: 640px; }
  table.data-table thead th { padding: 10px 12px; font-size: 10.5px; }
  table.data-table tbody td { padding: 10px 12px; }
}

/* ≤ 620: mobile portrait — full edge-to-edge */
@media (max-width: 620px) {
  .app-body { padding: 0; }
  .app-shell { border-radius: 0; border-width: 0 0 1px 0; box-shadow: none; }
  .app-header, .app-content { padding-left: 14px; padding-right: 14px; }
  .app-content { padding-top: 18px; padding-bottom: 24px; }
  .page-header { padding: 16px 14px; border-radius: var(--radius); }

  /* Login on mobile */
  .login-page { padding: 0; align-items: flex-start; }
  .login-shell {
    min-height: 100vh;
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .brand-side {
    padding: 28px 22px 22px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand-side > div:first-child { display: flex; flex-direction: column; gap: 16px; }
  .brand-logo-wrap { font-size: 22px; gap: 10px; }
  .brand-logo-wrap .mark { width: 40px; height: 40px; font-size: 1rem; }
  .brand-center { margin-top: 4px; }
  .brand-title { font-size: 26px; margin-bottom: 10px; }
  .brand-copy { font-size: 14px; }
  .preview-card { display: none; }
  .brand-foot { margin-top: 18px; }
  .login-side { padding: 28px 22px 36px; }
  .form-box { max-width: 100%; }
  .form-head { margin-bottom: 22px; }
  .form-title { font-size: 24px; }
}

/* ≤ 380: very small phones */
@media (max-width: 380px) {
  .app-header { padding: 12px 14px; }
  .app-brand .brand-text strong { font-size: 15px; }
  .app-brand .brand-text span { font-size: 10.5px; }
  .stats-grid { grid-template-columns: 1fr; }
}
