/* Task links: the inline editor, `.tl-*` (JS/features/task-links.js). Own file because three hosts dress
   bare inputs/buttons differently. The address sits on its own `url` track, shown only while `.tl-url` is
   not [hidden]. `!important` only where `#taskModal`'s input rule in alt-team.css outranks a class.
   Load after base.css and alt-team.css, before alt-focus.css (sys_design-system.md §18). */

.tl-section{
  display:flex; flex-direction:column; gap:6px;
  /* A container query, not a page breakpoint: this mounts at three different
     widths that don't line up with any one viewport — the technique CSS/okr.css
     already uses for a card narrow in one host and wide in another. */
  container-type:inline-size; container-name:tasklinks;
}

/* ---------- one row ---------- */
.tl-slot{ display:flex; flex-direction:column; gap:2px; }
.tl-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto auto auto;
  grid-template-areas:"label edit open remove" "url url url url";
  align-items:center; column-gap:8px; row-gap:0;
}
.tl-row .tl-label{ grid-area:label; }
.tl-row .tl-edit{ grid-area:edit; }
.tl-row .tl-open{ grid-area:open; }
.tl-row .tl-remove{ grid-area:remove; }
/* The address, on its own line at full width — a long URL needs the row, not half of one. */
.tl-row .tl-url{ grid-area:url; margin-top:6px; }

/* Own declarations, not `.a-input`'s — see the header. 32px matches `--a-ctl`'s own
   value without depending on a token that only resolves inside `.alt-app`. */
.tl-label, .tl-url{
  height:32px !important; min-width:0; padding:0 10px !important; font-size:var(--a-fs-13) !important;
  font-family:inherit; line-height:var(--a-lh-ui);
  background:var(--panel-2) !important; color:var(--text) !important;
  border:1px solid var(--border) !important; border-radius:var(--a-r-sm) !important;
}
.tl-label:focus, .tl-url:focus{ border-color:var(--accent) !important; }
.tl-label::placeholder, .tl-url::placeholder{ color:var(--text-faint); opacity:1; }
/* The secondary field, and it says so: dim ink keeps the URL from competing with
   the label. Not a different size — 13px is the floor here and §18's besides. */
.tl-url{ color:var(--text-dim) !important; letter-spacing:.1px; }

/* 24px square, the same §18 pointer-target floor `.tcl-del` in checklist.css uses. */
.tl-edit, .tl-open, .tl-remove{
  width:24px; height:24px; min-width:24px; min-height:24px; flex:0 0 auto;
  display:flex; align-items:center; justify-content:center;
  padding:0; border-radius:var(--a-r-sm);
  background:transparent; border:1px solid transparent; color:var(--text-dim);
  cursor:pointer;
}
.tl-edit svg, .tl-open svg, .tl-remove svg{ width:16px; height:16px; display:block; }
.tl-edit:hover:not(:disabled), .tl-open:hover:not(:disabled), .tl-remove:hover:not(:disabled){
  background:var(--panel-2); border-color:var(--border-soft); color:var(--text);
}
/* Not opacity alone — sys_design-system.md §18 asks for a second signal on a
   disabled control: the border and background both change, not just the alpha. */
.tl-edit:disabled, .tl-open:disabled, .tl-remove:disabled{
  opacity:.55; color:var(--text-faint); background:var(--gray-soft); border-color:transparent;
  cursor:not-allowed;
}
.tl-remove:hover:not(:disabled){ color:var(--red-text); border-color:var(--red-soft); background:var(--red-soft); }

/* Held down like a toggle, styled from `aria-expanded` — the state the button
   already publishes — rather than a second class. Not colour alone (§18). */
.tl-edit[aria-expanded="true"]{
  background:var(--panel-2); border-color:var(--border-strong); color:var(--accent-text);
}

/* Read live from the DOM, never from what was saved. Collapses while empty, the
   same choice `.tcl-status:empty` makes in checklist.css (Definition of Done 4f).
   Shown whether or not the address is: a dead link must read as broken either way. */
.tl-note{ font-size:var(--a-fs-11); color:var(--text-faint); line-height:var(--a-lh-ui); min-height:0; }
.tl-note:empty{ display:none; }
.tl-note.err{ color:var(--red-text); }

/* ---------- read-only presentation ----------
   Two lines; the second names the host, since a reader has no edit control to press
   to see the full address. Absent, not empty, when nothing is openable. */
.tl-ro{
  grid-template-columns:minmax(0,1fr) auto;
  grid-template-areas:"label open" "host open";
}
.tl-ro .tl-ro-host{ grid-area:host; }
.tl-ro-text{
  min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:var(--a-fs-13); color:var(--text);
}
.tl-ro-host{
  min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:var(--a-fs-11); color:var(--text-dim); line-height:var(--a-lh-ui);
}
.tl-ro-empty{ font-size:var(--a-fs-12); }

/* Email-sourced rows only: the marker chip beside the host and type. Empty collapses, as .tl-note does. */
.tl-meta{ display:flex; align-items:center; flex-wrap:wrap; gap:6px; min-width:0; }
.tl-meta:empty{ display:none; }
.tl-meta-text{
  min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:var(--a-fs-11); color:var(--text-dim); line-height:var(--a-lh-ui);
}

/* ---------- the add control ---------- */
.tl-add{ margin-top:2px; }
.tl-add-btn{
  height:var(--a-ctl-sm); padding:0 12px; border-radius:var(--a-r-sm);
  background:var(--panel-2); color:var(--text); border:1px solid var(--border);
  font-size:var(--a-fs-ctl-sm); font-weight:var(--a-fw-ctl); cursor:pointer;
}
.tl-add-btn:hover:not(:disabled){ border-color:var(--accent); color:var(--accent-text); }
.tl-add-btn:disabled{
  opacity:.55; background:var(--gray-soft); border-color:var(--border-soft); cursor:not-allowed;
}

/* Narrow: only the control gap tightens below 320px. `.tl-compact` gives the framed
   `?embed=task` editor the same density at any width. */
@container tasklinks (max-width:320px){
  .tl-row{ column-gap:4px; }
}
.tl-compact .tl-row{ column-gap:4px; }
