/* ==========================================================================
   "היום" — Joni's daily work view (views/Today.js). All colours come from the app tokens (light + dark).
   ========================================================================== */

.td-page { gap: 16px; }

/* ---- header strip ---- */
.td-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.td-head-main { min-width: 0; }
.td-date { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.td-head h1 { font-size: 26px; line-height: 1.2; margin-top: 2px; letter-spacing: -0.01em; }
.td-sub { color: var(--ink-2); font-size: 14.5px; margin-top: 4px; }
.td-head-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.td-head-side .select { width: auto; min-width: 190px; max-width: 260px; }
.td-week { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.td-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 10px 18px; min-width: 104px; border-inline-start: 1px solid var(--border); }
.td-stat:first-child { border-inline-start: 0; }
.td-stat b { font-size: 22px; font-weight: 700; line-height: 1.1; color: var(--ink); }
.td-stat span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.td-stat .money { font-size: 12px; }

/* ---- jump chips (counts row) ---- */
.td-jumps { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.td-jumps::-webkit-scrollbar { display: none; }
.td-jump {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 13.5px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: border-color 0.12s, background 0.12s;
}
.td-jump:hover { border-color: var(--border-strong); background: var(--surface-2); }
.td-jump b { font-weight: 700; color: var(--ink); min-width: 14px; text-align: center; }
.td-jump.zero { opacity: 0.6; box-shadow: none; }
.td-jump .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--td-fill, var(--c-gray-fill)); flex: none; }

/* ---- tones (bar + badge) ---- */
.tone-red    { --td-fill: var(--c-red-fill);    --td-ink: var(--c-red);    --td-soft: var(--c-red-soft); }
.tone-blue   { --td-fill: var(--c-blue-fill);   --td-ink: var(--c-blue);   --td-soft: var(--c-blue-soft); }
.tone-amber  { --td-fill: var(--c-amber-fill);  --td-ink: var(--c-amber);  --td-soft: var(--c-amber-soft); }
.tone-purple { --td-fill: var(--c-purple-fill); --td-ink: var(--c-purple); --td-soft: var(--c-purple-soft); }
.tone-teal   { --td-fill: var(--c-teal-fill);   --td-ink: var(--c-teal);   --td-soft: var(--c-teal-soft); }
.tone-yellow { --td-fill: var(--c-yellow-fill); --td-ink: var(--c-yellow); --td-soft: var(--c-yellow-soft); }
.tone-green  { --td-fill: var(--c-green-fill);  --td-ink: var(--c-green);  --td-soft: var(--c-green-soft); }
.tone-gray   { --td-fill: var(--c-gray-fill);   --td-ink: var(--c-gray);   --td-soft: var(--c-gray-soft); }

/* ---- two columns ---- */
.td-cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.td-main, .td-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1180px) { .td-cols { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 1023px) { .td-cols { grid-template-columns: minmax(0, 1fr); } }

/* ---- section card ---- */
.td-sec {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden; padding-inline-start: 5px; scroll-margin-top: calc(var(--topbar-h) + 12px);
}
.td-sec::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5px; background: var(--td-fill); }
.td-sec.is-empty::before { opacity: 0.45; }
.td-sec-head { display: flex; align-items: center; gap: 8px; }
.td-sec-h { flex: 1; min-width: 0; display: flex; font-size: inherit; font-weight: inherit; line-height: inherit; }
.td-sec-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: none; border: 0; color: inherit; font: inherit;
  text-align: start; cursor: pointer; border-radius: 0;
}
.td-sec-toggle:hover { background: var(--surface-2); }
.td-sec-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.td-sec-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--td-soft); color: var(--td-ink); flex: none; }
.td-sec-title { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.td-sec-title b { font-size: 15.5px; font-weight: 700; line-height: 1.25; color: var(--ink); }
.td-sec-title .sub { font-size: 12.5px; color: var(--muted); }
.td-count { min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--td-soft, var(--surface-3)); color: var(--td-ink, var(--ink-2)); font-weight: 700; font-size: 13px; flex: none; }
.td-sec.is-empty .td-count { background: var(--surface-3); color: var(--muted); }
.td-sec-toggle .chev { color: var(--muted); display: grid; place-items: center; transition: transform 0.15s ease; margin-inline-start: 4px; }
.td-sec.collapsed .chev { transform: rotate(90deg); }
.td-sec-actions { padding-inline-end: 12px; }
.td-sec-body { border-top: 1px solid var(--border); }
.td-items { display: flex; flex-direction: column; }

/* ---- empty / footer ---- */
.td-empty { display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: var(--muted); font-size: 14px; }
.td-empty .spark { font-size: 18px; line-height: 1; }
.td-empty b { color: var(--ink-2); font-weight: 600; }
.td-foot { display: flex; justify-content: flex-start; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 13.5px; }
.td-foot a { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-weight: 500; }
a.td-foot { text-decoration: none; }

/* ---- item row ---- */
.td-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); transition: opacity 0.18s, transform 0.18s; }
.td-item:last-child { border-bottom: 0; }
.td-item:hover { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.td-item.leaving { opacity: 0; transform: translateX(-8px); }
.td-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.td-item-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.td-name { font-weight: 600; color: var(--ink); text-decoration: none; font-size: 14.5px; max-width: 100%; }
.td-name:hover { color: var(--primary); text-decoration: none; }
.td-agency { font-size: 12px; color: var(--muted); background: var(--surface-3); padding: 1px 8px; border-radius: 999px; max-width: 160px; }
.td-detail { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); min-width: 0; }
.td-detail .money { font-weight: 600; color: var(--ink); }
.td-note { color: var(--muted); max-width: 420px; }
.td-miss { color: var(--ink); font-weight: 500; max-width: 480px; }
.td-years { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.td-days { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.td-days.now { background: var(--primary-soft); color: var(--primary-soft-ink); }
.td-days.warn { background: var(--c-amber-soft); color: var(--c-amber); }
.td-days.late { background: var(--c-red-soft); color: var(--c-red); }
.td-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.td-actions .btn { white-space: nowrap; }
.td-static { height: 28px; padding: 0 12px; font-size: 12.5px; }

/* ---- "⋯" menu ---- */
.td-more { position: relative; }
.td-menu {
  position: absolute; top: calc(100% + 4px); inset-inline-end: 0; z-index: 25; min-width: 220px; max-width: 320px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 2px;
  animation: fade-in 0.12s ease-out;
}
.td-more.align-start .td-menu { inset-inline-end: auto; inset-inline-start: 0; }
.td-menu .divider { margin: 4px 6px; }
.td-menu button, .td-menu a {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; border: 0; background: none; font: inherit; font-size: 14px;
  color: var(--ink); text-align: start; cursor: pointer; text-decoration: none; width: 100%;
}
.td-menu button:hover, .td-menu a:hover, .td-menu button:focus-visible, .td-menu a:focus-visible { background: var(--surface-2); outline: none; }
.td-menu button .icon, .td-menu a .icon { color: var(--muted); flex: none; }
.td-menu .ext { margin-inline-start: auto; }
.td-menu button.danger { color: var(--danger); }
.td-menu button:disabled { opacity: 0.5; cursor: default; }

/* ---- inquiry groups ---- */
.td-group + .td-group { border-top: 1px solid var(--border); }
.td-group-head { display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.td-stage { width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--c-gray-fill); }
.td-stage.s2 { background: var(--c-blue-fill); }
.td-stage.s3 { background: var(--c-amber-fill); }
.td-group-count { margin-inline-start: auto; font-weight: 700; color: var(--muted); }
.td-group-more { padding: 6px 16px 10px; font-size: 13px; }

/* ---- side cards ---- */
.td-side-card .card-head { padding: 14px 16px; }
.td-side-card .card-head h2 { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.td-side-card .card-head h2 .icon { color: var(--muted); }
.td-side-card .card-head h2 .td-count { height: 22px; min-width: 22px; font-size: 12px; background: var(--accent-soft); color: var(--accent-ink); }
.td-side-list { display: flex; flex-direction: column; }
.td-side-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--border); background: none; color: inherit; font: inherit;
  text-align: start; text-decoration: none; width: 100%; cursor: pointer;
}
.td-side-item:last-child { border-bottom: 0; }
.td-side-item:hover { background: var(--surface-2); text-decoration: none; }
.td-side-item .grow { flex: 1; min-width: 0; }
.td-side-item .title { font-weight: 500; font-size: 14px; }
.td-side-item .meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.td-side-item .n-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.td-time { font-size: 12px; color: var(--muted); white-space: nowrap; }

.td-bills { display: flex; flex-direction: column; }
.td-bill { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.td-bill:last-child { border-bottom: 0; }
.td-bill-main { flex: 1; min-width: 0; }
.td-bill-main .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.td-bal { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.td-bal.open { background: var(--c-red-soft); color: var(--c-red); }
.td-bal.ok { background: var(--c-green-soft); color: var(--c-green); }
.td-bill-total { padding: 10px 16px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--border); background: var(--surface-2); }
.td-mtd { padding: 10px 16px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--border); }
.td-mtd .money { font-weight: 600; color: var(--ink); }

/* ---- submit dialog ---- */
.td-yearpick { display: flex; gap: 6px; flex-wrap: wrap; }
.td-year {
  height: 34px; min-width: 62px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
}
.td-year.open { border-style: dashed; border-color: var(--border-strong); }
.td-year.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.td-year:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---- phone ---- */
@media (max-width: 899px) {
  .td-head { align-items: stretch; }
  .td-head h1 { font-size: 22px; }
  .td-head-side { width: 100%; }
  .td-head-side .select { flex: 1 1 auto; max-width: none; }
  .td-week { flex: 1 1 100%; order: 3; }
  .td-stat { flex: 1; min-width: 0; padding: 10px 8px; }
  .td-stat b { font-size: 20px; }
  .td-stat span { white-space: normal; text-align: center; }
  .td-sec-toggle { padding: 12px 14px; gap: 10px; }
  .td-item { flex-wrap: wrap; padding: 12px 14px; gap: 8px 12px; }
  .td-item-main { flex-basis: 100%; }
  .td-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .td-actions > .btn:first-child { flex: 1 1 auto; justify-content: center; }
  .td-actions .btn.btn-sm { height: 40px; font-size: 14px; }
  .td-more .iconbtn.sm { width: 40px; height: 40px; }
  .td-menu { min-width: 240px; }
  .td-note, .td-miss { max-width: 100%; }
  .td-empty, .td-foot, .td-group-head, .td-group-more, .td-side-item, .td-bill, .td-bill-total, .td-mtd { padding-inline: 14px; }
  .td-bill .td-actions { width: 100%; }
  .td-year { height: 40px; }
}
