/* ==========================================================================
   Task modal and task page (docs/task-modal-prompt.md,
   mock-up docs/devsoftuk-ERP-Task-Modal.html).

   The modal and the full task page are drawn from the same partials
   (Views/Shared/TaskDetail); everything here is prefixed tm- so nothing else on
   any page is touched. Colours come from the brand tokens in app.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   The overlay
   -------------------------------------------------------------------------- */

html.tm-lock,
html.tm-lock body {
  overflow: hidden;
}

.tm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1040;               /* under Bootstrap's own dialogs (1050+), over everything else */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(9, 20, 38, 0.55);
  backdrop-filter: blur(2px);
}

.tm-overlay[hidden] {
  display: none;
}

.tm-dialog {
  width: 1260px;
  max-width: 100%;
  height: min(910px, 96vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(5, 15, 35, 0.45);
  outline: none;
}

.tm-content,
.tm-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.tm-loading {
  padding: 18px;
  color: var(--dsu-ink-3, #64748b);
  font-size: 0.8125rem;
}

.tm-loading-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.tm-flash {
  margin: 0;
  border-radius: 0;
  font-size: 0.8125rem;
}

.tm-highlight {
  animation: tm-flash-bg 2.4s ease-out 1;
}

@keyframes tm-flash-bg {
  0% { background: var(--dsu-blue-light, #e8f1fb); }
  100% { background: transparent; }
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.tm-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--dsu-line, #e2e8f0);
  background: #fff;
}

.tm-head-main {
  min-width: 0;
  flex: 1;
}

.tm-crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--dsu-ink-3, #64748b);
}

.tm-project {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 420px;
  padding: 1px 7px;
  border: 1px solid var(--dsu-line, #e2e8f0);
  border-radius: 6px;
  background: var(--dsu-surface-2, #f8fafc);
  color: var(--dsu-ink-2, #475569);
  text-decoration: none;
}

.tm-project:hover {
  color: var(--dsu-ink, #172033);
}

.tm-project i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: none;
}

.tm-code {
  color: var(--dsu-ink-2, #475569);
}

.tm-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 5px 0 7px;
}

.tm-title h1,
.tm-title h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.2px;
  overflow-wrap: anywhere;
}

.tm-page .tm-title h1 {
  font-size: 1.375rem;
}

.tm-title-edit {
  color: var(--dsu-ink-3, #64748b);
  opacity: 0;
  transition: opacity 0.12s;
}

.tm-title:hover .tm-title-edit,
.tm-title-edit:focus-visible {
  opacity: 1;
}

.tm-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tm-badges .badge {
  font-weight: 600;
}

.tm-tag {
  background: #f0eafc;
  color: #6a3fc9;
}

.tm-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.tm-status {
  width: auto;
  min-width: 130px;
  font-weight: 600;
}

.tm-sep {
  width: 1px;
  height: 22px;
  margin: 0 2px;
  background: var(--dsu-line, #e2e8f0);
}

.tm-ib {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--dsu-line, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: var(--dsu-ink-2, #475569);
  text-decoration: none;
}

.tm-ib:hover,
.tm-ib:focus-visible {
  background: var(--dsu-surface-2, #f8fafc);
  color: var(--dsu-ink, #172033);
}

.tm-ib.is-done,
[data-tm-copy].is-done {
  color: var(--dsu-green, #2e7d32);
}

.tm-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 4px;
  border: 1px solid var(--dsu-line, #e2e8f0);
  border-radius: 8px;
  color: var(--dsu-ink-3, #64748b);
  font-size: 11.5px;
  white-space: nowrap;
}

.tm-nav[hidden] {
  display: none;
}

.tm-nav button {
  width: 22px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--dsu-ink-2, #475569);
}

.tm-nav button:hover:not(:disabled) {
  background: var(--dsu-surface-2, #f8fafc);
}

.tm-nav button:disabled {
  opacity: 0.35;
}

/* --------------------------------------------------------------------------
   Timer strip
   -------------------------------------------------------------------------- */

.tm-timer-error {
  border-radius: 0;
}

.tm-timer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  padding: 10px 20px;
  background: linear-gradient(90deg, var(--dsu-navy, #0b1f3a), #12325c);
  color: #fff;
}

.tm-timer-live {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.tm-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4ade80;
  flex: none;
  animation: tm-pulse 1.6s infinite;
}

@keyframes tm-pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .tm-dot { animation: none; }
}

.tm-timer-label {
  font-size: 11.5px;
  color: #a9bfdb;
}

.tm-clock {
  font-size: 20px;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.tm-use {
  flex: 1;
  min-width: 220px;
  max-width: 420px;
}

.tm-use-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: #a9bfdb;
}

.tm-use-row b {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  color: #fff;
}

.tm-use-row b.is-over {
  color: #ff9b9b;
}

.tm-bar {
  height: 6px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.14);
}

.tm-bar i {
  display: block;
  height: 100%;
  background: #4ade80;
}

.tm-bar i.is-over {
  background: #ff6b6b;
}

.tm-timer-note {
  margin-top: 4px;
  font-size: 11px;
  color: #8fa6c4;
}

.tm-timer-link {
  color: #cfe0f5;
  font-weight: 600;
}

.tm-timer-link:hover {
  color: #fff;
}

.tm-timer-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tm-btn-stop {
  background: #e5484d;
  border-color: #e5484d;
  color: #fff;
  font-weight: 600;
}

.tm-btn-stop:hover,
.tm-btn-stop:focus-visible {
  background: #cf3a3f;
  border-color: #cf3a3f;
  color: #fff;
}

.tm-btn-done {
  background: #1f8f4e;
  border-color: #1f8f4e;
  color: #fff;
  font-weight: 600;
}

.tm-btn-done:hover,
.tm-btn-done:focus-visible {
  background: #187a42;
  border-color: #187a42;
  color: #fff;
}

.tm-timer .stop-others .btn-outline-danger,
.tm-timer .stop-others .btn-outline-success {
  background: #fff;
}

.tm-other {
  display: flex;
  flex-direction: column;
  max-width: 360px;
  font-size: 12.5px;
}

.tm-other a {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.tm-other a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Body: tabs and panes, side panel
   -------------------------------------------------------------------------- */

.tm-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 0;
}

.tm-body[hidden] {
  display: none;
}

.tm-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--dsu-line, #e2e8f0);
}

.tm-tabs {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 2px;
  padding: 0 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--dsu-line, #e2e8f0);
  background: #fff;
}

.tm-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 12px 10px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--dsu-ink-2, #475569);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.tm-tab:hover {
  color: var(--dsu-ink, #172033);
}

.tm-tab.active {
  color: var(--dsu-blue, #1a76d1);
  border-bottom-color: var(--dsu-blue, #1a76d1);
}

.tm-n {
  padding: 0 6px;
  border-radius: 9px;
  background: #eef1f5;
  color: var(--dsu-ink-2, #475569);
  font-size: 11px;
  font-weight: 600;
}

.tm-n.is-red {
  background: var(--dsu-red-light, #fdecec);
  color: var(--dsu-red, #d32f2f);
}

.tm-n.is-amber {
  background: var(--dsu-amber-light, #fff4e0);
  color: var(--dsu-amber, #b26a00);
}

.tm-panes {
  flex: 1;
  overflow: auto;
  padding: 16px 18px 24px;
  background: var(--dsu-surface-2, #f8fafc);
}

.tm-panes > .tab-pane {
  display: none;
}

.tm-panes > .tab-pane.active {
  display: block;
}

.tm-panes .card {
  border-radius: 12px;
}

.tm-side {
  overflow: auto;
  background: #fff;
}

.tm-side-card {
  padding: 14px 18px;
  border-bottom: 1px solid var(--dsu-line, #e2e8f0);
}

.tm-side-card:last-child {
  border-bottom: 0;
}

.tm-side-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--dsu-ink-3, #64748b);
}

.tm-side-title span {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.tm-side-sub {
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--dsu-ink-2, #475569);
}

.tm-kv {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  margin: 0;
}

.tm-kv dt {
  padding: 5px 0;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--dsu-ink-3, #64748b);
}

.tm-kv dd {
  margin: 0;
  padding: 4px 6px;
  min-height: 30px;
  display: flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.tm-kv-edit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: calc(100% + 12px);
  margin: -4px -6px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}

.tm-kv-edit:hover,
.tm-kv-edit:focus-visible {
  border-color: var(--dsu-line, #e2e8f0);
  background: var(--dsu-surface-2, #f8fafc);
  color: inherit;
}

.tm-pen {
  flex: none;
  color: var(--dsu-ink-3, #64748b);
  opacity: 0;
}

.tm-kv-edit:hover .tm-pen,
.tm-kv-edit:focus-visible .tm-pen {
  opacity: 1;
}

.tm-time {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 8px;
}

.tm-time > div {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--dsu-surface-2, #f8fafc);
}

.tm-time-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--dsu-ink-3, #64748b);
}

.tm-time-value {
  margin-top: 2px;
  font-size: 13.5px;
  white-space: nowrap;
}

.tm-time-value.is-over,
.tm-stat-value.is-over,
.tm-es-value.is-over {
  color: var(--dsu-red, #d32f2f);
}

.tm-ubar {
  height: 7px;
  margin: 12px 0 5px;
  overflow: hidden;
  border-radius: 4px;
  background: #eef1f5;
}

.tm-ubar i {
  display: block;
  height: 100%;
  background: var(--dsu-blue, #1a76d1);
}

.tm-ubar i.is-over {
  background: var(--dsu-red, #d32f2f);
}

.tm-actions {
  display: grid;
  gap: 4px;
}

.tm-actions button,
.tm-actions a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--dsu-ink-2, #475569);
  font-size: 12.5px;
  text-align: left;
  text-decoration: none;
}

.tm-actions button:hover,
.tm-actions a:hover {
  background: var(--dsu-surface-2, #f8fafc);
  color: var(--dsu-ink, #172033);
}

/* The Edit form, opened over the tabs. */
.tm-edit {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 24px;
  background: var(--dsu-surface-2, #f8fafc);
}

.tm-edit[hidden] {
  display: none;
}

.tm-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 8px 20px;
  border-top: 1px solid var(--dsu-line, #e2e8f0);
  background: #fff;
  font-size: 11.5px;
  color: var(--dsu-ink-3, #64748b);
}

.tm-foot kbd {
  padding: 0 5px;
  border: 1px solid var(--dsu-line, #e2e8f0);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fff;
  color: var(--dsu-ink-2, #475569);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
}

/* --------------------------------------------------------------------------
   Overview and Work log
   -------------------------------------------------------------------------- */

.tm-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.tm-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--dsu-line, #e2e8f0);
  border-radius: 10px;
  background: #fff;
  text-align: left;
}

.tm-stat:hover,
.tm-stat:focus-visible {
  border-color: #c7d7ec;
}

.tm-stat-label {
  font-size: 11px;
  color: var(--dsu-ink-3, #64748b);
}

.tm-stat-value {
  margin-top: 2px;
  font-size: 17px;
  font-weight: 600;
}

.tm-es {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tm-es > div {
  padding: 11px 16px;
  border-right: 1px solid var(--dsu-line, #e2e8f0);
}

.tm-es > div:last-child {
  border-right: 0;
}

.tm-es-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--dsu-ink-3, #64748b);
}

.tm-es-value {
  margin-top: 3px;
  font-size: 15px;
}

.tm-es-value.is-pending {
  color: var(--dsu-amber, #b26a00);
}

.tm-es small {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--dsu-ink-3, #64748b);
}

.tm-es.has-five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

/* --------------------------------------------------------------------------
   The estimate: requests for more time, the approval bar, the dialogs
   (docs/task-estimate-request-prompt.md)
   -------------------------------------------------------------------------- */

.tm-est-pending {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 7px 9px;
  border: 1px solid #f1d9a6;
  border-radius: 7px;
  background: #fffaf0;
  font-size: 12px;
}

.tm-est-pending b {
  color: var(--dsu-amber, #b26a00);
  font-weight: 600;
}

.tm-est-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tm-est-buttons:empty {
  display: none;
}

.tm-est-mine {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  border-top: 1px solid #f3e0b5;
  background: #fffaf0;
  font-size: 12.5px;
}

.tm-est-mine b {
  font-weight: 600;
}

.tm-est-trail {
  padding: 9px 16px;
  border-top: 1px solid var(--dsu-line, #e2e8f0);
  font-size: 12px;
  color: var(--dsu-ink-3, #64748b);
}

.tm-est-trail b {
  color: var(--dsu-ink, #172033);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
}

.tm-est-trail b.is-pending {
  color: var(--dsu-amber, #b26a00);
}

.tm-table tr.is-pending td {
  background: #fffaf0;
}

/* The Estimate tab's efficiency strip and estimate history
   (docs/devsoftuk-ERP-task-estimate-efficiency-prompt.md §2–§3): ≥100% green, 90–99% amber, <90% red. */
.tm-effkpi {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.tm-effkp {
  flex: 1;
  min-width: 110px;
  background: var(--dsu-soft, #f7f9fc);
  border: 1px solid var(--dsu-line, #e2e8f0);
  border-radius: 11px;
  padding: 10px 12px;
}

.tm-effkp .k {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--dsu-ink-3, #64748b);
}

.tm-effkp .v {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.tm-effkp .v small { font-size: 12px; font-weight: 500; color: var(--dsu-ink-3, #64748b); }
.tm-effkp .v.is-est { color: #0f4c8a; }
.tm-effkp .v.is-g { color: #1f8f4e; }
.tm-effkp .v.is-a { color: #b86e00; }
.tm-effkp .v.is-r { color: #d93838; }

.tm-esttl {
  list-style: none;
  margin: 0;
  padding: 10px 16px 14px;
}

.tm-esttl-ev {
  display: grid;
  grid-template-columns: 120px 22px 1fr;
  gap: 10px;
  align-items: start;
}

.tm-esttl-tm {
  font-size: 11px;
  color: var(--dsu-ink-3, #64748b);
  padding-top: 7px;
  text-align: right;
}

.tm-esttl-nd {
  position: relative;
  justify-self: center;
  width: 12px;
  height: 12px;
  margin-top: 8px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #1a76d1;
}

.tm-esttl-ev:not(:last-child) .tm-esttl-nd::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 9px;
  width: 2px;
  height: 40px;
  transform: translateX(-50%);
  background: #e3e8f0;
}

.tm-esttl-ev.is-g .tm-esttl-nd { border-color: #1f8f4e; }
.tm-esttl-ev.is-r .tm-esttl-nd { border-color: #d93838; }
.tm-esttl-ev.is-a .tm-esttl-nd { border-color: #b86e00; }
.tm-esttl-ev.is-k .tm-esttl-nd { border-color: #8b97aa; }

.tm-esttl-bx { padding: 5px 0 9px; display: flex; flex-direction: column; }
.tm-esttl-t1 { font-weight: 600; font-size: 12.5px; }
.tm-esttl-t2 { font-size: 11.5px; color: var(--dsu-ink-2, #475569); margin-top: 2px; line-height: 1.5; }

@media (max-width: 600px) {
  .tm-esttl-ev { grid-template-columns: 78px 18px 1fr; }
}

/* The approval bar, above the tabs. */
.tm-apb {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 20px;
  border-bottom: 1px solid #f3e0b5;
  background: #fffaf0;
  font-size: 12.5px;
}

.tm-page .tm-apb {
  margin-bottom: 1rem;
  border: 1px solid #f3e0b5;
  border-radius: 12px;
}

.tm-apb b {
  font-weight: 600;
}

.tm-apb-text {
  flex: 1 1 320px;
  min-width: 0;
}

.tm-apb-reason {
  margin-top: 2px;
  color: var(--dsu-ink-2, #475569);
  overflow-wrap: anywhere;
}

.tm-apb-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--dsu-ink-2, #475569);
  font-size: 12px;
}

.tm-apb-form input[type="number"] {
  width: 70px;
}

.tm-apb-note {
  width: 220px;
}

/* The dialogs: native <dialog>, over the task modal. */
.tm-est-dialog {
  width: 480px;
  max-width: 94vw;
  padding: 0;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  color: var(--dsu-ink, #172033);
}

.tm-est-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.tm-est-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--dsu-line, #e2e8f0);
}

.tm-est-dialog-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.tm-est-dialog-body {
  display: grid;
  gap: 14px;
  padding: 16px 20px;
}

.tm-est-dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--dsu-line, #e2e8f0);
}

.tm-est-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tm-est-info > div {
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--dsu-surface-2, #f4f6f9);
  font-size: 11.5px;
  color: var(--dsu-ink-3, #64748b);
}

.tm-est-info b {
  display: block;
  margin-top: 2px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--dsu-ink, #172033);
}

.tm-est-info b.is-over {
  color: var(--dsu-red, #d32f2f);
}

.tm-est-info b.is-after {
  color: var(--dsu-green, #2e7d32);
}

.tm-est-hm {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tm-est-hm input {
  width: 84px;
}

/* Moving a task to another project: the impact box under the Edit form's Project field
   (docs/task-change-project-prompt.md). */
.task-move-impact {
  padding: 10px 12px;
  border: 1px solid #f1d9a6;
  border-radius: 8px;
  background: #fffaf0;
  font-size: 13px;
  color: var(--dsu-ink, #172033);
}

.task-move-impact ul {
  padding-left: 18px;
}

.task-move-impact li + li {
  margin-top: 6px;
}

.task-move-warning {
  color: var(--dsu-amber, #b26a00);
}

/* The Project dropdown with its own search box. */
.tm-combo {
  position: relative;
}

.tm-combo-toggle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tm-combo-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 260px;
  padding: 8px;
  border: 1px solid var(--dsu-line, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
}

.tm-combo-panel[hidden] {
  display: none;
}

.tm-combo-list {
  max-height: 260px;
  margin: 6px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.tm-combo-list [role=option] {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.tm-combo-list [role=option]:hover,
.tm-combo-list [role=option].is-active {
  background: var(--dsu-blue-light, #e8f1fb);
}

.tm-combo-list [role=option][aria-selected=true] {
  font-weight: 600;
  color: var(--dsu-blue, #1a76d1);
}

.tm-combo-list [role=option][hidden] {
  display: none;
}

.tm-combo-empty {
  margin: 8px 4px 2px;
  font-size: 12.5px;
  color: var(--dsu-ink-3, #64748b);
}

.tm-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--dsu-line, #e2e8f0);
}

.tm-chip {
  padding: 3px 10px;
  border: 1px solid var(--dsu-line, #e2e8f0);
  border-radius: 14px;
  background: #fff;
  color: var(--dsu-ink-2, #475569);
  font-size: 12px;
}

.tm-chip b {
  margin-left: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--dsu-ink-3, #64748b);
}

.tm-chip.is-on {
  border-color: var(--dsu-ink, #172033);
  background: var(--dsu-ink, #172033);
  color: #fff;
}

.tm-chip.is-on b {
  color: #c2cad6;
}

.tm-filter-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--dsu-ink-2, #475569);
}

.tm-table td,
.tm-table th {
  font-size: 12.5px;
}

.tm-table tr.is-running td {
  background: #f0faf3;
}

.tm-table tr.is-running td:first-child {
  box-shadow: inset 3px 0 0 var(--dsu-green, #2e7d32);
}

.tm-total td {
  background: #fbfcfd;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   The full task page: the same pieces, in the page's own frame
   -------------------------------------------------------------------------- */

.tm-page .tm-head {
  margin-bottom: 12px;
  padding: 0 0 12px;
  background: transparent;
}

.tm-page .tm-timer {
  margin-bottom: 1rem;
  border-radius: 12px;
}

.tm-page .tm-timer-error {
  margin-bottom: 0.75rem;
  border-radius: 8px;
}

.tm-side-page {
  overflow: hidden;
}

/* A task named in a Glance drawer opens the modal; it reads as the text it was. */
.task-link {
  color: inherit;
  text-decoration: none;
}

.task-link:hover,
.task-link:focus-visible {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Narrow screens: full screen, the side panel under the tabs
   -------------------------------------------------------------------------- */

@media (max-width: 899.98px) {
  .tm-overlay {
    padding: 0;
  }

  .tm-dialog {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .tm-head {
    flex-wrap: wrap;
  }

  .tm-head-actions {
    flex-wrap: wrap;
    width: 100%;
    margin-left: 0;
  }

  .tm-head-main {
    flex-basis: 100%;
  }

  .tm-status {
    min-width: 0;
    flex: 1 1 140px;
  }

  .tm-sep {
    display: none;
  }

  .tm-dialog .tm-body {
    display: block;
    overflow: auto;
  }

  .tm-dialog .tm-main {
    border-right: 0;
  }

  .tm-dialog .tm-panes {
    overflow: visible;
  }

  .tm-dialog .tm-side {
    overflow: visible;
    border-top: 1px solid var(--dsu-line, #e2e8f0);
  }

  .tm-stats,
  .tm-es,
  .tm-es.has-five {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tm-es > div:nth-child(2) {
    border-right: 0;
  }

  .tm-keys {
    display: none;
  }
}
