/* extras add-on (see ADDONS.md) */

.i-plug { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M9%202v6M15%202v6%22/%3E%3Cpath%20d%3D%22M6%208h12v4a6%206%200%200%201-12%200z%22/%3E%3Cpath%20d%3D%22M12%2018v4%22/%3E%3C/svg%3E"); }

/* runner-up alerts: home card */
.ext-ru-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); color: inherit; }
.ext-ru-row:last-of-type { border-bottom: none; }
.ext-ru-row:hover { text-decoration: none; background: #f7faff; }
.ext-ru-row > div { flex: 1; }
.ext-ru-n { background: #fff6d6; color: #8a6100; font-weight: 700; }

/* runner-up alerts: job card */
.ext-sugg-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.ext-sugg-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ext-why { font-size: 13px; color: #6b4e00; background: #fffaf0; border-radius: 6px; padding: 3px 8px; margin-top: 4px; display: inline-block; }
.ext-fit { margin-left: 6px; font-weight: 700; }
.ext-fit-hi { background: #d1fae5; color: #065f46; }
.ext-fit-mid { background: #e0eefe; color: #0b5cc2; }
.ext-fit-lo { background: #f3f4f6; color: #4b5563; }

/* call / text logger */
.ext-outcomes button, .ext-fu button { min-height: 36px; }

/* settings card */
.ext-set-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.ext-set-row:first-of-type { border-top: none; }
.ext-set-row > div { flex: 1; min-width: 0; }
.ext-switch { display: flex; gap: 6px; align-items: center; margin: 0; color: var(--ink); font-size: 14px; white-space: nowrap; }
.ext-switch input { width: auto; }

/* Connect apps page */
.ext-steps { line-height: 1.8; padding-left: 22px; }
.ext-steps code, .ext-token-line code { background: #f3f5f8; border-radius: 4px; padding: 1px 6px; }
.ext-token-box { background: #fffbea; border: 1px solid #f5d77a; border-radius: 8px; padding: 12px; margin: 8px 0 12px; }
.ext-token-line { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.ext-token-line code { font-size: 13px; word-break: break-all; flex: 1; min-width: 0; padding: 6px 8px; user-select: all; }
.ext-keys-wrap { overflow-x: auto; }

/* ------------------------------------------------------------------ phones (≤ 760px)
   The core already turns the sidebar into a bottom bar at 860px but hides some pages and
   squeezes the rest; here it becomes a scrollable bottom tab bar with every page reachable. */
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overscroll-behavior-y: none; }


  /* top bar + pages */
  .topbar { padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top)); gap: 8px; }
  .gsearch input { font-size: 16px; }              /* 16px stops iPhone zooming into inputs */
  input, select, textarea { font-size: 16px; }
  .page { padding: 12px 12px 20px; }
  .page-head { gap: 8px; }
  .page-head h1 { font-size: 21px; }
  .g-side, .g2, .home-grid { grid-template-columns: 1fr !important; }

  /* tap targets ≥ 44px */
  button, .btn, select { min-height: 44px; }
  button.small, .chips button { min-height: 40px; }
  .linkish, .sk-pgrid button, .sk-tools button, .toast-btn { min-height: 0; }
  .ext-ru-row { min-height: 48px; }
  .sk-ch, .sk-nav, .chat-side a { min-height: 44px; display: flex; align-items: center; }

  /* action bars wrap into a tidy 2-column grid */
  .actionbar, .page-head, .toolbar, .ext-actions, .card-head { flex-wrap: wrap; }
  .actionbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .actionbar > .btn, .actionbar > button, .ext-actions > button, .ext-actions > .btn { width: 100%; justify-content: center; }
  .actionbar .ext-actions { display: contents; }
  .page-head .spacer { display: none; }
  .page-head > button, .page-head .ext-actions > button { flex: 1 1 auto; justify-content: center; }
  .ext-actions { display: flex; gap: 8px; }
  .toolbar .search { flex: 1 1 100%; max-width: none; }

  /* tables scroll sideways instead of squashing */
  .table-card, .card:has(> table), .ext-keys-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-card > table, .card > table { min-width: 560px; }
  th:nth-child(3), td:nth-child(3) { display: table-cell; }   /* undo the core hiding a column */
  .table-card td, .table-card th { white-space: nowrap; }
  .table-card td:first-child { white-space: normal; min-width: 160px; }

  /* job pipeline board: swipe between stages */
  .board { scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .col { width: 84vw; max-height: none; scroll-snap-align: start; }

  /* modals become full-screen sheets */
  .overlay { padding: 0; place-items: stretch; }
  .modal, .modal.wide { width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0;
                        padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
  .modal .row2 { grid-template-columns: 1fr; }
  .modal .actions { position: sticky; bottom: 0; background: #fff; padding: 10px 0 0; margin-top: 12px; }
  .modal .actions button { flex: 1; justify-content: center; }

  #toast { max-width: calc(100vw - 24px); }

  /* extras bits */
  .ext-sugg-row { flex-direction: column; }
  .ext-sugg-btns { width: 100%; justify-content: stretch; }
  .ext-sugg-btns button { flex: 1; justify-content: center; }
  .ext-set-row { flex-direction: column; align-items: stretch; }
}

/* installed app (home-screen) mode */
@media (display-mode: standalone) {
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); }
}
