:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface2: #1a1a1a;
  --border: #262626;
  --border-hover: #3b82f6;
  --accent: #3b82f6;
  --accent-dim: rgba(59,130,246,0.15);
  --text: #e5e5e5;
  --text2: #a3a3a3;
  --text3: #737373;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --orange: #f97316;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
}
.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-header h2 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-header h2 a {
  color: var(--text3);
  text-decoration: none;
  font-size: 12px;
  font-weight: 400;
}
.sidebar-header h2 a:hover { color: var(--accent); }
.sidebar-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.sidebar-search { padding: 10px 12px 6px; }
.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.sidebar-search input:focus { border-color: var(--accent); }
.sidebar-search input::placeholder { color: var(--text3); }
.sidebar-filters {
  padding: 4px 12px 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 3px 10px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 14px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text2); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 16px;
}
.sidebar-client {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.12s;
  border: 1px solid transparent;
}
.sidebar-client:hover { background: var(--surface2); }
.sidebar-client.active { background: var(--accent-dim); border-color: var(--accent); }
.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-info { min-width: 0; }
.sidebar-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-meta { font-size: 11px; color: var(--text3); }
.sidebar-dot {
  margin-left: auto;
  flex-shrink: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.sidebar-dot.active { background: var(--green); }
.sidebar-dot.delinquent { background: var(--yellow); }
.sidebar-count {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text3);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ── Main Panel ── */
.main {
  flex: 1;
  margin-left: 280px;
  min-width: 0;
}
.main-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: var(--text3);
  font-size: 14px;
}

/* ── Header ── */
.client-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 32px 30px 24px;
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-logo {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.header-logo img { max-width: 52px; max-height: 52px; object-fit: contain; }
.header-logo .initials { font-size: 24px; font-weight: 800; color: var(--text3); }
.header-text h1 { font-size: 24px; font-weight: 800; }
.header-meta { font-size: 13px; color: var(--text2); margin-top: 2px; }
.header-meta span + span::before { content: "  \00b7  "; }
.header-badges { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-blue { background: var(--accent-dim); color: var(--accent); }
.badge-green { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-yellow { background: rgba(234,179,8,0.15); color: var(--yellow); }
.badge-gray { background: rgba(163,163,163,0.15); color: var(--text2); }
.badge-purple { background: rgba(168,85,247,0.15); color: #a855f7; }
.badge-cyan { background: rgba(6,182,212,0.15); color: #06b6d4; }
.badge-pink { background: rgba(236,72,153,0.15); color: #ec4899; }
.badge-orange { background: rgba(249,115,22,0.15); color: #f97316; }

/* ── Nav Tabs ── */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 30px;
}
.nav-btn {
  padding: 8px 14px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.nav-btn:hover { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: var(--accent-dim); color: var(--accent); }

/* ── Content ── */
.content {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 30px 60px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title .edit-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.card-title .edit-btn:hover { background: var(--accent); color: #fff; }
.card-title .edit-btn.saving { opacity: 0.5; pointer-events: none; }

/* ── Field Grid ── */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 2px; }
.field.full { grid-column: 1 / -1; }
.field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text3);
}
.field-value {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}
.field-value a { color: var(--accent); text-decoration: none; }
.field-value a:hover { text-decoration: underline; }
.field-value.empty { color: var(--text3); font-style: italic; font-size: 13px; }

/* ── Edit mode fields ── */
.field-input {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.field-input:focus { border-color: var(--accent); }
textarea.field-input { min-height: 60px; resize: vertical; }
.edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}
.btn-save, .btn-cancel {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.btn-save { background: var(--accent); color: #fff; }
.btn-save:hover { opacity: 0.9; }
.btn-cancel { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.btn-cancel:hover { background: var(--border); }

/* ── Metrics ── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metric {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg);
  border-radius: 8px;
}
.metric-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}
.metric-value.green { color: var(--green); }
.metric-value.orange { color: var(--orange); }
.metric-value.red { color: var(--red); }
.metric-label {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Tags ── */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 4px 12px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  background: var(--bg);
}
td { color: var(--text2); }

/* ── Color swatches ── */
.color-swatches { display: flex; gap: 16px; flex-wrap: wrap; }
.swatch { text-align: center; }
.swatch-circle {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  margin: 0 auto 6px;
}
.swatch-label { font-size: 11px; color: var(--text3); display: block; }
.swatch-hex { font-size: 11px; font-family: monospace; color: var(--text2); display: block; }

/* ── Links ── */
.link-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.link-item { }
.link-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  display: block;
  margin-bottom: 2px;
}
.link-item a {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.link-item a:hover { text-decoration: underline; }

/* ── Posts grid ── */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.post-card {
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.post-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: contain;
  display: block;
  background: #000;
}
.post-card-body { padding: 12px; }
.post-card-date { font-size: 11px; color: var(--text3); margin-bottom: 4px; }
.post-card-title { font-size: 13px; font-weight: 600; }
.post-card-title a { color: var(--accent); text-decoration: none; }

/* ── Checklist ── */
.checklist { display: flex; flex-direction: column; gap: 8px; }
.check-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.check-icon.yes { background: rgba(34,197,94,0.15); color: var(--green); }
.check-icon.no { background: rgba(239,68,68,0.15); color: var(--red); }

/* ── Notes ── */
.notes-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  white-space: pre-wrap;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--green);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 999;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Section label ── */
.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  margin: 16px 0 8px;
}

/* ── Ad Cards ── */
.ad-card-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 8px;
}
.ad-card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.ad-headlines {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}
.ad-desc {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 6px;
}
.ad-url {
  font-size: 12px;
}
.ad-url a {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--text3);
  display: inline;
  gap: 0;
}
.ad-url a:hover {
  color: var(--accent);
  background: none;
  border: none;
}

/* ── GeoGrid Comparison ── */
.geogrid-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.geogrid-item { text-align: center; }
.geogrid-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text3);
  margin-bottom: 8px;
}
.geogrid-img {
  width: 100%;
  max-width: 400px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s;
}
.geogrid-img:hover { border-color: var(--accent); }
.geogrid-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px dashed var(--border);
  color: var(--text3);
  font-size: 13px;
  font-style: italic;
}

/* ── Profile tabs (multi-GBP) ── */
.profile-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
}
.profile-tab {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text3);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.profile-tab:hover { color: var(--text); background: var(--hover); }
.profile-tab.active { background: var(--accent); color: #fff; }
.profile-panel { display: none; }
.profile-panel.active { display: block; }

/* ── Hamburger (hidden on desktop) ── */
.hamburger {
  display: none;
  position: fixed;
  top: 12px; right: 12px;
  z-index: 310;
  width: 36px; height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
}
.hamburger span {
  display: block;
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: all 0.2s;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 190;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ══════════════════════════════════
   MOBILE — phone (≤768px)
   ══════════════════════════════════ */
@media (max-width: 768px) {
  /* Hamburger visible */
  .hamburger { display: flex; }

  /* Sidebar: off-screen drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  /* Main panel: full width */
  .main { margin-left: 0; }

  /* Header: compact */
  .client-header { padding: 16px 16px 14px; }
  .header-inner { gap: 12px; }
  .header-logo { width: 44px; height: 44px; }
  .header-logo img { max-width: 36px; max-height: 36px; }
  .header-logo .initials { font-size: 16px; }
  .header-text h1 { font-size: 18px; }
  .header-meta { font-size: 11px; }
  .header-badges { gap: 4px; }

  /* Nav tabs: horizontal scroll */
  .nav-inner {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 12px;
    gap: 0;
    scrollbar-width: none;
  }
  .nav-inner::-webkit-scrollbar { display: none; }
  .nav-btn { padding: 7px 12px; font-size: 12px; flex-shrink: 0; }

  /* Content: tighter padding */
  .content { padding: 14px 12px 40px; }

  /* Cards: less padding */
  .card { padding: 14px 14px; border-radius: 10px; margin-bottom: 12px; }

  /* Metrics: 2-column grid */
  .metrics-row { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .metric { padding: 10px 6px; }
  .metric-value { font-size: 18px; }

  /* Field grid: single column */
  .field-grid { grid-template-columns: 1fr; gap: 10px; }

  /* Tables: responsive stacked cards */
  table { display: block; }
  thead { display: none; }
  tbody { display: block; }
  tr {
    display: block;
    background: var(--bg);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
  }
  td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 4px 0;
    border-bottom: none;
    font-size: 12px;
    gap: 8px;
  }
  td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text3);
    flex-shrink: 0;
    min-width: 70px;
  }

  /* Post grid: single column */
  .post-grid { grid-template-columns: 1fr; }

  /* GeoGrid: stack vertically */
  .geogrid-pair { grid-template-columns: 1fr; }

  /* Profile tabs: scroll horizontal on mobile */
  .profile-tab { padding: 6px 12px; font-size: 12px; }

  /* Link row: single column */
  .link-row { grid-template-columns: 1fr; }

  /* Color swatches: smaller */
  .swatch-circle { width: 36px; height: 36px; }

  /* Ad cards: tighter */
  .ad-card-item { padding: 10px 12px; }
  .ad-card-header-row { flex-wrap: wrap; gap: 4px; }
  .ad-headlines { font-size: 13px; }
  .ad-desc { font-size: 12px; }

  /* Toast: full width at bottom */
  .toast { left: 12px; right: 12px; bottom: 12px; text-align: center; }
}

/* ── Summary Button ── */
.summary-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--card);
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.summary-btn:hover { background: var(--hover); color: var(--text); }
.summary-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Summary View ── */
.summary-view { padding: 24px; }
.summary-title { font-size: 20px; font-weight: 600; margin-bottom: 16px; color: var(--text); }
.summary-scroll { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
.summary-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card);
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
}
.summary-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}
.summary-table tbody tr:hover { background: var(--hover); }
.summary-table tbody tr:hover td { color: var(--text); }

/* Sticky first column */
.sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg);
}
.summary-table thead .sticky-col { z-index: 3; background: var(--card); }
.summary-table tbody tr:hover .sticky-col { background: var(--hover); }

/* Client cell */
.summary-client-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-width: 180px;
}
.summary-client-cell:hover .summary-client-name { color: var(--accent); }
.summary-client-name { font-weight: 500; color: var(--text); }
.summary-logo { width: 24px; height: 24px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.summary-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.summary-link { color: var(--accent); text-decoration: none; }
.summary-link:hover { text-decoration: underline; }

/* Plan badges in summary */
.plan-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.plan-badge.plan-full { background: rgba(76,175,80,.15); color: #4caf50; }
.plan-badge.plan-lite { background: rgba(100,181,246,.15); color: #64b5f6; }
.plan-badge.plan-ads { background: rgba(255,152,0,.15); color: #ff9800; }
.plan-badge.plan-seo-plus { background: rgba(156,39,176,.15); color: #ce93d8; }

/* Color classes for summary cells */
.summary-table td.green { color: #4caf50; font-weight: 600; }
.summary-table td.orange { color: #ff9800; font-weight: 600; }
.summary-table td.red { color: #ef5350; font-weight: 600; }
