/* ═══════════════════════════════════════════════════════════
   SafePaaS WorkHub — My Timesheet (SWHW-48)
   Forge-parity day-column layout + Log Time modal.
   Uses the shared theme tokens from app.css.
   ═══════════════════════════════════════════════════════════ */

.ts-page { padding: 4px 2px 40px; }

/* ── Header ── */
.ts-header { margin-bottom: 16px; }
.ts-title-row { display: flex; align-items: center; gap: 12px; }
.ts-title-row .page-title { margin: 0; }
.ts-header-actions { margin-left: auto; display: flex; gap: 8px; }
.ts-subbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.ts-weeknav { display: flex; align-items: center; gap: 8px; }
.ts-weeknav .btn-secondary { padding: 6px 12px; }
.ts-weeklabel { font-weight: 600; color: var(--text-strong); margin-left: 6px; }
/* Hide-weekends toggle — Forge-style bordered pill, grouped with the week nav (SWHW-64) */
.ts-weekend-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; margin-right: 8px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--text-strong);
  cursor: pointer; user-select: none; white-space: nowrap;
}
.ts-weekend-toggle:hover { border-color: var(--accent-border); }
.ts-weekend-toggle input { cursor: pointer; margin: 0; }
.ts-controls { display: flex; align-items: center; gap: 10px; }
.ts-locked-note { color: var(--muted); font-size: 13px; }
.ts-reject { margin-top: 12px; }

/* ── Week: 7 day columns ── */
.ts-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.ts-week--5col { grid-template-columns: repeat(5, minmax(0, 1fr)); } /* Hide weekends (SWHW-64) */
.ts-daycol {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  display: flex; flex-direction: column; min-height: 150px; overflow: hidden;
}
.ts-daycol-head {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  background: var(--bg-alt); display: flex; flex-direction: column; gap: 2px;
}
.ts-daycol-label { font-size: 11px; letter-spacing: .04em; color: var(--muted); }
.ts-daycol-label strong { color: var(--text-strong); font-size: 14px; }
.ts-daycol-total { font-size: 12px; color: var(--muted); font-weight: 600; }
.ts-daycol-total.ts-over { color: var(--red); }
.ts-daycol-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.ts-add-entry {
  border: 1px dashed var(--border); background: transparent; color: var(--accent);
  border-radius: 8px; padding: 8px; font-size: 13px; cursor: pointer; width: 100%;
}
.ts-add-entry:hover { background: var(--accent-light); border-color: var(--accent-border); }
.ts-no-entries { color: var(--muted); font-size: 12px; text-align: center; padding: 8px 0; font-style: italic; }
.ts-day-empty { color: var(--border); font-size: 14px; text-align: center; padding: 6px 0; }

/* ── Entry cards ── */
.ts-entry {
  position: relative; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px; background: var(--surface); cursor: pointer;
}
.ts-entry:hover { border-color: var(--accent-border); background: var(--accent-light); }
.ts-entry-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.ts-entry-label { font-weight: 600; font-size: 12px; }
.ts-entry-issue { color: var(--accent); }
.ts-entry-internal { color: var(--purple, #7c3aed); }
.ts-entry-hours { font-size: 12px; font-weight: 600; color: var(--text-strong); white-space: nowrap; }
.ts-entry-summary, .ts-entry-desc {
  font-size: 11px; color: var(--muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ts-entry-del {
  position: absolute; top: 4px; right: 4px; border: none; background: transparent;
  color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 5px; border-radius: 4px;
}
.ts-entry-del:hover { color: var(--red); background: var(--red-bg); }

/* ── Jira worklog-sync banner + per-entry indicator (SWHW-60) ── */
.ts-jira-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 12px 14px; border-radius: 10px;
  background: var(--accent-light); border: 1px solid var(--accent-border); font-size: 13px; color: var(--text);
}
.ts-jira-msg { flex: 1; min-width: 240px; }
.ts-jira-connect { margin-left: auto; white-space: nowrap; }
.ts-jira-banner.ts-jira-warn { background: var(--bg-alt); border-color: var(--border); color: var(--muted); }
.ts-sync { font-size: 11px; font-weight: 700; margin-left: 4px; cursor: default; }
.ts-sync-ok { color: var(--green); }
.ts-sync-err { color: var(--orange, #b45309); }

/* ── Drag-and-drop (SWHW-55) ── */
.ts-entry-draggable { cursor: grab; }
.ts-entry-draggable:active { cursor: grabbing; }
.ts-entry.ts-dragging { opacity: .45; }
.ts-daycol.ts-drop-target { border-color: var(--accent); background: var(--accent-light); }
.ts-daycol.ts-drop-target .ts-daycol-body { outline: 2px dashed var(--accent-border); outline-offset: -6px; border-radius: 8px; }

/* ── Entry hover actions (pencil + kebab) — Forge parity ── */
.ts-entry-actions {
  position: absolute; right: 5px; bottom: 5px; display: flex; gap: 2px;
  opacity: 0; transition: opacity .12s ease;
  background: var(--surface); border-radius: 6px;
}
.ts-entry:hover .ts-entry-actions, .ts-entry:focus-within .ts-entry-actions { opacity: 1; }
.ts-entry-act {
  border: none; background: transparent; color: var(--muted);
  font-size: 14px; line-height: 1; cursor: pointer; padding: 3px 6px; border-radius: 5px;
}
.ts-entry-act:hover { color: var(--accent); background: var(--accent-light); }

/* ── Floating "…" action menu ── */
.ts-menu {
  position: absolute; z-index: 1200; min-width: 148px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.ts-menu-item {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  color: var(--text); font-size: 13px; padding: 7px 10px; border-radius: 6px; cursor: pointer;
}
.ts-menu-item:hover { background: var(--accent-light); }
.ts-menu-danger { color: var(--red); }
.ts-menu-danger:hover { background: var(--red-bg); }
.ts-menu-sep { height: 1px; background: var(--border-light); margin: 4px 2px; }

/* ── Move / Copy / Split modal bits ── */
.ts-op-summary { font-size: 13px; color: var(--text); margin: 0 0 12px; }
.ts-field-label { font-size: 11px; letter-spacing: .04em; color: var(--muted); margin: 12px 0 6px; }

.ts-move-days { display: flex; flex-direction: column; gap: 4px; }
.ts-move-day { display: block; font-size: 13px; color: var(--text); padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.ts-move-day:hover { background: var(--accent-light); }
.ts-move-day input { margin-right: 8px; vertical-align: middle; }
.ts-move-src { color: var(--muted); cursor: default; }
.ts-move-src:hover { background: transparent; }
.ts-move-current { color: var(--muted); font-size: 12px; }

.ts-copy-entry {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px;
  color: var(--muted); background: var(--bg-alt); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.ts-copy-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ts-copy-day { font-size: 13px; color: var(--text); padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.ts-copy-day:hover { background: var(--accent-light); }
.ts-copy-day input { margin-right: 6px; vertical-align: middle; }
.ts-copy-src { color: var(--muted); cursor: default; }
.ts-copy-opt { display: block; font-size: 13px; color: var(--text); margin: 12px 0 2px; }
.ts-copy-opt input { margin-right: 6px; vertical-align: middle; }

.ts-split-modal { max-width: 520px; }
.ts-split-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ts-split-hours { display: flex; align-items: center; gap: 4px; }
.ts-split-h { width: 78px; }
.ts-split-unit { color: var(--muted); font-size: 12px; }
.ts-split-label { font-size: 12px; font-weight: 600; min-width: 70px; }
.ts-split-desc { flex: 1; }
.ts-split-rm { border: none; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.ts-split-rm:hover { color: var(--red); background: var(--red-bg); }
.ts-split-add { border: none; background: transparent; color: var(--accent); font-size: 13px; cursor: pointer; padding: 4px 0; }
.ts-split-total { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg-alt); font-size: 13px; color: var(--text); }
.ts-split-total-ok { background: var(--green-bg, #e8f5ec); }
.ts-split-ok { color: var(--green); font-weight: 600; }
.ts-split-bad { color: var(--orange, #b45309); font-weight: 600; }

/* ── Log Time modal ── */
.ts-modal { max-width: 460px; width: 100%; }
.ts-field { margin-bottom: 14px; position: relative; }
.ts-field > label { display: block; font-size: 11px; letter-spacing: .04em; color: var(--muted); margin-bottom: 5px; }
.ts-input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-input); color: var(--text); font-size: 13px; box-sizing: border-box;
}
.ts-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
textarea.ts-input { resize: vertical; }
.ts-hours-row { display: flex; gap: 8px; }
.ts-hours-row .ts-input { flex: 1; }
.ts-unit { max-width: 120px; }
.ts-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.ts-issue-results {
  margin-top: 6px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  max-height: 200px; overflow-y: auto;
}
.ts-issue-results:empty { display: none; }
.ts-issue-opt {
  display: block; width: 100%; text-align: left; border: none; background: var(--surface);
  padding: 7px 10px; cursor: pointer; font-size: 12px; color: var(--text);
}
.ts-issue-opt + .ts-issue-opt { border-top: 1px solid var(--border-light); }
.ts-issue-opt:hover { background: var(--accent-light); }
.ts-io-key { font-weight: 600; color: var(--accent); margin-right: 6px; }
.ts-io-sum { color: var(--muted); }

.ts-modal-error {
  background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-top: 4px;
}
.ts-modal-delete { margin-right: auto; color: var(--red); }

/* ── Proposed (calendar) section ── */
.ts-proposed-wrap { margin-top: 22px; }
.ts-proposed { border-top: 2px solid var(--border); padding-top: 12px; }
.ts-proposed-head { font-size: 12px; letter-spacing: .06em; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.ts-proposed-sub { font-weight: 400; text-transform: none; letter-spacing: 0; }
.ts-proposed-week { align-items: start; }
.ts-proposed-col { min-height: 0; background: transparent; border: none; }
.ts-proposed-col .ts-daycol-body { padding: 0; }
.ts-proposed-connect { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.ts-proposed-card { position: relative; border: 1px dashed var(--accent-border); border-radius: 8px; padding: 8px 26px 8px 8px; background: var(--accent-light); cursor: pointer; }
.ts-proposed-card:hover { border-style: solid; }
.ts-proposed-title { color: var(--text-strong); }

/* Collapsible header + capped scroll (SWHW-61) */
.ts-proposed-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: transparent; border: none; cursor: pointer; padding: 6px 0;
}
.ts-proposed-toggle .ts-proposed-head { margin: 0; }
.ts-proposed-caret { font-size: 10px; color: var(--muted); }
.ts-proposed-count {
  font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-light);
  border-radius: 999px; padding: 1px 8px;
}
.ts-proposed-hint { margin-left: auto; font-size: 12px; color: var(--accent); }
.ts-proposed-toggle:hover .ts-proposed-hint { text-decoration: underline; }
.ts-proposed-scroll { max-height: 320px; overflow-y: auto; margin-top: 10px; padding-right: 2px; }
.ts-proposed-empty { color: var(--muted); font-size: 12px; font-style: italic; padding: 8px 0; }

/* ── Week total progress bar ── */
.ts-weektotal { margin: 2px 0 18px; }
.ts-weektotal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ts-weektotal-label { font-size: 12px; letter-spacing: .06em; font-weight: 700; color: var(--muted); }
.ts-weektotal-nums { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.ts-weektotal-bar { height: 10px; border-radius: 999px; background: var(--bg-alt); overflow: hidden; }
.ts-weektotal-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s ease; }
.ts-weektotal-fill.ts-over { background: var(--green); }
.ts-weektotal-note { margin-top: 8px; font-size: 12px; color: var(--orange, #b45309); }
.ts-weektotal-note.ts-weektotal-done { color: var(--green); }

/* ── Calendar connect (Settings) ── */
.cal-connect-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.cal-status { font-size: 13px; font-weight: 600; color: var(--muted); }
.cal-status.cal-on { color: var(--green); }
.cal-admin { margin: 8px 0 4px; }
.cal-subhead { margin: 4px 0 6px; font-size: 14px; color: var(--text-strong); }
.cal-label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 0; max-width: 520px; }
.cal-label .ts-input { margin-top: 4px; }
.cal-hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.cal-check { display: block; font-size: 13px; color: var(--text); margin: 10px 0; max-width: 520px; }
.cal-check input { margin-right: 6px; vertical-align: middle; }
.cal-warn { color: var(--red); font-size: 12px; }

/* Narrower screens: let the 7 columns scroll horizontally rather than crush. */
@media (max-width: 1100px) {
  .ts-week { grid-template-columns: repeat(7, minmax(150px, 1fr)); overflow-x: auto; }
  .ts-week--5col { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
}
