/*
 * css/timereport.css – Stil för tidrapportering (TR-3: tidssektionen i klardialogen, TR-4: påminnelsen,
 *             TR-5a: snabbrapportering och tidposter i rapportdialogen).
 * Ansvar    : Klasser med prefixet .tr- samt (TR-5a) .ta-report-* för tidposterna i rapportdialogen (task-actions.js). Stapelordning för dialogen styrs av
 *             .done-reason-overlay i styles.css (sätt aldrig z-index här).
 * Beroenden : Använder CSS-variabler från styles.css (--border, --muted, --danger, --accent, --text).
 *             Laddas efter styles.css och css/task-actions.css; ingår i APP_SHELL i sw.js.
 * Publikt   : .tr-done, .tr-done-head/-title/-total/-list/-row/-add/-addrow/-preview/-error, .tr-invalid
 * TR-5a    : .tr-quick-btn, .tr-quick-date, .ta-report-total/-entries/-entry/-entry-date/-entry-h/-entry-text
 * TR-6     : .tr-rep-card, .tr-rep-controls/-checks/-actions/-sum, .tr-rep-wrap/-table/-g/-e/-total/-num/-more,
 *             .tr-rep-badge(-leave/-sick/-other), .tr-rep-pauses(-title), .tr-rep-pro, .tr-rep-empty
 *             (rapportvyn i Statistik, js/timereport-report.js; återanvänder .chart-card och .pie-controls*)
 * TR-7     : .tr-rep-tpl-actions/-btn/-danger/-name/-input, .tr-rep-dirty, .tr-rep-hint (mallrad: spara/uppdatera/byt namn/ta bort,
 *             inbäddad namnrad, "ändrad"-markering; js/timereport-report.js)
 * TR-8     : .tr-adm-* (admin-sektionen "Tidrapportering – påminnelse", admin.js): -row/-check/-fields/-field/-label/-input/-sub/-days/-day/
 *             -chips/-chip(-date/-name/-del)/-empty/-form/-pause/-actions; .tr-cfg-* (Listinfo → Konfiguration, project.js): -types/-type/-actions.
 *             Modalens sidopadding (.tr-rem-body/.tr-rem-actions) och mobilanpassning (16 px-fält, ≥40–44 px tryckytor, radbrytning).
 * TR-9     : .tr-date-nav/-step/-today/-info (datumväljare ‹ datum › Idag i rapportdialogen).
 * Privat    : Inget.
 */
.tr-done { margin-top: 0.75rem; padding: 0.6rem; border: 1px solid var(--border); border-radius: 8px; }
.tr-done-head { display: flex; align-items: baseline; gap: 0.4rem; font-size: 0.72rem; }
.tr-done-title { color: var(--muted); }
.tr-done-total { font-weight: 600; }
.tr-done-list { margin: 0.4rem 0; max-height: 9rem; overflow-y: auto; }
.tr-done-row { display: flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0; font-size: 0.68rem; border-bottom: 1px solid var(--border); }
.tr-done-row:last-child { border-bottom: 0; }
.tr-done-rdate { color: var(--muted); white-space: nowrap; }
.tr-done-redit { width: 3.6rem; padding: 0.15rem 0.3rem; font-size: 0.68rem; text-align: right; }
.tr-done-runit { color: var(--muted); }
.tr-done-rtext { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.tr-done-btn { background: none; border: 1px solid var(--border); border-radius: 6px; color: inherit; cursor: pointer;
  font-size: 0.65rem; padding: 0.2rem 0.45rem; min-height: 28px; }
.tr-done-btn.tr-danger { border-color: var(--danger); color: var(--danger); }
.tr-done-del { border-color: transparent; color: var(--muted); }
.tr-done-confirm { display: inline-flex; gap: 0.25rem; }
.tr-done-label { font-size: 0.6rem; color: var(--muted); }
.tr-done-addrow { display: flex; gap: 0.4rem; margin-bottom: 0.3rem; }
.tr-done-hours { flex: 1; min-width: 0; font-size: 0.8rem; }
.tr-done-date { flex: 0 0 9.5rem; font-size: 0.72rem; }
.tr-done-text { width: 100%; font-size: 0.72rem; }
.tr-done-preview { min-height: 1em; font-size: 0.68rem; color: var(--muted); margin-top: 0.2rem; }
.tr-done-error { min-height: 0; font-size: 0.65rem; color: var(--danger); }
.tr-invalid { border-color: var(--danger) !important; }
@media (max-width: 600px) {
  .tr-done-addrow { flex-direction: column; }
  .tr-done-date { flex: 1 1 auto; }
  .tr-done-hours, .tr-done-date, .tr-done-text, .tr-done-redit { font-size: 16px; } /* undvik iOS-zoom */
  .tr-done-btn { min-height: 36px; min-width: 36px; }
  .tr-done-row { flex-wrap: wrap; }
}

/* ── [TR-4] Påminnelse om orapporterad tid (dialog #trReminderOverlay, återanvänder .ta-dialog*) ── */
.tr-rem { max-width: 560px; width: calc(100vw - 2rem); max-height: 85vh; display: flex; flex-direction: column; }
.tr-rem-body { overflow-y: auto; padding: 0.5rem 1.25rem; flex: 1 1 auto; } /* [TR-8] sidopadding (tidigare 0 → innehållet låg mot kanten) */
.tr-rem-intro { font-size: 0.72rem; color: var(--muted); margin: 0 0 0.6rem; }
.tr-rem-day { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.6rem; margin-bottom: 0.5rem; }
.tr-rem-dayhead { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-size: 0.75rem; font-weight: 600; }
.tr-rem-dayactions { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.4rem; }
.tr-rem-sub { font-size: 0.62rem; color: var(--muted); margin: 0.35rem 0 0.2rem; }
.tr-rem-task { display: flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0; }
.tr-rem-taskname { flex: 1; min-width: 0; font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-rem-hours { width: 4.5rem; font-size: 0.75rem; text-align: right; }
.tr-rem-save { min-height: 28px; }
.tr-rem-empty { font-size: 0.68rem; color: var(--muted); padding: 0.3rem 0; }
.tr-rem-back { margin-bottom: 0.4rem; }
.tr-rem-daterow { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.3rem 0; }
.tr-rem-body input[type="search"], .tr-rem-body input[type="text"], .tr-rem-body input[type="date"] { max-width: 100%; box-sizing: border-box; }
.tr-rem-presets { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.tr-rem-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; padding: 0.5rem 1.25rem 0.9rem; }
@media (max-width: 600px) {
  .tr-rem { width: 100vw; max-height: 92vh; border-radius: 12px 12px 0 0; }
  .tr-rem-body { padding: 0.5rem 1rem; }
  .tr-rem-actions { padding: 0.5rem 1rem 1rem; }
  .tr-quick-date .finput, .tr-date-nav .finput { max-width: none; }
  .tr-date-step { min-width: 44px; min-height: 44px; font-size: 1.4rem; }
  .tr-date-today { min-height: 44px; }
  .tr-rem-task { flex-wrap: wrap; }
  .tr-rem-taskname { flex: 1 1 100%; white-space: normal; }
  .tr-rem-hours { flex: 1 1 5rem; min-height: 40px; }
  .tr-rem-hours, .tr-rem input, .tr-rem select { font-size: 16px; } /* undvik iOS-zoom */
  .tr-rem-save, .tr-rem-actions button, .tr-rem-dayactions button { min-height: 36px; }
  .tr-rem-actions { justify-content: stretch; }
  .tr-rem-actions button { flex: 1 1 auto; }
}

/* ── [TR-5a] Snabbrapportering och tidposter i rapportdialogen ─────────────────── */
.tr-quick-btn { white-space: nowrap; }
.tr-quick-date { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.6rem; } /* [TR-8] etikett över fältet */
.tr-quick-date .finput { max-width: 12rem; }
.tr-date-nav { display: flex; align-items: stretch; gap: 0.35rem; }
.tr-date-nav .finput { flex: 1 1 auto; min-width: 0; max-width: 12rem; }
.tr-date-step { flex: 0 0 auto; min-width: 36px; min-height: 36px; padding: 0 0.6rem; background: none; border: 1px solid var(--border2); border-radius: 6px;
  color: var(--text2); cursor: pointer; font-family: inherit; font-size: 1.2rem; line-height: 1; transition: border-color 0.15s, color 0.15s; }
.tr-date-step:hover, .tr-date-step:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.tr-date-today { flex: 0 0 auto; white-space: nowrap; }
.tr-date-info { font-size: 0.68rem; color: var(--muted); min-height: 1em; text-transform: capitalize; }
.ta-dialog .tr-invalid { border-color: var(--danger); }
.ta-report-total { font-size: 0.72rem; font-weight: 600; margin: 0.6rem 0 0.2rem; }
.ta-report-entries { list-style: none; margin: 0; padding: 0; max-height: 9rem; overflow-y: auto; }
.ta-report-entry { display: flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0; font-size: 0.7rem; }
.ta-report-entry-date { color: var(--muted); white-space: nowrap; }
.ta-report-entry-h { font-weight: 600; white-space: nowrap; }
.ta-report-entry-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.ta-report-entry button { min-height: 26px; padding: 0 0.5rem; font-size: 0.7rem; }
@media (max-width: 600px) {
  .ta-report-entry { flex-wrap: wrap; }
  .ta-report-entry button { min-height: 36px; }
  .ta-dialog #taReportHours, .ta-dialog #taReportDate, .tr-quick-date .finput { font-size: 16px; } /* undvik iOS-zoom */
}

/* ── [TR-6] Rapportvy "Tidrapport" i Statistik (återanvänder .chart-card / .pie-controls*) ───────── */
.tr-rep-card { grid-column: 1 / -1; margin-top: 1rem; }
.tr-rep-controls .pie-control-select { min-width: 8rem; }
.tr-rep-dim { max-width: 11rem; }
.tr-rep-checks { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.72rem; margin: 0.4rem 0; }
.tr-rep-checks label { display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.tr-rep-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.6rem 0; }
.tr-rep-sum { margin-left: auto; font-size: 0.72rem; font-weight: 600; }
.tr-rep-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.tr-rep-table { width: 100%; border-collapse: collapse; font-size: 0.72rem; }
.tr-rep-table th, .tr-rep-table td { padding: 0.3rem 0.5rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.tr-rep-table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.tr-rep-num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tr-rep-g td { font-weight: 600; background: rgba(128, 128, 128, 0.1); }
.tr-rep-g1 td { background: rgba(128, 128, 128, 0.06); }
.tr-rep-g2 td { background: transparent; }
.tr-rep-total td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: 0; }
.tr-rep-more { text-align: center; margin: 0.6rem 0; }
.tr-rep-badge { display: inline-block; font-size: 0.6rem; font-weight: 600; padding: 0.05rem 0.4rem; border-radius: 999px; border: 1px solid var(--border); }
.tr-rep-badge-sick { border-color: var(--danger); color: var(--danger); }
.tr-rep-badge-leave { border-color: var(--accent); color: var(--accent); }
.tr-rep-pauses { margin-top: 0.8rem; font-size: 0.72rem; }
.tr-rep-pauses-title { font-weight: 600; margin-bottom: 0.25rem; }
.tr-rep-pauses ul { margin: 0; padding-left: 1.1rem; }
.tr-rep-pro, .tr-rep-empty { padding: 0.8rem; font-size: 0.75rem; color: var(--muted); }
.tr-rep-pro p { margin: 0.4rem 0 0.6rem; }
/* [TR-7] Egna rapportmallar */
.tr-rep-tpl-actions { flex-wrap: wrap; gap: 0.4rem; }
.tr-rep-tpl-btn { font-size: 0.7rem; padding: 0.25rem 0.6rem; }
.tr-rep-tpl-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.tr-rep-tpl-name { flex-wrap: wrap; gap: 0.4rem; }
.tr-rep-tpl-input { flex: 1 1 12rem; min-width: 0; }
.tr-rep-dirty { font-size: 0.68rem; color: var(--accent); white-space: nowrap; }
.tr-rep-hint { font-size: 0.66rem; color: var(--muted); }
@media (max-width: 600px) {
  .tr-rep-tpl-btn { min-height: 36px; flex: 1 1 auto; }
  .tr-rep-tpl-input { font-size: 16px; min-height: 36px; }
  .tr-rep-controls select, .tr-rep-controls input { font-size: 16px; } /* undvik iOS-zoom */
  .tr-rep-actions button { min-height: 36px; flex: 1 1 auto; }
  .tr-rep-sum { flex: 1 1 100%; margin-left: 0; }
  .tr-rep-dim { max-width: none; flex: 1 1 100%; }
}

/* ── [TR-8] Admin → "Tidrapportering – påminnelse" (.tr-adm-*) ─────────────────────
   Följer appens adminutseende: DM Mono, --surface/--border2, radbrytande rader, stora tryckytor på mobil. */
#admin-sec-time-reporting { display: flex; flex-direction: column; gap: 0.75rem; }
.tr-adm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.tr-adm-check { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 32px; font-size: 0.72rem; color: var(--text2); line-height: 1.5; cursor: pointer; }
.tr-adm-check input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.tr-adm-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 14rem)); gap: 0.75rem 1rem; }
.tr-adm-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.tr-adm-label { font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text2); }
.tr-adm-sub { font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text2); margin-top: 0.4rem; }
.tr-adm-input, .tr-adm-select {
  width: 100%; box-sizing: border-box; min-width: 0; background: var(--surface); border: 1px solid var(--border2); color: var(--text);
  font-family: 'DM Mono', monospace; font-size: 0.72rem; padding: 0.45rem 0.65rem; min-height: 36px; outline: none; transition: border-color 0.15s;
}
.tr-adm-input:focus, .tr-adm-select:focus { border-color: #e0a0f5; }
.tr-adm-select { appearance: auto; cursor: pointer; }
.tr-adm-days { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tr-adm-day { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.65rem; min-height: 32px; box-sizing: border-box;
  border: 1px solid var(--border2); background: var(--surface); color: var(--text2); font-size: 0.68rem; cursor: pointer; }
.tr-adm-day input { accent-color: var(--accent); cursor: pointer; }
.tr-adm-day:has(input:checked) { border-color: var(--accent); color: var(--text); }
.tr-adm-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tr-adm-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.3rem 0.25rem 0.6rem; max-width: 100%;
  border: 1px solid var(--border2); background: var(--surface); color: var(--text2); font-size: 0.65rem; line-height: 1.4; }
.tr-adm-chip-date { color: var(--text); white-space: nowrap; }
.tr-adm-chip-name { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.tr-adm-chip-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 0 0.35rem; min-width: 28px; min-height: 28px; }
.tr-adm-chip-del:hover { color: var(--danger); }
.tr-adm-empty { font-size: 0.68rem; color: var(--muted); }
.tr-adm-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.6rem 0.75rem; align-items: end; }
.tr-adm-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tr-adm-actions .btn-admin-add, .tr-adm-form .btn-admin-add { min-height: 36px; }
.tr-adm-pause { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.2rem;
  border-bottom: 1px solid var(--border); font-size: 0.7rem; color: var(--text2); line-height: 1.5; }
.tr-adm-pause:last-child { border-bottom: 0; }
.tr-adm-pause-text { min-width: 0; overflow-wrap: anywhere; }

/* ── [TR-8] Listinfo → Konfiguration → "Tidrapportering" (.tr-cfg-*) ───────────────── */
.tr-cfg-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.4rem; margin-top: 0.4rem; }
.tr-cfg-type { display: flex; align-items: center; gap: 0.55rem; min-height: 36px; padding: 0.3rem 0.6rem; box-sizing: border-box;
  border: 1px solid var(--border2); background: var(--surface); border-radius: 5px; cursor: pointer; min-width: 0; }
.tr-cfg-type .proj-cfg-label { min-width: 0; overflow-wrap: anywhere; }
.tr-cfg-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }

@media (max-width: 600px) {
  .tr-adm-fields { grid-template-columns: 1fr; }
  .tr-adm-input, .tr-adm-select { font-size: 16px; min-height: 44px; } /* undvik iOS-zoom */
  .tr-adm-check { min-height: 44px; font-size: 0.78rem; }
  .tr-adm-check input[type="checkbox"], .tr-adm-day input { width: 20px; height: 20px; }
  .tr-adm-day { min-height: 44px; padding: 0.4rem 0.8rem; font-size: 0.75rem; }
  .tr-adm-chip { font-size: 0.72rem; padding-left: 0.7rem; }
  .tr-adm-chip-del { min-width: 44px; min-height: 44px; font-size: 1.2rem; }
  .tr-adm-form { grid-template-columns: 1fr; }
  .tr-adm-actions .btn-admin-add, .tr-adm-form .btn-admin-add { min-height: 44px; flex: 1 1 100%; font-size: 0.75rem; }
  .tr-adm-pause { font-size: 0.75rem; }
  .tr-cfg-types { grid-template-columns: 1fr; }
  .tr-cfg-type { min-height: 44px; }
  .tr-cfg-type .proj-cfg-label { font-size: 0.8rem; }
  .tr-cfg-type .proj-cfg-checkbox { width: 20px; height: 20px; }
  .tr-cfg-actions .proj-cfg-btn { min-height: 44px; flex: 1 1 100%; font-size: 0.75rem; }
}
