/*
 * Screens 2: archive, history, payees, withholding, pension, feed, settings sections.
 * Uses only the tokens of app.css (light/dark there). One column at 375px, 44px targets, RTL.
 */

/* ---------------------------------------------------------------- tabs */
.s2-tabs {
  display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 0 0 16px; padding-bottom: 2px; border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.s2-tabs::-webkit-scrollbar { display: none; }
.s2-tab {
  flex: 0 0 auto; min-height: var(--touch); padding: 8px 14px;
  border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap;
  touch-action: manipulation;
}
.s2-tab:hover { color: var(--text); }
.s2-tab.is-current { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- lists of cards */
.s2-list { list-style: none; margin: 0; padding: 0; }
.s2-list > li { margin: 0 0 10px; }
.s2-item { padding: 12px 14px; margin: 0; }
.s2-item > * + * { margin-top: 6px; }
.s2-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.s2-item-title { font-weight: 700; color: var(--text); text-decoration: none; overflow-wrap: anywhere; margin: 0; unicode-bidi: plaintext; }
a.s2-item-title:hover { color: var(--accent); }
.s2-grow { flex: 1 1 auto; min-width: 0; }
.s2-date { color: var(--muted); font-size: 14px; }
.s2-ref { font-family: var(--mono); font-size: 14px; }
.s2-amount { font-weight: 700; }
.s2-chips { gap: 6px; }
.s2-tags { display: inline-flex; gap: 4px; margin-inline-start: 6px; }
.s2-empty, .s2-loading { padding: 16px 0; margin: 0; }
.s2-more { margin-top: 8px; }
.s2-item .checkbox { width: 24px; height: 24px; }
.s2-pick {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--touch); min-height: var(--touch); margin: -10px; cursor: pointer;
}
/* 44px targets at phone width for every small button of these screens (PDF, פתיחה, הורדה, תגובה, WHT actions) */
@media (max-width: 639px) {
  .btn--small { min-height: var(--touch); min-width: var(--touch); padding: 8px 12px; }
  /* E2E r4: list titles (history, WHT, payees) and the feed's "לשורה / לרשימה / לקובץ / למוטב" were 21-24px tall */
  a.s2-item-title { display: inline-flex; align-items: center; min-height: var(--touch); }
  .s2-event .row.small > a { display: inline-flex; align-items: center; justify-content: center;
    min-height: var(--touch); min-width: var(--touch); }
  /* fixer r4: the remaining bare links (WHT issue -> payee card, payee ambiguity list, payment "פרטים",
     the group mirror's "שורה N") */
  a.s2-tap { display: inline-flex; align-items: center; justify-content: center;
    min-height: var(--touch); min-width: var(--touch); }
  /* fixer r7: the office's draft links on "today" and the archive's payee link / "בקשה N" chip */
  .s1-draft > a.s2-tap { justify-content: flex-start; }
}

/* ---------------------------------------------------------------- forms */
.s2-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 640px) { .s2-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .s2-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.s2-adv > summary, details > summary {
  min-height: var(--touch); display: flex; align-items: center; cursor: pointer;
  font-weight: 600; color: var(--accent);
}
.s2-adv[open] > summary { margin-bottom: 8px; }
.s2-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; }
.s2-search { margin-bottom: 12px; }
.s2-zipbar { align-items: center; }
.s2-updates { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.s2-upload-panel > summary { margin: 0; }

/* ---------------------------------------------------------------- upload */
.s2-upload > * + * { margin-top: 10px; }
.s2-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  min-height: 112px; padding: 16px; cursor: pointer;
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.s2-drop.is-over, .s2-drop:focus-visible { border-color: var(--focus); background: var(--surface); }
.s2-drop-title { font-weight: 600; margin: 0 0 4px; }
.s2-upload-results { list-style: none; margin: 0; padding: 0; }
.s2-upload-results > li { margin: 0 0 8px; }
.s2-upload-item > * + * { margin-top: 6px; }
.s2-upload-name { font-weight: 600; overflow-wrap: anywhere; margin: 0; }

/* ---------------------------------------------------------------- archive: one file */
.s2-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 760px) { .s2-split { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } }
.s2-thumbwrap > * + * { margin-top: 10px; }
.s2-thumb {
  display: block; width: 100%; max-width: 420px; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.s2-lines { list-style: none; margin: 8px 0 0; padding: 0; }
.s2-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.s2-line:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- history */
.s2-money3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 6px 0 0; }
.s2-money3 dt { color: var(--muted); font-size: 13px; }
.s2-money3 dd { margin: 0; overflow-wrap: anywhere; }
/* a long delta chip ("הועבר יותר מהמבוקש 1,180.00") wraps inside its column at 375px instead of widening the page */
.s2-money3 dd .chip { white-space: normal; max-width: 100%; }
.s2-totals { margin: 0 0 12px; }
.s2-timeline { margin: 0; padding-inline-start: 20px; }
.s2-timeline > li + li { margin-top: 6px; }
.s2-comments { list-style: none; margin: 0 0 12px; padding: 0; }
.s2-comment { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); margin: 0 0 8px; }
.s2-comment p { margin: 2px 0 0; overflow-wrap: anywhere; }
.s2-comment.is-own { background: var(--gray-bg); }

/* ---------------------------------------------------------------- payees */
.s2-acct {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.s2-acct:last-child { border-bottom: 0; }
.s2-pays { list-style: none; margin: 0; padding: 0; }
.s2-picklist { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.s2-pick {
  display: block; width: 100%; min-height: var(--touch); padding: 10px 12px; text-align: start;
  border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text);
  font: inherit; cursor: pointer;
}
.s2-pick:hover, .s2-pick:focus-visible { background: var(--surface-2); }

/* ---------------------------------------------------------------- pension */
.s2-months {
  list-style: none; margin: 8px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
}
@media (min-width: 640px) { .s2-months { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.s2-month {
  display: flex; flex-direction: column; gap: 2px; padding: 6px 8px;
  border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0;
}
.s2-month.is-paid { background: var(--green-bg); }
.s2-month.is-missing { background: var(--gray-bg); }
.s2-dup { border-color: var(--red); }

/* ---------------------------------------------------------------- feed */
.s2-pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; margin: 0; }
pre.s2-pre { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.s2-event.is-unread { border-inline-start: 4px solid var(--accent); }
.s2-event--comment { background: var(--surface); }
.s2-group { border-style: dashed; }
.s2-cancel { border: 2px solid var(--red); background: var(--red-bg); }
.s2-composer { margin-top: 8px; }

/* ---------------------------------------------------------------- dialogs */
.s2-dialog { width: min(520px, calc(100vw - 2 * var(--gutter))); max-height: calc(100vh - 2 * var(--gutter)); overflow-y: auto; }
.s2-dialog .s2-drop { min-height: 88px; }

/* ---------------------------------------------------------------- settings */
.s2-wa-explain { margin-top: 12px; }
