/* ── Addon sub-tab strips ─────────────────────────────────────────── */
.addon-stab-strip {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--bdr);
}
.addon-stab {
  background: none;
  border: none;
  padding: 5px 14px;
  border-radius: var(--rsm);
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
  transition: background .1s, color .1s;
}
.addon-stab:hover { background: var(--surf2); color: var(--ink); }
.addon-stab.on { background: var(--blue-l); color: var(--blue); font-weight: 600; }
.addon-section { display: none; }
.addon-section.on { display: block; }

/* ── Addon modal — slide up on mobile, centred on desktop ─────── */
#addonModalOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}
#addonModalBox {
  background: var(--bg);
  border: 1px solid var(--bdr);
  border-radius: var(--r);
  padding: 20px;
  max-width: 560px;
  width: 90vw;
  max-height: 85vh;
  overflow: auto;
  position: relative;
}

@media (max-width: 768px) {
  #addonModalOverlay {
    align-items: flex-end !important;
  }
  #addonModalBox {
    border-radius: 16px 16px 0 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: 88vh !important;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Business profiles ────────────────────────────────────────── */
.biz-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 12px;
  align-items: start;
}
@media (max-width: 768px) {
  .biz-layout {
    grid-template-columns: 1fr !important;
  }
}

/* ── Bank transactions ────────────────────────────────────────── */
#bankList table {
  min-width: 480px;
}
@media (max-width: 768px) {
  #bankSummaryBar {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ── Moments grid ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  #momentGrid {
    grid-template-columns: 1fr 1fr !important;
  }
}
@media (max-width: 380px) {
  #momentGrid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Aurora chart ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  #auroraChart > div:first-of-type {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #auroraSummary {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ── Aroflow sites ────────────────────────────────────────────── */
@media (max-width: 600px) {
  #aroflowSites {
    grid-template-columns: 1fr 1fr !important;
  }
  #aroflowList {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #aroflowList table {
    min-width: 420px;
  }
}

/* ── Phone book ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  #pbList .pb-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  #pbList select,
  #pbList button {
    width: 100%;
  }
}

/* ── Legal refs grid ──────────────────────────────────────────── */
@media (max-width: 600px) {
  #legalList {
    grid-template-columns: 1fr !important;
  }
}

/* ── Self-review summary ──────────────────────────────────────── */
@media (max-width: 600px) {
  #srSummary {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ── Sub-tab strip on mobile ──────────────────────────────────── */
@media (max-width: 600px) {
  .addon-stab-strip {
    padding-bottom: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .addon-stab {
    font-size: 12px;
    padding: 5px 10px;
    white-space: nowrap;
  }
}

/* ── General: tab header rows wrap cleanly on phone ──────────── */
@media (max-width: 600px) {
  .tp > div:first-child {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .tp > div:first-child h2 {
    flex-basis: 100%;
  }
  .tp > div:first-child .btn,
  .tp > div:first-child .sel,
  .tp > div:first-child label.btn {
    font-size: 12px !important;
  }
}

/* ── Tablet (769–1024px) ──────────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  #momentGrid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .biz-layout {
    grid-template-columns: 200px 1fr !important;
  }
  #auroraSummary {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  #aroflowSites {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ── Touch: make all buttons easier to tap ───────────────────── */
@media (max-width: 768px) {
  .tp .btn {
    min-height: 42px;
  }
  .tp .sel {
    min-height: 38px;
    font-size: 16px !important; /* prevents iOS zoom */
  }
  .tp .inp {
    min-height: 38px;
    font-size: 16px !important; /* prevents iOS zoom */
  }
}
