/* [module: dashboard] Salla embedded design tokens (light + dark), RTL-first, logical properties only.
   4 px grid, 14 px base. Contrast pairs below were chosen for WCAG 2.1 AA (>= 4.5:1 for text). */
@font-face {
  font-family: 'PingARLT';
  src: url('https://cdn.salla.network/fonts/lib/pingarlt/PingARLT-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'PingARLT';
  src: url('https://cdn.salla.network/fonts/lib/pingarlt/PingARLT-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'PingARLT';
  src: url('https://cdn.salla.network/fonts/lib/pingarlt/PingARLT-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --primary: #004d5b;
  --on-primary: #ffffff;
  --secondary: #73fcd7;
  --on-secondary: #004d5b;
  --success: #00b259;
  --danger: #f5434a;
  --bg-main: #f8f8f8;
  --bg-card: #ffffff;
  --bg-subtle: #f1f3f4;
  --bg-input: #ffffff;
  --text: #1d1e20;
  --text-muted: #5f6368;
  --border: #e5e7eb;
  --border-strong: #c7cbd1;
  --focus: #004d5b;
  --success-bg: #e7f7ee;
  --success-text: #0a6b37;
  --warning-bg: #fff4e0;
  --warning-text: #7a4300;
  --danger-bg: #fdecec;
  --danger-text: #b3261e;
  --info-bg: #e6f4f1;
  --info-text: #004d5b;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --radius: 12px;
  color-scheme: light;
}
[data-theme='dark'] {
  --primary: #baefe3;
  --on-primary: #1d1e20;
  --secondary: #baefe3;
  --on-secondary: #1d1e20;
  --success: #00b259;
  --danger: #f5434a;
  --bg-main: #1d1e20;
  --bg-card: #26282b;
  --bg-subtle: #2f3236;
  --bg-input: #1f2123;
  --text: #f3f4f6;
  --text-muted: #a1a1aa;
  --border: #3f3f46;
  --border-strong: #5b5b63;
  --focus: #baefe3;
  --success-bg: rgba(0, 178, 89, 0.16);
  --success-text: #7ee2ae;
  --warning-bg: rgba(251, 191, 90, 0.14);
  --warning-text: #fbc56b;
  --danger-bg: rgba(245, 67, 74, 0.16);
  --danger-text: #ff9a9e;
  --info-bg: rgba(186, 239, 227, 0.12);
  --info-text: #baefe3;
  --shadow: none;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg-main);
  color: var(--text);
  font-family: 'PingARLT', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  overflow-wrap: break-word;
}
#app {
  padding: 16px;
  max-inline-size: 100%;
  overflow-x: hidden;
}
h1,
h2,
h3,
p {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.muted {
  color: var(--text-muted);
}
.small {
  font-size: 12px;
}
.break {
  overflow-wrap: anywhere;
}
.loading {
  padding: 24px 0;
  text-align: center;
}

/* ---------- layout ---------- */
.app {
  display: grid;
  gap: 16px;
  max-inline-size: 1280px;
  margin-inline: auto;
}
.plan-area {
  display: grid;
  gap: 12px;
}
.view {
  display: grid;
  gap: 16px;
}
.panel:focus-visible {
  outline-offset: 4px;
  border-radius: 8px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  min-inline-size: 0;
}
.card--inset {
  background: var(--bg-subtle);
  box-shadow: none;
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}
.card-title:focus {
  outline: none;
}
.card-title:focus-visible {
  outline: 2px solid var(--focus);
}
.sub-title {
  font-size: 14px;
  font-weight: 700;
  margin-block-start: 4px;
}
.state {
  text-align: center;
  padding: 32px 16px;
  justify-items: center;
  max-inline-size: 560px;
  margin: 32px auto;
}
.state-title {
  font-size: 18px;
  font-weight: 700;
}
.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 24px 8px;
}

/* ---------- banners & usage ---------- */
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.banner-text {
  display: grid;
  gap: 2px;
  flex: 1 1 280px;
  min-inline-size: 0;
}
.banner-title {
  font-weight: 700;
}
.banner--info {
  background: var(--info-bg);
  color: var(--info-text);
}
.banner--success {
  background: var(--success-bg);
  color: var(--success-text);
}
.banner--warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}
.banner--danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger);
}
.usage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.usage-text {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.meter {
  block-size: 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}
.meter-fill {
  display: block;
  block-size: 100%;
  background: var(--primary);
  border-radius: inherit;
}
.meter--warning .meter-fill {
  background: #d98200;
}
.meter--danger .meter-fill {
  background: var(--danger);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--info-bg);
  color: var(--info-text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge--muted {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

/* ---------- toolbar: tabs + date range ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tabs,
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-inline-size: 100%;
}
.tab,
.seg-btn {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  min-block-size: 36px;
}
.seg-btn {
  min-block-size: 32px;
  padding: 4px 12px;
}
.tab:hover,
.seg-btn:hover {
  color: var(--text);
}
.tab[aria-selected='true'],
.seg-btn[aria-pressed='true'] {
  background: var(--primary);
  color: var(--on-primary);
}
.range {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.range-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}
.range-field {
  display: grid;
  gap: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- form controls ---------- */
input[type='text'],
input[type='url'],
input[type='email'],
input[type='number'],
input[type='date'],
input[type='datetime-local'],
select,
textarea {
  inline-size: 100%;
  min-block-size: 38px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
}
.range select,
.range input {
  inline-size: auto;
}
textarea {
  resize: vertical;
  min-block-size: 64px;
}
input[type='checkbox'] {
  inline-size: 18px;
  block-size: 18px;
  accent-color: var(--primary);
  flex: none;
  margin: 0;
}
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
input[aria-invalid='true'],
select[aria-invalid='true'] {
  border-color: var(--danger);
}
.field {
  display: grid;
  gap: 4px;
  min-inline-size: 0;
}
.field > label {
  font-weight: 500;
}
.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.field-error,
.form-error {
  font-size: 13px;
  color: var(--danger-text);
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check label {
  cursor: pointer;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.form {
  gap: 12px;
}
.form-title {
  font-size: 15px;
  font-weight: 700;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.form-host:empty {
  display: none;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-block-size: 38px;
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
}
.btn--secondary {
  background: var(--bg-card);
  color: var(--primary);
  border-color: var(--primary);
}
.btn--ghost {
  border-color: var(--border-strong);
}
.btn--danger-ghost {
  color: var(--danger-text);
  border-color: var(--border-strong);
}
.btn--sm {
  min-block-size: 32px;
  padding: 4px 12px;
  font-size: 13px;
}
.btn--icon {
  inline-size: 32px;
  min-block-size: 32px;
  padding: 0;
  border-color: var(--border-strong);
  font-size: 16px;
  line-height: 1;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- KPIs & signals ---------- */
.kpis,
.signals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.kpi,
.signal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: grid;
  gap: 2px;
  min-inline-size: 0;
}
.signal {
  background: var(--bg-subtle);
  border-color: transparent;
}
.kpi-label,
.signal-label {
  color: var(--text-muted);
  font-size: 13px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.kpi-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.signal-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- tables (stack into cards when the container is narrow; never scroll the page) ---------- */
.table-wrap {
  container-type: inline-size;
  min-inline-size: 0;
}
.table {
  inline-size: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.table th,
.table td {
  padding: 10px 12px;
  text-align: start;
  vertical-align: top;
  border-block-end: 1px solid var(--border);
}
.table thead th {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
.table tbody th {
  font-weight: 500;
}
.table tbody tr:last-child > * {
  border-block-end: 0;
}
.who {
  display: block;
  font-weight: 700;
}
.handle {
  display: block;
}
.bar-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bar {
  display: inline-block;
  inline-size: 72px;
  block-size: 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  flex: none;
}
.bar-fill {
  display: block;
  block-size: 100%;
  background: var(--primary);
}
@container (max-width: 640px) {
  .table--stack thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .table--stack,
  .table--stack tbody,
  .table--stack tr,
  .table--stack th,
  .table--stack td {
    display: block;
    inline-size: 100%;
  }
  .table--stack tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px 12px;
    margin-block-end: 8px;
  }
  .table--stack tbody th,
  .table--stack td {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
  }
  .table--stack td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 12px;
  }
  .table--stack tbody tr > *:last-child {
    border-block-end: 0;
  }
}
@container (max-width: 1040px) {
  .table--wide thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .table--wide,
  .table--wide tbody,
  .table--wide tr,
  .table--wide th,
  .table--wide td {
    display: block;
    inline-size: 100%;
  }
  .table--wide tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px 12px;
    margin-block-end: 8px;
  }
  .table--wide tbody th,
  .table--wide td {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
  }
  .table--wide td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 12px;
  }
  .table--wide tbody tr > *:last-child {
    border-block-end: 0;
  }
}
@supports not (container-type: inline-size) {
  .table-wrap {
    overflow-x: auto;
  }
}

/* ---------- chips & verdicts ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 12px;
  border: 1px solid transparent;
  max-inline-size: 100%;
  overflow-wrap: anywhere;
}
.chip--code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border-color: var(--border-strong);
}
.chip--action {
  cursor: pointer;
  border-color: var(--border-strong);
  background: var(--bg-card);
  min-block-size: 32px;
}
.chip--action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.chip--survey {
  background: var(--info-bg);
  color: var(--info-text);
}
.verdict {
  display: inline-flex;
  padding: 2px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.verdict--renew {
  background: var(--success-bg);
  color: var(--success-text);
}
.verdict--watch {
  background: var(--warning-bg);
  color: var(--warning-text);
}
.verdict--stop {
  background: var(--danger-bg);
  color: var(--danger-text);
}
.verdict--insufficient_data {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 500;
}
.evidence summary,
.campaigns summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 500;
}
.evidence ul {
  margin: 4px 0 0;
  padding-inline-start: 16px;
  font-size: 12px;
}

/* ---------- ledger ---------- */
.ledger {
  display: grid;
  gap: 12px;
}
.ledger-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: grid;
  gap: 8px;
  min-inline-size: 0;
}
.ledger-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.ledger-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-inline-size: 0;
}
.ledger-name h3 {
  font-size: 15px;
  font-weight: 700;
}
.link-line {
  color: var(--text-muted);
}
.campaign-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
}
.campaign {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-block-start: 1px solid var(--border);
}
.campaign-text {
  display: grid;
  min-inline-size: 0;
}
.suggestions {
  display: grid;
  gap: 4px;
}

/* ---------- settings ---------- */
.settings {
  display: grid;
  gap: 16px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}
.options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}
.option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-block-end: 1px solid var(--border);
}
.option-label,
.custom-inputs {
  flex: 1 1 160px;
  min-inline-size: 0;
}
.custom-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
}
.lock-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-subtle);
}
.preview-stage {
  background: var(--bg-subtle);
  border-radius: var(--radius);
  padding: 24px 12px 12px;
  min-block-size: 180px;
  display: flex;
  align-items: flex-end;
}
/* The storefront card is shown as shoppers see it on a (light) store page. */
.sf-card {
  inline-size: 100%;
  background: #ffffff;
  color: #1d1e20;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.14);
  display: grid;
  gap: 10px;
}
.sf-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.sf-q {
  font-weight: 700;
}
.sf-x {
  color: #5f6368;
  font-size: 18px;
  line-height: 1;
}
.sf-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sf-opt {
  border: 1px solid #c7cbd1;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
}

/* ---------- upgrade prompt ---------- */
.upgrade {
  justify-items: center;
  text-align: center;
  padding: 32px 16px;
}
.upgrade-icon {
  font-size: 28px;
  color: var(--primary);
}

@media (max-width: 480px) {
  #app {
    padding: 12px;
  }
  .toolbar {
    align-items: stretch;
  }
  .tabs {
    display: flex;
    inline-size: 100%;
  }
  .tab {
    flex: 1 1 auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
