/* Kanban — layout */
.kanban-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px 32px;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
}

.kanban-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

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

.kanban-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: #999;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}

.kanban-tab:hover { color: #666; background: transparent; }
.kanban-tab.active {
  background: transparent;
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}
.kanban-tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.kanban-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 0;
}

.kanban-main {
  flex: 1;
  overflow: hidden;
  padding-top: 16px;
}

.kanban-board {
  display: flex;
  gap: 16px;
  height: 100%;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-column {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  max-height: 100%;
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 13px;
}

.kanban-column-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.kanban-column-count {
  background: rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
}

.kanban-card-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 40px;
}

.kanban-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  padding: 12px;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
  font-size: 13px;
}
.kanban-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.kanban-card.dragging { opacity: 0.5; cursor: grabbing; }

.kanban-card-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #0f172a;
}
.kanban-card-meta {
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}
.kanban-card-arr {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 6px;
  background: #dcfce7;
  color: #166534;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
}

.kanban-column.drag-over { background: #e0e7ff; }

.kanban-add-card-btn {
  background: transparent;
  border: 1px dashed rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 8px;
  margin-top: 4px;
  cursor: pointer;
  color: #64748b;
  font-family: inherit;
  font-size: 12px;
  transition: all 0.15s;
}
.kanban-add-card-btn:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: rgba(0,0,0,0.02);
}

.kanban-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.kanban-empty {
  padding: 60px;
  text-align: center;
  color: #94a3b8;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0,0,0,0.08);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Form styling (used by kanban-bedrift.js) */
.kanban-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: 'Outfit', sans-serif;
}
.kanban-form h2 {
  font-size: 18px; font-weight: 600; margin: 0 0 8px;
}
.kanban-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: #64748b;
}

/* Override column-stacking for B2B calculator labels (higher specificity) */
.kanban-form .b2b-pkg-row,
.kanban-form .b2b-row-main,
.kanban-form .b2b-lock-toggle,
.kanban-form .b2b-arr-override,
.kanban-form .b2b-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.kanban-form .b2b-pkg-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
}
.kanban-form .b2b-section label,
.kanban-form .b2b-arr-section label {
  color: #0f172a;
  font-size: 13px;
}
.kanban-form input, .kanban-form textarea {
  font-family: inherit; font-size: 14px;
  padding: 8px 10px; border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px; color: #0f172a;
}
.kanban-form input:focus, .kanban-form textarea:focus {
  outline: none; border-color: var(--text-primary);
}
.kanban-form fieldset {
  border: 1px solid rgba(0,0,0,0.08); border-radius: 8px;
  padding: 10px 12px;
}
.kanban-form legend {
  font-size: 12px; color: #64748b; padding: 0 4px;
}
.kanban-check {
  display: inline-flex !important; flex-direction: row !important;
  gap: 6px; margin-right: 12px; font-size: 13px; color: #0f172a;
}
.kanban-form-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px;
}
.kanban-form-actions button {
  padding: 8px 16px; border-radius: 6px; border: none;
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.btn-save { background: var(--text-primary); color: #fff; }
.btn-cancel { background: transparent; color: #64748b; }
.btn-archive { background: transparent; color: #c0392b; margin-right: auto; }

/* Oversikt-fanen */
.kanban-board.oversikt-mode {
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  overflow-x: hidden;
}

.kanban-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.kanban-kpi {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kanban-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 500;
}

.kanban-kpi-value {
  font-size: 22px;
  font-weight: 600;
  color: #0f172a;
}

.kanban-action-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.kanban-action-col {
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 240px;
}

.kanban-action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
}

.kanban-action-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-left: 3px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.kanban-action-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.kanban-action-card.origin-b2b-bedrift { border-left-color: #3b82f6; }
.kanban-action-card.origin-b2b-idrettslag { border-left-color: #f97316; }
.kanban-action-card.origin-b2c-lead { border-left-color: #22c55e; }
.kanban-action-card.origin-interne-oppgaver { border-left-color: #94a3b8; }

@media (max-width: 1100px) {
  .kanban-action-board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kanban-action-board { grid-template-columns: 1fr; }
}

/* B2C Lead score badges */
.kanban-lead-score {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.kanban-lead-score.score-hot { background: #fee2e2; color: #991b1b; }
.kanban-lead-score.score-warm { background: #fef3c7; color: #854d0e; }
.kanban-lead-score.score-cold { background: #dbeafe; color: #1e40af; }

.kanban-form select {
  font-family: inherit; font-size: 14px;
  padding: 8px 10px; border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px; color: #0f172a; background: #fff;
}

/* Interne oppgaver */
.kanban-task-chips {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px;
}
.kanban-task-prio, .kanban-task-deadline {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.kanban-task-prio.prio-lav { background: #e2e8f0; color: #475569; }
.kanban-task-prio.prio-medium { background: #dbeafe; color: #1e40af; }
.kanban-task-prio.prio-hoy { background: #fef3c7; color: #854d0e; }
.kanban-task-prio.prio-kritisk { background: #fee2e2; color: #991b1b; }

.kanban-task-deadline.deadline-ok { background: #f1f5f9; color: #64748b; }
.kanban-task-deadline.deadline-soon { background: #fef3c7; color: #854d0e; }
.kanban-task-deadline.deadline-past { background: #fee2e2; color: #991b1b; }

.kanban-form input[type="date"] {
  font-family: inherit; font-size: 14px;
  padding: 8px 10px; border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px; color: #0f172a;
}

/* Nav badge */
.kanban-nav-badge {
  display: inline-block;
  margin-left: 8px;
  background: #dc2626;
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  vertical-align: middle;
}

/* Alert stripe on Oversikt */
.kanban-alert-stripe {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
}
.kanban-alert-stripe-header {
  font-weight: 600;
  color: #991b1b;
  margin-bottom: 8px;
  font-size: 13px;
}
.kanban-alert-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kanban-alert-item {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: #7f1d1d;
  align-items: baseline;
}
.kanban-alert-label {
  font-weight: 600;
  flex: 0 0 auto;
  padding: 2px 6px;
  background: rgba(220,38,38,0.08);
  border-radius: 4px;
}
.kanban-alert-title {
  color: #0f172a;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanban-alert-more {
  font-size: 11px;
  color: #7f1d1d;
  font-style: italic;
  margin-top: 4px;
}

/* ═══ B2B Calculator ═════════════════════════════════════════ */

/* Meta grid: compact 2-col top fields */
.b2b-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-bottom: 8px;
}
.b2b-meta-grid label {
  font-size: 11px;
}
.b2b-meta-grid input {
  font-size: 13px;
  padding: 6px 10px;
}

/* Collapsible sections */
.b2b-section {
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  margin-bottom: 6px;
  background: #fff;
  overflow: hidden;
}
.b2b-section > summary {
  cursor: pointer;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 12px;
  color: #334155;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  background: #f8fafc;
  gap: 8px;
}
.b2b-section > summary::-webkit-details-marker { display: none; }
.b2b-section > summary::before {
  content: '▸';
  font-size: 9px;
  color: #94a3b8;
  transition: transform 0.12s ease;
}
.b2b-section[open] > summary::before {
  transform: rotate(90deg);
}
.b2b-section-count {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 500;
  margin-left: auto;
}
.b2b-section-body {
  padding: 6px 12px;
}

/* Package rows — one aligned row per package */
.b2b-pkg-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
  cursor: pointer;
}
.b2b-pkg-row input[type="radio"] { margin: 0; }
.b2b-pkg-name {
  color: #0f172a;
  font-weight: 500;
}
.b2b-pkg-price-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #64748b;
}
.b2b-pkg-price-input {
  width: 80px;
  font-family: inherit;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  background: #fff;
  text-align: right;
}
.b2b-pkg-price-input:disabled {
  background: #f8fafc;
  color: #94a3b8;
  border-color: transparent;
}
.b2b-pkg-unit {
  color: #94a3b8;
  font-size: 10px;
}

/* Product rows — single visual line */
.b2b-row {
  padding: 5px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.b2b-row:last-child { border-bottom: none; }
.b2b-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  min-height: 24px;
}
.b2b-row-main input[type="checkbox"] { margin: 0; flex-shrink: 0; }
.b2b-row-name {
  flex: 1;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.b2b-row-default {
  font-size: 10px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}
.b2b-row-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #64748b;
}
.b2b-override-toggle {
  background: transparent;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 11px;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
.b2b-override-toggle:hover {
  border-color: #334155;
  color: #334155;
}
.b2b-row.has-override .b2b-override-toggle {
  background: #fef3c7;
  border-color: #fbbf24;
  color: #854d0e;
}
.b2b-row-override {
  margin-left: 26px;
  margin-top: 4px;
  padding: 6px 8px;
  background: #fefce8;
  border-radius: 4px;
  font-size: 11px;
  color: #854d0e;
  display: flex;
  align-items: center;
  gap: 6px;
}
.b2b-row-override[hidden] { display: none; }

/* Shared input sizing */
.b2b-small {
  width: 80px;
  font-family: inherit;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  background: #fff;
  text-align: right;
}
.b2b-qty {
  width: 50px;
  font-family: inherit;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  background: #fff;
  text-align: center;
}

/* Inline utility */
.b2b-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #334155;
}

/* ARR summary */
.b2b-arr-section {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 12px;
}
.b2b-arr-header {
  font-weight: 600;
  font-size: 11px;
  color: #166534;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.b2b-arr-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 1px 0;
  color: #475569;
}
.b2b-arr-line span {
  font-weight: 500;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}
.b2b-arr-gross {
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: 4px;
  margin-top: 3px;
}
.b2b-arr-net {
  font-size: 16px;
  font-weight: 700;
  color: #166534;
  border-top: 1px solid #86efac;
  padding-top: 6px;
  margin-top: 6px;
}
.b2b-arr-net span {
  font-weight: 700;
  color: #166534;
}

.b2b-lock-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: #64748b;
  cursor: pointer;
  padding: 4px 0;
}
.b2b-lock-toggle input { margin: 0; }

.b2b-lock-banner {
  background: #fef3c7;
  color: #854d0e;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid #fde68a;
}

.b2b-arr-override {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
}
.b2b-arr-override input { width: 100%; max-width: 160px; text-align: right; }

/* ═══ Kanban Helpers ═════════════════════════════════════════ */

.helpers-section > summary {
  background: #eff6ff;
  color: #1e40af;
}

.helper-item {
  padding: 8px 0;
  border-bottom: 1px dashed rgba(0,0,0,0.06);
}
.helper-item:last-child { border-bottom: none; }

.helper-label {
  font-weight: 500;
  font-size: 13px;
  color: #0f172a;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.helper-progress {
  font-size: 11px;
  color: #64748b;
  font-weight: 400;
  margin-left: auto;
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 10px;
}

.helper-checklist {
  list-style: none;
  margin: 0;
  padding: 0 0 0 24px;
}
.helper-checklist li {
  margin: 2px 0;
}
.kanban-form .helper-checklist li label {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  line-height: 1.4;
}
.helper-checklist input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
}

.helper-link-btn {
  display: inline-block;
  margin-left: 24px;
  padding: 4px 10px;
  background: var(--text-primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.helper-link-btn:hover { background: #334155; }

.helper-muted {
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
}
.helper-warning {
  font-size: 11px;
  color: #854d0e;
  background: #fef3c7;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 8px;
}

.helper-template-field {
  margin-bottom: 8px;
}

.kanban-helper-badge {
  font-size: 10px;
  color: #1e40af;
  background: #eff6ff;
  border-radius: 10px;
  padding: 1px 6px;
  font-weight: 500;
  margin-left: auto;
  margin-right: 4px;
}
.kanban-helper-badge:empty { display: none; }

/* AI helper responses */
.helper-ai-result {
  margin-left: 24px;
  margin-top: 8px;
  padding: 10px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  font-size: 13px;
  color: #0c4a6e;
  line-height: 1.5;
}
.helper-ai-response {
  white-space: pre-wrap;
}
.helper-ai-meta {
  margin-top: 6px;
  font-size: 10px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}
.helper-ai-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}
.helper-ai-actions button {
  font-size: 11px;
  padding: 3px 10px;
  margin-left: 0;
}
