@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Manrope:wght@500;600;700;800&display=swap');

/* ═══════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════ */
:root {
  --ink: #19221e;
  --ink-soft: #2d3a33;
  --muted: #6f7773;
  --muted-light: #8b938e;
  --line: #e6ebe7;
  --line-light: #f0f4f1;
  --green: #157a52;
  --green-hover: #1a9463;
  --green-bg: #eaf5ec;
  --green-border: #c8e6cc;
  --lime: #d8f65a;
  --lime-muted: #c2e24e;
  --bg: #f7f9f7;
  --bg-raised: #ffffff;
  --blue: #5281ff;
  --blue-bg: #edf2ff;
  --red: #e54d3b;
  --red-bg: #fff0ed;
  --red-text: #a42a1d;
  --yellow: #f5a623;
  --yellow-bg: #fff8e6;
  --sidebar-w: 250px;
  --header-h: 0px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 1px 3px rgba(15, 32, 17, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 32, 17, 0.08);
  --shadow-lg: 0 8px 32px rgba(15, 32, 17, 0.10);
  --transition: 0.2s ease;
}

/* ═══════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  visibility: hidden; /* auth gate hides until verified */
}
body.revealed {
  visibility: visible;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

button, a, select, input { touch-action: manipulation; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #17241e 0%, #132019 100%);
  color: #eef6ef;
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
  text-decoration: none;
  margin-bottom: 8px;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-hover) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(21, 122, 82, 0.3);
}
.sidebar-brand-text {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: white;
  letter-spacing: -0.02em;
}
.sidebar-brand-text span { color: var(--lime); }

.sidebar-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5e7367;
  padding: 24px 12px 10px;
}

.sidebar-nav {
  display: grid;
  gap: 3px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #a9b8ae;
  text-decoration: none;
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}
.sidebar-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}
.sidebar-nav a.active {
  color: #fff;
  background: #2a3a32;
  font-weight: 600;
}
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--lime);
  border-radius: 0 3px 3px 0;
}
.nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.nav-badge {
  margin-left: auto;
  background: var(--green);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid #2d3d35;
  padding: 20px 10px 4px;
  display: grid;
  gap: 6px;
}
.sidebar-footer .workspace-label {
  color: #5e7367;
  font-size: 10px;
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
}
.sidebar-footer strong {
  color: #dbe8df;
  font-size: 13px;
  font-weight: 600;
}
.sidebar-footer small {
  color: #7a8e80;
  font-size: 12px;
}
.logout-btn {
  margin-top: 10px;
  width: 100%;
  padding: 9px;
  font: 500 12px 'DM Sans', sans-serif;
  background: transparent;
  border: 1px solid #3c4a42;
  border-radius: 7px;
  color: #8fa898;
  cursor: pointer;
  transition: all var(--transition);
}
.logout-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(229, 77, 59, 0.06);
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════
   MAIN CONTENT AREA
   ═══════════════════════════════════════════════ */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 36px 48px 80px;
  max-width: calc(var(--sidebar-w) + 1400px);
}

/* ═══════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 32px;
  gap: 20px;
}
.page-header-text { flex: 1; }
.page-eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--green);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.page-title {
  font-family: 'Manrope', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 0 0 6px;
  color: var(--ink);
}
.page-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
  line-height: 1.6;
}
.page-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: start;
}

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 13px 'DM Sans', sans-serif;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: wait; transform: none; }

.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover { background: #243028; box-shadow: var(--shadow-md); }

.btn-green {
  background: var(--green);
  color: #fff;
}
.btn-green:hover { background: var(--green-hover); box-shadow: 0 4px 16px rgba(21, 122, 82, 0.2); }

.btn-outline {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-outline:hover { border-color: #c8d0ca; box-shadow: var(--shadow); }

.btn-danger {
  background: white;
  color: var(--red);
  border: 1px solid #fdd;
}
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }

.btn-lime {
  background: var(--lime);
  color: var(--ink);
}
.btn-lime:hover { background: var(--lime-muted); box-shadow: 0 4px 16px rgba(216,246,90,0.3); }

.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-icon { padding: 8px 10px; }

/* ═══════════════════════════════════════════════
   METRIC CARDS
   ═══════════════════════════════════════════════ */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 6px;
  transition: box-shadow var(--transition);
}
.metric-card:hover { box-shadow: var(--shadow); }
.metric-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.metric-value {
  font: 700 28px 'Manrope', sans-serif;
  letter-spacing: -0.06em;
  color: var(--ink);
}
.metric-sub {
  font-size: 11px;
  color: var(--muted-light);
  font-style: normal;
}

/* ═══════════════════════════════════════════════
   PANELS / CARDS
   ═══════════════════════════════════════════════ */
.panel {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 18px;
}
.panel-title {
  font: 600 17px 'Manrope', sans-serif;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.panel-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

/* ═══════════════════════════════════════════════
   CONTROLS / TOOLBAR
   ═══════════════════════════════════════════════ */
.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.controls-group {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}

select, .select {
  font: 500 13px 'DM Sans', sans-serif;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 12px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--transition);
}
select:hover { border-color: #c0cac3; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.control-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.control-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.control-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════ */
.chart-container { overflow-x: auto; }
.chart {
  height: 200px;
  display: flex;
  align-items: end;
  gap: 6px;
  padding: 20px 5px 0;
  border-bottom: 1px solid var(--line);
}
.bar-group {
  height: 100%;
  flex: 1;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  min-width: 8px;
  cursor: pointer;
}
.bar-group:hover .bar { filter: brightness(1.15); }
.bar {
  width: min(12px, 45%);
  border-radius: 5px 5px 2px 2px;
  transition: height 0.4s ease, filter var(--transition);
  min-height: 1px;
}
.bar.wa { background: var(--green); }
.bar.call { background: var(--blue); }
.chart-axis {
  display: flex;
  justify-content: space-between;
  color: #929a95;
  font-size: 10px;
  padding: 8px 5px 0;
}
.chart-legend {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  display: inline-block;
  margin-right: 4px;
}
.chart-legend .wa { background: var(--green); }
.chart-legend .call { background: var(--blue); }

/* ═══════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  text-align: left;
}
thead th {
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-light);
  max-width: 300px;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: #f9fbf9; }

/* ═══════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-yellow { background: var(--yellow-bg); color: #8a6d00; }
.badge-red { background: var(--red-bg); color: var(--red-text); }
.badge-gray { background: var(--line-light); color: var(--muted); }

/* ═══════════════════════════════════════════════
   STATUS MESSAGES
   ═══════════════════════════════════════════════ */
.status-msg {
  font-size: 13px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  line-height: 1.5;
  margin-bottom: 16px;
}
.status-msg:empty { display: none; }
.status-msg.error { background: var(--red-bg); color: var(--red-text); }
.status-msg.success { background: var(--green-bg); color: var(--green); }
.status-msg.info { background: var(--blue-bg); color: var(--blue); }

/* ═══════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group {
  display: grid;
  gap: 6px;
}
.form-group.wide { grid-column: 1 / -1; }
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}
.form-input, .form-textarea {
  font: 400 13px 'DM Sans', sans-serif;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:hover, .form-textarea:hover { border-color: #c0cac3; }
.form-input:focus, .form-textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21, 122, 82, 0.1);
}
.form-input::placeholder, .form-textarea::placeholder { color: #b0b8b3; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-help {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-input-wrap .form-input {
  width: 100%;
  padding-right: 40px;
}
.password-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  user-select: none;
  transition: color var(--transition), background-color var(--transition);
}
.password-toggle-btn:hover {
  color: var(--ink);
  background-color: var(--line-light);
}
.password-toggle-btn svg {
  display: block;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════
   WIDGET LIST ITEMS
   ═══════════════════════════════════════════════ */
.widget-list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  transition: all var(--transition);
}
.widget-list-item:hover {
  border-color: var(--green);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.widget-list-item.active {
  border-color: var(--green);
  background: #f5faf7;
}
.widget-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.widget-icon-circle.wa { background: var(--green-bg); }
.widget-icon-circle.call { background: var(--blue-bg); }
.widget-icon-circle.both { background: linear-gradient(135deg, var(--green-bg), var(--blue-bg)); }
.widget-list-info { flex: 1; min-width: 0; }
.widget-list-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.widget-list-origin {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.widget-list-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   LIVE PREVIEW
   ═══════════════════════════════════════════════ */
.live-preview {
  border: 1px dashed #cfd9d1;
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
}
.live-preview-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #78847c;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.preview-buttons {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.preview-buttons a, .preview-buttons span {
  color: #fff;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.preview-wa { background: #1da86e; }
.preview-call { background: #255ee9; }

/* ═══════════════════════════════════════════════
   CODE BLOCK
   ═══════════════════════════════════════════════ */
.code-block {
  border-radius: var(--radius);
  background: #13231c;
  color: #e4f1e9;
  overflow: hidden;
}
.code-block-header {
  padding: 12px 16px;
  border-bottom: 1px solid #2d4238;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.code-block-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #91aa9d;
  text-transform: uppercase;
}
.code-block-copy {
  background: transparent;
  border: 1px solid #597465;
  border-radius: 5px;
  color: white;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition);
}
.code-block-copy:hover { background: #1e3529; border-color: var(--lime); color: var(--lime); }
.code-block pre {
  margin: 0;
  padding: 18px;
  white-space: pre-wrap;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #c3e999;
  overflow-x: auto;
}
.code-block-footer {
  padding: 10px 16px;
  border-top: 1px solid #2d4238;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.code-block-footer span { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: #91aa9d; }
.code-block-footer a { color: var(--lime); font-size: 12px; }

/* ═══════════════════════════════════════════════
   TOP PAGES LIST
   ═══════════════════════════════════════════════ */
.page-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line-light);
  font-size: 13px;
}
.page-row:first-child { border-top: none; }
.page-row-icon { color: var(--green); font-size: 12px; font-weight: 700; }
.page-row-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
}
.page-row-clicks { font-size: 12px; font-weight: 600; color: var(--ink); }

/* ═══════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 16px; opacity: 0.6; }
.empty-state h3 {
  font: 600 17px 'Manrope', sans-serif;
  color: var(--ink);
  margin-bottom: 6px;
}
.empty-state p { font-size: 13px; line-height: 1.6; max-width: 380px; margin: 0 auto; }

/* ═══════════════════════════════════════════════
   NOTICE / TIP
   ═══════════════════════════════════════════════ */
.notice {
  font-size: 12px;
  line-height: 1.6;
  background: #f0f8d2;
  border-left: 3px solid #a9cb19;
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
}
.notice-info {
  background: var(--blue-bg);
  border-left-color: var(--blue);
  color: #3a5bbd;
}

/* ═══════════════════════════════════════════════
   STEP CARDS (install guide)
   ═══════════════════════════════════════════════ */
.step-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.step-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  transition: box-shadow var(--transition);
}
.step-card:hover { box-shadow: var(--shadow-md); }
.step-number {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font: 700 14px 'Manrope', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.step-card h3 {
  font: 600 15px 'Manrope', sans-serif;
  color: var(--ink);
  margin-bottom: 6px;
}
.step-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════
   SETTINGS ROWS
   ═══════════════════════════════════════════════ */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-light);
  gap: 16px;
}
.settings-row:last-child { border-bottom: none; }
.settings-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.settings-value {
  font-size: 13px;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════
   TWO COLUMN LAYOUT
   ═══════════════════════════════════════════════ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* ═══════════════════════════════════════════════
   GRID LAYOUTS
   ═══════════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.gap-sm { gap: 12px; }
.mb-sm { margin-bottom: 12px; }
.mb-md { margin-bottom: 20px; }
.mb-lg { margin-bottom: 32px; }
.mt-sm { margin-top: 12px; }
.mt-md { margin-top: 20px; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .metric-cards { grid-template-columns: repeat(2, 1fr); }
  .two-col, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.wide { grid-column: 1; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-toggle { display: flex; }
  .main { margin-left: 0; padding: 60px 20px 40px; }
  .page-header { flex-direction: column; }
  .page-actions { width: 100%; }
  .metric-cards { grid-template-columns: 1fr; }
  .step-cards { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .controls-bar { flex-direction: column; align-items: stretch; }
  .controls-group { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════
   TABS NAVIGATION
   ═══════════════════════════════════════════════ */
.tabs-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar { display: none; }
.tab-btn {
  background: transparent;
  border: none;
  font: 600 13.5px 'DM Sans', sans-serif;
  color: var(--muted);
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tab-btn:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.02);
}
.tab-btn.active {
  color: var(--green);
  border-bottom-color: var(--green);
  font-weight: 700;
}
.tab-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--line-light);
  color: var(--muted);
}
.tab-btn.active .tab-badge {
  background: var(--green-bg);
  color: var(--green);
}

/* ═══════════════════════════════════════════════
   BUTTON PILLS / DATE FILTER
   ═══════════════════════════════════════════════ */
.btn-group {
  display: inline-flex;
  background: var(--line-light);
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 2px;
  flex-wrap: wrap;
}
.btn-pill {
  border: none;
  background: transparent;
  font: 600 12px 'DM Sans', sans-serif;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-pill:hover {
  color: var(--ink);
}
.btn-pill.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.date-range-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════
   MODAL DIALOG
   ═══════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideUp 0.2s ease;
}
@keyframes modalSlideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  font: 700 18px 'Manrope', sans-serif;
  color: var(--ink);
  margin: 0;
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
}
.modal-close:hover { color: var(--ink); background: var(--line-light); }
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

/* ═══════════════════════════════════════════════
   COMPANY DASHBOARD GRID & CARDS
   ═══════════════════════════════════════════════ */
.company-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.company-dash-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: all var(--transition);
  position: relative;
}
.company-dash-card:hover {
  border-color: var(--green);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.company-dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.company-dash-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.company-avatar {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--green-bg) 0%, var(--green-border) 100%);
  color: var(--green);
  font: 700 16px 'Manrope', sans-serif;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.company-dash-name {
  font: 700 15px 'Manrope', sans-serif;
  color: var(--ink);
  margin-bottom: 2px;
}
.company-dash-url {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}
.company-dash-url:hover {
  color: var(--green);
  text-decoration: underline;
}
.company-dash-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}
.company-stat-item {
  display: flex;
  flex-direction: column;
}
.company-stat-val {
  font: 700 14px 'Manrope', sans-serif;
  color: var(--ink);
}
.company-stat-lbl {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.company-dash-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line-light);
}


/* ═══════════════════════════════════════════════
   PREMIUM UI LAYER (main content only — the sidebar is unchanged)
   Soft elevated cards, icon chips, clear hierarchy, 8px spacing rhythm.
   ═══════════════════════════════════════════════ */
:root {
  --page-bg: #f5f7f6;
  --card-border: #e7ece9;
  --card-shadow: 0 1px 2px rgba(16, 24, 20, 0.04), 0 2px 8px rgba(16, 24, 20, 0.04);
  --card-shadow-hover: 0 2px 4px rgba(16, 24, 20, 0.05), 0 8px 24px rgba(16, 24, 20, 0.07);
  --radius-card: 16px;
  --radius-control: 10px;
  --primary: #145c3d;
  --primary-hover: #0f4a31;
  --text-2: #4b5751;
  --purple: #7c5cff; --purple-bg: #f2eeff;
  --orange: #f08a24; --orange-bg: #fff4e8;
  --teal: #0f9f8f; --teal-bg: #e7f7f4;
  --pink: #e0457b; --pink-bg: #fdecf2;
  --slate-bg: #f1f4f2;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
body { background: var(--page-bg); }
.main { padding: 28px 40px 80px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* Page header: breadcrumb + icon tile + title */
.main .breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.main .breadcrumb a { color: var(--muted); text-decoration: none; }
.main .breadcrumb a:hover { color: var(--green); }
.main .breadcrumb .sep { display: inline-flex; color: #b3bcb7; }
.main .breadcrumb .sep svg { width: 14px; height: 14px; }
.main .breadcrumb .current { color: var(--ink); font-weight: 600; }
.page-header { align-items: center; margin-bottom: 24px; }
.page-header-text.has-tile { display: flex; align-items: center; gap: 16px; }
.page-tile { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0; background: var(--green-bg); color: var(--green); box-shadow: inset 0 0 0 1px rgba(21,122,82,.08); }
.page-tile svg { width: 28px; height: 28px; }
.page-title { font-size: 30px; letter-spacing: -0.035em; line-height: 1.15; }
.page-subtitle { font-size: 14.5px; color: var(--text-2); }
.page-eyebrow.as-crumb { display: none; }
.page-actions { align-items: center; flex-wrap: wrap; }

/* Cards */
.panel, .metric-card, .step-card, .integration-card, .account-card, .company-dash-card, .modal-card {
  border-color: var(--card-border); border-radius: var(--radius-card); box-shadow: var(--card-shadow);
}
.panel { padding: 24px; margin-bottom: 20px; }
.panel-header { align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.panel-header > div:first-child { min-width: 0; }
.panel-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.panel-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.panel-subtitle { font-size: 13.5px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }

/* Icon chips (added by shared.js): soft tinted circle with a stroke icon */
.icon-chip { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--green-bg); color: var(--green); }
.icon-chip svg { width: 22px; height: 22px; }
.icon-chip.sm { width: 36px; height: 36px; } .icon-chip.sm svg { width: 18px; height: 18px; }
.icon-chip.lg { width: 56px; height: 56px; } .icon-chip.lg svg { width: 26px; height: 26px; }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-blue { background: var(--blue-bg); color: #3d6af2; }
.tone-purple { background: var(--purple-bg); color: var(--purple); }
.tone-orange { background: var(--orange-bg); color: #d8741a; }
.tone-teal { background: var(--teal-bg); color: var(--teal); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-pink { background: var(--pink-bg); color: var(--pink); }
.tone-yellow { background: var(--yellow-bg); color: #b47b00; }
.tone-slate { background: var(--slate-bg); color: var(--text-2); }

/* Metric cards: icon chip + value + label + helper */
.metric-cards { gap: 16px; }
.metric-card { padding: 20px; gap: 4px; position: relative; transition: box-shadow .2s var(--ease); }
.metric-card:hover { box-shadow: var(--card-shadow-hover); }
.metric-card.has-icon { grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; align-content: start; }
.metric-card.has-icon > .icon-chip { grid-row: 1 / span 4; align-self: start; width: 52px; height: 52px; }
.metric-card.has-icon > .icon-chip svg { width: 24px; height: 24px; }
.metric-card.has-icon > :not(.icon-chip) { grid-column: 2; }
.metric-label { font-size: 13.5px; color: var(--text-2); font-weight: 500; }
.metric-value { font-size: 28px; letter-spacing: -0.04em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric-sub { font-size: 12px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 600; }
.delta svg { width: 14px; height: 14px; }
.delta.up { color: var(--green); } .delta.down { color: var(--red); } .delta.flat { color: var(--muted); }
.metric-spark { position: absolute; right: 16px; bottom: 18px; width: 80px; height: 32px; pointer-events: none; }

/* Buttons */
.btn { min-height: 42px; padding: 10px 18px; border-radius: var(--radius-control); font-size: 13.5px; gap: 8px; justify-content: center;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), color .15s var(--ease); }
.btn:hover { transform: none; }
.btn:active { transform: scale(.98); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-sm { min-height: 36px; padding: 7px 14px; font-size: 13px; }
.btn-xs { min-height: 30px; }
.btn-primary, .btn-green { background: var(--primary); color: #fff; }
.btn-primary:hover, .btn-green:hover { background: var(--primary-hover); box-shadow: 0 4px 14px rgba(20, 92, 61, .22); }
.btn-outline { background: #fff; border: 1px solid #dfe5e1; color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,20,.04); }
.btn-outline:hover { background: #fafcfb; border-color: #c9d2cc; }
.btn-danger { background: #fff; border: 1px solid #f3c3bd; color: #c93b2b; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.btn-soft { background: var(--green-bg); color: var(--green); border: 1px solid transparent; }
.btn-soft:hover { background: #dcefe1; }

/* Inputs */
.form-input, .form-textarea, .main select { min-height: 44px; border-radius: var(--radius-control); border-color: #dfe5e1; font-size: 14px; }
.form-input:focus, .form-textarea:focus, .main select:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(21,122,82,.12); outline: none; }
.form-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.main input[type="checkbox"], .main input[type="radio"] { accent-color: var(--green); width: 16px; height: 16px; }
.main button:focus-visible, .main a:focus-visible { outline: 3px solid rgba(21,122,82,.35); outline-offset: 2px; }

/* Tabs: card-style strip with icons */
.tabs-nav { background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius-card); padding: 0 8px; box-shadow: var(--card-shadow); gap: 2px; margin-bottom: 20px; }
.tab-btn { padding: 16px 16px 13px; font-size: 14px; border-bottom-width: 3px; border-radius: 0; color: var(--text-2); font-weight: 500; }
.tab-btn:hover { background: transparent; color: var(--ink); }
.tab-btn.active { color: var(--green); font-weight: 600; }
.tab-btn svg { width: 18px; height: 18px; }
.tab-badge { min-width: 22px; text-align: center; background: var(--slate-bg); }

/* Badges */
.badge { font-size: 12px; padding: 4px 10px; gap: 5px; }
.badge svg { width: 13px; height: 13px; }

/* Tables */
table { font-size: 13.5px; }
thead th { font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 10px 14px; }
tbody td { color: var(--ink-soft); padding: 12px 14px; }
tbody tr:hover { background: #f8faf9; }

/* Status and notices */
.status-msg { border-radius: 12px; padding: 12px 16px; font-weight: 500; }
.status-msg.success { background: #ecf7ef; border: 1px solid #cfe9d6; }
.status-msg.error { background: #fdf0ee; border: 1px solid #f6cdc6; }
.notice { border: 1px solid #d7e3fb; border-left-width: 1px; background: #f2f6ff; color: #2f55c7; border-radius: 12px; padding: 14px 16px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.callout-success { display: flex; gap: 14px; align-items: center; background: #eef8f1; border: 1px solid #cde8d5; border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.callout-success strong { color: var(--green); display: block; font-size: 14px; }
.callout-success span { font-size: 13px; color: var(--text-2); }
.callout-success .icon-chip { background: var(--green); color: #fff; width: 36px; height: 36px; }
.callout-success.info { background: #f2f6ff; border-color: #d7e3fb; }
.callout-success.info strong { color: #2f55c7; }
.callout-success.info .icon-chip { background: #3d6af2; }

/* Settings-style detail rows */
.settings-row { padding: 14px 0; }
.detail-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-light); font-size: 14px; }
.detail-row:last-child { border-bottom: 0; }
.detail-row > svg { width: 18px; height: 18px; color: var(--text-2); }
.detail-row .label { color: var(--ink); font-weight: 500; }
.detail-row .value { color: var(--text-2); text-align: right; word-break: break-word; }
.detail-row .value a { color: var(--green); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.detail-row .value a svg { width: 14px; height: 14px; }
.kv-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 22px; font-size: 13.5px; margin: 0; }
.kv-list dt { color: var(--muted); } .kv-list dd { color: var(--ink); margin: 0; word-break: break-word; }

/* Empty states */
.empty-state { padding: 44px 20px; }
.empty-art { width: 120px; height: 120px; border-radius: 50%; background: #eef7f1; display: grid; place-items: center; margin: 0 auto 18px; color: var(--green); position: relative; }
.empty-art svg { width: 44px; height: 44px; }
.empty-art::after { content: ''; position: absolute; inset: 12px; border-radius: 50%; border: 1px dashed #c7e1d0; }
.empty-state h3 { font-size: 18px; margin-bottom: 6px; }
.empty-state p { font-size: 14px; color: var(--text-2); }
.empty-state .btn { margin-top: 16px; }

/* Numbered steps */
.step-num { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font: 700 18px 'Manrope', sans-serif; background: var(--green-bg); color: var(--green); flex-shrink: 0; }
.step-num.blue { background: var(--blue-bg); color: #3d6af2; }

/* Misc */
.code-block { border-radius: 12px; }
.page-row { padding: 12px 4px; }
.company-avatar { border-radius: 12px; }

/* Rows with icons (social, lists) */
.social-icon { width: 22px; height: 22px; display: inline-grid; place-items: center; flex-shrink: 0; }
.social-icon svg { width: 20px; height: 20px; }
.list-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 6px; border-top: 1px solid var(--line-light); font-size: 14px; color: var(--ink); text-decoration: none; min-height: 48px; border-radius: 8px; }
.list-row:first-of-type { border-top: 0; }
.list-row:hover { background: #f8faf9; }
.list-row .num { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 13px; }
.list-row .chev { color: #aab4ae; display: inline-flex; } .list-row .chev svg { width: 16px; height: 16px; }
.list-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 6px 8px; border-bottom: 1px solid var(--line-light); }

/* SVG charts */
.svg-chart { width: 100%; display: block; overflow: visible; }
.svg-chart .grid { stroke: #e9eeeb; stroke-dasharray: 3 4; }
.svg-chart .axis { fill: #8b958f; font-size: 11px; }
.legend-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.legend-dot i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.chart-legend { gap: 16px; }

@media (max-width: 1024px) { .main { padding: 24px 24px 60px; } }
@media (max-width: 768px) {
  .main { padding: 64px 16px 40px; }
  .page-header { align-items: stretch; }
  .page-actions > * { flex: 1 1 auto; }
  .page-title { font-size: 24px; }
  .page-tile { width: 48px; height: 48px; }
  .tabs-nav { padding: 0 4px; }
  .detail-row { grid-template-columns: 22px minmax(0, 1fr); } .detail-row .value { grid-column: 2; text-align: left; }
  .metric-spark { display: none; }
}

/* Widget list icons */
.widget-icon-circle { border-radius: 50%; color: var(--green); }
.widget-icon-circle.call { color: #3d6af2; }
.widget-icon-circle svg { width: 20px; height: 20px; }
.widget-list-item { border-radius: 12px; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* Grid columns may shrink; wide tables scroll inside their card instead of widening the page */
.two-col, .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two-col > *, .grid-2 > *, .grid-3 > * { min-width: 0; }
.panel { min-width: 0; }
@media (max-width: 1024px) { .two-col, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* Icon bullet lines */
.icon-line { display: flex; gap: 10px; align-items: flex-start; }
.icon-line svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--green); }
.icon-line.warn svg { color: #d8741a; }
.type-card-icon svg { width: 22px; height: 22px; }

/* ═══════════════════════════════════════════════
   MARKETING TOOL PAGES (Google Analytics, Search Console, SEO Keywords, Social Media)
   Company selector + status banner, numbered steps, connection box, report layout.
   ═══════════════════════════════════════════════ */
.ga-head-actions { align-items:stretch; }
.help-card { display:flex; align-items:center; gap:12px; background:#fff; border:1px solid var(--card-border); border-radius:14px; padding:10px 14px; text-decoration:none; color:var(--ink); box-shadow:var(--card-shadow); min-height:56px; }
.help-card:hover { border-color:#c9d2cc; }
.help-card strong { display:block; font-size:13.5px; }
.help-card span span { font-size:12.5px; color:#3d6af2; }
.help-card > svg { width:14px; height:14px; color:#3d6af2; }
.select-with-icon { display:inline-flex; align-items:center; gap:8px; background:#fff; border:1px solid #dfe5e1; border-radius:10px; padding:0 4px 0 12px; min-height:44px; color:var(--text-2); box-shadow:0 1px 2px rgba(16,24,20,.04); }
.select-with-icon:focus-within { border-color:var(--green); box-shadow:0 0 0 4px rgba(21,122,82,.12); }
.select-with-icon svg { width:18px; height:18px; color:#3d6af2; flex-shrink:0; }
.select-with-icon select { border:0 !important; min-height:42px; background:transparent; padding:0 8px; box-shadow:none !important; flex:1; font-weight:500; }
.select-with-icon.wide { display:flex; }
.select-panel { display:grid; grid-template-columns:minmax(260px,1fr) minmax(0,1.35fr); gap:24px; align-items:center; }
.select-company { gap:8px; }
.tool-banner { display:flex; align-items:center; gap:18px; border:1px solid var(--card-border); border-radius:14px; padding:16px 20px; background:#fafcfb; min-height:84px; flex-wrap:wrap; }
.tool-banner.ready { border-color:#9fd4b4; background:#f6fbf8; }
.ga-mark { display:inline-flex; align-items:flex-end; gap:3px; height:34px; flex-shrink:0; }
.ga-mark i { width:8px; border-radius:4px; display:block; }
.ga-mark i:nth-child(1) { height:12px; background:#e37400; border-radius:50%; width:9px; }
.ga-mark i:nth-child(2) { height:22px; background:#f9ab00; }
.ga-mark i:nth-child(3) { height:34px; background:#e37400; }
.tool-banner-text { flex:1; min-width:220px; }
.tool-banner-text strong { display:block; font:700 16px 'Manrope',sans-serif; color:var(--ink); margin-bottom:3px; }
.tool-banner-text span { font-size:13.5px; color:var(--text-2); }
.tool-banner-action { display:grid; justify-items:end; gap:6px; }
.tool-banner-action small { font-size:12px; color:var(--muted); }
.empty-panel .empty-state { padding:36px 20px 28px; }
.empty-illustration { position:relative; width:230px; height:150px; margin:0 auto 18px; border-radius:50%; background:#eef7f1; display:grid; place-items:center; }
.mini-window { width:150px; background:#fff; border-radius:10px; box-shadow:0 6px 18px rgba(16,24,20,.1); padding:8px 10px 10px; display:grid; grid-template-columns:auto 1fr; gap:6px 10px; align-items:end; }
.mini-window .dots { grid-column:1/-1; display:flex; gap:4px; }
.mini-window .dots i { width:6px; height:6px; border-radius:50%; background:#ef6b5b; display:block; } .mini-window .dots i:nth-child(2) { background:#f5bf4f; } .mini-window .dots i:nth-child(3) { background:#5cc36e; }
.mini-bars { display:flex; align-items:flex-end; gap:3px; height:30px; } .mini-bars i { width:7px; background:#f9ab00; border-radius:2px; display:block; } .mini-bars i:nth-child(1){height:10px;background:#e37400} .mini-bars i:nth-child(2){height:18px} .mini-bars i:nth-child(3){height:28px;background:#e37400}
.mini-window svg { width:100%; height:28px; }
.badge-chip { position:absolute; right:26px; bottom:14px; background:#fff; box-shadow:0 4px 12px rgba(16,24,20,.12); }
.text-link { color:var(--green); font-weight:600; text-decoration:none; font-size:13.5px; } .text-link:hover { text-decoration:underline; }
.integration-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; margin-bottom:20px; }
.integration-card { border:1px solid var(--card-border); background:#fff; border-radius:var(--radius-card); padding:24px; box-shadow:var(--card-shadow); display:grid; gap:16px; align-content:start; }
.integration-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.step-head { display:flex; gap:14px; align-items:flex-start; }
.step-head h2 { font:700 17px 'Manrope',sans-serif; color:var(--ink); margin-top:2px; }
.step-sub { font-size:13.5px; color:var(--text-2); margin-top:4px; }
.readonly-row { display:flex; gap:10px; margin-top:8px; }
.readonly-field { flex:1; display:flex; align-items:center; min-height:44px; border:1px solid #dfe5e1; border-radius:10px; padding:0 14px; font:600 14px ui-monospace, SFMono-Regular, Menlo, monospace; color:var(--ink); background:#fff; word-break:break-all; }
.integration-actions { display:flex; gap:10px; flex-wrap:wrap; }
.integration-actions:empty { display:none; }
details.install summary { cursor:pointer; font-size:13.5px; font-weight:600; color:var(--green); display:inline-flex; align-items:center; gap:8px; list-style:none; }
details.install summary::-webkit-details-marker { display:none; }
details.install summary svg { width:16px; height:16px; }
details.install .code-block { margin-top:12px; }
.connection-box { display:flex; gap:16px; align-items:flex-start; border:1px solid var(--card-border); border-radius:14px; padding:16px 18px; }
.g-mark { width:44px; height:44px; border-radius:50%; border:1px solid var(--card-border); display:grid; place-items:center; flex-shrink:0; background:#fff; }
.g-mark svg { width:22px; height:22px; }
.conn-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
.conn-actions > [hidden] { display:none; }
.conn-actions #connect-btn { grid-column:1/-1; }
.note-warn { font-size:13px; color:#7a5a00; background:var(--yellow-bg); border:1px solid #f7df9a; padding:12px 14px; border-radius:12px; margin-bottom:16px; }
.report-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; flex-wrap:wrap; margin-bottom:20px; }
.report-title { font:700 22px 'Manrope',sans-serif; letter-spacing:-.02em; color:var(--ink); }
.report-head .panel-subtitle { display:flex; align-items:center; gap:10px; flex-wrap:wrap; font-size:14px; }
.meta-divider { width:1px; height:14px; background:var(--line); display:inline-block; }
.filters { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.filters .form-input { width:auto; }
.kpi-grid { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:12px; margin-bottom:20px; }
.kpi-grid .metric-card { padding:16px 14px; box-shadow:none; column-gap:10px; }
.kpi-grid .metric-card.has-icon > .icon-chip { width:40px; height:40px; } .kpi-grid .metric-card.has-icon > .icon-chip svg { width:20px; height:20px; }
.kpi-grid .metric-value { font-size:24px; }
.kpi-grid .metric-label { font-size:12.5px; }
.report-panel { padding:24px; }
.report-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; margin-top:20px; }
.report-grid.first-row { grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); margin-top:0; }
.panel.inner { margin:0; box-shadow:none; min-width:0; }
.share { display:flex; align-items:center; gap:8px; min-width:120px; }
.share-bar { flex:1; height:6px; background:var(--bg); border-radius:99px; overflow:hidden; }
.share-bar i { display:block; height:100%; background:var(--green); border-radius:99px; }
.share span { font-size:12px; color:var(--muted); width:42px; text-align:right; font-variant-numeric:tabular-nums; }
td.num, th.num { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
.empty-row { color:var(--muted); font-size:13px; padding:16px 0; }
@media(max-width:1500px){ .kpi-grid{grid-template-columns:repeat(4,minmax(0,1fr))} }
@media(max-width:1100px){ .select-panel,.integration-grid,.report-grid,.report-grid.first-row{grid-template-columns:1fr} }
@media(max-width:700px){ .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))} .conn-actions{grid-template-columns:1fr} .tool-banner-action{justify-items:start} }

.kpi-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpi-grid.four, .kpi-grid.six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.optional-tag { font: 600 11px 'DM Sans', sans-serif; color: var(--muted); background: var(--slate-bg); border-radius: 99px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.tool-banner .icon-chip.lg { flex-shrink: 0; }

/* Marketing tool pages: clickable KPI cards, tabbed sections and banner states */
button.metric-card { font: inherit; text-align: left; width: 100%; cursor: pointer; color: inherit; }
button.metric-card:hover { border-color: #9fd4b4; }
button.metric-card:focus-visible { outline: 3px solid rgba(21,122,82,.35); outline-offset: 2px; }
.report-panel + .page-tabs { margin-top: 4px; }
.section-stack { display: grid; gap: 20px; }
.section-stack > .panel { margin: 0; min-width: 0; }
.tool-banner.warn { border-color: #f3d58a; background: #fffbf0; }
.tool-banner.error { border-color: #f1b8b8; background: #fff6f6; }
.tool-banner-action .btn { white-space: nowrap; }
@media (min-width: 1101px) and (max-width: 1500px) { .kpi-grid.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ═══════════════════════════════════════════════
   SIDEBAR v2 — Dashboard · Companies (grouped) · Installation · Settings · Client Portal
   Direction: ConnectJerry+ light app with a deep-green navigation rail. DM Sans body, Manrope display.
   ═══════════════════════════════════════════════ */
:root {
  --sidebar-w: 268px;
  --sb-bg: #12201a;
  --sb-bg-2: #0f1b16;
  --sb-text: #b4c3b9;
  --sb-text-strong: #ffffff;
  --sb-muted: #6d8377;
  --sb-hover: rgba(255, 255, 255, 0.06);
  --sb-active: rgba(216, 246, 90, 0.10);
  --sb-line: rgba(255, 255, 255, 0.08);
  --sb-field: rgba(255, 255, 255, 0.05);
  --sb-radius: 10px;
}
.sidebar { background: linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg-2) 100%); padding: 22px 14px 16px; gap: 0; scrollbar-width: thin; scrollbar-color: var(--sb-line) transparent; }
.sidebar-brand { padding: 0 8px; margin-bottom: 20px; }
.sidebar-logo svg { width: 19px; height: 19px; color: #fff; }
.sb-company { padding: 0 4px 16px; margin-bottom: 10px; border-bottom: 1px solid var(--sb-line); }
.sb-label { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sb-muted); margin: 0 0 7px 4px; }
.sb-select { position: relative; display: flex; align-items: center; gap: 8px; background: var(--sb-field); border: 1px solid var(--sb-line); border-radius: var(--sb-radius); padding: 0 10px; min-height: 44px; color: var(--sb-text); }
.sb-select:focus-within { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(216, 246, 90, .15); }
.sb-select > svg { width: 16px; height: 16px; flex-shrink: 0; }
.sb-select select { appearance: none; -webkit-appearance: none; flex: 1; min-width: 0; background: transparent; border: 0; color: var(--sb-text-strong); font: 600 13.5px 'DM Sans', sans-serif; padding: 11px 22px 11px 0; cursor: pointer; outline: none; text-overflow: ellipsis; }
.sb-select select option { color: var(--ink); background: #fff; }
.sb-select .sb-select-chevron { position: absolute; right: 10px; width: 14px; height: 14px; pointer-events: none; }
.sb-nav { display: grid; gap: 2px; }
.sb-link, .sb-toggle { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--sb-radius); color: var(--sb-text); font: 500 14px 'DM Sans', sans-serif; text-decoration: none; background: transparent; border: 0; cursor: pointer; text-align: left; position: relative; transition: background var(--transition), color var(--transition); }
.sb-link:hover, .sb-toggle:hover { background: var(--sb-hover); color: var(--sb-text-strong); text-decoration: none; }
.sb-link:focus-visible, .sb-toggle:focus-visible, .logout-btn:focus-visible { outline: 2px solid var(--lime); outline-offset: 1px; }
.sb-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.sb-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-link.active { background: var(--sb-active); color: var(--sb-text-strong); font-weight: 600; }
.sb-link.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lime); }
.sb-link.active .sb-icon { color: var(--lime); opacity: 1; }
.sb-toggle.depth-0 { color: var(--sb-text-strong); font-weight: 600; }
.sb-group.has-active > .sb-toggle.depth-0 .sb-icon { color: var(--lime); }
.sb-chevron { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; transition: transform .2s ease; }
.sb-toggle[aria-expanded="false"] .sb-chevron { transform: rotate(-90deg); }
.sb-children { display: grid; gap: 1px; margin: 2px 0 6px 20px; padding-left: 10px; border-left: 1px solid var(--sb-line); }
.sb-link.depth-1, .sb-toggle.depth-1 { min-height: 38px; font-size: 13.5px; padding: 8px 10px; }
.sb-toggle.depth-1 { color: var(--sb-muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; margin-top: 6px; }
.sb-toggle.depth-1 .sb-icon { width: 15px; height: 15px; }
.sb-group.depth-1.has-active > .sb-toggle { color: var(--sb-text); }
.sb-children .sb-children { margin-left: 6px; }
.sb-link.depth-2 { min-height: 36px; font-size: 13.5px; padding: 7px 10px; }
.sb-link.depth-2 .sb-icon, .sb-link.depth-1 .sb-icon { width: 16px; height: 16px; }
.sb-children .sb-link.active::before { left: -11px; }
.sb-link .nav-badge { margin-left: auto; }
.sb-footer { margin-top: auto; border-top: 1px solid var(--sb-line); padding: 16px 4px 0; gap: 10px; }
.sb-user { display: flex; align-items: center; gap: 10px; }
.sb-user strong { display: block; color: var(--sb-text-strong); font-size: 13.5px; }
.sb-user small { display: block; color: var(--sb-muted); font-size: 12px; }
.sb-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--lime); color: var(--sb-bg); font: 800 14px 'Manrope', sans-serif; flex-shrink: 0; }
.sb-footer .logout-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; margin-top: 2px; border-color: var(--sb-line); color: var(--sb-text); font-size: 13px; }
.sb-footer .logout-btn svg { width: 16px; height: 16px; }
.sidebar-toggle svg { width: 20px; height: 20px; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .sb-chevron, .sb-link, .sb-toggle, .sidebar { transition: none; } }
/* Page header: actions drop below the title when space runs out instead of squeezing it. */
.page-header { flex-wrap: wrap; row-gap: 16px; }
.page-header-text { flex: 1 1 auto; min-width: min(420px, 100%); }
@media (max-width: 1024px) { .sidebar { padding-top: 68px; } .sidebar-toggle { z-index: 210; } }
.sb-footer .sb-switch { text-decoration: none; }
.sb-footer .sb-switch:hover { border-color: var(--lime); color: var(--sb-text-strong); background: var(--sb-hover); text-decoration: none; }
.sb-footer .sb-switch .sb-ext { width: 13px; height: 13px; opacity: .7; }
.sb-footer .sb-switch + .logout-btn { margin-top: 0; }

/* Sidebar company switcher (custom listbox) */
:root { --sb-pop: #1b2b24; --sb-pop-line: rgba(255, 255, 255, 0.1); --sb-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); }
.sb-picker { position: relative; }
.sb-picker-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 7px 10px; background: var(--sb-field); border: 1px solid var(--sb-line); border-radius: var(--sb-radius); color: var(--sb-text); cursor: pointer; text-align: left; font: inherit; transition: border-color var(--transition), background var(--transition); }
.sb-picker-btn:hover { background: var(--sb-hover); border-color: var(--sb-pop-line); }
.sb-picker-btn:focus-visible { outline: 2px solid var(--lime); outline-offset: 1px; }
.sb-picker-btn[aria-expanded="true"] { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(216, 246, 90, .12); }
.sb-picker-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: rgba(255, 255, 255, 0.08); color: var(--sb-text-strong); font: 800 12px 'Manrope', sans-serif; letter-spacing: .02em; }
.sb-picker-mark svg { width: 16px; height: 16px; }
.sb-picker-mark.is-company { background: var(--lime); color: var(--sb-bg); }
.sb-picker-text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.sb-picker-text strong { color: var(--sb-text-strong); font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-picker-text small { color: var(--sb-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-picker-chevron { width: 15px; height: 15px; flex-shrink: 0; opacity: .75; transition: transform .2s ease; }
.sb-picker-btn[aria-expanded="true"] .sb-picker-chevron { transform: rotate(180deg); }
.sb-picker-pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--sb-pop); border: 1px solid var(--sb-pop-line); border-radius: 12px; box-shadow: var(--sb-shadow); padding: 6px; animation: sbPop .14s ease-out; }
@keyframes sbPop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sb-picker-search { display: flex; align-items: center; gap: 8px; margin: 2px 2px 6px; padding: 0 10px; min-height: 38px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); color: var(--sb-muted); }
.sb-picker-search svg { width: 15px; height: 15px; flex-shrink: 0; }
.sb-picker-search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--sb-text-strong); font: 500 13px 'DM Sans', sans-serif; }
.sb-picker-search input::placeholder { color: var(--sb-muted); }
.sb-picker-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--sb-line) transparent; }
.sb-option { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 8px; border-radius: 8px; cursor: pointer; color: var(--sb-text); outline: none; }
.sb-option:hover, .sb-option:focus { background: var(--sb-hover); }
.sb-option:focus-visible { box-shadow: inset 0 0 0 2px var(--lime); }
.sb-option[aria-selected="true"] { background: var(--sb-active); }
.sb-option .sb-picker-mark { width: 30px; height: 30px; font-size: 11.5px; }
.sb-option-check { width: 16px; height: 16px; color: var(--lime); flex-shrink: 0; }
.sb-option-empty { padding: 12px 10px; font-size: 13px; color: var(--sb-muted); }
.sb-picker-manage { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 10px 10px 6px; border-top: 1px solid var(--sb-pop-line); color: var(--sb-muted); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.sb-picker-manage:hover { color: var(--sb-text-strong); text-decoration: none; }
.sb-picker-manage svg { width: 14px; height: 14px; }
@media (prefers-reduced-motion: reduce) { .sb-picker-pop { animation: none; } .sb-picker-chevron { transition: none; } }

/* Sidebar group whose name is a page link (Companies) with a separate open/close control */
.sb-group-head { display: flex; align-items: center; gap: 2px; }
.sb-group-head .sb-group-link { flex: 1; min-width: 0; font-weight: 600; color: var(--sb-text-strong); }
.sb-group.has-active > .sb-group-head .sb-group-link:not(.active) .sb-icon { color: var(--lime); }
.sb-toggle.sb-toggle-icon { width: 36px; min-width: 36px; min-height: 36px; padding: 0; justify-content: center; flex: 0 0 auto; }
.sb-toggle.sb-toggle-icon .sb-chevron { margin: 0; }

/* ═══════════════════════════════════════════════
   INTERACTIVE SIDEBAR RAIL
   The existing green palette is intentionally retained.  On larger screens the
   rail takes only icon space, then opens as a navigable overlay on hover/focus.
   ═══════════════════════════════════════════════ */
@media (min-width: 1025px) {
  :root {
    --sidebar-w: 84px;
    --sb-expanded-w: 276px;
    --sb-motion: 300ms cubic-bezier(.16, 1, .3, 1);
  }

  .sidebar {
    width: var(--sidebar-w);
    overflow: visible;
    isolation: isolate;
    transition: width var(--sb-motion), box-shadow var(--sb-motion);
  }
  .sidebar::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    opacity: .8;
    background:
      radial-gradient(circle at 50% 24%, rgba(216, 246, 90, .12), transparent 20%),
      radial-gradient(circle at 50% 76%, rgba(216, 246, 90, .06), transparent 22%);
    transition: opacity var(--sb-motion);
  }
  .sidebar:hover,
  .sidebar:focus-within {
    width: var(--sb-expanded-w);
    box-shadow: 14px 0 34px rgba(0, 0, 0, .24);
  }
  .sidebar:hover::before,
  .sidebar:focus-within::before { opacity: 1; }

  .sidebar-brand {
    justify-content: center;
    padding: 0;
    min-height: 42px;
    margin-bottom: 20px;
    transition: padding var(--sb-motion), justify-content var(--sb-motion);
  }
  .sidebar-brand-text,
  .sb-label,
  .sb-text,
  .sb-picker-text,
  .sb-picker-chevron,
  .sb-footer .workspace-label,
  .sb-user > span:last-child,
  .sb-footer .logout-btn > span {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateX(-8px);
    white-space: nowrap;
    transition: max-width var(--sb-motion), opacity 160ms ease, transform var(--sb-motion);
  }
  .sidebar:hover .sidebar-brand,
  .sidebar:focus-within .sidebar-brand { justify-content: flex-start; padding: 0 8px; }
  .sidebar:hover .sidebar-brand-text,
  .sidebar:focus-within .sidebar-brand-text { max-width: 175px; opacity: 1; transform: none; }

  .sb-company { padding: 0 4px 16px; }
  .sb-label { display: block; margin-left: 4px; }
  .sb-picker-btn {
    width: 48px;
    min-height: 48px;
    padding: 7px;
    gap: 0;
    justify-content: center;
    margin: 0 auto;
    transition: width var(--sb-motion), padding var(--sb-motion), border-color var(--transition), background var(--transition);
  }
  .sb-picker-pop { min-width: 260px; }
  .sb-picker-chevron { width: 0; }
  .sidebar:hover .sb-label,
  .sidebar:focus-within .sb-label,
  .sidebar:hover .sb-text,
  .sidebar:focus-within .sb-text,
  .sidebar:hover .sb-picker-text,
  .sidebar:focus-within .sb-picker-text,
  .sidebar:hover .sb-picker-chevron,
  .sidebar:focus-within .sb-picker-chevron,
  .sidebar:hover .sb-footer .workspace-label,
  .sidebar:focus-within .sb-footer .workspace-label,
  .sidebar:hover .sb-user > span:last-child,
  .sidebar:focus-within .sb-user > span:last-child,
  .sidebar:hover .sb-footer .logout-btn > span,
  .sidebar:focus-within .sb-footer .logout-btn > span {
    max-width: 184px;
    opacity: 1;
    transform: none;
  }
  .sidebar:hover .sb-picker-btn,
  .sidebar:focus-within .sb-picker-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 7px 10px;
    gap: 10px;
  }
  .sidebar:hover .sb-picker-chevron,
  .sidebar:focus-within .sb-picker-chevron { width: 15px; }

  .sb-nav { gap: 6px; }
  .sb-link,
  .sb-toggle {
    justify-content: center;
    gap: 0;
    border-radius: 14px;
    transition: background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease, padding var(--sb-motion), gap var(--sb-motion);
  }
  .sb-link:hover,
  .sb-toggle:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 7px 18px rgba(0, 0, 0, .15);
  }
  .sb-link.active {
    box-shadow: inset 0 0 0 1px rgba(216, 246, 90, .14), 0 8px 18px rgba(0, 0, 0, .16);
  }
  .sb-link.active::before { left: 4px; top: 10px; bottom: 10px; }
  .sb-group-head .sb-group-link { justify-content: center; }
  .sb-toggle.sb-toggle-icon { display: none; }
  .sidebar:not(:hover):not(:focus-within) .sb-children { display: none !important; }

  .sidebar:hover .sb-link,
  .sidebar:hover .sb-toggle,
  .sidebar:focus-within .sb-link,
  .sidebar:focus-within .sb-toggle {
    justify-content: flex-start;
    gap: 11px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .sidebar:hover .sb-group-head .sb-group-link,
  .sidebar:focus-within .sb-group-head .sb-group-link { justify-content: flex-start; }
  .sidebar:hover .sb-toggle.sb-toggle-icon,
  .sidebar:focus-within .sb-toggle.sb-toggle-icon { display: flex; }
  .sidebar:hover .sb-link.active::before,
  .sidebar:focus-within .sb-link.active::before { left: -14px; }

  .sb-children {
    overflow: hidden;
    transform-origin: top center;
    animation: sbMenuReveal 260ms cubic-bezier(.16, 1, .3, 1) both;
  }
  .sb-children > * { animation: sbMenuItem 280ms cubic-bezier(.16, 1, .3, 1) both; }
  .sb-children > *:nth-child(2) { animation-delay: 32ms; }
  .sb-children > *:nth-child(3) { animation-delay: 64ms; }
  .sb-children > *:nth-child(4) { animation-delay: 96ms; }
  .sb-children > *:nth-child(5) { animation-delay: 128ms; }
  .sb-children > *:nth-child(n + 6) { animation-delay: 160ms; }

  .sb-footer { padding-left: 4px; padding-right: 4px; }
  .sb-user { justify-content: center; }
  .sb-footer .logout-btn { padding-left: 0; padding-right: 0; }
  .sidebar:hover .sb-user,
  .sidebar:focus-within .sb-user { justify-content: flex-start; }
  .sidebar:hover .sb-footer .logout-btn,
  .sidebar:focus-within .sb-footer .logout-btn { padding-left: 12px; padding-right: 12px; }
}
@keyframes sbMenuReveal {
  from { opacity: 0; transform: translateY(-8px) scaleY(.96); }
  to { opacity: 1; transform: none; }
}
@keyframes sbMenuItem {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar *, .sidebar::before { animation: none !important; transition: none !important; }
  .sb-link:hover, .sb-toggle:hover { transform: none; }
}

/* Fixed icon rail: individual expandable items preview their child links beside
   the rail. The existing green navigation colors remain unchanged. */
@media (min-width: 1025px) {
  :root { --sidebar-w: 88px; }
  .sidebar, .sidebar:hover, .sidebar:focus-within {
    width: var(--sidebar-w); padding: 0; overflow: visible; background: transparent; box-shadow: none;
  }
  .sidebar::before, .sidebar-brand, .sb-footer { display: none; }
  .sb-company {
    position: absolute;
    top: 20px;
    left: 50%;
    z-index: 2;
    padding: 0;
    margin: 0;
    border: 0;
    transform: translateX(-50%);
  }
  .sb-company .sb-label { display: none; }
  .sb-picker-btn, .sidebar:hover .sb-picker-btn, .sidebar:focus-within .sb-picker-btn {
    width: 56px; min-height: 56px; padding: 8px; gap: 0; justify-content: center; margin: 0;
    border-radius: 50%; background: linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg-2) 100%);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
  }
  .sb-picker-mark { width: 32px; height: 32px; }
  .sb-picker-text, .sb-picker-chevron, .sidebar:hover .sb-picker-text, .sidebar:focus-within .sb-picker-text,
  .sidebar:hover .sb-picker-chevron, .sidebar:focus-within .sb-picker-chevron { display: none; }
  .sb-picker-pop { top: 0; right: auto; left: calc(100% + 12px); min-width: 260px; }
  /* The rail hides the current-company label, never the labels in its popover. */
  .sb-picker-pop .sb-picker-text {
    display: grid !important;
    flex: 1 1 auto;
    max-width: none;
    opacity: 1;
    overflow: visible;
    transform: none;
  }
  .sb-picker-pop .sb-picker-text strong,
  .sb-picker-pop .sb-picker-text small { display: block; }

  .sb-nav {
    position: absolute; top: 50%; left: 50%; width: 54px; padding: 10px 5px; gap: 4px; transform: translate(-50%, -50%);
    border: 1px solid var(--sb-line); border-radius: 30px;
    background: linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg-2) 100%); box-shadow: 0 16px 32px rgba(0, 0, 0, .23);
  }
  .sb-nav > .sb-link, .sb-group-head, .sb-group-head .sb-group-link,
  .sidebar:hover .sb-link, .sidebar:focus-within .sb-link, .sidebar:hover .sb-toggle, .sidebar:focus-within .sb-toggle {
    width: 42px; min-height: 42px; padding: 0; gap: 0; justify-content: center;
  }
  .sb-group-head { display: flex; }
  .sb-group-head .sb-group-link { flex: 0 0 42px; }
  .sb-toggle.sb-toggle-icon, .sidebar:hover .sb-toggle.sb-toggle-icon, .sidebar:focus-within .sb-toggle.sb-toggle-icon { display: none; }
  .sb-nav .sb-icon { width: 17px; height: 17px; }
  .sb-nav .sb-text, .sidebar:hover .sb-text, .sidebar:focus-within .sb-text {
    display: block; flex: 0 0 0; max-width: 0; opacity: 0; overflow: hidden; transform: none;
  }
  .sb-nav .sb-link { position: relative; border-radius: 14px; }
  .sb-nav .sb-link:hover { transform: translateY(-1px) scale(1.04); }
  /* The Companies trigger is an anchor point for its flyout, so it never moves. */
  .sb-group-head .sb-group-link,
  .sb-group-head .sb-group-link:hover,
  .sb-group-head .sb-group-link:focus-visible {
    transform: none;
  }
  .sidebar:hover .sb-group-head .sb-group-link,
  .sidebar:focus-within .sb-group-head .sb-group-link,
  .sidebar:hover .sb-group-head .sb-group-link:hover,
  .sidebar:focus-within .sb-group-head .sb-group-link:focus-visible {
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    padding: 0;
    gap: 0;
    justify-content: center;
    transform: none;
  }
  .sb-nav .sb-link.active::before, .sidebar:hover .sb-link.active::before, .sidebar:focus-within .sb-link.active::before { left: 3px; top: 10px; bottom: 10px; }

  /* A short fade label helps identify links that do not have children. */
  .sb-nav > .sb-link::after, .sb-group-head .sb-group-link::after {
    content: attr(data-tooltip); position: absolute; left: calc(100% + 12px); top: 50%; z-index: 4;
    padding: 8px 11px; border: 1px solid var(--sb-pop-line); border-radius: 9px; background: var(--sb-pop); box-shadow: var(--sb-shadow);
    color: var(--sb-text-strong); font-size: 12.5px; font-weight: 600; line-height: 1; white-space: nowrap; pointer-events: none;
    opacity: 0; transform: translate(-8px, -50%); transition: opacity 150ms ease, transform 220ms cubic-bezier(.16, 1, .3, 1);
  }
  .sb-nav > .sb-link:hover::after, .sb-nav > .sb-link:focus-visible::after { opacity: 1; transform: translate(0, -50%); }

  /* Companies is the expandable rail item. Its preview fades in from the rail. */
  .sb-group.depth-0 { position: relative; }
  .sb-group.depth-0::after {
    content: '';
    position: absolute;
    z-index: 4;
    top: -28px;
    bottom: -28px;
    left: 100%;
    width: 8px;
  }
  .sidebar:not(:hover):not(:focus-within) .sb-group.depth-0 > .sb-children { display: grid !important; }
  .sb-group.depth-0 > .sb-children {
    position: absolute; top: 50%; left: calc(100% + 8px); z-index: 5; display: grid !important; width: min(292px, calc(100vw - 124px));
    max-height: calc(100dvh - 32px); margin: 0; padding: 14px; gap: 4px; overflow-x: hidden; overflow-y: auto;
    border: 1px solid var(--sb-pop-line); border-left: 1px solid rgba(216, 246, 90, .20); border-radius: 22px;
    background: linear-gradient(155deg, var(--sb-pop) 0%, var(--sb-bg-2) 100%); box-shadow: 0 24px 54px rgba(0, 0, 0, .34);
    visibility: hidden; pointer-events: none; opacity: 0; transform: translate(-12px, -50%) scale(.98); transform-origin: left center; animation: none;
    transition: opacity 170ms ease, transform 260ms cubic-bezier(.16, 1, .3, 1), visibility 0s linear 260ms;
  }
  .sb-group.depth-0:hover > .sb-children, .sb-group.depth-0:focus-within > .sb-children {
    visibility: visible; pointer-events: auto; opacity: 1; transform: translate(0, -50%); transition-delay: 0s;
  }
  .sb-group.depth-0:hover > .sb-group-head .sb-group-link::after,
  .sb-group.depth-0:focus-within > .sb-group-head .sb-group-link::after { opacity: 0; }
  .sb-preview-title {
    display: block; padding: 4px 8px 10px; color: var(--sb-text-strong); font: 700 16px 'Manrope', sans-serif;
    letter-spacing: -.02em; border-bottom: 1px solid var(--sb-line); margin-bottom: 4px;
  }
  .sb-group.depth-0 > .sb-children .sb-link, .sb-group.depth-0 > .sb-children .sb-toggle {
    width: 100%; min-height: 42px; padding: 9px 11px; gap: 11px; justify-content: flex-start; border-radius: 12px;
  }
  .sb-group.depth-0 > .sb-children .sb-text { display: block; flex: 1 1 auto; max-width: none; opacity: 1; overflow: visible; }
  .sb-group.depth-0 > .sb-children .sb-toggle.depth-1 { margin-top: 4px; color: var(--sb-muted); }
  .sb-group.depth-0 > .sb-children .sb-children { margin: 1px 0 5px 15px; padding-left: 8px; overflow: hidden; }
  .sb-group.depth-0 > .sb-children .sb-link.active::before { left: -9px; }
}
@media (prefers-reduced-motion: reduce) {
  .sb-group.depth-0 > .sb-children, .sb-nav > .sb-link::after, .sb-group-head .sb-group-link::after { transition: none; }
}

/* ═══════════════════════════════════════════════
   PREMIUM APPLICATION SHELL
   A single aligned canvas ties the compact rail, header, and page content
   together while the existing color system remains the source of all color.
   ═══════════════════════════════════════════════ */
@media (min-width: 1025px) {
  :root { --app-gutter: clamp(32px, 4vw, 68px); }
  .sidebar-brand {
    position: absolute;
    top: 14px;
    left: 0;
    display: flex;
    justify-content: center;
    width: var(--sidebar-w);
    min-height: 22px;
    margin: 0;
    padding: 0;
  }
  .sidebar-brand .sidebar-logo { display: none; }
  .sidebar-brand-text {
    display: block;
    max-width: none;
    opacity: 1;
    overflow: visible;
    transform: none;
    color: var(--sb-bg);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: -.04em;
    white-space: nowrap;
  }
  .sidebar-brand-text span { color: var(--green); }
  .sb-company { top: 52px; }
  body {
    overflow-x: hidden;
    background:
      radial-gradient(circle at 15% 8%, rgba(216, 246, 90, .12), transparent 22rem),
      var(--page-bg);
  }
  .main {
    position: relative;
    z-index: 0;
    isolation: isolate;
    max-width: 1560px;
    min-height: 100dvh;
    padding: 38px var(--app-gutter) 76px;
  }
  .main::before {
    content: '';
    position: fixed;
    z-index: -1;
    top: 18px;
    right: 20px;
    bottom: 18px;
    left: calc(var(--sidebar-w) + 12px);
    pointer-events: none;
    border: 1px solid rgba(21, 122, 82, .08);
    border-radius: 28px;
    background: rgba(255, 255, 255, .34);
    box-shadow: 0 18px 50px rgba(16, 24, 20, .035);
  }
  .page-header {
    position: relative;
    align-items: center;
    gap: 28px;
    margin-bottom: 28px;
    padding: 2px 0 26px;
    border-bottom: 1px solid rgba(21, 122, 82, .10);
  }
  .page-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 72px;
    height: 2px;
    border-radius: 2px;
    background: var(--green);
  }
  .page-header-text.has-tile { gap: 18px; }
  .page-tile {
    border-radius: 18px;
    box-shadow: inset 0 0 0 1px rgba(21, 122, 82, .09), 0 10px 20px rgba(21, 122, 82, .09);
  }
  .page-title { font-size: clamp(29px, 2.15vw, 34px); }
  .page-subtitle { max-width: 760px; line-height: 1.55; }
  .page-actions { justify-content: flex-end; }

  .panel,
  .metric-card,
  .step-card,
  .integration-card,
  .account-card,
  .company-dash-card {
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(10px);
    transition: border-color 180ms ease, box-shadow 220ms var(--ease), transform 220ms var(--ease);
  }
  .panel:hover,
  .metric-card:hover,
  .step-card:hover,
  .integration-card:hover,
  .account-card:hover,
  .company-dash-card:hover {
    border-color: rgba(21, 122, 82, .18);
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
  }
  .main > :not(script) {
    animation: pageSurfaceIn 420ms cubic-bezier(.16, 1, .3, 1) both;
  }
  .main > :not(script):nth-child(2) { animation-delay: 40ms; }
  .main > :not(script):nth-child(3) { animation-delay: 80ms; }
  .main > :not(script):nth-child(4) { animation-delay: 120ms; }
  .main > :not(script):nth-child(n + 5) { animation-delay: 150ms; }
}
@keyframes pageSurfaceIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 1024px) {
  .main::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .main > :not(script) { animation: none !important; }
  .panel:hover, .metric-card:hover, .step-card:hover, .integration-card:hover, .account-card:hover, .company-dash-card:hover { transform: none; }
}
/* Role badge on pages for restricted roles */
.role-note { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #f3d58a; background: #fffbf0; color: #7a5a00; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 16px; }
.role-note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* ═══ Post schedule: calendar, post editor, AI writer (admin + client portal) ═══ */
:root { --st-draft: #6f7773; --st-draft-bg: #f1f4f2; --st-approval: #9a6b00; --st-approval-bg: #fff4d6; --st-scheduled: #2f5fd6; --st-scheduled-bg: #eaf0ff;
  --st-posted: #157a52; --st-posted-bg: #e5f5ec; --st-cancelled: #a42a1d; --st-cancelled-bg: #fdecea; }
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-nav, .cal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-actions .form-input { width: auto; min-width: 140px; }
.cal-month { font: 700 20px 'Manrope', sans-serif; color: var(--ink); min-width: 170px; text-align: center; margin: 0; }
.cal-nav .btn svg { width: 16px; height: 16px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--slate-bg); gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; border-radius: 8px; min-height: 36px; padding: 0 12px; font: 600 13px 'DM Sans', sans-serif; color: var(--text-2); cursor: pointer; }
.seg button svg { width: 15px; height: 15px; }
.seg button[aria-checked="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 20, .08); }
.seg button:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; font-size: 12.5px; color: var(--text-2); }
.cal-legend .st::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cal-legend .draft::before { background: var(--st-draft); } .cal-legend .needs_approval::before { background: #e3a008; } .cal-legend .scheduled::before { background: var(--st-scheduled); } .cal-legend .posted::before { background: var(--st-posted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--card-border); border-radius: 12px; overflow: hidden; background: var(--card-border); gap: 1px; }
.cal-dow { background: #fafcfb; padding: 8px 10px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cal-cell { background: #fff; min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell.empty { background: #fafcfb; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--green); }
.cal-day { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--ink); padding: 0 2px; }
.cal-cell.today .cal-day span { color: var(--green); }
.cal-add { width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s; }
.cal-add svg { width: 15px; height: 15px; }
.cal-cell:hover .cal-add, .cal-add:focus-visible { opacity: 1; background: var(--green-bg); color: var(--green); }
.cal-post { display: flex; align-items: center; gap: 5px; width: 100%; border: 0; border-left: 3px solid var(--st-draft); border-radius: 6px; padding: 4px 6px; background: var(--st-draft-bg); font: 600 11.5px 'DM Sans', sans-serif; color: var(--ink); text-align: left; cursor: pointer; min-height: 26px; }
.cal-post:hover { filter: brightness(.97); } .cal-post:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.cal-post.st-needs_approval { border-color: #e3a008; background: var(--st-approval-bg); } .cal-post.st-scheduled { border-color: var(--st-scheduled); background: var(--st-scheduled-bg); }
.cal-post.st-posted { border-color: var(--st-posted); background: var(--st-posted-bg); } .cal-post.st-cancelled { border-color: var(--st-cancelled); background: var(--st-cancelled-bg); text-decoration: line-through; }
.cal-post-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-icons { display: inline-flex; gap: 1px; flex-shrink: 0; }
.mini-brand { width: 18px; height: 18px; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 5px; position: relative; }
.mini-brand svg { width: 15px; height: 15px; }
.mini-brand.done::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--st-posted); border: 1.5px solid #fff; }
.cal-more { border: 0; background: none; color: var(--green); font: 600 11.5px 'DM Sans', sans-serif; cursor: pointer; text-align: left; padding: 2px 4px; }
.cal-unscheduled { margin-top: 14px; } .cal-unscheduled-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; margin-top: 6px; }
.st-badge { display: inline-flex; align-items: center; border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 700; background: var(--st-draft-bg); color: var(--st-draft); }
.st-badge.st-needs_approval { background: var(--st-approval-bg); color: var(--st-approval); } .st-badge.st-scheduled { background: var(--st-scheduled-bg); color: var(--st-scheduled); }
.st-badge.st-posted { background: var(--st-posted-bg); color: var(--st-posted); } .st-badge.st-cancelled { background: var(--st-cancelled-bg); color: var(--st-cancelled); }
.post-table td { vertical-align: middle; } .post-table .mini-brand { margin-right: 4px; }
.post-cell strong { display: block; color: var(--ink); } .post-cell small { color: var(--muted); display: block; max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Dialogs */
.post-dialog { border: 0; border-radius: 18px; padding: 0; width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 40px); box-shadow: 0 24px 70px rgba(10, 20, 15, .3); }
.post-dialog::backdrop { background: rgba(10, 20, 15, .5); }
.post-dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.pd-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line-light); }
.pd-head .panel-title { display: flex; align-items: center; gap: 8px; margin: 0; } .pd-head .panel-title svg { width: 18px; height: 18px; color: var(--green); }
.pd-head .icon-btn { margin-left: auto; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.icon-btn:hover { background: var(--slate-bg); color: var(--ink); } .icon-btn.danger:hover { background: var(--red-bg); color: var(--red); }
.icon-btn svg { width: 17px; height: 17px; } .icon-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.pd-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 22px; padding: 18px 22px; overflow-y: auto; }
.pd-body.single { grid-template-columns: 1fr; }
.pd-body .form-group { margin-bottom: 14px; } .pd-body .form-input { width: 100%; }
.pd-body textarea.form-input { resize: vertical; min-height: 110px; line-height: 1.5; }
.pd-count { float: right; font-weight: 500; color: var(--muted); }
.pd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } .pd-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
fieldset.form-group { border: 0; padding: 0; margin-left: 0; margin-right: 0; min-width: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.p-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--card-border); border-radius: 99px; padding: 6px 12px 6px 8px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; background: #fff; min-height: 38px; }
.p-chip input { width: 16px; height: 16px; accent-color: var(--green); margin: 0; }
.p-chip:has(input:checked) { border-color: var(--green); background: var(--green-bg); }
.p-chip:focus-within { outline: 2px solid var(--green); outline-offset: 1px; }
.pd-side { border-left: 1px solid var(--line-light); padding-left: 22px; min-width: 0; }
.pd-images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 8px 0 10px; }
.pd-thumb { margin: 0; border: 1px solid var(--card-border); border-radius: 10px; overflow: hidden; background: #f5f7f6; }
.pd-thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #eef2f0; }
.pd-thumb figcaption { display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 8px; font-size: 11.5px; color: var(--text-2); }
.pd-thumb figcaption span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-thumb .icon-btn { width: 30px; height: 30px; }
.pd-upload { position: relative; cursor: pointer; } .pd-upload.disabled { opacity: .5; pointer-events: none; }
.pd-posted { display: grid; gap: 10px; margin-top: 6px; }
.posted-row { border: 1px solid var(--card-border); border-radius: 10px; padding: 10px; display: grid; gap: 8px; }
.posted-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .posted-info strong { font-size: 13.5px; color: var(--ink); } .posted-info small { color: var(--muted); font-size: 12px; margin-left: auto; }
.posted-actions { display: flex; gap: 6px; } .posted-actions .form-input { flex: 1; min-width: 0; min-height: 34px; font-size: 13px; }
.pd-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line-light); flex-wrap: wrap; }
.pd-spacer { flex: 1; }
.ai-results { display: grid; gap: 12px; }
.ai-card { border: 1px solid var(--card-border); border-radius: 12px; padding: 14px 16px; background: #fafcfb; }
.ai-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; } .ai-card-head strong { color: var(--ink); font-size: 14px; }
.ai-caption { white-space: pre-wrap; font-size: 14px; line-height: 1.55; color: var(--ink); margin: 0 0 8px; }
.ai-tags { color: #2f5fd6; font-size: 13px; margin: 0 0 8px; }
.ai-idea { display: flex; gap: 6px; font-size: 12.5px; color: var(--text-2); margin: 0 0 10px; } .ai-idea svg { width: 15px; height: 15px; flex-shrink: 0; color: #b47b00; }
.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) { .pd-body { grid-template-columns: 1fr; } .pd-side { border-left: 0; padding-left: 0; } .pd-row.three { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .cal-grid { grid-template-columns: 1fr; background: none; border: 0; gap: 6px; }
  .cal-dow, .cal-cell.empty { display: none; }
  .cal-cell { min-height: 0; border: 1px solid var(--card-border); border-radius: 10px; }
  .cal-add { opacity: 1; }
  .pd-row { grid-template-columns: 1fr; }
}
/* Dialogs: restore browser centering (the global margin reset removes it). */
dialog { margin: auto; }
/* Role-based visibility (also covers content added later by page scripts). The server enforces access too. */
body[data-role="developer"] [data-admin-only], body[data-role="sales"] [data-admin-only] { display: none !important; }
body[data-role="developer"] [data-roles]:not([data-roles~="developer"]), body[data-role="sales"] [data-roles]:not([data-roles~="sales"]) { display: none !important; }

/* ── Two-step delete confirmation ── */
.confirm-dialog { width:min(440px, calc(100vw - 32px)); border:0; border-radius:16px; padding:28px 26px 22px; box-shadow:0 24px 60px rgba(16,24,20,.22); color:var(--ink); }
.confirm-dialog::backdrop { background:rgba(16,24,20,.45); }
.confirm-dialog .cd-icon { width:48px; height:48px; border-radius:14px; display:grid; place-items:center; background:#fdecec; color:var(--red); margin-bottom:14px; }
.confirm-dialog .cd-icon svg { width:22px; height:22px; }
.confirm-dialog .cd-step { font-size:11.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); margin:0 0 4px; }
.confirm-dialog h2 { font-size:20px; margin:0 0 8px; }
.confirm-dialog .cd-text { font-size:14px; color:var(--text-2); line-height:1.55; margin:0 0 10px; }
.confirm-dialog .cd-text strong { color:var(--ink); }
.confirm-dialog .cd-text b { color:var(--red); }
.confirm-dialog .cd-list { margin:0 0 6px; padding-left:18px; font-size:13.5px; color:var(--text-2); line-height:1.7; }
.confirm-dialog .cd-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; flex-wrap:wrap; }
.confirm-dialog .cd-confirm { background:var(--red); border-color:var(--red); color:#fff; }
.confirm-dialog .cd-confirm:hover { filter:brightness(.92); }

/* ── Auto-publishing (Facebook & Instagram) ── */
.pub-bar { display:flex; align-items:center; gap:12px 16px; flex-wrap:wrap; border:1px solid var(--card-border); background:#f8fbf9; border-radius:12px; padding:12px 14px; margin-bottom:16px; font-size:13.5px; }
.pub-bar .pub-icon { width:36px; height:36px; border-radius:10px; background:var(--green-bg); color:var(--green); display:grid; place-items:center; flex:none; }
.pub-bar .pub-icon svg { width:18px; height:18px; }
.pub-bar .pub-text { flex:1 1 280px; min-width:0; display:grid; gap:2px; }
.pub-bar .pub-text strong { color:var(--ink); font-size:14px; }
.pub-bar .pub-text small { color:var(--muted); font-size:12.5px; line-height:1.45; }
.pub-bar .pub-accounts { display:flex; flex-wrap:wrap; gap:6px 14px; align-items:center; color:var(--ink); font-weight:600; }
.pub-bar .pub-accounts span { display:inline-flex; align-items:center; gap:6px; }
.pub-bar .pub-accounts svg { width:16px; height:16px; }
.pub-bar .pub-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.pub-bar .pub-actions select { width:auto; min-width:200px; }
.pub-sim { display:inline-flex; align-items:center; font-size:11px; font-weight:700; color:#8a5a00; background:#fff4d6; border-radius:99px; padding:2px 9px; }
.pub-warn { color:var(--red-text); font-size:12.5px; }
.pd-auto { border:1px solid var(--card-border); border-radius:12px; padding:10px 12px; margin:-4px 0 14px; background:#fbfdfc; }
.pd-auto-toggle { display:flex; gap:12px; align-items:center; cursor:pointer; }
.pd-auto-toggle input { position:absolute; opacity:0; width:1px; height:1px; }
.pd-switch { width:38px; height:22px; border-radius:99px; background:#cfd8d3; position:relative; flex:none; transition:background .15s; }
.pd-switch::after { content:''; position:absolute; top:3px; left:3px; width:16px; height:16px; border-radius:50%; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.2); transition:transform .15s; }
.pd-auto-toggle input:checked + .pd-switch { background:var(--green); }
.pd-auto-toggle input:checked + .pd-switch::after { transform:translateX(16px); }
.pd-auto-toggle input:focus-visible + .pd-switch { outline:2px solid var(--green); outline-offset:2px; }
.pd-auto-toggle input:disabled + .pd-switch { opacity:.5; }
.pd-auto-toggle strong { display:block; font-size:13.5px; color:var(--ink); }
.pd-auto-toggle small { display:block; font-size:12px; color:var(--muted); line-height:1.4; }
.pd-auto-warn { margin:8px 0 0; font-size:12px; color:#8a5a00; background:#fff8e6; border-radius:8px; padding:6px 9px; }
.pd-sizes { display:grid; gap:12px; margin-top:8px; }
.pd-size-group { border:1px solid var(--card-border); border-radius:10px; padding:8px; }
.pd-size-head { display:flex; align-items:center; gap:8px; margin-bottom:8px; font-size:12px; color:var(--text-2); }
.pd-size-head span { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; }
.pd-size-head select { width:auto; min-height:30px; padding:2px 26px 2px 8px; font-size:12px; }
.pd-size-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(92px, 1fr)); gap:8px; }
.pd-size { margin:0; display:grid; gap:4px; align-content:start; }
.pd-size .pd-size-box { display:grid; place-items:center; background:#eef2f0; border-radius:6px; overflow:hidden; height:92px; }
.pd-size img { display:block; max-width:100%; max-height:92px; box-shadow:0 0 0 1px rgba(0,0,0,.06); }
.pd-size figcaption { font-size:11px; line-height:1.3; color:var(--text-2); }
.pd-size figcaption b { display:block; color:var(--ink); font-size:11.5px; }
.pd-size.low figcaption { color:#8a5a00; }
.pub-state { display:block; font-size:11.5px; margin-top:2px; }
.pub-state.ok { color:var(--green); } .pub-state.bad { color:var(--red-text); } .pub-state.wait { color:#8a5a00; }
.cal-post.has-error { box-shadow:inset 3px 0 0 var(--red); }
.pd-size-head .form-input { width:auto !important; flex:none; max-width:180px; }
.nav-badge[hidden] { display: none !important; }

/* ── Caption tools (emoji + styled text) ── */
.composer-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 6px; }
.composer-btn { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--card-border); background: #fff; border-radius: 8px; cursor: pointer; font: 600 14px 'DM Sans', sans-serif; color: var(--ink); line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.composer-btn:hover { border-color: var(--green); color: var(--green); }
.composer-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.composer-btn.emoji-btn { font-size: 16px; }
.composer-btn sub { font-size: 9px; }
.composer-hint { font-size: 11.5px; color: var(--muted); flex: 1 1 180px; min-width: 0; }
.emoji-wrap { position: relative; display: inline-flex; }
.emoji-pop { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; width: min(320px, calc(100vw - 48px)); max-height: 300px; overflow-y: auto; overflow-x: hidden; box-sizing: border-box; background: #fff; border: 1px solid var(--card-border); border-radius: 12px; box-shadow: 0 16px 40px rgba(16, 24, 20, .18); padding: 10px; }
.emoji-pop .emoji-search { margin-bottom: 8px; min-height: 34px; font-size: 13px; }
.emoji-groups h4 { margin: 8px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.emoji-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 2px; }
.emoji-item { border: 0; background: none; cursor: pointer; font-size: 19px; line-height: 1; padding: 4px; border-radius: 6px; width: 100%; min-width: 0; overflow: hidden; }
.emoji-item:hover { background: var(--green-bg); }
.emoji-item:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.area-note { font-size:13px; color:var(--text-2); margin:0 0 12px; }

/* ── AI settings ── */
.ai-set-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.ai-set-grid div { border:1px solid var(--card-border); border-radius:10px; padding:10px 12px; display:grid; gap:2px; }
.ai-set-grid span { font-size:11.5px; color:var(--muted); font-weight:600; }
.ai-set-grid strong { font-size:14px; color:var(--ink); overflow-wrap:anywhere; }
.ai-toggle { display:flex; gap:10px; align-items:flex-start; border:1px solid var(--card-border); border-radius:10px; padding:10px 12px; cursor:pointer; }
.ai-toggle input { width:18px; height:18px; accent-color:var(--green); margin-top:2px; }
.ai-toggle strong { display:block; font-size:13.5px; color:var(--ink); }
.ai-toggle small { display:block; font-size:12px; color:var(--muted); line-height:1.4; }
.ai-toggle.locked { opacity:.75; cursor:default; }
@media(max-width:900px){ .ai-set-grid{grid-template-columns:repeat(2,minmax(0,1fr))} }

/* ── Post schedule: counts and AI image ── */
.post-counts { display:flex; gap:8px 18px; flex-wrap:wrap; font-size:12.5px; color:var(--text-2); background:#fafcfb; border:1px solid var(--card-border); border-radius:10px; padding:9px 12px; margin-bottom:14px; }
.post-counts b { color:var(--ink); }
.pd-image-actions { display:flex; gap:8px; flex-wrap:wrap; }
.img-result { display:grid; gap:10px; justify-items:center; border:1px solid var(--card-border); border-radius:12px; padding:12px; background:var(--bg); }
.img-result img { max-width:100%; max-height:320px; border-radius:8px; display:block; }
.img-result .row { display:flex; gap:8px; flex-wrap:wrap; }
.ai-ratio { font-size:11.5px; color:var(--muted); }

/* ── AI Creative Studio: a danger tone for buttons that delete ── */
.btn-outline.danger { color: var(--red); border-color: #f3cfc9; }
.btn-outline.danger:hover { background: var(--red-bg); border-color: var(--red); }
.empty-mini { font-size: 12.5px; color: var(--muted); }

/* Reference dashboard skin. Presentation only; existing markup and interactions
   remain the source of truth. Keep these rules after the legacy shell layers. */
:root {
  --radius: 18px; --radius-card: 18px; --radius-control: 11px;
  --sb-radius: 12px;
}
body { background: var(--page-bg); }
body.revealed, .main > :not(script), .sb-children, .sb-children > * { animation: none; }
.sidebar { background: var(--sb-bg); }
.sidebar-toggle svg { pointer-events: none; }
.sidebar-nav a.active { background: var(--sb-active); }
.sidebar-logo { background: var(--green); box-shadow: none; border-radius: 12px; }
.sidebar-brand-text span { color: var(--lime); }
.main { min-width: 0; }
.page-header { border: 0; padding-bottom: 0; gap: 18px; margin-bottom: 24px; }
.page-header::after { content: none; }
.page-title { font-size: clamp(24px, 2.1vw, 30px); letter-spacing: -.035em; line-height: 1.25; }
.page-subtitle { font-size: 13px; line-height: 1.6; }
.page-tile { width: 46px; height: 46px; border-radius: 14px; box-shadow: none; background: var(--green-bg); }
.page-tile svg { width: 23px; height: 23px; }
.main .breadcrumb { font-size: 11px; margin-bottom: 14px; }
.panel, .metric-card, .step-card, .integration-card, .account-card, .company-dash-card {
  background: #fff; border: 1px solid var(--card-border);
  border-radius: var(--radius-card); box-shadow: var(--card-shadow); backdrop-filter: none;
}
.panel:hover, .metric-card:hover, .step-card:hover, .integration-card:hover,
.account-card:hover, .company-dash-card:hover { transform: none; border-color: var(--green-border); box-shadow: var(--card-shadow-hover); }
.panel { padding: 20px; }
.panel-header { margin-bottom: 18px; gap: 12px; }
.panel-title { font-size: 17px; letter-spacing: -.025em; }
.panel-subtitle { font-size: 12px; color: var(--muted); }
.icon-chip, .icon-chip.sm, .icon-chip.lg { border-radius: 12px; }
.panel-heading > .icon-chip { width: 36px; height: 36px; }
.panel-heading > .icon-chip svg { width: 18px; height: 18px; }
.metric-cards { gap: 16px; }
.metric-card { padding: 18px; }
.metric-card.has-icon { column-gap: 12px; }
.metric-card.has-icon > .icon-chip { width: 40px; height: 40px; border-radius: 13px; }
.metric-card.has-icon > .icon-chip svg { width: 20px; height: 20px; }
.metric-label { font-size: 12px; }
.metric-value { font-size: 28px; font-weight: 800; }
.metric-sub { font-size: 11px; }
.metric-spark { width: 62px; opacity: .8; }
.company-avatar { background: var(--green-bg); border-radius: 12px; }
.company-dash-stats, .list-head { background: var(--bg); border-radius: 11px; }
.btn { box-shadow: none; font-size: 13px; }
.btn-primary:hover, .btn-green:hover { box-shadow: none; }
.btn-outline { border-color: #dfe5e1; color: var(--ink); }
.btn-outline:hover { background: #fafcfb; border-color: #c9d2cc; }
.form-input:focus, .form-textarea:focus, .main select:focus { box-shadow: 0 0 0 3px rgba(21,122,82,.12); }
.main button:focus-visible, .main a:focus-visible { outline-color: rgba(21,122,82,.35); }
.sb-link:hover, .sb-toggle:hover { transform: none; box-shadow: none; }
.sb-picker-pop, .sb-group.depth-0 > .sb-children { background: var(--sb-pop); }

@media (min-width: 1025px) {
  :root { --sidebar-w: 124px; }
  body { background: var(--page-bg); padding: 16px 16px 16px 0; }
  body:has(> .sidebar)::before {
    content: none; position: fixed; inset: 6px; border: 0;
    border-radius: 38px; pointer-events: none; z-index: 220;
  }
  .sidebar, .sidebar:hover, .sidebar:focus-within {
    inset: 28px auto 28px 22px; width: var(--sidebar-w); padding: 0;
    border-radius: 30px 0 0 30px; background: var(--sb-bg); box-shadow: none;
  }
  .sidebar-brand, .sidebar:hover .sidebar-brand, .sidebar:focus-within .sidebar-brand {
    top: 18px; left: 0; width: 100%; padding: 0 4px; justify-content: center;
  }
  .sidebar-brand-text { color: var(--sb-text-strong); font-size: 12px; letter-spacing: -.04em; }
  .sb-company { top: 60px; }
  .sb-picker-btn, .sidebar:hover .sb-picker-btn, .sidebar:focus-within .sb-picker-btn {
    width: 42px; min-height: 42px; padding: 5px; border-radius: 13px;
    background: var(--sb-field); box-shadow: none;
  }
  .sb-nav {
    top: 126px; left: 8px; width: calc(100% - 16px); padding: 0; gap: 12px;
    transform: none; border: 0; border-radius: 0; background: none; box-shadow: none;
  }
  .sb-nav > .sb-link, .sb-group-head, .sb-group-head .sb-group-link,
  .sidebar:hover .sb-nav > .sb-link, .sidebar:focus-within .sb-nav > .sb-link,
  .sidebar:hover .sb-group-head .sb-group-link, .sidebar:focus-within .sb-group-head .sb-group-link {
    width: 100%; min-width: 0; min-height: 60px; flex: 1 1 auto;
    padding: 7px 3px; gap: 6px; flex-direction: column; justify-content: center;
  }
  .sb-nav > .sb-link .sb-text, .sb-group-head .sb-text,
  .sidebar:hover .sb-nav > .sb-link .sb-text, .sidebar:focus-within .sb-nav > .sb-link .sb-text,
  .sidebar:hover .sb-group-head .sb-text, .sidebar:focus-within .sb-group-head .sb-text {
    flex: none; max-width: 100%; opacity: 1; transform: none;
    font-size: 11px; line-height: 1.4; white-space: normal; overflow: visible; text-align: center;
  }
  .sb-nav > .sb-link .sb-icon, .sb-group-head .sb-icon {
    width: 28px; height: 28px; padding: 5px; border-radius: 9px; background: var(--sb-hover);
  }
  .sb-nav > .sb-link.active { background: transparent; box-shadow: none; }
  .sb-nav > .sb-link.active .sb-icon, .sb-group-head .sb-group-link.active .sb-icon {
    color: var(--green); background: #fff; box-shadow: 0 0 0 2px rgb(255 255 255 / 12%);
  }
  .sb-nav > .sb-link.active::before, .sb-group-head .sb-group-link.active::before,
  .sb-nav > .sb-link::after, .sb-group-head .sb-group-link::after { content: none; }
  .sb-nav > .sb-link:hover { transform: none; }
  .sb-group.depth-0 > .sb-children { border-radius: 18px; border-color: var(--sb-line); box-shadow: 0 12px 30px rgba(15,32,17,.20); }
  .main {
    margin-left: 146px; max-width: none; min-height: calc(100dvh - 32px);
    padding: 26px 24px 44px; border-radius: 30px; border: 0;
    background: var(--page-bg);
  }
  .main::before { content: none; }
  .page-header-text.has-tile { gap: 12px; }
}
@media (min-width: 1025px) and (max-height: 720px) {
  .sb-nav { gap: 3px; top: 114px; }
  .sb-nav > .sb-link, .sb-group-head, .sb-group-head .sb-group-link { min-height: 50px; }
}
@media (max-width: 1024px) {
  .main { margin: 12px; padding: 68px 20px 32px; border: 0; border-radius: 24px; background: var(--page-bg); }
  .sidebar { width: min(280px, calc(100vw - 56px)); border-radius: 0 24px 24px 0; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-toggle { display: flex; top: 24px; left: 26px; border-radius: 11px; background: #fff; border-color: #dfe5e1; }
  .company-dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
}
@media (max-width: 600px) {
  .main { margin: 6px; padding: 66px 12px 24px; border-radius: 20px; }
  .panel { padding: 16px; }
  .page-title { font-size: 23px; overflow-wrap: anywhere; }
  .page-header-text { min-width: 0; }
  .page-header-text.has-tile { align-items: flex-start; gap: 10px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-actions > *, .toolbar-inline .form-input { max-width: 100%; min-width: 0; }
  .company-dash-stats { flex-wrap: wrap; }
}

/* ── Google data pages: compact connection bar and "last N days" input ── */
.conn-bar { display:flex; align-items:center; gap:18px; flex-wrap:wrap; background:#fff; border:1px solid var(--card-border); border-radius:var(--radius-card); box-shadow:var(--card-shadow); padding:16px 20px; margin-bottom:20px; }
.conn-bar.ready { border-color:#9fd4b4; background:#f6fbf8; }
.conn-bar > .ga-mark, .conn-bar > .icon-chip { flex-shrink:0; }
.conn-bar-text { flex:1 1 320px; min-width:0; display:grid; gap:6px; }
.conn-bar-title { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.conn-bar-title strong { font:700 16px 'Manrope',sans-serif; color:var(--ink); }
.conn-bar-meta { display:flex; flex-wrap:wrap; gap:6px 28px; margin:0; font-size:13.5px; }
.conn-bar-meta > div { display:flex; gap:8px; align-items:baseline; min-width:0; }
.conn-bar-meta dt { color:var(--muted); }
.conn-bar-meta dd { margin:0; color:var(--ink); font-weight:600; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.conn-bar-note { font-size:13px; color:#8a6d00; margin:0; }
.conn-bar-actions { display:flex; gap:10px; flex-wrap:wrap; }
.conn-bar-actions [hidden] { display:none; }
.range-days { display:inline-flex; align-items:center; gap:8px; font-size:13.5px; color:var(--text-2); }
.range-days .form-input { width:88px; }
@media(max-width:700px){ .conn-bar-actions{width:100%} .conn-bar-actions .btn{flex:1;justify-content:center} }
/* Phone: form, popup and widget rows wrap their action buttons instead of widening the page */
@media (max-width: 600px) {
  .widget-list-item { flex-wrap: wrap; }
  .widget-list-info { flex: 1 1 60%; min-width: 0; }
  .widget-list-actions { width: 100%; flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONNECTJERRY+ PREMIUM LAYER
   Last layer on purpose: it refines every page (tokens, surfaces, controls, motion)
   and replaces the desktop rail with a floating navigation column that has a brand
   mark, a company chip and an account button (with Sign out) at the bottom.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --page-bg: #f2f5f3;
  --card-border: #e3e9e5;
  --card-shadow: 0 1px 2px rgba(15, 35, 25, .04), 0 8px 24px -12px rgba(15, 35, 25, .12);
  --card-shadow-hover: 0 2px 6px rgba(15, 35, 25, .05), 0 22px 44px -18px rgba(15, 35, 25, .22);
  --float-shadow: 0 28px 70px -20px rgba(6, 24, 15, .45), 0 10px 24px -12px rgba(6, 24, 15, .25);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --radius-card: 20px; --radius-control: 12px;
  --cj-green-grad: linear-gradient(180deg, #1c8f5f 0%, #13714b 100%);
  --cj-rail: linear-gradient(180deg, #173226 0%, #10231a 48%, #0b1812 100%);
  --cj-lime-grad: linear-gradient(140deg, #e6fb7a 0%, #b9ec5d 100%);
}
body {
  background:
    radial-gradient(1100px 520px at 105% -8%, rgba(216, 246, 90, .16), transparent 60%),
    radial-gradient(900px 480px at -8% 108%, rgba(21, 122, 82, .09), transparent 62%),
    var(--page-bg);
  background-attachment: fixed;
}
::selection { background: rgba(216, 246, 90, .55); color: var(--ink); }
* { scrollbar-width: thin; scrollbar-color: #c7d2cc transparent; }

/* ── Surfaces ─────────────────────────────────────────────────────────────── */
.panel, .metric-card, .step-card, .integration-card, .account-card, .company-dash-card, .modal-card,
.mkt-section, .page-card, .oauth-card, .conn-bar, .kw-summary {
  background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  transition: box-shadow 260ms var(--ease-out), border-color 200ms ease, transform 260ms var(--ease-out);
}
.panel:hover, .mkt-section:hover { transform: none; border-color: #d7e2dc; box-shadow: var(--card-shadow-hover); }
/* Smaller cards lift a little on hover. */
.metric-card:hover, .integration-card:hover, .company-dash-card:hover, .page-card:hover, .oauth-card:hover, .account-card:hover {
  transform: translateY(-3px); border-color: #cfe0d6; box-shadow: var(--card-shadow-hover);
}
.panel.inner { box-shadow: none; }
.panel.inner:hover { box-shadow: 0 10px 28px -18px rgba(15, 35, 25, .25); }
.metric-card { background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%); overflow: hidden; }
.metric-card::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, rgba(21, 122, 82, .0), rgba(21, 122, 82, .35), rgba(216, 246, 90, .0));
  opacity: 0; transition: opacity 260ms ease;
}
.metric-card:hover::after { opacity: 1; }
.metric-value { font-family: 'Manrope', sans-serif; letter-spacing: -.045em; }
.icon-chip { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6), 0 6px 14px -8px rgba(15, 35, 25, .35); }
.panel-title, .report-title { font-family: 'Manrope', sans-serif; letter-spacing: -.025em; }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-title { font-weight: 800; color: #0f2019; }
.page-tile {
  background: linear-gradient(145deg, #e9f7ee 0%, #ffffff 100%); color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(21, 122, 82, .12), 0 12px 24px -14px rgba(21, 122, 82, .55);
}
.page-eyebrow { letter-spacing: .14em; }
.main .breadcrumb a { transition: color 160ms ease; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { border-radius: var(--radius-control); transition: transform 180ms var(--ease-out), box-shadow 220ms var(--ease-out), background 180ms ease, border-color 180ms ease, color 180ms ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); transition-duration: 80ms; }
.btn-primary, .btn-green {
  background: var(--cj-green-grad); color: #fff; border: 1px solid #12704a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 18px -10px rgba(21, 122, 82, .75);
}
.btn-primary:hover:not(:disabled), .btn-green:hover:not(:disabled) {
  background: linear-gradient(180deg, #22a06b 0%, #157a52 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 14px 26px -12px rgba(21, 122, 82, .8);
}
.btn-outline { background: #fff; border: 1px solid #dce5e0; color: var(--ink); box-shadow: 0 1px 2px rgba(15, 35, 25, .05); }
.btn-outline:hover:not(:disabled) { border-color: #b9d3c4; background: #fbfdfc; box-shadow: 0 8px 18px -12px rgba(15, 35, 25, .35); }
.btn-danger { box-shadow: 0 1px 2px rgba(15, 35, 25, .04); }
.btn-danger:hover:not(:disabled) { box-shadow: 0 8px 18px -12px rgba(201, 59, 43, .45); }
.btn:focus-visible { outline: 3px solid rgba(21, 122, 82, .35); outline-offset: 2px; }

/* ── Inputs ─────────────────────────────────────────────────────────────── */
.form-input, .form-textarea, .main select, .main textarea {
  border-radius: var(--radius-control); border-color: #dce5e0; background-color: #fff;
  transition: border-color 160ms ease, box-shadow 200ms var(--ease-out), background-color 160ms ease;
}
.form-input:hover, .form-textarea:hover, .main select:hover { border-color: #c3d3ca; }
.form-input:focus, .form-textarea:focus, .main select:focus, .main textarea:focus {
  border-color: var(--green); box-shadow: 0 0 0 4px rgba(21, 122, 82, .12); outline: none;
}
.select-with-icon { border-radius: var(--radius-control); transition: border-color 160ms ease, box-shadow 200ms var(--ease-out); }
.select-with-icon:hover { border-color: #c3d3ca; }

/* ── Tabs: a segmented bar; the active tab is a raised pill ─────────────── */
.tabs-nav { padding: 6px; gap: 4px; border-radius: 16px; background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px); }
.tab-btn {
  border: 0; border-radius: 11px; padding: 10px 14px; min-height: 42px; color: var(--text-2);
  transition: background 200ms ease, color 200ms ease, box-shadow 240ms var(--ease-out);
}
.tab-btn:hover { background: #f1f6f3; color: var(--ink); }
.tab-btn.active {
  background: linear-gradient(180deg, #eef8f2 0%, #e3f3ea 100%); color: #0f5c3c; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(21, 122, 82, .18), 0 6px 14px -10px rgba(21, 122, 82, .6);
}
.tab-btn.active svg { color: var(--green); }
.tab-btn.active .tab-badge { background: var(--green); color: #fff; }

/* ── Tables, lists, badges ───────────────────────────────────────────────── */
thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7b8781; background: #f7faf8; }
thead th:first-child { border-top-left-radius: 10px; } thead th:last-child { border-top-right-radius: 10px; }
tbody tr { transition: background 160ms ease; }
tbody tr:hover { background: #f5faf7; }
.list-row, .mkt-row { transition: background 180ms ease, transform 220ms var(--ease-out); }
.list-row:hover { transform: translateX(2px); }
.badge { border-radius: 999px; font-weight: 600; letter-spacing: .01em; }
.badge-green { box-shadow: inset 0 0 0 1px rgba(21, 122, 82, .14); }

/* ── Feedback ────────────────────────────────────────────────────────────── */
.status-msg:not(:empty) { animation: cjDrop 320ms var(--ease-out) both; box-shadow: 0 10px 24px -18px rgba(15, 35, 25, .45); }
.post-dialog, .modal-card { border-radius: 22px; box-shadow: var(--float-shadow); }
.post-dialog[open] { animation: cjPop 260ms var(--ease-out) both; }
.post-dialog::backdrop { background: rgba(8, 20, 14, .45); backdrop-filter: blur(3px); }
.modal-backdrop { backdrop-filter: blur(3px); }
.modal-backdrop .modal-card { animation: cjPop 260ms var(--ease-out) both; }
.empty-art { background: radial-gradient(circle at 30% 25%, #ffffff 0%, #eef7f1 60%); box-shadow: 0 16px 34px -22px rgba(21, 122, 82, .55); }

/* ── Motion: page content settles in, card grids ripple in ───────────────── */
.main > :not(script):not(dialog):not(.modal-backdrop) { animation: cjRise 460ms var(--ease-out) both; }
.main > :nth-child(2) { animation-delay: 40ms; } .main > :nth-child(3) { animation-delay: 80ms; }
.main > :nth-child(4) { animation-delay: 120ms; } .main > :nth-child(n + 5) { animation-delay: 160ms; }
.kpi-grid > *, .metric-cards > *, .mkt-sections > *, .company-dashboard-grid > *, .page-cards > * { animation: cjRise 520ms var(--ease-out) both; }
.kpi-grid > :nth-child(2), .metric-cards > :nth-child(2), .mkt-sections > :nth-child(2), .company-dashboard-grid > :nth-child(2) { animation-delay: 50ms; }
.kpi-grid > :nth-child(3), .metric-cards > :nth-child(3), .mkt-sections > :nth-child(3), .company-dashboard-grid > :nth-child(3) { animation-delay: 100ms; }
.kpi-grid > :nth-child(4), .metric-cards > :nth-child(4), .company-dashboard-grid > :nth-child(4) { animation-delay: 150ms; }
.kpi-grid > :nth-child(n + 5), .metric-cards > :nth-child(n + 5), .company-dashboard-grid > :nth-child(n + 5) { animation-delay: 200ms; }
@keyframes cjRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes cjDrop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes cjPop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes cjFade { from { opacity: 0; } to { opacity: 1; } }

/* ── Popovers shared by the company switcher and the account panel ───────── */
.sb-picker-pop, .sb-account-pop {
  background: #fff; color: var(--ink); border: 1px solid #e3e9e5; border-radius: 18px; padding: 8px;
  box-shadow: var(--float-shadow); animation: cjPop 220ms var(--ease-out) both; z-index: 60;
}
.sb-pop-head { padding: 8px 10px 10px; display: grid; gap: 2px; border-bottom: 1px solid #eef2ef; margin-bottom: 6px; }
.sb-pop-head strong { font: 700 14px 'Manrope', sans-serif; color: var(--ink); letter-spacing: -.01em; }
.sb-pop-head small { font-size: 12px; color: var(--muted); }
.sb-picker-search { background: #f3f7f5; color: var(--muted); border-radius: 11px; margin: 4px 2px 8px; }
.sb-picker-search input { color: var(--ink); }
.sb-picker-search input::placeholder { color: #93a19a; }
.sb-option { color: var(--ink); border-radius: 11px; min-height: 50px; transition: background 150ms ease; }
.sb-option:hover, .sb-option:focus { background: #f3f8f5; }
.sb-option:focus-visible { box-shadow: inset 0 0 0 2px var(--green); }
.sb-option[aria-selected="true"] { background: #eaf6ee; }
.sb-option .sb-picker-text strong { color: var(--ink); }
.sb-option .sb-picker-text small { color: var(--muted); }
.sb-option-check { color: var(--green); }
.sb-option-empty { color: var(--muted); }
.sb-picker-manage { color: var(--green); border-top-color: #eef2ef; border-radius: 0 0 10px 10px; padding: 12px 10px 8px; }
.sb-picker-manage:hover { color: #0f5c3c; }
/* Company marks: "All companies" is a lime tile with a layers icon; each company has its own colour. */
.sb-picker-mark { background: var(--cj-lime-grad); color: #10231a; border-radius: 11px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45); }
.sb-picker-mark.is-company {
  background: hsl(var(--mark-hue, 150) 62% 88%); color: hsl(var(--mark-hue, 150) 55% 22%);
  box-shadow: inset 0 0 0 1px hsl(var(--mark-hue, 150) 45% 76%);
}
.sb-option .sb-picker-mark:not(.is-company) { background: #f0f5f2; color: var(--green); box-shadow: inset 0 0 0 1px #e1ebe5; }

/* Account panel */
.sb-account { position: relative; }
.sb-account-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 8px 10px; cursor: pointer; text-align: left;
  font: inherit; color: var(--sb-text); background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); border-radius: 16px;
  transition: background 180ms ease, border-color 180ms ease, transform 220ms var(--ease-out);
}
.sb-account-btn:hover { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .14); }
.sb-account-btn:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.sb-account.open .sb-account-btn { border-color: rgba(216, 246, 90, .45); }
.sb-account-text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.sb-account-text strong { color: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-account-text small { color: var(--sb-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-account-chevron { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; transform: rotate(180deg); transition: transform 220ms var(--ease-out); }
.sb-account.open .sb-account-chevron { transform: none; }
.sb-avatar {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--cj-lime-grad); color: #10231a; font: 800 15px 'Manrope', sans-serif;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 8px 18px -10px rgba(216, 246, 90, .8);
}
.sb-avatar.lg { width: 44px; height: 44px; border-radius: 14px; font-size: 17px; }
.sb-account-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 10px); width: auto; min-width: 250px; }
.sb-account-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 12px; border-bottom: 1px solid #eef2ef; margin-bottom: 6px; }
.sb-account-head strong { display: block; font: 700 14.5px 'Manrope', sans-serif; color: var(--ink); }
.sb-account-head small { display: block; font-size: 12px; color: var(--muted); }
.sb-account-group { display: grid; gap: 2px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid #eef2ef; }
.sb-account-label { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #93a19a; padding: 6px 10px 4px; }
.sb-account-pop .sb-account-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 11px; width: 100%; min-height: 44px; padding: 10px; border: 0; border-radius: 11px; margin: 0;
  background: transparent; color: var(--ink); font: 500 13.5px 'DM Sans', sans-serif; text-decoration: none; cursor: pointer; text-align: left;
  transition: background 150ms ease, color 150ms ease;
}
.sb-account-pop .sb-account-item:hover, .sb-account-item:focus { background: #f3f8f5; text-decoration: none; outline: none; }
.sb-account-pop .sb-account-item:focus-visible { box-shadow: inset 0 0 0 2px var(--green); }
.sb-account-pop .sb-account-item svg { width: 17px; height: 17px; color: var(--text-2); flex-shrink: 0; }
.sb-account-pop .sb-account-item.sb-signout { color: #b3321f; }
.sb-account-pop .sb-account-item.sb-signout svg { color: #c93b2b; }
.sb-account-pop .sb-account-item.sb-signout:hover { background: #fff1ee; }
.sb-account .logout-btn { border: 0; }
.sb-account-pop .sb-account-item > span { max-width: none !important; opacity: 1 !important; transform: none !important; overflow: visible !important; }

/* Brand mark */
.sidebar-logo {
  background: var(--cj-lime-grad); color: #10231a; border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 10px 22px -12px rgba(216, 246, 90, .9);
}
.sidebar-logo svg { color: #10231a; }

/* ── Desktop: floating navigation column ─────────────────────────────────── */
@media (min-width: 1025px) {
  :root { --sidebar-w: 104px; }
  body { padding: 0; }
  .sidebar, .sidebar:hover, .sidebar:focus-within {
    inset: 18px auto 18px 18px; width: var(--sidebar-w); padding: 16px 10px 14px; gap: 14px;
    display: flex; flex-direction: column; align-items: center; overflow: visible;
    background: var(--cj-rail); border: 1px solid rgba(255, 255, 255, .05); border-radius: 28px;
    box-shadow: var(--float-shadow), inset 0 1px 0 rgba(255, 255, 255, .06);
    animation: cjFade 500ms ease both;
  }
  .sidebar::before {
    content: ''; display: block; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; opacity: 1;
    background: radial-gradient(120px 140px at 50% 0%, rgba(216, 246, 90, .16), transparent 70%), radial-gradient(160px 120px at 50% 100%, rgba(40, 170, 110, .18), transparent 70%);
  }
  .sidebar-brand, .sidebar:hover .sidebar-brand, .sidebar:focus-within .sidebar-brand {
    position: static; display: flex; flex-direction: column; align-items: center; gap: 7px; width: 100%; padding: 0; margin: 0; min-height: 0;
  }
  .sidebar-brand .sidebar-logo { display: grid; place-items: center; width: 40px; height: 40px; transition: transform 300ms var(--ease-out); }
  .sidebar-brand:hover .sidebar-logo { transform: rotate(-6deg) scale(1.05); }
  .sidebar-brand .sidebar-logo svg { width: 20px; height: 20px; }
  .sidebar-brand-text { font-size: 11.5px; font-weight: 800; letter-spacing: -.02em; color: #fff; white-space: nowrap; }
  .sidebar-brand-text span { color: var(--lime); }

  /* Company chip: mark + current company name, opens the switcher beside the rail */
  .sb-company { position: static; transform: none; width: 100%; padding: 12px 0 0; margin: 0; border: 0; border-top: 1px solid rgba(255, 255, 255, .07); }
  .sb-picker { display: flex; justify-content: center; }
  .sb-picker-btn, .sidebar:hover .sb-picker-btn, .sidebar:focus-within .sb-picker-btn {
    width: 100%; min-height: 0; padding: 8px 4px 7px; gap: 6px; margin: 0; flex-direction: column; align-items: center; justify-content: center;
    border-radius: 16px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); box-shadow: none;
    transition: background 180ms ease, border-color 180ms ease;
  }
  .sb-picker-btn:hover { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .15); }
  .sb-picker-btn[aria-expanded="true"] { border-color: rgba(216, 246, 90, .5); box-shadow: 0 0 0 3px rgba(216, 246, 90, .12); }
  .sb-picker-btn .sb-picker-mark { width: 36px; height: 36px; font-size: 12.5px; }
  .sb-picker-btn .sb-picker-mark svg { width: 18px; height: 18px; }
  .sb-picker-btn .sb-picker-text, .sidebar:hover .sb-picker-btn .sb-picker-text, .sidebar:focus-within .sb-picker-btn .sb-picker-text {
    display: block !important; max-width: 100%; opacity: 1; transform: none; text-align: center;
  }
  .sb-picker-btn .sb-picker-text strong { display: block; max-width: 80px; margin: 0 auto; font-size: 10.5px; font-weight: 600; color: #dbe7df; }
  .sb-picker-btn .sb-picker-text small, .sb-picker-btn .sb-picker-chevron { display: none !important; }
  .sb-picker-pop { top: 0; left: calc(100% + 16px); right: auto; width: 300px; min-width: 0; }
  .sb-picker-pop .sb-picker-text { display: grid !important; }

  /* Navigation */
  .sb-nav { position: static; transform: none; width: 100%; padding: 0; gap: 6px; border: 0; background: none; box-shadow: none; }
  .sb-nav > .sb-link, .sb-group-head, .sb-group-head .sb-group-link,
  .sidebar:hover .sb-nav > .sb-link, .sidebar:focus-within .sb-nav > .sb-link,
  .sidebar:hover .sb-group-head .sb-group-link, .sidebar:focus-within .sb-group-head .sb-group-link {
    width: 100%; min-height: 58px; padding: 7px 2px 6px; gap: 5px; flex-direction: column; justify-content: center; border-radius: 16px;
  }
  .sb-nav > .sb-link .sb-icon, .sb-group-head .sb-icon {
    width: 34px; height: 34px; padding: 8px; border-radius: 11px; background: rgba(255, 255, 255, .05); color: #b9c9bf;
    transition: background 200ms ease, color 200ms ease, transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out);
  }
  .sb-nav > .sb-link .sb-text, .sb-group-head .sb-text { font-size: 10.5px; font-weight: 600; color: #a9bbb0; transition: color 200ms ease; }
  .sb-nav > .sb-link:hover, .sb-group-head .sb-group-link:hover { background: rgba(255, 255, 255, .04); }
  .sb-nav > .sb-link:hover .sb-icon, .sb-group-head .sb-group-link:hover .sb-icon { background: rgba(255, 255, 255, .1); color: #fff; transform: translateY(-2px); }
  .sb-nav > .sb-link:hover .sb-text, .sb-group-head .sb-group-link:hover .sb-text { color: #fff; }
  .sb-nav > .sb-link.active, .sb-group-head .sb-group-link.active { background: rgba(216, 246, 90, .06); box-shadow: none; }
  .sb-nav > .sb-link.active .sb-icon, .sb-group-head .sb-group-link.active .sb-icon,
  .sb-group.has-active > .sb-group-head .sb-group-link .sb-icon {
    background: var(--cj-lime-grad); color: #10231a; box-shadow: 0 10px 20px -10px rgba(216, 246, 90, .9);
  }
  .sb-nav > .sb-link.active .sb-text, .sb-group.has-active > .sb-group-head .sb-text { color: #fff; }
  .sb-group.depth-0 > .sb-children { left: calc(100% + 14px); border-radius: 20px; background: linear-gradient(160deg, #1b3327 0%, #0f1f17 100%); box-shadow: var(--float-shadow); }

  /* Account button at the bottom: the avatar; the panel opens beside the rail */
  .sidebar .sb-account { display: block !important; margin-top: auto; width: 100%; padding: 12px 0 0; border-top: 1px solid rgba(255, 255, 255, .07); }
  .sb-account-btn { flex-direction: column; justify-content: center; gap: 5px; min-height: 0; padding: 8px 4px 7px; text-align: center; }
  .sb-account-btn .sb-account-text { display: block; max-width: 100%; opacity: 1; transform: none; }
  .sb-account-btn .sb-account-text strong { font-size: 10.5px; max-width: 80px; margin: 0 auto; color: #dbe7df; }
  .sb-account-btn .sb-account-text small, .sb-account-btn .sb-account-chevron { display: none; }
  .sb-account-pop { left: calc(100% + 16px); right: auto; bottom: 0; width: 272px; }

  /* Tooltips for the company and account buttons */
  .sb-picker-btn::after, .sb-account-btn::after {
    content: attr(data-tooltip); position: absolute; left: calc(100% + 14px); top: 50%; z-index: 70; padding: 7px 10px; border-radius: 9px;
    background: #10231a; color: #fff; font: 600 12px 'DM Sans', sans-serif; white-space: nowrap; pointer-events: none; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5);
    opacity: 0; transform: translate(-6px, -50%); transition: opacity 150ms ease, transform 220ms var(--ease-out);
  }
  .sb-picker, .sb-account { position: relative; }
  .sb-picker-btn:hover::after, .sb-account-btn:hover::after { opacity: 1; transform: translate(0, -50%); }
  .sb-picker-btn[aria-expanded="true"]::after, .sb-account-btn[aria-expanded="true"]::after { opacity: 0; }

  .main { margin-left: calc(var(--sidebar-w) + 36px); max-width: none; background: transparent; padding: 30px 36px 56px 12px; min-height: 100dvh; border-radius: 0; }
}
@media (min-width: 1025px) and (max-height: 760px) {
  .sidebar, .sidebar:hover, .sidebar:focus-within { gap: 8px; padding-top: 12px; }
  .sidebar-brand-text { display: none; }
  .sb-nav { gap: 2px; }
  .sb-nav > .sb-link, .sb-group-head, .sb-group-head .sb-group-link { min-height: 50px; padding-top: 5px; padding-bottom: 4px; }
  .sb-nav > .sb-link .sb-icon, .sb-group-head .sb-icon { width: 30px; height: 30px; padding: 7px; }
}

/* ── Tablet and phone: drawer ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { background: var(--cj-rail); box-shadow: var(--float-shadow); }
  .sidebar-toggle { box-shadow: 0 8px 20px -12px rgba(15, 35, 25, .5); transition: transform 180ms var(--ease-out); }
  .sidebar-toggle:active { transform: scale(.95); }
  .sb-account { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
  .sb-picker-pop { top: calc(100% + 8px); }
  .main { background: transparent; }
  .sb-preview-title { display: none; } /* the title belongs to the desktop flyout */
}

@media (prefers-reduced-motion: reduce) {
  .main > *, .kpi-grid > *, .metric-cards > *, .mkt-sections > *, .company-dashboard-grid > *, .page-cards > *,
  .sidebar, .sb-picker-pop, .sb-account-pop, .post-dialog[open], .modal-card, .status-msg { animation: none !important; }
  .btn:hover, .metric-card:hover, .integration-card:hover, .company-dash-card:hover, .page-card:hover, .oauth-card:hover, .account-card:hover,
  .list-row:hover, .sb-nav > .sb-link:hover .sb-icon, .sidebar-brand:hover .sidebar-logo { transform: none !important; }
}

/* ── Company switcher and account panel share the Companies flyout design ───
   Dark green panel with a lime edge, a white title over a divider, and light rows. */
.sb-picker-pop, .sb-account-pop {
  background: linear-gradient(160deg, #1b3327 0%, #0f1f17 100%); color: var(--sb-text);
  border: 1px solid var(--sb-pop-line); border-left: 1px solid rgba(216, 246, 90, .20); border-radius: 20px;
  padding: 14px; box-shadow: var(--float-shadow);
}
.sb-pop-head, .sb-account-head { border-bottom: 1px solid var(--sb-line); padding: 4px 8px 12px; margin-bottom: 6px; }
.sb-pop-head strong, .sb-account-head strong { color: var(--sb-text-strong); font: 700 16px 'Manrope', sans-serif; letter-spacing: -.02em; }
.sb-pop-head small, .sb-account-head small { color: var(--sb-muted); }
/* Rows */
.sb-option, .sb-account-pop .sb-account-item {
  color: var(--sb-text); border-radius: 12px; min-height: 44px; transition: background 150ms ease, color 150ms ease;
}
.sb-option:hover, .sb-option:focus, .sb-account-pop .sb-account-item:hover, .sb-account-pop .sb-account-item:focus {
  background: var(--sb-hover); color: var(--sb-text-strong);
}
.sb-option:focus-visible, .sb-account-pop .sb-account-item:focus-visible { box-shadow: inset 0 0 0 2px var(--lime); }
.sb-option .sb-picker-text strong { color: var(--sb-text-strong); }
.sb-option .sb-picker-text small { color: var(--sb-muted); }
.sb-option[aria-selected="true"] { background: var(--sb-active); box-shadow: inset 0 0 0 1px rgba(216, 246, 90, .14); }
.sb-option-check { color: var(--lime); }
.sb-option-empty { color: var(--sb-muted); }
.sb-option .sb-picker-mark:not(.is-company) { background: rgba(255, 255, 255, .08); color: var(--lime); box-shadow: none; }
.sb-picker-search { background: rgba(255, 255, 255, .06); color: var(--sb-muted); border: 1px solid var(--sb-line); }
.sb-picker-search:focus-within { border-color: rgba(216, 246, 90, .4); }
.sb-picker-search input { color: var(--sb-text-strong); }
.sb-picker-search input::placeholder { color: var(--sb-muted); }
.sb-picker-manage { color: var(--lime); border-top: 1px solid var(--sb-line); }
.sb-picker-manage:hover { color: #efff9c; }
.sb-account-pop .sb-account-item svg { color: var(--sb-muted); }
.sb-account-pop .sb-account-item:hover svg { color: var(--lime); }
.sb-account-label { color: var(--sb-muted); }
.sb-account-group { border-bottom: 1px solid var(--sb-line); }
.sb-account-pop .sb-account-item.sb-signout { color: #ff9b89; }
.sb-account-pop .sb-account-item.sb-signout svg { color: #ff9b89; }
.sb-account-pop .sb-account-item.sb-signout:hover { background: rgba(229, 77, 59, .14); color: #ffb8ab; }
/* The chosen company's workspace, first in the Companies menu */
.sb-link[data-workspace-link] { font-weight: 600; color: var(--sb-text-strong); }
.sb-link[data-workspace-link] .sb-icon { color: var(--lime); }

/* ── ConnectJerry+ logo: white "C" and lime hook on the brand's deep green tile ── */
.sidebar-logo {
  background: #0e281c; color: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(216, 246, 90, .22), 0 10px 22px -14px rgba(0, 0, 0, .7);
}
.sidebar-logo svg.cj-mark, .sidebar-brand .sidebar-logo svg.cj-mark { width: 74%; height: auto; color: #fff; }
@media (min-width: 1025px) {
  .sidebar-brand .sidebar-logo { width: 44px; height: 44px; }
  .sidebar-brand .sidebar-logo svg.cj-mark { width: 32px; height: auto; }
}

/* ── Roles: what a team member cannot use is not shown, including content that pages add later ── */
body[data-role]:not([data-role="admin"]) [data-admin-only] { display: none !important; }
body[data-role="developer"] [data-roles]:not([data-roles~="developer"]),
body[data-role="sales"] [data-roles]:not([data-roles~="sales"]) { display: none !important; }
body[data-role="sales"] [data-write] { display: none !important; }
fieldset.lock-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.lock-fieldset:disabled .form-input, fieldset.lock-fieldset:disabled input, fieldset.lock-fieldset:disabled select, fieldset.lock-fieldset:disabled textarea { cursor: default; }

/* ── Dashboard companies: name, status and a way into the workspace ── */
.company-dash-card.compact { gap: 16px; padding: 18px; cursor: pointer; }
.company-dash-card.compact .company-dash-header { align-items: center; gap: 12px; }
.company-dash-card.compact .company-dash-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.company-dash-card.compact .company-avatar { flex-shrink: 0; }
.company-dash-card.compact .company-dash-name { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.company-dash-card.compact .badge { flex-shrink: 0; white-space: nowrap; }
.company-dash-card.compact .company-dash-open { width: 100%; justify-content: center; }

/* ── Desktop rail: Companies stays still on hover, and its menu always fits the screen ── */
@media (min-width: 1025px) {
  .sidebar:hover .sb-group-head .sb-group-link:hover, .sidebar:focus-within .sb-group-head .sb-group-link:focus-visible,
  .sidebar:hover .sb-group-head .sb-group-link, .sidebar:focus-within .sb-group-head .sb-group-link {
    flex: 1 1 auto; width: 100%; min-width: 0; min-height: 58px; padding: 7px 2px 6px; gap: 5px; flex-direction: column; justify-content: center; transform: none;
  }
  .sb-group-head .sb-group-link .sb-text { white-space: nowrap; }
  /* Placed by bindFlyout(): anchored at --fly-top instead of centred, so it is never cut off. */
  .sb-group.depth-0.fly-placed > .sb-children { top: var(--fly-top); max-height: var(--fly-h); transform: translate(-12px, 0) scale(.98); }
  .sb-group.depth-0.fly-placed:hover > .sb-children, .sb-group.depth-0.fly-placed:focus-within > .sb-children { transform: translate(0, 0); }
  /* Hover bridge across the gap between the rail and the menu, as tall as the menu. */
  .sb-group.depth-0::after { width: 18px; }
  .sb-group.depth-0.fly-placed::after { top: var(--fly-top); bottom: auto; height: var(--fly-h); }
}

/* ── Desktop rail: the Companies menu fits without a scrollbar (Marketing and Tools links in two columns) ── */
@media (min-width: 1025px) {
  .sb-group.depth-0 > .sb-children { width: min(480px, calc(100vw - 150px)); scrollbar-width: none; }
  .sb-group.depth-0 > .sb-children::-webkit-scrollbar { display: none; }
  .sb-group.depth-0 > .sb-children .sb-children { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 4px; }
  .sb-group.depth-0 > .sb-children .sb-children .sb-link { min-height: 40px; padding: 8px 10px; }
  .sb-group.depth-0 > .sb-children .sb-children .sb-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ── Company switcher: every company is listed at full size, with no scroll bar ── */
.sb-picker-list { max-height: none; overflow: visible; }
/* Only if a very long list would run past the screen can it move, and even then no scroll bar is drawn. */
.sb-picker-pop { max-height: calc(100dvh - 32px); overflow-y: auto; scrollbar-width: none; }
.sb-picker-pop::-webkit-scrollbar { display: none; }

/* ── Desktop rail: the Companies menu always shows every link; Marketing and Tools are plain headings ── */
@media (min-width: 1025px) {
  .sidebar .sb-group.depth-0 > .sb-children .sb-group > .sb-children { display: grid !important; }
  .sb-group.depth-0 > .sb-children .sb-toggle.depth-1 { pointer-events: none; cursor: default; }
  .sb-group.depth-0 > .sb-children .sb-toggle.depth-1 .sb-chevron { display: none; }
}

/* ── Desktop rail: on any page inside Companies, its lime tile keeps a dark icon (it was lime on lime) ── */
@media (min-width: 1025px) {
  .sidebar .sb-group.has-active > .sb-group-head .sb-group-link .sb-icon,
  .sidebar .sb-group.has-active > .sb-group-head .sb-group-link:not(.active) .sb-icon { color: #10231a; }
}

/* ── While the company switcher is open, the Companies menu (and its hover strip) stays closed ── */
@media (min-width: 1025px) {
  body.picker-open .sb-group.depth-0 > .sb-children { visibility: hidden !important; opacity: 0 !important; pointer-events: none !important; }
  body.picker-open .sb-group.depth-0::after { display: none; }
}

/* ── Dashboard hero and date-range menu (admin dashboard and client portal) ── */
/* Hero: greeting, period, quick actions and headline numbers */
.dash-hero {
  position: relative; overflow: hidden; isolation: isolate; border-radius: 26px; padding: 30px 32px; margin-bottom: 22px; color: #eaf3ed;
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 28px; align-items: center;
  background: linear-gradient(135deg, #173a2b 0%, #10271d 55%, #0c1d15 100%);
  box-shadow: 0 30px 60px -30px rgba(6, 30, 18, .65), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.dash-hero::before, .dash-hero::after { content: ''; position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; }
.dash-hero::before { width: 420px; height: 420px; right: -120px; top: -210px; background: radial-gradient(circle, rgba(216, 246, 90, .28) 0%, transparent 68%); animation: heroGlow 9s ease-in-out infinite alternate; }
.dash-hero::after { width: 360px; height: 360px; left: -140px; bottom: -220px; background: radial-gradient(circle, rgba(45, 180, 115, .30) 0%, transparent 70%); }
.dash-hero-rings { position: absolute; z-index: -1; right: 26%; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .06); box-shadow: 0 0 0 36px rgba(255, 255, 255, .025), 0 0 0 72px rgba(255, 255, 255, .02); pointer-events: none; }
@keyframes heroGlow { from { transform: translate(0, 0) scale(1); } to { transform: translate(-30px, 20px) scale(1.08); } }
.dash-hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #b9d8c6; margin: 0 0 10px; }
.dash-hero-eyebrow .live { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 0 rgba(216, 246, 90, .6); animation: livePulse 2.4s ease-out infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(216, 246, 90, .55); } 70% { box-shadow: 0 0 0 10px rgba(216, 246, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(216, 246, 90, 0); } }
.dash-hero-title { font: 800 clamp(26px, 2.6vw, 36px)/1.15 'Manrope', sans-serif; letter-spacing: -.04em; color: #fff; margin: 0 0 8px; }
.dash-hero-title em { font-style: normal; background: linear-gradient(90deg, #e6fb7a, #9fe38a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dash-hero-sub { font-size: 14.5px; line-height: 1.6; color: #b8cdc0; margin: 0 0 20px; max-width: 520px; }
.dash-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-select { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px 0 14px; border-radius: 12px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); color: #fff; transition: background 180ms ease, border-color 180ms ease; }
.hero-select:hover { background: rgba(255, 255, 255, .12); }
.hero-select:focus-within { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(216, 246, 90, .2); }
.hero-select svg { width: 17px; height: 17px; color: var(--lime); }
.main .hero-select select { border: 0 !important; background: transparent; color: #fff; min-height: 42px; padding: 0 8px; font: 600 14px 'DM Sans', sans-serif; box-shadow: none !important; cursor: pointer; }
.main .hero-select select option { color: var(--ink); }
/* Date range menu (same dark style as the sidebar menus) */
.period-menu { position: relative; }
.period-btn { cursor: pointer; font: 600 14px 'DM Sans', sans-serif; padding: 0 12px 0 14px; }
.period-btn:focus-visible { outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px rgba(216, 246, 90, .2); }
.period-btn[aria-expanded="true"] { border-color: var(--lime); background: rgba(255, 255, 255, .12); }
.period-btn svg:last-child { width: 15px; height: 15px; color: #cfe0d6; transition: transform 200ms ease; }
.period-btn[aria-expanded="true"] svg:last-child { transform: rotate(180deg); }
.period-btn-text { white-space: nowrap; }
/* Moved to <body> and fixed to the window by the script, so the rounded hero panel cannot clip it. */
.period-pop { position: fixed; top: 0; left: 0; z-index: 60; width: 260px; padding: 8px; border-radius: 16px;
  background: linear-gradient(160deg, #1b3327 0%, #0f1f17 100%); border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 24px 50px -16px rgba(0, 0, 0, .55);
  animation: periodIn 180ms cubic-bezier(.16, 1, .3, 1); }
@keyframes periodIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.period-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.period-list li { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 12px; border-radius: 10px; color: #dbe7df; font-size: 14px; font-weight: 500; cursor: pointer; transition: background 140ms ease, color 140ms ease; }
.period-list li:hover, .period-list li:focus { background: rgba(255, 255, 255, .07); color: #fff; outline: none; }
.period-list li:focus-visible { box-shadow: inset 0 0 0 2px var(--lime); }
.period-list li[aria-selected="true"] { background: rgba(216, 246, 90, .1); color: #fff; font-weight: 600; }
.period-list li[aria-selected="true"]::after { content: ''; width: 16px; height: 16px; background: var(--lime);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat; }
.period-list li[data-value="custom"] { margin-top: 4px; border-top: 1px solid rgba(255, 255, 255, .08); border-radius: 0 0 10px 10px; padding-top: 2px; }
.period-custom { margin-top: 8px; padding: 10px 6px 4px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 10px; }
.period-dates { display: grid; grid-template-columns: 1fr; gap: 8px; }
.period-dates label { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 11.5px; font-weight: 600; color: #a9c3b4; }
body .period-pop .period-dates input { width: 100%; min-height: 38px; padding: 0 8px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .16) !important; background: rgba(255, 255, 255, .06); color: #fff; font: 500 13px 'DM Sans', sans-serif; color-scheme: dark; box-shadow: none !important; }
body .period-pop .period-dates input:focus { border-color: var(--lime) !important; outline: none; }
.period-error { margin: 0; font-size: 12.5px; color: #ffb3a5; }
.btn.period-apply { width: 100%; justify-content: center; min-height: 38px; background: var(--cj-lime-grad); color: #10231a; border: 0; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .period-pop { animation: none; } .period-btn svg:last-child { transition: none; } }
.btn.hero-btn { min-height: 44px; }
.btn.hero-btn.primary { background: var(--cj-lime-grad); color: #10231a; border: 1px solid rgba(255, 255, 255, .4); box-shadow: 0 10px 24px -12px rgba(216, 246, 90, .8); }
.btn.hero-btn.primary:hover { background: linear-gradient(140deg, #efff96 0%, #c6f26b 100%); box-shadow: 0 14px 28px -12px rgba(216, 246, 90, .9); }
.btn.hero-btn.ghost { background: rgba(255, 255, 255, .06); color: #fff; border: 1px solid rgba(255, 255, 255, .16); box-shadow: none; }
.btn.hero-btn.ghost:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .26); }
.dash-hero-stats { display: grid; grid-template-columns: minmax(160px, 220px); justify-content: end; gap: 12px; }
.hero-stat { border-radius: 18px; padding: 16px 16px 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(6px); display: grid; gap: 4px; transition: transform 260ms var(--ease-out), background 200ms ease; }
.hero-stat:hover { transform: translateY(-3px); background: rgba(255, 255, 255, .1); }
.hero-stat svg { width: 18px; height: 18px; color: var(--lime); margin-bottom: 6px; }
.hero-stat strong { font: 800 26px/1.1 'Manrope', sans-serif; letter-spacing: -.04em; color: #fff; font-variant-numeric: tabular-nums; }
.hero-stat span { font-size: 12px; color: #a9c3b4; line-height: 1.35; }
@media (max-width: 1200px) { .dash-hero { grid-template-columns: 1fr; } .dash-hero-stats { justify-content: start; } }
@media (max-width: 640px) { .dash-hero { padding: 22px 18px; border-radius: 22px; } .dash-hero-stats { grid-template-columns: 1fr; } .dash-hero-actions > * { flex: 1 1 auto; justify-content: center; } }
@media (prefers-reduced-motion: reduce) { .dash-hero::before, .dash-hero-eyebrow .live { animation: none; } .hero-stat:hover { transform: none; } }
/* The same date-range button on a light page header (client portal report pages) */
.period-btn.on-light { background: #fff; border-color: var(--card-border); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 35, 25, .05); }
.period-btn.on-light:hover { background: #f6faf7; border-color: #b9dcc7; }
.period-btn.on-light svg { color: var(--green); }
.period-btn.on-light svg:last-child { color: var(--muted); }
.period-btn.on-light[aria-expanded="true"] { border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px rgba(21, 122, 82, .12); }

/* ── Sidebar: only the page you are on is highlighted ── */
/* The company workspace link looks like any other link until it is the page you are on. */
.sb-link[data-workspace-link]:not(.active) { font-weight: 500; color: var(--sb-text); }
.sb-link[data-workspace-link]:not(.active) .sb-icon { color: inherit; }
/* A section (Companies, Marketing, Tools) is not highlighted just because it holds the current page. */
.sb-group.has-active > .sb-toggle .sb-icon,
.sb-group.has-active > .sb-group-head .sb-group-link:not(.active) .sb-icon { color: inherit; }
@media (min-width: 1025px) {
  /* On the rail the pages inside Companies sit in its hover menu, so Companies keeps only a thin outline as a location hint. */
  .sidebar .sb-group.has-active > .sb-group-head .sb-group-link:not(.active) { background: none; }
  .sidebar .sb-group.has-active > .sb-group-head .sb-group-link:not(.active) .sb-icon { background: rgba(255, 255, 255, .05); color: #b9c9bf; box-shadow: inset 0 0 0 1.5px rgba(216, 246, 90, .45); }
  .sidebar .sb-group.has-active > .sb-group-head .sb-group-link:not(.active) .sb-text { color: #a9bbb0; }
  .sidebar .sb-group.has-active > .sb-group-head .sb-group-link:not(.active):hover .sb-icon { background: rgba(255, 255, 255, .1); color: #fff; }
  /* The company switcher tile is neutral, so it is not mistaken for the selected page. */
  .sidebar .sb-picker-btn .sb-picker-mark, .sidebar .sb-picker-btn .sb-picker-mark.is-company { background: rgba(255, 255, 255, .08); color: #eaf3ed; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
  .sidebar .sb-picker-btn:hover .sb-picker-mark { background: rgba(255, 255, 255, .14); }
}
@media (min-width: 1025px) {
  /* The signed-in account stands out: a round lime avatar with a glowing ring and a "signed in" dot
     (round, so it is not mistaken for the square tile of the selected page), on a lime-tinted card. */
  .sidebar .sb-account-btn { background: linear-gradient(160deg, rgba(216, 246, 90, .16) 0%, rgba(216, 246, 90, .05) 100%); border-color: rgba(216, 246, 90, .32);
    box-shadow: 0 12px 26px -16px rgba(216, 246, 90, .55), inset 0 1px 0 rgba(255, 255, 255, .06); }
  .sidebar .sb-account-btn:hover, .sidebar .sb-account-btn[aria-expanded="true"] { background: linear-gradient(160deg, rgba(216, 246, 90, .24) 0%, rgba(216, 246, 90, .08) 100%); border-color: rgba(216, 246, 90, .55); }
  .sidebar .sb-account-btn .sb-avatar { position: relative; border-radius: 50%; background: var(--cj-lime-grad); color: #10231a;
    box-shadow: 0 0 0 3px rgba(16, 35, 26, .9), 0 0 0 5px rgba(216, 246, 90, .55), 0 10px 22px -8px rgba(216, 246, 90, .9); transition: box-shadow 200ms ease, transform 220ms var(--ease-out); }
  .sidebar .sb-account-btn .sb-avatar::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: #3ddc84; border: 2px solid #10231a; }
  .sidebar .sb-account-btn:hover .sb-avatar, .sidebar .sb-account-btn[aria-expanded="true"] .sb-avatar { box-shadow: 0 0 0 3px rgba(16, 35, 26, .9), 0 0 0 5px rgba(216, 246, 90, .85), 0 12px 26px -8px rgba(216, 246, 90, 1); transform: translateY(-1px); }
  .sidebar .sb-account-btn .sb-account-text strong { color: #f4ffd6; font-weight: 700; }
  @media (prefers-reduced-motion: reduce) { .sidebar .sb-account-btn .sb-avatar { transition: none; } .sidebar .sb-account-btn:hover .sb-avatar { transform: none; } }
}


/* ── Tool pages shown inside the company workspace (?embed=1) ── */
.cp-embedded body { background: transparent; }
.cp-embedded .sidebar, .cp-embedded .sidebar-toggle, .cp-embedded .breadcrumb, .cp-embedded #workspace-link { display: none !important; }
.cp-embedded .main, .cp-embedded body .main { margin: 0 !important; padding: 4px 4px 32px !important; max-width: none !important; min-height: 0 !important; border-radius: 0; }
.cp-embedded .page-header { margin-bottom: 18px; }

/* ── Loading layer over a report (date range changes, refresh) ── */
.report-panel, .portal-view-wrap { position: relative; }
.report-panel.is-loading { min-height: 320px; }
.cp-loading { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center; align-items: flex-start; padding-top: 72px;
  background: rgba(255, 255, 255, .7); backdrop-filter: blur(1.5px); border-radius: 0 0 var(--radius-card) var(--radius-card); animation: cpFade 160ms ease both; }
.cp-loading-card { position: sticky; top: 45vh; display: inline-flex; align-items: center; gap: 12px; padding: 12px 20px 12px 16px; border-radius: 99px; background: #fff;
  border: 1px solid var(--card-border); box-shadow: 0 18px 40px -18px rgba(15, 35, 25, .45); font: 600 14px 'DM Sans', sans-serif; color: var(--ink); }
.cp-spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--green-bg, #e7f5ed); border-top-color: var(--green); animation: cpSpin .75s linear infinite; flex-shrink: 0; }
.cp-spinner.sm { width: 16px; height: 16px; border-width: 2px; }
.cp-loading-block { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 72px 0; color: var(--text-2); font: 600 14px 'DM Sans', sans-serif; }
@keyframes cpSpin { to { transform: rotate(360deg); } }
@keyframes cpFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cp-spinner { animation-duration: 1.6s; } .cp-loading { animation: none; } }

/* ── Company logo field (company create/edit forms) ── */
.logo-field-group { grid-column: 1 / -1; }
.logo-field { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px; border: 1px dashed var(--card-border); border-radius: 14px; background: var(--bg); }
.logo-field-preview { width: 112px; height: 72px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px; background: #fff; border: 1px solid var(--card-border); color: var(--muted); overflow: hidden; }
.logo-field-preview svg { width: 26px; height: 26px; }
.logo-field-preview img { max-width: 92%; max-height: 84%; object-fit: contain; }
.logo-field-body { display: grid; gap: 8px; min-width: 0; flex: 1 1 220px; }
.logo-field-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.logo-field-actions .btn svg { width: 15px; height: 15px; }
.logo-field-remove { color: var(--red-text); }
.logo-field-hint { font-size: 12px; color: var(--muted); }
.logo-field-hint.is-error { color: var(--red-text); font-weight: 600; }

/* Selected company logo in the sidebar company switcher: square logos fill the tile, wide ones get a wider white tile. */
.sidebar .sb-picker-btn .sb-picker-mark.has-logo { overflow: hidden; background: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .14); padding: 0; }
.sidebar .sb-picker-btn .sb-picker-mark.has-logo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sidebar .sb-picker-btn .sb-picker-mark.has-logo.logo-wide { width: auto; min-width: 36px; max-width: 70px; padding: 4px 5px; }
.sidebar .sb-picker-btn .sb-picker-mark.has-logo.logo-wide img { width: auto; max-width: 60px; height: 22px; object-fit: contain; }
