/*
 * main.css — Klaviyo Tools
 * Delt stylesheet for alle sider og tools
 * Importér med: <link rel="stylesheet" href="/assets/css/main.css" />
 */

/* ── GOOGLE FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

/* ── RESET ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── DESIGN TOKENS ── */
:root {
  /* Backgrounds */
  --bg:           #f5f6fa;
  --surface:      #ffffff;
  --surface-2:    #f9fafb;

  /* Borders */
  --border:       #e8eaf0;
  --border-focus: #a0aec0;

  /* Text */
  --text:         #1a1d23;
  --text-dim:     #6b7280;
  --text-muted:   #9ca3af;

  /* Accent colours (one per tool) */
  --accent:       #4CAF82;   /* Green  — Weather */
  --accent-bg:    #edf7f2;
  --accent2:      #7C6FCD;   /* Purple — Winner  */
  --accent2-bg:   #f0eefb;
  --accent3:      #E87B4A;   /* Orange — Typo Merge */
  --accent3-bg:   #fef2eb;
  --accent4:      #4A9EE8;   /* Blue   — Lead Ad Value */
  --accent4-bg:   #eaf3fd;

  /* Status */
  --ok:           #047857;
  --ok-bg:        #ecfdf5;
  --ok-border:    #bbf7d0;
  --bad:          #b91c1c;
  --bad-bg:       #fff1f2;
  --bad-border:   #fecdd3;
  --warn:         #92400e;
  --warn-bg:      #fffbeb;
  --warn-border:  #fde68a;

  /* Layout */
  --sidebar-w:    224px;
  --nav-h:        60px;
  --content-pad:  2rem;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 18px rgba(0,0,0,0.08);
}

/* ── BASE ── */
html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT SHELL ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  overflow-y: auto;
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── SIDEBAR LOGO ── */
.sidebar-logo {
  padding: 0 1.25rem;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 12px; /* evt. lidt større spacing */
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.logo-icon {
  height: 30px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-text {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── SIDEBAR NAVIGATION ── */
.sidebar-section {
  padding: 1.25rem 0.75rem 0.5rem;
}

.sidebar-section-label {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 0.5rem;
  margin-bottom: 0.4rem;
  display: block;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.845rem;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  margin-bottom: 1px;
}

.sidebar-link:hover {
  background: var(--bg);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--accent-bg);
  color: var(--accent);
}

.sidebar-link.active-purple { background: var(--accent2-bg); color: var(--accent2); }
.sidebar-link.active-orange { background: var(--accent3-bg); color: var(--accent3); }
.sidebar-link.active-blue   { background: var(--accent4-bg); color: var(--accent4); }

.link-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.coming-pill {
  margin-left: auto;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent2-bg);
  color: var(--accent2);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--content-pad);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb strong {
  color: var(--text);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-badge {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* ── MENU BUTTON (mobile) ── */
.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ── SIDEBAR OVERLAY (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 49;
}

.sidebar-overlay.visible {
  display: block;
}

/* ── CONTENT AREA ── */
.content {
  padding: var(--content-pad);
  flex: 1;
}

/* ── PAGE HEADER ── */
.page-header {
  margin-bottom: 1.75rem;
}

.page-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.page-header p {
  font-size: 0.865rem;
  color: var(--text-dim);
}

/* ── SECTION HEADER ── */
.section-header {
  margin-bottom: 1rem;
}

.section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.section-sub {
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 1rem;
}

/* ── STAT CARDS ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.stat-icon.green  { background: var(--accent-bg); }
.stat-icon.purple { background: var(--accent2-bg); }
.stat-icon.orange { background: var(--accent3-bg); }
.stat-icon.blue   { background: var(--accent4-bg); }

.stat-label {
  font-size: 0.77rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ── TOOL CARDS (homepage grid) ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tool-card:hover {
  border-color: #cdd2dc;
  box-shadow: var(--shadow-md);
}

.tool-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.tool-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.tool-card-arrow {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.tool-card:hover .tool-card-arrow {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.tool-card-name {
  font-size: 0.955rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.tool-card-desc {
  font-size: 0.815rem;
  color: var(--text-dim);
  line-height: 1.62;
}

/* ── COMING SOON CARDS ── */
.coming-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.coming-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  opacity: 0.65;
}

.coming-badge {
  font-size: 0.63rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent2-bg);
  color: var(--accent2);
  padding: 2px 8px;
  border-radius: 4px;
  width: fit-content;
}

.coming-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.coming-desc {
  font-size: 0.79rem;
  color: var(--text-dim);
  line-height: 1.55;
}

.idea-card {
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.4rem;
  min-height: 110px;
}

.idea-card .plus {
  font-size: 1.3rem;
  color: var(--text-muted);
}

.idea-card p {
  font-size: 0.79rem;
  color: var(--text-muted);
}

.idea-card a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.idea-card a:hover {
  text-decoration: underline;
}

/* ── TAGS ── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 0.695rem;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 5px;
}

/* ── FORM ELEMENTS ── */
label {
  display: block;
  font-weight: 600;
  font-size: 0.855rem;
  color: var(--text);
  margin-bottom: 6px;
}

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(76,175,130,0.1);
}

.input-has-icon {
  padding-right: 40px;
}

.input-wrap {
  position: relative;
}

.input-suffix-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 11px;
  transition: background 0.12s, color 0.12s;
}

.input-suffix-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.checkbox-row label {
  margin-bottom: 0;
  font-weight: 500;
  cursor: pointer;
}

/* ── DROPDOWN ── */
.dropdown-wrap {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.dropdown-menu.open {
  display: block;
}

.dropdown-item {
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-size: 0.845rem;
  transition: background 0.1s;
}

.dropdown-item:hover {
  background: var(--bg);
}

.dropdown-item-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.dropdown-item-id {
  font-family: ui-monospace, Menlo, monospace;
  color: var(--text-muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}

.dropdown-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.855rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

/* Primary CTA er altid samme grønne på tværs af tools — uafhængig af tool-accent */
.btn-primary {
  background: #4CAF82;
  color: white;
  border-color: #4CAF82;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(0.92);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-purple {
  background: var(--accent2);
  color: white;
  border-color: var(--accent2);
}

.btn-purple:hover {
  background: #6a5eb8;
  border-color: #6a5eb8;
}

.btn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ── STATUS BANNERS ── */
.status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.845rem;
  font-weight: 600;
  border: 1px solid;
}

.status-banner.ok {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok-border);
}

.status-banner.bad {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: var(--bad-border);
}

.status-banner.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: var(--warn-border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── TABLES ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.845rem;
}

thead th {
  background: var(--bg);
  color: var(--text-muted);
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg);
}

code.pill {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 5px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ── SECTION DIVIDER ── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── TOOL HEADER ── */
.tool-header {
  margin-bottom: 1.5rem;
}

.tool-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.tool-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
  letter-spacing: -0.01em;
}

.tool-header p {
  font-size: 0.845rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ── STEP LABELS ── */
.step-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* ── FOOTER ── */
.footer {
  padding: 1.4rem var(--content-pad);
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer p {
  font-size: 0.77rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.12s;
}

.footer a:hover {
  color: var(--accent);
}

/* ── DETAILS/DEBUG ── */
details {
  margin-top: 1rem;
  font-size: 0.815rem;
}

details summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  padding: 6px 0;
}

details pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── UTILITIES ── */
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.font-mono     { font-family: ui-monospace, Menlo, monospace; }
.tabular-nums  { font-variant-numeric: tabular-nums; }
.hidden        { display: none !important; }

/* ═══════════════════════════════════════
   RESPONSIVE — MOBILE
   ═══════════════════════════════════════ */

@media (max-width: 768px) {
  body { display: block; }

  /* Sidebar becomes off-canvas drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 60;
  }

  .sidebar.open {
    transform: translateX(0);
  }

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

  /* Show hamburger */
  .menu-btn { display: flex; }

  /* Hide badge in topbar */
  .topbar-badge { display: none; }

  /* Topbar & content padding */
  .topbar { padding: 0 1rem; }
  .content { padding: 1.25rem 1rem; }

  /* Grids collapse */
  .stats-row        { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .tools-grid       { grid-template-columns: 1fr; gap: 0.75rem; }
  .coming-grid      { grid-template-columns: 1fr; gap: 0.75rem; }
  .form-row         { grid-template-columns: 1fr; }

  /* Footer stack */
  .footer { flex-direction: column; align-items: flex-start; }

  .page-header h1 { font-size: 1.15rem; }
}

@media (max-width: 420px) {
  .stats-row { grid-template-columns: 1fr; }
  .btn-actions .btn { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════
   OAUTH AUTH WIDGET (topbar)
   ═══════════════════════════════════════ */

.kt-auth-widget {
  display: flex;
  align-items: center;
}

/* Forbundet pill */
.kt-connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
}

.kt-connection-pill.kt-connected {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok-border);
}

.kt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: ktpulse 2s ease-in-out infinite;
}

@keyframes ktpulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.kt-account-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kt-disconnect-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: currentColor;
  opacity: 0.6;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  border-radius: 3px;
  transition: opacity 0.12s;
  flex-shrink: 0;
}

.kt-disconnect-btn:hover { opacity: 1; }

/* Forbind-knap */
.kt-connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.775rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}

.kt-connect-btn:hover {
  background: #3d9e72;
  color: white;
}

/* ── Tool-sider: connect gate ── */
/* Vises når bruger ikke er forbundet og prøver at bruge et tool */
.kt-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  gap: 1rem;
}

.kt-gate-icon {
  font-size: 2.5rem;
}

.kt-gate h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.kt-gate p {
  font-size: 0.865rem;
  color: var(--text-dim);
  max-width: 380px;
  margin: 0;
}

/* ═══════════════════════════════════════
   TOOL COLOR THEMING
   Hver tool-side sætter en klasse på <body> (fx tool-blue)
   som ændrer --tool-accent + --tool-accent-bg globalt.
   Alle komponenter nedenfor respekterer disse variabler.
   ═══════════════════════════════════════ */

body                 { --tool-accent: var(--accent);  --tool-accent-bg: var(--accent-bg); }
body.tool-green      { --tool-accent: var(--accent);  --tool-accent-bg: var(--accent-bg); }
body.tool-purple     { --tool-accent: var(--accent2); --tool-accent-bg: var(--accent2-bg); }
body.tool-orange     { --tool-accent: var(--accent3); --tool-accent-bg: var(--accent3-bg); }
body.tool-blue       { --tool-accent: var(--accent4); --tool-accent-bg: var(--accent4-bg); }

/* Tool-kolorerede elementer — bruger CSS var så de følger body-klassen */
body.tool-purple .sidebar-link.active,
body.tool-orange .sidebar-link.active,
body.tool-blue   .sidebar-link.active {
  background: var(--tool-accent-bg);
  color: var(--tool-accent);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--tool-accent, var(--border-focus));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tool-accent, var(--accent)) 12%, transparent);
}

/* ═══════════════════════════════════════
   AUTH PILL (forbindelsesstatus)
   ═══════════════════════════════════════ */
.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid;
  margin-bottom: 0.75rem;
}
.auth-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.auth-pill.ok   { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-border); }
.auth-pill.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.auth-pill.bad  { background: var(--bad-bg);  color: var(--bad);  border-color: var(--bad-border); }

/* ═══════════════════════════════════════
   DROPDOWN MED SØGEFELT
   Bruges i alle søge-dropdowns (metrics, lister, segmenter)
   ═══════════════════════════════════════ */
.dropdown-search {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dropdown-search-icon {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}
.dropdown-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.84rem;
  color: var(--text);
  background: transparent;
  padding: 4px 0;
  width: 100%;
}
.dropdown-search-input::placeholder { color: var(--text-muted); }

.dropdown-empty {
  padding: 14px 14px;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

/* Dropdown item — fremhæv valgt */
.dropdown-item.selected:not(.multi) {
  background: var(--tool-accent-bg);
  color: var(--tool-accent);
}
.dropdown-item.selected:not(.multi) .dropdown-item-name {
  color: var(--tool-accent);
}

/* Multi-select dropdown item med checkbox */
.dropdown-item.multi { padding-left: 12px; }
.dropdown-item.multi .checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  margin-right: 12px;
  flex-shrink: 0;
  transition: all 0.12s;
}
.dropdown-item.multi.selected .checkbox {
  background: var(--tool-accent);
  border-color: var(--tool-accent);
}
.dropdown-item.multi .dropdown-item-name { flex: 1; }

/* ═══════════════════════════════════════
   PERIOD PILLS (tidsperiode-chips)
   ═══════════════════════════════════════ */
.period-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.period-pill {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all 0.12s;
}
.period-pill:hover:not(.active) {
  border-color: var(--border-focus);
  color: var(--text);
}
.period-pill.active {
  background: var(--tool-accent-bg);
  border-color: var(--tool-accent);
  color: var(--tool-accent);
}

/* ═══════════════════════════════════════
   TONE CHIPS (genbrugelige tag-knapper)
   ═══════════════════════════════════════ */
.tone-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tone-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.tone-chip.active {
  background: var(--tool-accent-bg);
  border-color: var(--tool-accent);
  color: var(--tool-accent);
}
.tone-chip:hover:not(.active) {
  border-color: var(--border-focus);
  color: var(--text);
}

/* ═══════════════════════════════════════
   TOGGLE-GROUP (flere knapper side om side)
   ═══════════════════════════════════════ */
.toggle-group {
  display: flex;
  gap: 6px;
}
.toggle-btn {
  flex: 1;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  font-size: 0.815rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
}
.toggle-btn.active {
  background: var(--tool-accent-bg);
  border-color: var(--tool-accent);
  color: var(--tool-accent);
}
.toggle-btn:hover:not(.active) {
  border-color: var(--border-focus);
  color: var(--text);
}

/* ═══════════════════════════════════════
   DROPZONE (CSV upload)
   ═══════════════════════════════════════ */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem 1.25rem;
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover,
.dropzone.has-file {
  border-color: var(--tool-accent);
  background: var(--tool-accent-bg);
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.dropzone-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.dropzone-label {
  font-size: 0.845rem;
  color: var(--text-dim);
}
.dropzone-label strong {
  color: var(--text);
  display: block;
  margin-bottom: 2px;
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════ */
.progress-bar-wrap {
  background: var(--border);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress-bar {
  height: 100%;
  background: var(--tool-accent);
  border-radius: 20px;
  width: 0%;
  transition: width 0.3s ease;
}
.progress-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

/* Fetch-progress (til paginated API fetches) */
.fetch-progress {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--tool-accent-bg);
  border: 1px solid var(--tool-accent);
  border-radius: var(--radius-sm);
}
.fetch-progress.visible { display: flex; }
.fetch-progress-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.fetch-progress-bar {
  height: 100%;
  background: var(--tool-accent);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}
.fetch-progress-label {
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--tool-accent);
}

/* ═══════════════════════════════════════
   DATE INPUT STYLING
   ═══════════════════════════════════════ */
input[type="date"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  color-scheme: light;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.12s;
}
input[type="date"]:hover::-webkit-calendar-picker-indicator {
  opacity: 1;
}

.date-range-custom {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

/* ═══════════════════════════════════════
   SPINNER & SKELETON
   ═══════════════════════════════════════ */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: kt-spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-dark {
  border-color: var(--border);
  border-top-color: var(--tool-accent);
}
@keyframes kt-spin { to { transform: rotate(360deg); } }

.skeleton {
  height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg) 25%, var(--border) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: kt-shimmer 1.4s infinite;
}
.skeleton-wrap { display: flex; flex-direction: column; gap: 6px; }
@keyframes kt-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════
   RESULT HIGHLIGHT (stor resultatbanner)
   ═══════════════════════════════════════ */
.result-highlight {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.result-highlight-label {
  font-size: 0.845rem;
  color: var(--ok);
  font-weight: 600;
}
.result-highlight-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ok);
  letter-spacing: -0.03em;
}

/* ═══════════════════════════════════════
   METRIC GRID / METRIC CARDS
   ═══════════════════════════════════════ */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.metric-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.metric-card-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}
.metric-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.metric-card-value.green  { color: var(--ok); }
.metric-card-value.blue   { color: var(--accent4); }
.metric-card-value.purple { color: var(--accent2); }
.metric-card-value.orange { color: var(--accent3); }
.metric-card-value.accent { color: var(--tool-accent); }
.metric-card-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 3px;
}

@media (max-width: 768px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .metric-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════
   RESULT STATS (mindre stats-bokse)
   ═══════════════════════════════════════ */
.result-stat-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.result-stat-box {
  flex: 1;
  min-width: 100px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  text-align: center;
}
.result-stat-box .val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}
.result-stat-box .lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.result-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.result-stat-grid .result-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.result-stat .lbl {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.result-stat .val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.result-stat .val.green { color: var(--ok); }
.result-stat .val.red   { color: var(--bad); }
@media (max-width: 768px) {
  .result-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════
   TWO-COL LAYOUT HELPER
   ═══════════════════════════════════════ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════
   BADGES (auto / manual / info)
   ═══════════════════════════════════════ */
.badge {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge.auto   { background: var(--ok-bg);   color: var(--ok);   border: 1px solid var(--ok-border); }
.badge.manual { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }

/* ═══════════════════════════════════════
   MULTI-WARN BANNER (advarsel om dobbelttælling osv.)
   ═══════════════════════════════════════ */
.multi-warn {
  font-size: 0.755rem;
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
  display: none;
}
.multi-warn.visible { display: block; }
