/* Tillägg ovanpå ~/css/app.css — app-specifikt som designsystemet inte täcker */

@media (min-width: 901px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}

/* Popover i tabell: .table-wrap overflow-x klipper annars menyn i raden */
.table-wrap:has(.pop-anchor[open]) {
  overflow: visible;
}

.table td.col-actions {
  overflow: visible;
}

.table tbody tr:has(.pop-anchor[open]) {
  position: relative;
  z-index: 6;
}

.pop-anchor[open] .popover {
  z-index: 40;
}

a.menu-item {
  text-decoration: none;
  color: inherit;
}

[data-exports-view][aria-busy="true"] {
  opacity: 0.92;
  pointer-events: none;
}

/* Begränsningar (plattformsadmin) */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.setting-row:first-child {
  border-top: 0;
}

.setting-row > span:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.setting-label {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
}

.savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 -32px -48px;
  padding: 14px 32px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 18px rgba(20, 20, 40, 0.05);
}

.limits-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.side-sticky {
  position: sticky;
  top: 16px;
}

.setting-row .seg button {
  white-space: nowrap;
}

.limits-picker {
  position: relative;
  z-index: 0;
}

.limits-picker:focus-within {
  z-index: 8;
}

.limits-picker .sni-picker-panel {
  z-index: 12;
}

.crumbs .crumb-middle {
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12rem;
}

@media (max-width: 760px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .setting-row.has-seg {
    flex-wrap: wrap;
  }

  .setting-row.has-seg .seg {
    width: 100%;
  }

  .setting-row.has-seg .seg button {
    flex: 1 1 auto;
  }

  .savebar {
    margin: 0 -16px -48px;
    padding: 12px 16px;
  }
}

.sb-search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--fs);
  color: var(--text);
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}

.sb-search-input::placeholder {
  color: var(--placeholder);
}

.sb-search-input:focus {
  outline: none;
  box-shadow: none;
}

.sb-search:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.sb-brand-link {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 0;
  text-decoration: none;
}

.sb-brand-mark {
  display: block;
  width: auto;
  max-width: 100%;
  height: 26px;
}

.mobile-bar-logo {
  flex: none;
  display: block;
  width: 24px;
  height: 24px;
}

body.login-page {
  margin: 0;
}

.lg-wrap {
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
  background: var(--bg-app);
}

.lg-form {
  flex: 1 1 480px;
  display: flex;
  flex-direction: column;
  padding: 40px 48px;
}

.lg-brand {
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  align-items: center;
}

.lg-brand-logo {
  height: 30px;
  width: auto;
}

body.login-page .sb-logo .cut {
  stroke: var(--bg-app);
}

body.login-page .sb-logo .cut-head {
  fill: var(--bg-app);
}

.lg-brand-name {
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.035em;
}

.lg-form-main {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 48px 0;
}

.lg-form-inner {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lg-title {
  margin: 8px 0 0;
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.lg-fields {
  gap: 16px;
}

.input-lg {
  height: 44px;
  font-size: 14px;
}

.pw-field {
  position: relative;
}

.pw-field .input-lg {
  padding-right: 72px;
  width: 100%;
}

.pw-toggle {
  position: absolute;
  right: 6px;
  top: 8px;
}

.lg-brand-name.sb-product {
  font-size: 22px;
}

.w-full {
  width: 100%;
}

.lg-help {
  margin: 0;
}

.login-error {
  background: var(--err-bg);
  border-color: #e7c2b5;
  color: var(--err-fg);
}

.login-error svg {
  color: var(--err-fg);
  width: 20px;
  height: 20px;
  flex: none;
}

.lg-foot {
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
  gap: 8px;
}

.lg-panel {
  flex: 1.15 1 520px;
  margin: 12px;
  border-radius: 18px;
  background: var(--mint);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  color: var(--text);
}

.lg-panel-kicker {
  color: #1d4a3a;
}

.lg-hero {
  margin: 0;
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-size: clamp(2.75rem, 5vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.92;
}

.lg-panel-lead {
  margin: 20px 0 0;
  font-size: 17px;
  max-width: 460px;
  color: #1d3a30;
}

.lg-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 10px;
}

.lg-mini {
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 132px;
  justify-content: space-between;
}

.lg-mini--dark {
  background: var(--brand-block);
  color: #fff;
}

.lg-mini--dark .kpi-label {
  color: rgba(255, 255, 255, .88);
}

.lg-mini--blue {
  background: var(--bg);
  color: var(--text);
}

.lg-mini--blue .kpi-label {
  color: var(--text-3);
}

.lg-mini--light {
  background: var(--bg-subtle);
}

.lg-mini-val {
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.lg-mini-unit {
  font-size: 16px;
  font-weight: 500;
}

@media (max-width: 900px) {
  .lg-form {
    padding: 28px 20px;
  }

  .lg-panel {
    margin: 0 12px 12px;
    padding: 28px;
  }
}

.container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 24px;
}

[role="status"].status-banner,
[role="alert"] {
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 16px;
}

[role="alert"] {
  background: var(--err-bg, #fdf0ef);
  border-color: #ebc4c0;
  color: var(--err-fg, #8a1f16);
}

.lead-watch-panel {
  margin-bottom: 16px;
}

.lead-watch-panel__actions {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}

.search-results-form .lead-watch-panel + .export-toolbar {
  margin-top: 8px;
}

.lead-watch-details {
  font-size: 13px;
  color: var(--text-2);
}

.lead-watch-details summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text-1);
}

.lead-watch-pending-msg {
  font-size: 13px;
  margin: 0;
}

.support-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--warn-bg, #fff6e8);
  color: var(--warn-fg, #8a5a00);
  border-bottom: 1px solid var(--border, #ead9b4);
  font-size: 14px;
}

.support-banner form {
  margin: 0;
}

.validation-summary-errors {
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid #ebc4c0;
  background: var(--err-bg, #fdf0ef);
  color: var(--err-fg, #8a1f16);
  font-size: 13px;
  margin-bottom: 16px;
}

.validation-summary-errors ul {
  margin: 0;
  padding-left: 1.2rem;
}

.export-columns {
  margin: 0 0 12px;
  padding: 0;
  overflow: hidden;
}

.export-columns-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.export-columns-summary::-webkit-details-marker {
  display: none;
}

.export-columns-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  min-width: 0;
}

.export-columns-title {
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--text);
}

.export-columns-count {
  font-size: var(--fs-sm);
}

.export-columns-chevron {
  flex: none;
  color: var(--text-3);
  transition: transform 0.15s ease;
}

.export-columns[open] .export-columns-chevron {
  transform: rotate(180deg);
}

.export-columns-body {
  padding: 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.export-columns-body > :not(.export-columns-foot) {
  padding-left: 14px;
  padding-right: 14px;
}

.export-columns-help {
  margin: 0;
  padding-top: 12px;
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.export-columns-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 4px;
}

.export-columns-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 14px;
}

.export-columns-group-title {
  margin: 0 0 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.export-columns-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 11.5rem), 1fr));
  gap: 6px 10px;
}

.export-col {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--r);
  line-height: 1.35;
  min-height: 32px;
}

.export-col:hover {
  background: var(--bg-muted);
}

.export-col input {
  margin-top: 2px;
  flex: none;
  accent-color: var(--brand-strong);
}

.export-col span {
  min-width: 0;
}

.export-columns-foot {
  margin-top: 2px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--r-tile, var(--r-lg)) var(--r-tile, var(--r-lg));
}

.export-save-default {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
  cursor: pointer;
  line-height: 1.4;
}

.export-save-default input {
  flex: none;
  margin: 0;
  accent-color: var(--brand-strong);
}

.export-save-default span {
  min-width: 0;
}

.search-results-form .export-toolbar {
  margin-bottom: 4px;
}

@media (max-width: 640px) {
  .export-columns-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .export-columns-summary {
    padding: 12px;
  }

  .export-columns-body > :not(.export-columns-foot) {
    padding-left: 12px;
    padding-right: 12px;
  }

  .export-columns-foot {
    padding: 12px;
  }
}

.sb-foot form {
  margin: 0;
}

.sb-foot button.linkish {
  background: none;
  border: 0;
  padding: 0;
  height: auto;
  font: inherit;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
}

.sb-foot button.linkish:hover {
  color: var(--text);
  text-decoration: underline;
}

.inline-form {
  display: inline;
}

.search-results-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

a.page-btn {
  text-decoration: none;
  color: inherit;
}

.results > .pagination {
  margin-top: 4px;
}

[data-search-results][aria-busy="true"] {
  opacity: 0.72;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

@media (max-width: 1080px) {
  .search-layout .filters:not(.is-open) {
    display: none !important;
  }

  .search-layout .results {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .search-layout .g-blocks {
    gap: 10px;
  }

  .search-layout .block-hero .kpi-value {
    font-size: 40px;
  }

  .page-header .filters-toggle {
    min-height: 44px;
  }

  .search-results-form .table-wrap {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .search-results-form .table {
    min-width: 720px;
  }

  .filters.is-open .filter-form {
    padding-bottom: 8px;
  }

  .filters .sni-picker-panel,
  .filters .geo-picker-panel {
    max-height: min(220px, 40dvh);
  }
}

a.chip {
  text-decoration: none;
  color: inherit;
}

a.chip:hover {
  background: var(--bg-subtle);
}

/* Kontakt i tabell: samma textfärg som övriga celler, inte standardlänkblått */
.table td a:not(.co-name):not(.btn):not(.sort-btn):not(.btn-ghost) {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}

.table td a:not(.co-name):not(.btn):not(.sort-btn):not(.btn-ghost):hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

dialog.dialog:not([open]) {
  display: none;
}

dialog.dialog[open] {
  padding: 0;
  border: none;
  max-width: min(480px, calc(100vw - 32px));
}

dialog.dialog::backdrop {
  background: rgb(21 23 28 / 45%);
}

.save-search-form.stack {
  gap: 12px;
}

.save-search-submit {
  align-self: flex-start;
}

/* Sparade sökningar: se .filters-saved i css/app.css */
