/* Budget screens, on top of styles.css (copied from the invoices app, so both sites look alike). */

.nowrap { white-space: nowrap; }
.good { color: var(--ok); }
.bad { color: var(--bad); }
.stat.good b { color: var(--ok); }
.stat.bad b { color: var(--bad); }
.stat.good { background: var(--ok-soft); }
.stat.bad { background: var(--bad-soft); }

/* A checkbox with its text on one line. */
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--brown); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { background: var(--brown-soft); color: var(--brown); border-radius: 999px; padding: 3px 10px; font-size: 0.85rem; font-weight: 500; }
.badge.night { background: #e6e3f5; color: #3e3480; }

.add-row { margin-top: 12px; }
.add-row select { width: auto; max-width: 100%; }

.icon-btn {
  background: none; border: 1px solid transparent; border-radius: 8px; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 0.85rem; padding: 4px 7px; line-height: 1;
}
.icon-btn:hover:not(:disabled) { color: var(--bad); border-color: var(--line); background: #fff; }
.icon-btn:disabled { opacity: 0.25; cursor: default; }
.move { display: inline-flex; gap: 2px; }
.move .icon-btn:hover:not(:disabled) { color: var(--brown); }

/* Editable budget tables: inputs fill their cells, numbers read left to right. */
table.budget td, table.catalog td { padding: 5px 6px; }
table.budget input, table.catalog input, table.catalog select { padding: 6px 8px; border-radius: 8px; }
.cell-num { width: 100px; direction: ltr; text-align: right; }
.cell-text { min-width: 110px; }
.cell-text.notes { min-width: 150px; }
.cell-text.own { min-width: 140px; font-weight: 700; }
td.name-col { font-weight: 700; min-width: 140px; }
td.name-col .cell-num { width: 70px; }
td.total { font-weight: 700; min-width: 90px; }
.group-row td { background: var(--tint); color: var(--muted); font-size: 0.8rem; font-weight: 700; }
tr:hover td input { background: #fff; }
input.saved { box-shadow: 0 0 0 2px var(--ok); transition: box-shadow 0.2s; }
/* number fields without the spinner arrows, which crowd the narrow cells */
.cell-num::-webkit-outer-spin-button, .cell-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cell-num { -moz-appearance: textfield; }

/* The new-project picker tables. */
table.grades-pick td, table.sections-pick td { padding: 7px 8px; }
table.grades-pick { max-width: 420px; }

table.catalog tr.inactive td { opacity: 0.55; }
table.catalog .cell-num { width: 110px; }

/* Plan vs actual: the actual columns get a light tint, so the two read apart. */
.stat small { display: block; margin-top: 4px; font-size: 0.85rem; }
.stat small b { display: inline; font-size: inherit; }
th.actual-col { background: #f3ead0; color: #6b5200; }
td.actual-col { background: #fdf8ea; }
.cell-num.actual { border-color: #e2cf96; }
td.diff { font-weight: 500; font-size: 0.85rem; }

/* Keys (stage 2). */
.badge.key { background: var(--sun); color: #6b5200; }
td.key-cell { white-space: nowrap; }
td.key-cell .btn { padding: 4px 10px; }
.key-table th.phase-head { text-align: center; border-inline-start: 2px solid var(--line); }
.key-table th.day, .key-table td.day { text-align: center; }
.key-table .day-num { width: 64px; text-align: center; }
.key-name { font-weight: 700; max-width: 260px; }
.inactive-card { opacity: 0.6; }

/* Project tabs, like the trip app's: the header and summary stay on top, one part of the budget below. */
.tabs {
  display: flex; gap: 6px; margin: 4px 0 16px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 2px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 10px 14px; min-height: 44px;
  text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -2px;
  border-radius: 10px 10px 0 0;
}
.tabs a:hover { background: var(--brown-soft); color: var(--brown); }
.tabs a.on { color: var(--brown); border-bottom-color: var(--orange); font-weight: 700; }
.tab-icon { font-size: 1.1rem; }
@media (max-width: 520px) {
  .tabs { gap: 0; justify-content: space-between; }
  .tabs a { flex-direction: column; gap: 0; padding: 6px 4px; font-size: 0.78rem; flex: 1; text-align: center; }
}
/* On a phone the summary boxes are smaller, so the tabs are reached sooner. */
@media (max-width: 520px) {
  #stats { gap: 8px; }
  #stats .stat { flex: 1 1 40%; padding: 8px 10px; }
  #stats .stat b { font-size: 1.1rem; }
  #stats .stat span, #stats .stat small { font-size: 0.75rem; }
}

/* Drag handle (⋮⋮) for reordering rows, and the row while it is dragged. */
.drag {
  cursor: grab; touch-action: none; user-select: none; color: var(--muted); font-weight: 800; letter-spacing: -2px;
  padding: 4px 6px; border-radius: 6px; line-height: 1;
}
.drag:hover { background: var(--brown-soft); color: var(--brown); }
tr.dragging td { background: var(--orange-soft) !important; }
tr.dragging .drag { cursor: grabbing; }

/* Folding cards (the admin's keys screen): one summary line, opened to edit. */
details.fold { padding: 0; }
details.fold > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-radius: var(--radius);
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: '◀'; font-size: 0.75rem; color: var(--muted); transition: transform 0.15s; }
details.fold[open] > summary::before { transform: rotate(-90deg); }
details.fold > summary:hover { background: var(--tint); }
details.fold[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.fold-title { font-weight: 700; font-size: 1.05rem; }
.fold-body { padding: 14px 18px 18px; }

/* A grade's / group's stay: arrival day and nights (project form, income tab). */
.stay-num { width: 56px; text-align: center; }
td.stay-cell { white-space: nowrap; }
td.stay-cell .nowrap + .nowrap { margin-inline-start: 6px; }
/* The key page's per-day rows: participants that day, and the security/medical requirement. */
.key-table tr.day-info th { background: var(--sun); color: #5a4300; font-weight: 700; font-size: 0.75rem; }
.key-table th.req { font-weight: 500; white-space: normal; min-width: 70px; line-height: 1.3; }

/* Which grades a staff group accompanies (income tab, admin settings). */
.with-pick { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; font-weight: 500; margin-top: 4px; }
.with-pick label { display: inline-flex; align-items: center; gap: 3px; margin: 0; font-weight: 500; }
.with-pick input[type="checkbox"] { width: 15px; height: 15px; }
/* The key page: a day whose requirement has a unit the table lacks, and the per-grade details. */
.req-warn { color: var(--bad); }
.req-details { margin-top: 12px; font-size: 0.85rem; }
.req-details summary { cursor: pointer; color: var(--brown); font-weight: 700; }
.req-details ul { margin: 8px 0 0; padding-inline-start: 20px; line-height: 1.7; }

/* The requirements table on the key page, read only for the tribe; the rows the project used are marked. */
table.guide-view { max-width: 420px; margin-top: 8px; }
table.guide-view td, table.guide-view th { text-align: center; padding: 6px 8px; }
table.guide-view tr.used td { background: var(--sun); font-weight: 700; }

/* The key page's "what to order" row stands out from the day and night requirements above it. */
.key-table tr.day-info.order th { background: #ecd27a; color: #3e2e00; font-weight: 800; }

/* List filters (projects list): space from the title above and the table below; a select doesn't stretch across
   the whole card on a computer. */
.card .filters { margin: 14px 0 16px; }
.card .filters label { max-width: 260px; }
@media (max-width: 640px) { .card .filters label { max-width: none; } }

/* Picking a daily key's items from the admin's list. */
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 18px; margin: 10px 0 16px; }
.pick-item { display: flex; align-items: center; gap: 8px; margin: 0; padding: 7px 8px; border-radius: 8px; font-weight: 500; cursor: pointer; }
.pick-item:hover { background: var(--tint); }
.pick-item .pick-name { flex: 1; }

/* The balance card of the project summary: first and widest; the actual balance large, the planned one beside it. */
.stat.balance { flex: 2 1 320px; display: flex; gap: 16px; align-items: stretch; border-width: 2px; }
.stat.balance > div { display: flex; flex-direction: column; justify-content: center; }
.stat.balance .bal-actual { flex: 1.4; }
.stat.balance .bal-plan { flex: 1; border-inline-start: 1px solid var(--line); padding-inline-start: 14px; }
.stat.balance .bal-actual b { font-size: 1.9rem; font-weight: 800; }
.stat.balance .bal-plan b { font-size: 1.2rem; }
.stat.balance b.good { color: var(--ok); }
.stat.balance b.bad { color: var(--bad); }
.stat.balance .bal-none { font-size: 0.95rem !important; font-weight: 500 !important; color: var(--muted); }
.stat.balance.good { background: var(--ok-soft); border-color: #b6dfc4; }
.stat.balance.bad { background: var(--bad-soft); border-color: #efbdb9; }
@media (max-width: 520px) {
  #stats .stat.balance { flex-basis: 100%; }
  #stats .stat.balance .bal-actual b { font-size: 1.5rem; }
}
.stat.balance b { white-space: nowrap; }
.stat.balance { flex-basis: 380px; }

/* Stage 3: actuals from the finance file. */
.file-hint { font-size: 0.75rem; margin-top: 3px; white-space: nowrap; color: #6b5200; }
.file-hint.ok { color: var(--ok); }
.file-hint .linkbtn { font-size: 0.75rem; font-weight: 700; }
table.file-rows td { vertical-align: top; }
table.file-rows select { width: auto; max-width: 220px; padding: 6px 8px; }
table.file-rows select.unassigned { border-color: var(--bad); background: var(--bad-soft); }
table.file-rows tr.open-row td { background: #fff8f7; }
.linkbtn.on { font-weight: 800; text-decoration: none; color: var(--ink); }
.warn-text { color: var(--warn); font-weight: 500; }
.spinner-inline { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--brown-soft);
  border-top-color: var(--orange); animation: spin 0.9s linear infinite; vertical-align: middle; margin-inline-end: 6px; }

/* The link back to the portal of the shared login (zofim-hashahar.com). */
.who-link { color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.who-link:hover { background: rgba(255,255,255,.12); }
