.admin-body { background: var(--bg-soft); }

.admin-gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; flex-direction: column;
  gap: 1rem; text-align: center; padding: 2rem;
}
.admin-gate p { color: var(--text-secondary); font-size: 0.95rem; margin: 0; }
.admin-gate a { color: var(--accent-ink); text-decoration: underline; }

.admin-app[hidden], .admin-gate[hidden] { display: none !important; }

/* ---------- Topbar ---------- */
.admin-topbar {
  display: flex; align-items: center; gap: 1.5rem; padding: 0.9rem 1.75rem;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.admin-topbar-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); background: var(--bg-soft); border-radius: 999px; padding: 0.25rem 0.65rem;
}
.admin-tabs { display: flex; gap: 0.4rem; margin-left: auto; }
.admin-tab {
  background: none; border: 1px solid transparent; border-radius: 8px; padding: 0.5rem 0.9rem;
  font-size: 0.86rem; font-weight: 600; color: var(--text-muted); cursor: pointer;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.admin-signout {
  background: none; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0.45rem 0.9rem;
  font-size: 0.82rem; color: var(--text-secondary); cursor: pointer;
}
.admin-signout:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Layout ---------- */
.admin-main { max-width: 1040px; margin: 0 auto; padding: 2rem 1.75rem 4rem; }
.admin-panel-section { display: none; }
.admin-panel-section.is-active { display: block; }

/* ---------- Orders ---------- */
.admin-summary { display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.admin-summary-item { display: flex; flex-direction: column; gap: 0.2rem; }
.admin-summary-item .n { font-size: 1.6rem; font-weight: 800; }
.admin-summary-item .l { font-size: 0.78rem; color: var(--text-muted); }

.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.admin-table th {
  text-align: left; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-muted); background: var(--bg-soft); padding: 0.75rem 1rem; white-space: nowrap;
}
.admin-table td { padding: 0.8rem 1rem; border-top: 1px solid var(--border); vertical-align: top; }
.admin-table .admin-email { font-weight: 600; color: var(--text-primary); }
.admin-items-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.2rem; }
.admin-status { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; padding: 0.1rem 0.4rem; border-radius: 4px; }
.admin-status-paid, .admin-status-active { background: rgba(14, 165, 233, 0.12); color: var(--accent-2); }
.admin-status-pending { background: rgba(217,119,6,0.12); color: #b45309; }
.admin-status-failed, .admin-status-cancelled { background: rgba(180,35,44,0.1); color: #b4232c; }
.admin-status-not_applicable { color: var(--text-muted); }
.admin-empty { padding: 2rem; text-align: center; color: var(--text-muted); font-size: 0.9rem; margin: 0; }

/* ---------- Site Content ---------- */
.admin-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 1.75rem;
  margin-bottom: 1.5rem; max-width: 640px;
}
.admin-card h2 { font-size: 1.05rem; margin: 0 0 0.4rem; }
.admin-card-note { font-size: 0.84rem; color: var(--text-muted); margin: 0 0 1.25rem; }

.admin-asset-row { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.admin-asset-preview {
  width: 120px; height: 64px; border: 1px dashed var(--border-strong); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem; flex-shrink: 0;
  background: var(--bg-soft); padding: 0.5rem;
}
.admin-asset-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.admin-asset-preview-small { width: 64px; }
.admin-asset-default-label { font-size: 0.68rem; color: var(--text-muted); text-align: center; }
.admin-asset-actions { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.admin-status-note { font-size: 0.8rem; color: var(--text-muted); margin: 0.9rem 0 0; }
.admin-status-note.is-error { color: #b4232c; }
.admin-status-note.is-ok { color: var(--accent-2); }

.admin-text-form { display: flex; flex-direction: column; gap: 1rem; }
.admin-field { display: flex; flex-direction: column; gap: 0.35rem; }
.admin-field label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.admin-field input, .admin-field textarea {
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 0.6rem 0.75rem; font-size: 0.9rem;
  background: var(--bg); color: var(--text-primary); font-family: inherit; resize: vertical;
}
.admin-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.admin-text-form-actions { display: flex; gap: 0.75rem; align-items: center; }

/* ---------- Portfolio ---------- */
.admin-field-checkbox { flex-direction: row; align-items: center; gap: 0.5rem; justify-content: flex-start; }
.admin-field-checkbox label { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; color: var(--text-primary); }
.admin-portfolio-item { max-width: 760px; }
.admin-portfolio-preview { width: 160px; height: 100px; }
.admin-portfolio-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }

/* The "Template piece thumbnails" card needs real width for a 4-up grid —
   wider than the default .admin-card max-width used by the single-asset
   (logo/favicon) cards. */
.admin-card-wide { max-width: 1040px; }

#portfolio-thumb-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* Each template piece as its own horizontal card — wide thumbnail on top,
   title and upload/reset controls stacked below — rather than the old thin
   list row, so a row of these actually reads as "cards in a row". */
.admin-portfolio-thumb-row {
  display: flex; flex-direction: column; align-items: stretch; gap: 0.7rem;
  padding: 0.9rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-soft);
}
.admin-portfolio-thumb-row .admin-portfolio-preview { width: 100%; height: auto; aspect-ratio: 16 / 10; }
.admin-portfolio-thumb-info { display: flex; flex-direction: column; gap: 0.5rem; align-items: stretch; width: 100%; }
.admin-portfolio-thumb-info strong { font-size: 0.86rem; }
.admin-portfolio-thumb-info .admin-asset-actions { flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
.admin-portfolio-thumb-info .btn-sm { font-size: 0.78rem; padding: 0.45rem 0.8rem; }
.admin-portfolio-thumb-info .admin-status-note { margin-top: 0.3rem; }

@media (max-width: 960px) {
  #portfolio-thumb-list { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .admin-topbar { flex-wrap: wrap; padding: 0.9rem 1.1rem; }
  .admin-tabs { margin-left: 0; order: 3; width: 100%; }
  .admin-main { padding: 1.5rem 1.1rem 3rem; }
  .admin-field-row { grid-template-columns: 1fr; }
  #portfolio-thumb-list { grid-template-columns: 1fr; }
}

/* ---------- Proposals ---------- */
.admin-subhead {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); margin: 0.75rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border);
}
.admin-text-form > .admin-subhead:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.admin-req { color: #b4232c; }

.admin-field select {
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 0.6rem 0.75rem; font-size: 0.9rem;
  background: var(--bg); color: var(--text-primary); font-family: inherit;
}

/* One catalog SKU = one selectable row. The seats/cycle controls only become
   relevant once the row is ticked, so they stay dimmed until then. */
.pr-group-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); margin: 1rem 0 0.5rem;
}
.pr-group-label:first-child { margin-top: 0; }
.pr-item {
  display: flex; align-items: flex-start; gap: 0.85rem;
  border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem 0.95rem;
  margin-bottom: 0.5rem; background: var(--bg-soft);
}
.pr-item.is-on { border-color: var(--accent); background: var(--accent-soft); }
.pr-item input[type="checkbox"] { margin-top: 0.25rem; flex-shrink: 0; }
.pr-item-main { flex: 1; min-width: 0; }
.pr-item-name { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }
.pr-item-tagline { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.pr-item-controls { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.pr-item-controls select, .pr-item-controls input {
  border: 1px solid var(--border-strong); border-radius: 7px; padding: 0.35rem 0.5rem;
  font-size: 0.8rem; background: var(--bg); color: var(--text-primary); font-family: inherit;
}
.pr-item-controls input[type="number"] { width: 5rem; }
.pr-qty { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; color: var(--text-muted); }
.pr-qty input[type="number"] { width: 4.25rem; }
.pr-item:not(.is-on) .pr-item-controls { opacity: 0.4; }
.pr-item-price { font-size: 0.86rem; font-weight: 700; white-space: nowrap; min-width: 6.5rem; text-align: right; }

.pr-custom-line {
  display: grid; grid-template-columns: 1.6fr 0.8fr 0.9fr auto; gap: 0.5rem; align-items: start;
  border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem 0.95rem; margin-bottom: 0.5rem;
}
.pr-custom-line input, .pr-custom-line select {
  border: 1px solid var(--border-strong); border-radius: 7px; padding: 0.45rem 0.55rem;
  font-size: 0.84rem; background: var(--bg); color: var(--text-primary); font-family: inherit; width: 100%;
}
.pr-custom-line .pr-custom-note { grid-column: 1 / -1; }

.admin-proposal-preview {
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-soft);
  padding: 1rem 1.15rem; font-size: 0.86rem;
}
.admin-proposal-preview .row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.25rem 0; }
.admin-proposal-preview .row.total { border-top: 1px solid var(--border-strong); margin-top: 0.4rem; padding-top: 0.5rem; font-weight: 700; }
.admin-proposal-preview .row.disc { color: #b45309; }
.admin-proposal-preview .empty { color: var(--text-muted); }

.admin-row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
/* The discount badge sits under the value, so it needs to be its own box
   rather than inheriting the inline flow of the figures above it. */
.admin-table .admin-status { display: inline-block; margin-top: 0.3rem; }

@media (max-width: 860px) {
  .pr-item { flex-wrap: wrap; }
  .pr-custom-line { grid-template-columns: 1fr 1fr; }
}

/* Team access */
.team-sections { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.team-sections label { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; }
.team-pill { display: inline-block; margin: 0 0.3rem 0.3rem 0; padding: 0.15rem 0.6rem; border-radius: 999px; background: #f1f5f9; font-size: 0.8rem; }

/* ==================================================================
   Work management (Teams, and later Objectives/Tasks) — the "wk-" set.
   ------------------------------------------------------------------
   Deliberately brighter and more solid than the rest of the admin: this
   is a screen people scan many times a day for "who is where / what is
   on", so teams are identified by a saturated colour everywhere they
   appear, and status reads as a filled pill rather than tinted text.
   The warm page background and the type scale stay as they are, so it
   still sits inside the Axonetwo shell rather than next to it.
   ================================================================== */

.wk-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.wk-head-text h2 { font-size: 1.5rem; letter-spacing: -0.02em; margin: 0 0 0.3rem; }
.wk-head-text p { font-size: 0.86rem; color: var(--text-secondary); margin: 0; max-width: 56ch; line-height: 1.5; }

.wk-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font: inherit; font-size: 0.84rem; font-weight: 600;
  padding: 0.55rem 1rem; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, box-shadow 0.15s, transform 0.08s;
}
.wk-btn:active { transform: translateY(1px); }
.wk-btn-primary { background: #0073ea; color: #fff; box-shadow: 0 1px 2px rgba(0, 115, 234, 0.4); }
.wk-btn-primary:hover { background: #0060c2; }
.wk-btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border-strong); }
.wk-btn-ghost:hover { background: var(--bg-soft); color: var(--text-primary); }

/* --- the board of team cards --- */
.wk-board {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  align-items: start;
}

.wk-team {
  position: relative; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.1rem 1.15rem 0.9rem;
  box-shadow: 0 1px 2px rgba(22, 21, 28, 0.04);
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
.wk-team::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: var(--team, #0073ea);
}
.wk-team:hover {
  transform: translateY(-2px); border-color: var(--border-strong);
  box-shadow: 0 8px 22px rgba(22, 21, 28, 0.09);
}

.wk-team-head { display: flex; align-items: center; gap: 0.55rem; margin: 0.35rem 0 0.1rem; }
.wk-team-head h3 {
  font-size: 1rem; font-weight: 700; margin: 0; letter-spacing: -0.01em;
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wk-team-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: var(--team, #0073ea);
}
.wk-icon-btn {
  font: inherit; line-height: 1; background: none; border: 0; cursor: pointer;
  color: var(--text-muted); padding: 0.25rem 0.4rem; border-radius: 6px;
}
.wk-icon-btn:hover { background: var(--bg-soft); color: var(--text-primary); }

.wk-team-desc {
  font-size: 0.81rem; color: var(--text-secondary); line-height: 1.5;
  margin: 0.15rem 0 0.75rem; min-height: 2.4em;
}
.wk-team-meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.85rem; }

.wk-pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 0.22rem 0.6rem; border-radius: 999px; white-space: nowrap;
}
.wk-pill-team { background: var(--team, #0073ea); color: #fff; }
.wk-pill-grey { background: var(--bg-soft); color: var(--text-secondary); border: 1px solid var(--border); }

/* --- people --- */
.wk-people { display: flex; flex-direction: column; gap: 0.1rem; }
.wk-person {
  position: relative;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.42rem 0.3rem; border-radius: 8px;
}
.wk-person:hover { background: var(--bg-soft); }
.wk-avatar {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.71rem; font-weight: 700; color: #fff; letter-spacing: 0.02em;
  background: var(--avatar, #0073ea);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 0 1px var(--avatar, #0073ea);
}
.wk-avatar-lead::after {
  content: '★'; position: absolute; font-size: 0.6rem;
  transform: translate(13px, 10px); color: #fdab3d; text-shadow: 0 0 2px #fff;
}
.wk-person-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.wk-person-text strong {
  font-size: 0.82rem; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wk-person-text span {
  font-size: 0.72rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wk-move {
  font: inherit; font-size: 0.74rem; color: var(--text-secondary);
  padding: 0.25rem 0.4rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-card); cursor: pointer;
  max-width: 9.5rem;
}
.wk-move:hover { border-color: var(--border-strong); }

.wk-team-empty {
  font-size: 0.78rem; color: var(--text-muted); font-style: italic;
  padding: 0.6rem 0.3rem;
}

/* --- unassigned pool + archive --- */
.wk-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.1rem 1.15rem;
}
.wk-pool { margin-top: 1.5rem; border-style: dashed; border-color: var(--border-strong); }
.wk-pool-head { display: flex; align-items: center; gap: 0.5rem; }
.wk-pool-head h3 { font-size: 0.95rem; margin: 0; font-weight: 700; }
.wk-pool-note { font-size: 0.78rem; color: var(--text-muted); margin: 0.3rem 0 0.8rem; }

.wk-archive { margin-top: 1.25rem; font-size: 0.82rem; }
.wk-archive summary { cursor: pointer; color: var(--text-secondary); padding: 0.4rem 0; }
.wk-archive summary:hover { color: var(--text-primary); }

.wk-status { font-size: 0.8rem; margin: 0.9rem 0 0; min-height: 1.2em; }
.wk-status.is-error { color: #e2445c; }
.wk-status.is-ok { color: #037f4c; }

/* --- dialog --- */
.wk-dialog {
  border: 0; border-radius: 14px; padding: 0; width: min(420px, calc(100vw - 2rem));
  box-shadow: 0 24px 60px rgba(22, 21, 28, 0.26);
}
.wk-dialog::backdrop { background: rgba(22, 21, 28, 0.4); }
.wk-dialog-form { padding: 1.4rem 1.4rem 1.2rem; display: flex; flex-direction: column; }
.wk-dialog-form h3 { font-size: 1.1rem; margin: 0 0 1rem; font-weight: 700; }
.wk-label {
  font-size: 0.74rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.3rem;
}
.wk-input {
  font: inherit; font-size: 0.86rem; padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg-card); color: var(--text-primary); margin-bottom: 0.9rem;
}
.wk-input:focus { outline: 2px solid #0073ea; outline-offset: -1px; border-color: transparent; }

.wk-swatches { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1rem; }
.wk-swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 2px transparent;
  transition: box-shadow 0.15s, transform 0.12s;
}
.wk-swatch:hover { transform: scale(1.12); }
.wk-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--text-primary); }

.wk-dialog-error { font-size: 0.8rem; color: #e2445c; margin: 0 0 0.7rem; }
.wk-dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

@media (max-width: 640px) {
  .wk-board { grid-template-columns: 1fr; }
  .wk-head { align-items: flex-start; }
}

/* The per-person team picker is a rare action sitting on a row that is read
   constantly, so on pointer devices it stays out of the way until the row is
   hovered or something in it has keyboard focus. Touch devices, which have no
   hover, keep it visible. */
@media (hover: hover) {
  /* Taken out of flow as well as hidden, so the name and role get the row's
     full width instead of being truncated by a control nobody is looking at. */
  /* Scoped to a person row on purpose — the same select class is used as a
     plain filter elsewhere, where it must stay in flow and visible. */
  .wk-person .wk-move {
    position: absolute; right: 0.3rem; top: 50%; transform: translateY(-50%);
    opacity: 0; pointer-events: none; transition: opacity 0.15s;
    box-shadow: 0 1px 6px rgba(22, 21, 28, 0.14);
  }
  .wk-person:hover .wk-move,
  .wk-person:focus-within .wk-move { opacity: 1; pointer-events: auto; }
}

/* "Add person" sits at the foot of each team card: a dashed slot that reads as
   an empty place waiting to be filled rather than a button competing with the
   team's own colour. */
.wk-add {
  display: flex; align-items: center; justify-content: center; gap: 0.35rem;
  width: 100%; margin-top: 0.5rem; padding: 0.5rem;
  font: inherit; font-size: 0.78rem; font-weight: 600;
  color: var(--text-muted); background: transparent;
  border: 1px dashed var(--border-strong); border-radius: 8px; cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.wk-add:hover {
  color: var(--team, #0073ea); border-color: var(--team, #0073ea);
  background: var(--bg-soft);
}

.wk-label-soft { font-weight: 500; text-transform: none; letter-spacing: 0; opacity: 0.7; }
.wk-dialog-note {
  font-size: 0.76rem; color: var(--text-muted); line-height: 1.45;
  margin: 0 0 0.9rem;
}
.wk-checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.wk-check {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.8rem; color: var(--text-secondary); cursor: pointer;
}
.wk-check input { accent-color: #0073ea; }

/* ==================================================================
   Tasks board — a grouped table rather than columns of cards. Status
   is the thing people change most, so it is a solid colour chip wide
   enough to hit without aiming, and every cell edits in place: a board
   that needs a save button stops being used by Friday.
   ================================================================== */

.tk-stats { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.1rem; }
.tk-stat {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.6rem 0.9rem; min-width: 88px;
}
.tk-stat strong { display: block; font-size: 1.25rem; line-height: 1.1; letter-spacing: -0.02em; }
.tk-stat span {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600;
}
.tk-stat-alert strong { color: #e2445c; }
.tk-stat-warn strong { color: #fdab3d; }

.tk-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.tk-toggle {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.8rem; color: var(--text-secondary); cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 0.35rem 0.7rem; border-radius: 999px;
}
.tk-toggle input { accent-color: #0073ea; }
.tk-toggle:has(input:checked) { border-color: #0073ea; color: #0073ea; background: rgba(0, 115, 234, 0.06); }
.tk-filter { max-width: 13rem; padding: 0.4rem 0.6rem; }
.tk-search { margin-bottom: 0; padding: 0.38rem 0.65rem; font-size: 0.8rem; min-width: 11rem; }

/* --- groups --- */
.tk-group { margin-bottom: 1.6rem; }
.tk-group-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.45rem; }
.tk-group-head h3 {
  font-size: 0.92rem; font-weight: 700; margin: 0; color: var(--team, #0073ea);
  letter-spacing: -0.01em;
}
.tk-group-rule { flex: 1; height: 1px; background: var(--border); }

.tk-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.tk-table-wrap {
  overflow-x: auto; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 10px;
  border-left: 4px solid var(--team, #0073ea);
}
.tk-table th {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 700; text-align: left;
  padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tk-table td {
  padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--border);
  font-size: 0.83rem; vertical-align: middle;
}
.tk-table tr:last-child td { border-bottom: 0; }
.tk-table tbody tr:hover { background: var(--bg-soft); }
.tk-col-title { width: 42%; min-width: 14rem; }
.tk-col-tight { width: 1%; white-space: nowrap; }

.tk-title-cell { display: flex; align-items: center; gap: 0.5rem; }
.tk-title-btn {
  font: inherit; font-size: 0.83rem; text-align: left; background: none; border: 0;
  color: var(--text-primary); cursor: pointer; padding: 0.15rem 0; flex: 1; min-width: 0;
}
.tk-title-btn:hover { text-decoration: underline; }
.tk-done .tk-title-btn { color: var(--text-muted); text-decoration: line-through; }
.tk-note-dot { color: var(--text-muted); font-size: 0.7rem; flex: none; }

/* Status: a solid chip, the one control on the row people reach for daily. */
.tk-status-cell {
  font: inherit; font-size: 0.74rem; font-weight: 600; color: #fff;
  border: 0; border-radius: 6px; padding: 0.3rem 0.6rem; cursor: pointer;
  min-width: 7.6rem; text-align: center;
  appearance: none; -webkit-appearance: none;
  background-image: none; transition: filter 0.12s;
}
.tk-status-cell:hover { filter: brightness(1.08); }
.tk-status-cell option { color: var(--text-primary); background: var(--bg-card); font-weight: 500; }

.tk-prio {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  padding: 0.18rem 0.5rem; border-radius: 5px; letter-spacing: 0.02em;
}
.tk-prio-low { background: var(--bg-soft); color: var(--text-muted); }
.tk-prio-normal { background: rgba(0, 115, 234, 0.1); color: #0073ea; }
.tk-prio-high { background: rgba(253, 171, 61, 0.18); color: #b76e00; }
.tk-prio-critical { background: rgba(226, 68, 92, 0.14); color: #e2445c; }

.tk-due { font-size: 0.78rem; color: var(--text-secondary); }
.tk-due-over { color: #e2445c; font-weight: 700; }
.tk-due-today { color: #b76e00; font-weight: 700; }
.tk-due-none { color: var(--text-muted); }

.tk-who { display: flex; align-items: center; gap: 0.4rem; }
.tk-who .wk-avatar { width: 24px; height: 24px; font-size: 0.62rem; }
.tk-who-none {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 1px dashed var(--border-strong); color: var(--text-muted); font-size: 0.7rem;
}

.tk-add-row td { padding: 0; }
.tk-add {
  display: flex; align-items: center; gap: 0.4rem; width: 100%;
  font: inherit; font-size: 0.79rem; font-weight: 600; color: var(--text-muted);
  background: none; border: 0; padding: 0.55rem 0.7rem; cursor: pointer; text-align: left;
}
.tk-add:hover { color: var(--team, #0073ea); background: var(--bg-soft); }

.tk-dialog-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.8rem; }
.tk-noteam {
  background: var(--bg-card); border: 1px dashed var(--border-strong);
  border-radius: 12px; padding: 1.5rem; text-align: center; color: var(--text-secondary);
  font-size: 0.86rem;
}

@media (max-width: 640px) {
  .tk-dialog-row { grid-template-columns: 1fr; }
}

/* A class that sets `display` outranks the browser's own [hidden] rule, so
   every wk- control that gets toggled from JS needs this or it stays visible
   while reporting itself as hidden. */
.wk-btn[hidden], .wk-add[hidden], .wk-pill[hidden] { display: none; }

/* Sign-in details: a key button that sits beside the team picker on a person
   row, and the dialog behind it. */
.wk-key {
  font: inherit; font-size: 0.72rem; line-height: 1; cursor: pointer;
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-muted); padding: 0.28rem 0.4rem; flex: none;
}
.wk-key:hover { border-color: var(--border-strong); color: var(--text-primary); background: var(--bg-card); }
.wk-key-on { color: #037f4c; border-color: rgba(3, 127, 76, 0.35); background: rgba(0, 200, 117, 0.08); }
.wk-key-warn { color: #b76e00; border-color: rgba(253, 171, 61, 0.45); background: rgba(253, 171, 61, 0.1); }

.wk-cred-row { display: flex; gap: 0.5rem; align-items: start; }
.wk-cred-row .wk-input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (hover: hover) {
  .wk-person .wk-key { opacity: 0; transition: opacity 0.15s; }
  .wk-person:hover .wk-key,
  .wk-person:focus-within .wk-key { opacity: 1; }
  /* A member who can sign in, or who still owes a password change, is worth
     seeing without hovering every row. */
  .wk-person .wk-key-on, .wk-person .wk-key-warn { opacity: 1; }
}

/* The Sign-in column in the Team members table. */
.team-signin { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.team-username {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem;
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 0.1rem 0.35rem; border-radius: 5px; color: var(--text-primary);
}
.team-signin-state { font-size: 0.7rem; }
.team-signin-state.is-ok { color: var(--text-muted); }
.team-signin-state.is-pending { color: #b76e00; font-weight: 600; }

/* ==================================================================
   Objectives — the "why" above the tasks board. Each objective is a
   card carrying one honest number: how far along it is, next to how
   much of the period has gone. Those two bars sitting side by side
   are the whole point of the screen.
   ================================================================== */

.ob-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 1.1rem; }
.ob-filter { max-width: 13rem; padding: 0.4rem 0.6rem; }

.ob-group { margin-bottom: 1.8rem; }
.ob-group-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.ob-group-head h3 { font-size: 0.92rem; font-weight: 700; margin: 0; color: var(--team, #0073ea); }

.ob-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 4px solid var(--team, #0073ea);
  border-radius: 10px; padding: 1.1rem 1.2rem; margin-bottom: 0.8rem;
}
.ob-card-head { display: flex; align-items: flex-start; gap: 0.7rem; }
.ob-card-head h4 {
  font-size: 1rem; font-weight: 700; margin: 0 0 0.15rem;
  letter-spacing: -0.01em; flex: 1; min-width: 0;
}
.ob-desc { font-size: 0.81rem; color: var(--text-secondary); margin: 0.2rem 0 0; line-height: 1.5; }
.ob-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem;
  margin: 0.7rem 0 0.9rem; font-size: 0.75rem; color: var(--text-muted);
}

.ob-pace {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.71rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 999px;
}
.ob-pace-on_track { background: rgba(0, 200, 117, 0.14); color: #037f4c; }
.ob-pace-at_risk { background: rgba(253, 171, 61, 0.18); color: #b76e00; }
.ob-pace-behind { background: rgba(226, 68, 92, 0.14); color: #e2445c; }

/* The headline pair: progress over elapsed. */
.ob-bars { display: grid; gap: 0.35rem; margin-bottom: 1rem; }
.ob-bar-row { display: grid; grid-template-columns: 5.5rem 1fr 3rem; align-items: center; gap: 0.6rem; }
.ob-bar-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; }
/* display:block matters — these are spans in the objective header rows, and an
   inline box ignores height, so the fill would collapse to nothing. */
.ob-bar { display: block; height: 8px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.ob-bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--team, #0073ea); transition: width 0.3s; }
.ob-bar-fill-time { background: var(--border-strong); }
.ob-bar-value { font-size: 0.78rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.ob-krs { border-top: 1px solid var(--border); padding-top: 0.75rem; }
.ob-kr {
  display: grid; grid-template-columns: 1fr 9rem 2.6rem auto;
  align-items: center; gap: 0.7rem; padding: 0.45rem 0.2rem; border-radius: 8px;
}
.ob-kr:hover { background: var(--bg-soft); }
.ob-kr-title { font-size: 0.83rem; min-width: 0; }
.ob-kr-title button {
  font: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--text-primary); text-align: left;
}
.ob-kr-title button:hover { text-decoration: underline; }
.ob-kr-nums { font-size: 0.73rem; color: var(--text-muted); font-variant-numeric: tabular-nums; margin-top: 0.1rem; }
.ob-kr-pct { font-size: 0.76rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.ob-kr-done .ob-kr-pct { color: #037f4c; }

.ob-empty-krs { font-size: 0.79rem; color: var(--text-muted); font-style: italic; padding: 0.4rem 0.2rem; }

.ci-history {
  margin: 0.4rem 0 1rem; border-top: 1px solid var(--border);
  max-height: 11rem; overflow-y: auto;
}
.ci-entry {
  display: flex; align-items: baseline; gap: 0.5rem;
  padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.78rem;
}
.ci-entry strong { font-variant-numeric: tabular-nums; }
.ci-entry span { color: var(--text-muted); font-size: 0.72rem; }
.ci-entry em { color: var(--text-secondary); font-style: normal; flex: 1; }

@media (max-width: 640px) {
  .ob-kr { grid-template-columns: 1fr auto; }
  .ob-bar-row { grid-template-columns: 4.5rem 1fr 2.6rem; }
}

/* Repeating commitments: a strip above the board. The streak is the number
   people care about — it is the only thing here set in a large face. */
.tk-recurring {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.9rem 1rem; margin-bottom: 1.4rem;
}
.tk-recurring-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.tk-recurring-head h3 { font-size: 0.88rem; font-weight: 700; margin: 0; }

.tk-rec {
  display: grid; grid-template-columns: 1fr auto auto auto;
  align-items: center; gap: 0.8rem;
  padding: 0.5rem 0.2rem; border-top: 1px solid var(--border);
}
.tk-rec:first-child { border-top: 0; }
.tk-rec-title { min-width: 0; }
.tk-rec-title strong { font-size: 0.84rem; font-weight: 600; display: block; }
.tk-rec-title span { font-size: 0.73rem; color: var(--text-muted); }
.tk-rec-paused { opacity: 0.55; }

.tk-streak { text-align: center; min-width: 3.4rem; }
.tk-streak strong { display: block; font-size: 1.15rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tk-streak span { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; }
.tk-streak-hot strong { color: #037f4c; }
.tk-streak-cold strong { color: var(--text-muted); }
.tk-rec-missed { font-size: 0.73rem; color: #e2445c; font-weight: 600; min-width: 5.5rem; text-align: right; }
.tk-rec-clean { font-size: 0.73rem; color: var(--text-muted); min-width: 5.5rem; text-align: right; }

@media (max-width: 640px) {
  .tk-rec { grid-template-columns: 1fr auto; row-gap: 0.3rem; }
}
#tk-repeat-block[hidden] { display: none; }

/* ==================================================================
   Dashboard — the owner's one screen. Numbers that need acting on are
   coloured; everything else stays quiet, so colour keeps its meaning.
   ================================================================== */

.db-section { margin-bottom: 1.8rem; }
.db-section > h3 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); font-weight: 700; margin: 0 0 0.7rem;
}
.db-sub { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: 0.8; }
.db-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; }

.db-teams { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.db-team {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 4px solid var(--team, #0073ea);
  border-radius: 10px; padding: 0.95rem 1.05rem;
}
.db-team-head { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.6rem; }
.db-team-head h4 { font-size: 0.95rem; font-weight: 700; margin: 0; flex: 1; }
.db-team-head span { font-size: 0.72rem; color: var(--text-muted); }

.db-prog { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.7rem; }
.db-prog .ob-bar { flex: 1; }
.db-prog b { font-size: 0.8rem; font-variant-numeric: tabular-nums; min-width: 2.6rem; text-align: right; }

.db-figs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.db-fig {
  font-size: 0.72rem; font-weight: 600; padding: 0.22rem 0.55rem;
  border-radius: 6px; background: var(--bg-soft); color: var(--text-secondary);
}
.db-fig b { font-variant-numeric: tabular-nums; }
.db-fig-alert { background: rgba(226, 68, 92, 0.12); color: #e2445c; }
.db-fig-warn { background: rgba(253, 171, 61, 0.16); color: #b76e00; }
.db-fig-good { background: rgba(0, 200, 117, 0.13); color: #037f4c; }

.db-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.2rem; border-bottom: 1px solid var(--border); font-size: 0.82rem;
}
.db-row:last-child { border-bottom: 0; }
.db-row-main { flex: 1; min-width: 0; }
.db-row-main strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-row-main span { font-size: 0.72rem; color: var(--text-muted); }
.db-row-nums { display: flex; gap: 0.3rem; flex: none; }

.db-empty { font-size: 0.8rem; color: var(--text-muted); font-style: italic; padding: 0.6rem 0.2rem; }

@media (max-width: 900px) {
  .db-split { grid-template-columns: 1fr; }
}

/* ==================================================================
   Shell — a fixed left rail and a scrolling column beside it.
   Replaces the old row of tabs: nine destinations is more than a
   header can hold legibly, and a vertical list stays readable as more
   are added. Grouped under quiet headings so the eye lands on a
   section before a name.
   ================================================================== */

.admin-app { display: flex; min-height: 100vh; align-items: stretch; }

.admin-sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: 244px; flex: none; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg-card); border-right: 1px solid var(--border);
  padding: 1.15rem 0.85rem 0.85rem;
}

.admin-brand {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0 0.35rem 1.15rem; min-width: 0;
}
/* The uploaded wordmark is wide; the rail is not. Bound both axes and let it
   letterbox, rather than letting it push the tag off the edge. */
.admin-brand .logo { display: inline-flex; align-items: center; min-width: 0; flex: 0 1 auto; }
.admin-brand .logo img { max-height: 26px; max-width: 132px; width: auto; object-fit: contain; }
.admin-brand-tag { flex: none; }
.admin-brand-tag {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 0.2rem 0.45rem; border-radius: 5px;
}

.admin-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.admin-nav-label {
  font-size: 0.63rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); margin: 1rem 0 0.35rem; padding: 0 0.6rem;
}
.admin-nav-label:first-child { margin-top: 0; }
.admin-nav-label[hidden] { display: none; }

.admin-tab {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  font: inherit; font-size: 0.845rem; font-weight: 500; text-align: left;
  color: var(--text-secondary); background: transparent; border: 0;
  padding: 0.52rem 0.6rem; border-radius: 8px; cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.admin-tab[hidden] { display: none; }
.admin-tab:hover { background: var(--bg-soft); color: var(--text-primary); }
.admin-tab.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.admin-tab.is-active .admin-ico { color: var(--accent); }

.admin-ico {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  color: var(--text-muted);
}

/* The signed-in person, and the way out — always visible, never behind a
   menu you have to discover. */
.admin-user {
  display: grid; grid-template-columns: auto 1fr; gap: 0.55rem;
  align-items: center; padding: 0.75rem 0.45rem 0.1rem;
  border-top: 1px solid var(--border); margin-top: 0.6rem;
}
.admin-user[hidden] { display: none; }
.admin-user-avatar {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; font-size: 0.74rem; font-weight: 700;
  color: #fff; background: var(--accent);
}
.admin-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.admin-user-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.admin-user-text strong {
  font-size: 0.815rem; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-user-text span {
  font-size: 0.705rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-signout {
  grid-column: 1 / -1; margin-top: 0.55rem;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-size: 0.79rem; font-weight: 600;
  color: var(--text-secondary); background: transparent;
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 0.45rem; cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.admin-signout:hover { color: #e2445c; border-color: rgba(226, 68, 92, 0.45); background: rgba(226, 68, 92, 0.06); }
.admin-signout:hover .admin-ico { color: #e2445c; }

/* --- the column beside the rail --- */
.admin-column { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0 1.9rem; height: 58px; flex: none;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--border);
}
.admin-page-title { font-size: 0.95rem; font-weight: 650; margin: 0; letter-spacing: -0.01em; flex: 1; }
.admin-topbar-meta { font-size: 0.76rem; color: var(--text-muted); }

.admin-burger {
  display: none; font: inherit; background: none; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; padding: 0.3rem 0.4rem;
}

/* The old 88px lead-in came from a marketing-site `section` rule and left a
   dead band under every heading. The rail gives the page its own frame, so
   the panels set their own spacing now. */
.admin-panel-section { padding: 0; }
.admin-main { max-width: 1120px; margin: 0; padding: 1.9rem 1.9rem 4rem; width: 100%; }

@media (max-width: 860px) {
  .admin-sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-100%); transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgba(22, 21, 28, 0.16);
  }
  .admin-sidebar.is-open { transform: translateX(0); }
  .admin-burger { display: inline-flex; }
  .admin-main { padding: 1.3rem 1.1rem 3rem; }
  .admin-topbar { padding: 0 1.1rem; }
}

/* ==================================================================
   AI objective planner
   ================================================================== */
.wk-head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.wk-btn-ai { background: #6c3fd0; color: #fff; box-shadow: 0 1px 2px rgba(108, 63, 208, 0.4); }
.wk-btn-ai:hover { background: #5a31b3; }
.wk-btn-ai[hidden] { display: none; }

.ai-dialog { width: min(860px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); }
.ai-dialog textarea.wk-input { resize: vertical; }
#ai-step-goal, #ai-step-review { display: flex; flex-direction: column; }
#ai-step-goal[hidden], #ai-step-review[hidden],
.ai-busy[hidden], .ai-warnings[hidden] { display: none; }
.ai-busy { align-self: center; font-size: 0.8rem; color: var(--text-muted); }
.ai-warnings {
  background: #fff6e0; border: 1px solid #f0d58a; color: #6b4e00;
  border-radius: 8px; padding: 0.6rem 0.8rem; margin-bottom: 0.9rem;
  font-size: 0.8rem; line-height: 1.45;
}
.ai-warnings ul { margin: 0; padding-left: 1.1rem; }
.ai-section-head {
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin: 0.3rem 0 0.5rem;
}
.ai-krs, .ai-tasks { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 1rem; }
.ai-row {
  display: grid; gap: 0.45rem; align-items: center;
  padding: 0.45rem 0.55rem; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--bg-card);
}
.ai-row .wk-input { margin: 0; padding: 0.38rem 0.5rem; font-size: 0.8rem; min-width: 0; width: 100%; box-sizing: border-box; }
.ai-kr-row { grid-template-columns: minmax(0, 1fr) 6.5rem 5.5rem 5.5rem 4.5rem auto; }
.ai-task-row { grid-template-columns: auto minmax(0, 1.6fr) minmax(0, 1fr) 8.5rem 6rem; }
.ai-task-row.is-off { opacity: 0.45; }
.ai-task-row .ai-task-extra { grid-column: 2 / -1; font-size: 0.74rem; color: var(--text-muted); }
.ai-x {
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 0.2rem 0.4rem; border-radius: 6px;
}
.ai-x:hover { background: var(--bg-soft); color: #e2445c; }
.ai-cap { font-size: 0.66rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
@media (max-width: 720px) {
  .ai-kr-row { grid-template-columns: 1fr 1fr; }
  .ai-kr-row > :first-child { grid-column: 1 / -1; }
  .ai-task-row { grid-template-columns: auto 1fr; }
  .ai-task-row > :nth-child(n+3) { grid-column: 1 / -1; }
  .ai-task-row .ai-task-extra { grid-column: 1 / -1; }
}

/* --- AI settings --- */
.ai-state {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: 10px; padding: 0.85rem 1rem; margin-bottom: 1.3rem;
}
.ai-state-on { border-left-color: #00c875; }
.ai-state-off { border-left-color: #e2445c; }
.ai-state-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); flex: none; }
.ai-state-on .ai-state-dot { background: #00c875; }
.ai-state-off .ai-state-dot { background: #e2445c; }
.ai-state-main { flex: 1; min-width: 0; }
.ai-state-main strong { display: block; font-size: 0.88rem; }
.ai-state-main span { font-size: 0.76rem; color: var(--text-muted); }
.ai-state-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem;
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 0.18rem 0.45rem; border-radius: 5px;
}

.ai-key-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ai-hint { display: block; font-size: 0.73rem; color: var(--text-muted); margin-top: 0.25rem; }
.ai-toggle { align-self: start; margin-top: 0.3rem; }

.ai-warn {
  background: rgba(253, 171, 61, 0.12); border: 1px solid rgba(253, 171, 61, 0.4);
  color: #8a5300; border-radius: 8px; padding: 0.6rem 0.75rem;
  font-size: 0.78rem; margin: 0 0 1rem; line-height: 1.5;
}

.ai-sources { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.55rem; }
.ai-sources li { font-size: 0.82rem; color: var(--text-secondary); }
.ai-sources li span { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }
.ai-sources li code {
  font-size: 0.78rem; background: var(--bg-soft); padding: 0.1rem 0.3rem; border-radius: 4px;
}
.ai-sources li.is-live {
  color: var(--text-primary); font-weight: 600;
  background: rgba(0, 200, 117, 0.08); border-radius: 6px;
  padding: 0.3rem 0.45rem; margin-left: -0.45rem;
}

/* ==================================================================
   Persona (resume, level, notes)
   ================================================================== */
.wk-persona-btn {
  font: inherit; font-size: 0.72rem; line-height: 1; cursor: pointer; flex: none;
  background: none; border: 1px dashed var(--border-strong); border-radius: 6px;
  color: #6c3fd0; border-color: rgba(108, 63, 208, 0.45); padding: 0.28rem 0.45rem;
}
.wk-persona-btn:hover { color: var(--text-primary); background: var(--bg-card); }
.wk-persona-set {
  border-style: solid; font-weight: 700; color: #0060c2;
  border-color: rgba(0, 115, 234, 0.35); background: rgba(0, 115, 234, 0.08);
}

.persona-dialog { width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); }
.persona-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.persona-tab {
  font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-muted); padding: 0.5rem 0.8rem; margin-bottom: -1px;
}
.persona-tab:hover { color: var(--text-primary); }
.persona-tab.is-active { color: #0060c2; border-bottom-color: #0073ea; }
.persona-count:not(:empty) {
  background: var(--bg-soft); border-radius: 999px; padding: 0.05rem 0.45rem;
  font-size: 0.7rem; margin-left: 0.2rem;
}
.persona-pane { display: flex; flex-direction: column; }
.persona-pane[hidden] { display: none; }
.persona-hint { font-size: 0.76rem; color: var(--text-muted); }
.persona-busy { font-size: 0.8rem; color: var(--text-muted); }
.persona-busy[hidden], #persona-suggestion[hidden] { display: none; }
.persona-dialog textarea.wk-input { resize: vertical; }
.persona-foot { margin-top: 0.4rem; }

.persona-resume {
  border: 1px dashed var(--border-strong); border-radius: 10px;
  padding: 0.8rem; margin-bottom: 1rem; background: var(--bg-soft);
}
.persona-resume .wk-input { width: 100%; box-sizing: border-box; margin: 0.6rem 0; }
.persona-resume .wk-dialog-note { margin: 0.6rem 0 0; }
.persona-resume-row { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.persona-file-name { font-size: 0.78rem; color: var(--text-muted); min-width: 0; overflow-wrap: anywhere; }

.persona-skills { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.4rem; }
.persona-skill-row { display: grid; grid-template-columns: minmax(0, 1fr) 4.2rem auto; gap: 0.4rem; align-items: center; }
.persona-skill-row .wk-input { margin: 0; padding: 0.38rem 0.5rem; font-size: 0.8rem; width: 100%; box-sizing: border-box; }
#persona-skill-add { margin: 0 0 0.9rem; }

/* level badges: one hue per band so a glance down the Teams board reads as a spread */
.persona-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700; line-height: 1;
  padding: 0.22rem 0.4rem; border-radius: 5px; color: #fff; background: #676879;
}
.persona-L1 { background: #8d8fa0; } .persona-L2 { background: #00a3bf; } .persona-L3 { background: #0073ea; }
.persona-L4 { background: #784bd1; } .persona-L5 { background: #e2445c; }
.persona-level-now {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.85rem;
  padding: 0.7rem 0.8rem; border-radius: 10px; background: var(--bg-soft); margin-bottom: 1rem;
}
.persona-level-now span:not(.persona-badge) { color: var(--text-secondary); font-size: 0.8rem; }
.persona-level-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; margin-bottom: 0.9rem; }
.persona-pick {
  font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  padding: 0.55rem 0.2rem; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg-card); color: var(--text-primary);
}
.persona-pick small { font-size: 0.68rem; color: var(--text-muted); }
.persona-pick:hover { border-color: #0073ea; }
.persona-pick.is-picked { border-color: #0073ea; background: rgba(0, 115, 234, 0.09); box-shadow: 0 0 0 1px #0073ea inset; }
.persona-suggest { border-top: 1px solid var(--border); margin: 1rem 0; padding-top: 0.9rem; }
.persona-suggest-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.3rem; }
.persona-suggest-card {
  border: 1px solid rgba(108, 63, 208, 0.4); background: rgba(108, 63, 208, 0.06);
  border-radius: 10px; padding: 0.7rem 0.8rem; margin-top: 0.6rem;
}
.persona-suggest-card p { margin: 0.4rem 0 0.7rem; font-size: 0.84rem; line-height: 1.45; }
.persona-suggest-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.persona-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 0.5rem; }
.persona-stat { border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.7rem; display: flex; flex-direction: column; }
.persona-stat strong { font-size: 1.15rem; }
.persona-stat span { font-size: 0.7rem; color: var(--text-muted); }

.persona-note-form { margin-bottom: 1rem; }
.persona-notes { display: flex; flex-direction: column; gap: 0.5rem; }
.persona-note { border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.75rem; }
.persona-note p { margin: 0.35rem 0 0; font-size: 0.84rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.persona-note-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.persona-note-head .ai-x { margin-left: auto; }
.persona-note-kind { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #676879; }
.persona-kind-quality { color: #037f4c; } .persona-kind-assignment { color: #0060c2; }
.persona-note-rating { color: #fdab3d; font-size: 0.8rem; letter-spacing: 1px; }
.persona-note-dim { color: var(--border-strong); }
.persona-note-task { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.2rem; }
@media (max-width: 640px) {
  .persona-stats { grid-template-columns: repeat(2, 1fr); }
  .persona-level-pick { grid-template-columns: repeat(5, 1fr); gap: 0.25rem; }
}

/* Planner review: layers and complexity */
.ai-task-row .ai-task-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.ai-task-extra .wk-input { width: auto; max-width: 14rem; }
.ai-task-extra .ai-note { flex-basis: 100%; }
.ai-milestone { background: var(--bg-soft); border-left: 3px solid #0073ea; }
.ai-sub { margin-left: 1.4rem; border-left: 3px solid var(--border-strong); }
.ai-tag {
  font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: #0060c2; background: rgba(0, 115, 234, 0.1); border-radius: 4px; padding: 0.2rem 0.4rem;
}
.ai-over { color: #b76e00; font-size: 0.72rem; font-weight: 600; }
.ai-task-row.is-over { border-color: rgba(253, 171, 61, 0.75); }
@media (max-width: 720px) { .ai-sub { margin-left: 0.7rem; } }

/* Tasks board: complexity and layers */
.tk-cx {
  font-size: 0.64rem; font-weight: 700; line-height: 1; border-radius: 4px; padding: 0.2rem 0.32rem;
  margin-left: 0.4rem; color: #fff; background: #8d8fa0; flex: none;
}
.tk-cx-2 { background: #00a3bf; } .tk-cx-3 { background: #0073ea; } .tk-cx-4 { background: #784bd1; } .tk-cx-5 { background: #e2445c; }
.tk-sub-progress {
  font-size: 0.68rem; font-weight: 600; color: var(--text-muted); margin-left: 0.4rem;
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.08rem 0.4rem; flex: none;
}
.tk-part-of { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; }

/* Two-column rows inside the persona and planner dialogs: label above input. */
.persona-dialog .tk-dialog-row > div, .ai-dialog .tk-dialog-row > div { display: flex; flex-direction: column; min-width: 0; }
.persona-dialog .wk-input, .ai-dialog .tk-dialog-row .wk-input { width: 100%; box-sizing: border-box; }

/* Objective delete */
.wk-icon-danger:hover { background: rgba(226, 68, 92, 0.1); color: #e2445c; }
.wk-btn-danger { background: #e2445c; color: #fff; }
.wk-btn-danger:hover { background: #c9314a; }
.wk-btn-danger:disabled { opacity: 0.6; cursor: default; }
.obdel-check { align-items: flex-start; margin-bottom: 1rem; line-height: 1.4; }
.obdel-check[hidden] { display: none; }
.obdel-check input { margin-top: 0.15rem; }

/* Person rows on the Teams board. The team picker used to float over the right
   of the row on hover, which covered the Persona and key buttons, and the key
   stayed invisible until hover. Now the row wraps: name, Persona and key on the
   first line, the team picker on its own line beneath, all always visible. */
.wk-person { flex-wrap: wrap; row-gap: 0.3rem; }
.wk-person .wk-person-text { flex: 1 1 7rem; }
.wk-person .wk-key { opacity: 1; }
.wk-person .wk-move {
  position: static; transform: none; opacity: 1; pointer-events: auto; box-shadow: none;
  flex: 0 0 calc(100% - 40px); margin-left: 40px; max-width: none; box-sizing: border-box;
}

/* Tasks: export and clear */
.wk-btn-danger-ghost { color: #e2445c; border-color: rgba(226, 68, 92, 0.4); }
.wk-btn-danger-ghost:hover { background: rgba(226, 68, 92, 0.08); color: #c9314a; }
.wk-btn-danger-ghost[hidden] { display: none; }
.tkclear-check { margin-bottom: 0.8rem; align-items: flex-start; line-height: 1.4; }
.tkclear-check[hidden] { display: none; }
.tkclear-check input { margin-top: 0.15rem; }
#tkclear-confirm:disabled { opacity: 0.45; cursor: not-allowed; }

/* Persona: inline save results */
.persona-msg { font-size: 0.8rem; color: var(--text-muted); align-self: center; min-height: 1em; }
.persona-msg.is-ok { color: #037f4c; font-weight: 600; }
.persona-msg.is-err { color: #e2445c; font-weight: 600; }
.persona-msg.is-warn { color: #b76e00; }
.persona-dialog .wk-btn.is-saved {
  background: #00a85f; border-color: transparent; color: #fff; opacity: 1; cursor: default;
}
.persona-dialog .wk-btn.is-saved:disabled { opacity: 1; }

/* ==================================================================
   Task page
   ================================================================== */
#panel-task { max-width: 1180px; }
#tp-body[hidden], #tp-loading[hidden], #tp-error[hidden] { display: none; }
.tp-spacer { flex: 1; }

/* navigation: back link, then where the task sits */
.tp-nav { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 1.1rem; font-size: 0.8rem; }
.tp-back {
  color: var(--text-secondary); text-decoration: none; font-weight: 600;
  padding: 0.3rem 0.6rem 0.3rem 0.5rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-card);
}
.tp-back:hover { color: #0060c2; border-color: var(--border-strong); }
.tp-path { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem; margin: 0; padding: 0; min-width: 0; }
.tp-path li { display: inline-flex; align-items: center; min-width: 0; color: var(--text-muted); }
.tp-path li + li::before { content: "\203A"; margin: 0 0.45rem; color: var(--border-strong); font-size: 1rem; }
.tp-path .tp-path-text { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-path a { color: #0060c2; text-decoration: none; }
.tp-path a:hover { text-decoration: underline; }
.tp-path .tp-path-here { color: var(--text-primary); font-weight: 600; }

/* header */
.tp-header { margin-bottom: 1.4rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--border); }
.tp-header-top { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.tp-kind {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #0060c2;
  background: rgba(0, 115, 234, 0.1); border-radius: 4px; padding: 0.22rem 0.5rem;
}
.tp-ref { font-size: 0.74rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tp-title {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25;
  color: var(--text-primary); background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 0.2rem 0.5rem; margin: 0 0 0.6rem -0.5rem; width: calc(100% + 0.5rem);
}
.tp-title:hover { border-color: var(--border); }
.tp-title:focus { outline: 2px solid #0073ea; outline-offset: -1px; background: var(--bg-card); }
.tp-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tp-chip {
  display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--text-secondary);
  border: 1px solid var(--border); background: var(--bg-card); border-radius: 999px; padding: 0.28rem 0.7rem 0.28rem 0.55rem;
}
.tp-chip b { font-weight: 600; color: var(--text-primary); }
.tp-chip .tp-dot { width: 8px; height: 8px; }
.tp-chip .wk-avatar { width: 20px; height: 20px; font-size: 0.55rem; }
.tp-chip-over { color: #b3261e; border-color: rgba(226, 68, 92, 0.4); background: rgba(226, 68, 92, 0.06); }
.tp-chip-over b { color: #b3261e; }

/* layout */
.tp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20.5rem; gap: 1.4rem; align-items: start; }
.tp-main, .tp-side { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.tp-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.05rem 1.2rem 1.15rem; min-width: 0; }
.tp-card[hidden] { display: none; }
.tp-card-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.85rem; min-height: 1.6rem; }
.tp-card-head h3 {
  margin: 0; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted);
}
.tp-pill {
  font-size: 0.7rem; font-weight: 600; color: var(--text-secondary); background: var(--bg-soft);
  border-radius: 999px; padding: 0.12rem 0.55rem;
}
.tp-pill[hidden] { display: none; }
.tp-textarea { width: 100%; box-sizing: border-box; resize: vertical; line-height: 1.55; margin: 0; }
.tp-empty { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 0.9rem; line-height: 1.5; }
.tp-empty[hidden] { display: none; }
.tp-note { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; margin: 0.4rem 0 0.7rem; }
.tp-note[hidden] { display: none; }
.tp-linkbtn { font: inherit; font-size: 0.78rem; color: #0060c2; background: none; border: 0; padding: 0.3rem 0; cursor: pointer; }
.tp-linkbtn:hover { text-decoration: underline; }
.tp-linkbtn[hidden] { display: none; }
.tp-toggle { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--text-secondary); cursor: pointer; }
.tp-toggle[hidden] { display: none; }
.tp-iconbtn {
  font: inherit; font-size: 0.7rem; line-height: 1; cursor: pointer; color: var(--text-secondary);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 0.45rem 0.6rem;
}
.tp-iconbtn:hover:not(:disabled) { color: #0060c2; border-color: var(--border-strong); }
.tp-iconbtn:disabled { opacity: 0.4; cursor: default; }

/* hierarchy tree */
.tp-tree { display: flex; flex-direction: column; }
.tp-node {
  --depth: 0; position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.7rem 0.55rem calc(0.7rem + var(--depth) * 1.5rem); border-radius: 8px; text-decoration: none; color: inherit;
}
.tp-node::before { /* the guide line down the left of a nested row */
  content: ""; position: absolute; left: calc(1.15rem + (var(--depth) - 1) * 1.5rem); top: 0; bottom: 0;
  border-left: 1px solid var(--border-strong); display: none;
}
.tp-node-nested::before { display: block; }
a.tp-node:hover { background: var(--bg-soft); }
.tp-node-here { background: rgba(0, 115, 234, 0.07); box-shadow: inset 3px 0 0 #0073ea; }
.tp-node-ico {
  position: relative; z-index: 1; width: 1.5rem; height: 1.5rem; border-radius: 6px; display: grid; place-items: center;
  font-size: 0.7rem; font-weight: 700; color: #fff; background: #8d8fa0;
}
.tp-node-objective .tp-node-ico { background: #784bd1; }
.tp-node-kr .tp-node-ico { background: #00a3bf; }
.tp-node-milestone .tp-node-ico { background: #0073ea; }
.tp-node-subtask .tp-node-ico, .tp-node-task .tp-node-ico { background: #8d8fa0; }
.tp-node-body { min-width: 0; display: flex; flex-direction: column; }
.tp-node-type { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.tp-node-title { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-node-title.is-done { text-decoration: line-through; color: var(--text-muted); }
.tp-node-here .tp-node-title { font-weight: 650; }
.tp-node-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; }
.tp-node-meta .wk-avatar { width: 22px; height: 22px; font-size: 0.58rem; }
.tp-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.tp-here-tag { font-size: 0.64rem; font-weight: 700; color: #0060c2; background: rgba(0, 115, 234, 0.12); border-radius: 4px; padding: 0.15rem 0.4rem; text-transform: uppercase; letter-spacing: 0.05em; }
.tp-sub-progress { height: 5px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin: 0.2rem 0.7rem 0.6rem; }
.tp-sub-progress span { display: block; height: 100%; background: #00c875; border-radius: 999px; }

/* videos: the player, what is playing, then the cards in play order */
.tp-stage { margin-bottom: 1rem; }
.tp-stage[hidden] { display: none; }
.tp-player { position: relative; aspect-ratio: 16 / 9; background: #0f0f14; border-radius: 10px; overflow: hidden; }
.tp-player iframe, .tp-player > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tp-nowplaying { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 0.65rem; }
.tp-np-text { min-width: 0; display: flex; flex-direction: column; }
.tp-np-text strong { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-np-text span { font-size: 0.76rem; color: var(--text-muted); }
.tp-np-controls { display: flex; gap: 0.4rem; flex: none; }
.tp-playlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.tp-playlist:empty { display: none; }
.tp-vcard {
  position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-card); overflow: hidden; cursor: pointer; text-align: left; font: inherit; color: inherit; padding: 0;
}
.tp-vcard:hover { border-color: var(--border-strong); }
.tp-vcard.is-playing { border-color: #0073ea; box-shadow: 0 0 0 1px #0073ea; }
.tp-vthumb { position: relative; aspect-ratio: 16 / 9; background: var(--bg-soft) center / cover no-repeat; }
.tp-vnum {
  position: absolute; left: 0.45rem; top: 0.45rem; min-width: 1.4rem; height: 1.4rem; display: grid; place-items: center;
  font-size: 0.7rem; font-weight: 700; color: #fff; background: rgba(15, 15, 20, 0.78); border-radius: 5px; padding: 0 0.3rem;
}
.tp-vstate {
  position: absolute; right: 0.45rem; bottom: 0.45rem; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: #fff; background: rgba(15, 15, 20, 0.78); border-radius: 4px; padding: 0.15rem 0.4rem;
}
.tp-vcard.is-playing .tp-vstate { background: #0073ea; }
.tp-vbody { padding: 0.55rem 0.7rem 0.6rem; min-width: 0; }
.tp-vtitle {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.8rem; font-weight: 600; line-height: 1.35;
}
.tp-vauthor { display: block; font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-vtools { display: flex; gap: 0.2rem; padding: 0 0.5rem 0.5rem; margin-top: auto; }
.tp-vtools button {
  font: inherit; font-size: 0.7rem; line-height: 1; cursor: pointer; color: var(--text-muted); background: none;
  border: 1px solid transparent; border-radius: 5px; padding: 0.3rem 0.45rem;
}
.tp-vtools button:hover:not(:disabled) { color: var(--text-primary); background: var(--bg-soft); }
.tp-vtools button.tp-vremove:hover { color: #e2445c; }
.tp-vtools button:disabled { opacity: 0.3; cursor: default; }
.tp-vtools .tp-spacer { flex: 1; }
.tp-add { display: flex; gap: 0.5rem; }
.tp-add .wk-input { flex: 1; margin: 0; }
#tp-video-msg { margin: 0.45rem 0 0; min-height: 1.1em; }

/* notes: each one stamped with who and when */
.tp-compose { margin-bottom: 1rem; }
.tp-compose-row { display: flex; align-items: center; justify-content: flex-end; gap: 0.7rem; margin-top: 0.5rem; }
.tp-notelist { display: flex; flex-direction: column; }
.tp-entry { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.75rem; padding: 0.85rem 0; border-top: 1px solid var(--border); }
.tp-entry-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.tp-entry-head strong { font-size: 0.84rem; }
.tp-stamp { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tp-entry-head .ai-x { margin-left: auto; align-self: center; }
.tp-entry p { margin: 0.3rem 0 0; font-size: 0.88rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

/* details column */
.tp-props { margin: 0; display: flex; flex-direction: column; }
.tp-props > div { display: grid; grid-template-columns: 6.2rem minmax(0, 1fr); align-items: center; gap: 0.6rem; padding: 0.4rem 0; border-top: 1px solid var(--border); }
.tp-props > div:first-child { border-top: 0; }
.tp-props > div[hidden] { display: none; }
.tp-props dt { font-size: 0.76rem; color: var(--text-muted); }
.tp-props dt label { font-weight: 500; }
.tp-props dd { margin: 0; min-width: 0; }
.tp-select {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 0.82rem; color: var(--text-primary);
  background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 0.32rem 0.4rem; margin-left: -0.4rem; width: calc(100% + 0.4rem);
}
.tp-select:hover { border-color: var(--border-strong); background: var(--bg-card); }
.tp-select:focus { outline: 2px solid #0073ea; outline-offset: -1px; background: var(--bg-card); }
.tp-select:disabled { opacity: 0.5; }
.tp-meta { font-size: 0.72rem; color: var(--text-muted); margin: 0.7rem 0 0; padding-top: 0.7rem; border-top: 1px solid var(--border); }

/* history */
.tp-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tp-history li { position: relative; padding: 0 0 0.85rem 1.15rem; font-size: 0.8rem; line-height: 1.4; }
.tp-history li::before { content: ""; position: absolute; left: 0.1rem; top: 0.38rem; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.tp-history li::after { content: ""; position: absolute; left: calc(0.1rem + 3px); top: 0.9rem; bottom: -0.05rem; border-left: 1px solid var(--border); }
.tp-history li:last-child { padding-bottom: 0; }
.tp-history li:last-child::after { display: none; }
.tp-history .tp-stamp { display: block; margin-top: 0.1rem; }
.tp-danger .tp-card-head h3 { color: #b3261e; }
.tp-danger .tp-note { margin-top: 0; }

#tp-save.is-saved { background: #00a85f; border-color: transparent; color: #fff; opacity: 1; cursor: default; }
#tp-save:disabled:not(.is-saved) { opacity: 0.6; }
#tp-complexity-block[hidden], #tp-repeat-block[hidden] { display: none; }

/* One column once the content area is too narrow for two (the rail takes space
   too, so this is wider than the usual breakpoint). The two columns dissolve so
   every card can be ordered on its own: what you act on first, history last. */
@media (max-width: 1180px) {
  .tp-grid { display: flex; flex-direction: column; align-items: stretch; gap: 1.1rem; }
  .tp-main, .tp-side { display: contents; }
  .tp-c-details { order: 1; } .tp-c-tree { order: 2; } .tp-c-desc { order: 3; } .tp-c-video { order: 4; }
  .tp-c-notes { order: 5; } .tp-c-history { order: 6; } .tp-c-danger { order: 7; }
  .tp-props { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.4rem; }
  .tp-props > div:nth-child(2) { border-top: 0; }
}
@media (max-width: 960px) {
  .tp-title { font-size: 1.4rem; }
}
@media (max-width: 560px) {
  .tp-props { display: flex; }
  .tp-props > div:nth-child(2) { border-top: 1px solid var(--border); }
  .tp-props > div { grid-template-columns: 5.2rem minmax(0, 1fr); }
  .tp-node { grid-template-columns: auto minmax(0, 1fr); }
  .tp-node-meta { grid-column: 2; }
  .tp-add { flex-direction: column; }
  .tp-playlist { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* Top-bar title, hidden when the page heading right below would repeat it. It
   keeps its space so the date stays on the right. */
.admin-page-title.is-duplicate { visibility: hidden; }

/* Tasks board: a milestone is followed by its subtasks, indented with a connector */
.tk-tag {
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #0060c2;
  background: rgba(0, 115, 234, 0.1); border-radius: 4px; padding: 0.18rem 0.38rem; flex: none;
}
.tk-parent > td { background: rgba(0, 115, 234, 0.025); }
.tk-child .tk-title-cell { position: relative; padding-left: 1.7rem; }
.tk-child .tk-title-cell::before {
  content: ""; position: absolute; left: 0.55rem; top: -0.7rem; height: 1.2rem; width: 0.7rem;
  border-left: 2px solid var(--border-strong); border-bottom: 2px solid var(--border-strong); border-bottom-left-radius: 6px;
}
.tk-child .tk-title-btn { font-size: 0.9em; }
.tk-video-flag {
  font-size: 0.64rem; font-weight: 600; color: var(--text-muted); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 0.08rem 0.4rem; margin-left: 0.4rem; flex: none;
}

/* Description: read-only text, with an Edit button for owners */
.tp-desc { font-size: 0.92rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-primary); min-height: 1.6rem; }
.tp-desc.is-empty { color: var(--text-muted); font-style: italic; }
.tp-desc[hidden], .tp-textarea[hidden] { display: none; }
.tp-card-head .tp-linkbtn {
  font-weight: 600; padding: 0.25rem 0.7rem; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg-card); color: var(--text-secondary);
}
.tp-card-head .tp-linkbtn:hover { color: #0060c2; text-decoration: none; border-color: #0073ea; }

/* ==================================================================
   How to do — the card on a task, and the guide page
   ================================================================== */
.tp-howto-brief { margin: 0 0 0.8rem; font-size: 0.92rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.tp-howto-brief.is-empty { color: var(--text-muted); font-style: italic; }
.tp-howto-peek { margin: 0 0 1rem; padding: 0; list-style: none; counter-reset: peek; display: flex; flex-direction: column; gap: 0.35rem; }
.tp-howto-peek:empty { display: none; }
.tp-howto-peek li {
  counter-increment: peek; display: flex; gap: 0.6rem; align-items: baseline; font-size: 0.85rem; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tp-howto-peek li::before {
  content: counter(peek); flex: none; width: 1.3rem; height: 1.3rem; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.68rem; font-weight: 700; color: #0060c2; background: rgba(0, 115, 234, 0.1);
}
.tp-howto-peek .tp-more { color: var(--text-muted); font-size: 0.78rem; }
.tp-howto-peek .tp-more::before { content: "\2026"; background: none; color: var(--text-muted); }
.tp-howto-go[hidden] { display: none; }
.tp-howto-go { text-decoration: none; }

/* the guide page */
#panel-howto { max-width: 1100px; }
#ht-body[hidden], #ht-loading[hidden], #ht-error[hidden], #ht-editor[hidden], #ht-view[hidden] { display: none; }
.ht-header { margin-bottom: 1.6rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--border); }
.ht-title { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; margin: 0.4rem 0 0.7rem; }
.ht-brief { font-size: 1.02rem; line-height: 1.65; color: var(--text-secondary); max-width: 46rem; margin: 0 0 0.7rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.ht-brief:empty { display: none; }
.ht-meta { font-size: 0.76rem; color: var(--text-muted); margin: 0; }
.ht-layout { display: grid; grid-template-columns: 15rem minmax(0, 46rem); gap: 2.4rem; align-items: start; }
.ht-toc { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 0.1rem; border-left: 2px solid var(--border); }
.ht-toc-title { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 0 0 0.5rem 0.9rem; }
.ht-toc button {
  font: inherit; font-size: 0.82rem; text-align: left; cursor: pointer; color: var(--text-secondary); background: none; border: 0;
  border-left: 2px solid transparent; margin-left: -2px; padding: 0.4rem 0.4rem 0.4rem 0.9rem; display: flex; gap: 0.55rem; line-height: 1.35;
}
.ht-toc button:hover { color: #0060c2; }
.ht-toc button.is-current { color: #0060c2; border-left-color: #0073ea; font-weight: 600; }
.ht-toc .ht-toc-n { flex: none; width: 1.2rem; font-variant-numeric: tabular-nums; color: var(--text-muted); }

.ht-steps { display: flex; flex-direction: column; }
.ht-step { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); gap: 1rem; padding: 0 0 2rem; position: relative; scroll-margin-top: 1rem; }
.ht-step::before { content: ""; position: absolute; left: 1.15rem; top: 2.6rem; bottom: 0.2rem; border-left: 2px solid var(--border); }
.ht-step:last-child { padding-bottom: 0; }
.ht-step:last-child::before { display: none; }
.ht-step-num {
  width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.95rem;
  color: #fff; background: #0073ea; position: relative; z-index: 1;
}
.ht-step h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.01em; margin: 0.4rem 0 0.6rem; line-height: 1.35; }
.ht-body { font-size: 0.95rem; line-height: 1.7; color: var(--text-primary); overflow-wrap: anywhere; }
.ht-body p { margin: 0 0 0.8rem; }
.ht-body p:last-child, .ht-body ul:last-child, .ht-body ol:last-child { margin-bottom: 0; }
.ht-body ul, .ht-body ol { margin: 0 0 0.8rem; padding-left: 1.4rem; }
.ht-body li { margin-bottom: 0.3rem; }
.ht-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 4px; padding: 0.05rem 0.35rem; }
.ht-body a { color: #0060c2; }
.ht-empty { color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; padding: 1.6rem; border: 1px dashed var(--border-strong); border-radius: 12px; text-align: center; }
.ht-empty .wk-btn { margin-top: 0.9rem; }

/* editing */
.ht-editor { max-width: 52rem; }
.ht-editor-steps-head { display: flex; flex-direction: column; gap: 0.2rem; margin: 1.2rem 0 0.6rem; }
.ht-editor-steps-head .wk-label { margin: 0; }
.ht-estep { border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem; margin-bottom: 0.7rem; background: var(--bg-soft); }
.ht-estep-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.ht-estep-n { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.78rem; font-weight: 700; color: #fff; background: #0073ea; }
.ht-estep-head .wk-input { flex: 1; margin: 0; font-weight: 600; }
.ht-estep .wk-input { width: 100%; box-sizing: border-box; background: var(--bg-card); }
.ht-estep textarea.wk-input { margin: 0; resize: vertical; line-height: 1.55; }
.ht-estep-tools { display: flex; gap: 0.25rem; flex: none; }
.ht-estep-tools button { font: inherit; font-size: 0.78rem; line-height: 1; cursor: pointer; color: var(--text-muted); background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.5rem; }
.ht-estep-tools button:hover:not(:disabled) { color: var(--text-primary); border-color: var(--border-strong); }
.ht-estep-tools button.ht-remove:hover { color: #e2445c; }
.ht-estep-tools button:disabled { opacity: 0.35; cursor: default; }
#ht-add-step { margin-bottom: 1rem; }

@media (max-width: 1180px) {
  .ht-layout { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
  .ht-toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 0.4rem; border-left: 0; }
  .ht-toc-title { width: 100%; padding-left: 0; }
  .ht-toc button { border: 1px solid var(--border); border-radius: 999px; margin: 0; padding: 0.3rem 0.75rem; }
  .ht-toc button.is-current { border-color: #0073ea; }
  .ht-title { font-size: 1.5rem; }
}
@media (max-width: 560px) {
  .ht-step { grid-template-columns: 1.9rem minmax(0, 1fr); gap: 0.7rem; }
  .ht-step-num { width: 1.9rem; height: 1.9rem; font-size: 0.8rem; }
  .ht-step::before { left: 0.9rem; top: 2.1rem; }
}
.ht-toc[hidden], .ht-view[hidden] { display: none; }

/* ==================================================================
   Tasks: a card per team
   ================================================================== */
.tk-overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 1.1rem; margin-top: 0.4rem; }
.tk-overview[hidden], #tk-filters[hidden], #tk-allteams[hidden] { display: none; }
.tk-allteams { margin-bottom: 0.9rem; }
.tk-teamcard {
  --team: #0073ea; position: relative; display: flex; flex-direction: column; gap: 0.75rem; text-decoration: none; color: inherit;
  background: var(--bg-card); border: 1px solid var(--border); border-top: 4px solid var(--team); border-radius: 12px;
  padding: 1rem 1.15rem 0.95rem; transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}
.tk-teamcard:hover { box-shadow: 0 8px 24px rgba(22, 21, 28, 0.1); transform: translateY(-2px); border-color: var(--border-strong); border-top-color: var(--team); }
.tk-teamcard:focus-visible { outline: 2px solid #0073ea; outline-offset: 2px; }
.tk-tc-head { display: flex; align-items: center; gap: 0.55rem; }
.tk-tc-head h3 { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-tc-head .tk-team-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--team); flex: none; }
.tk-tc-go { color: var(--text-muted); font-size: 1.05rem; transition: transform 0.15s, color 0.15s; }
.tk-teamcard:hover .tk-tc-go { transform: translateX(3px); color: var(--team); }
.tk-tc-overdue { font-size: 0.68rem; font-weight: 700; color: #b3261e; background: rgba(226, 68, 92, 0.1); border-radius: 999px; padding: 0.18rem 0.5rem; white-space: nowrap; }
.tk-tc-desc { margin: 0; font-size: 0.8rem; line-height: 1.45; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.3em; }
.tk-tc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.tk-tc-stat { background: var(--bg-soft); border-radius: 10px; padding: 0.65rem 0.8rem; display: flex; flex-direction: column; }
.tk-tc-stat strong { font-size: 1.7rem; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tk-tc-stat span { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }
.tk-tc-split { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tk-tc-chip { font-size: 0.76rem; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 999px; padding: 0.22rem 0.65rem; }
.tk-tc-chip b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tk-tc-chip-rec { border-color: rgba(120, 75, 209, 0.35); background: rgba(120, 75, 209, 0.06); }
.tk-tc-foot { display: flex; justify-content: space-between; gap: 0.6rem; font-size: 0.72rem; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 0.6rem; margin-top: auto; }
.tk-tc-clear { align-self: center; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #037f4c; margin-left: auto; }
@media (max-width: 560px) { .tk-overview { grid-template-columns: 1fr; } }

/* ==================================================================
   Team page: a Recurring tasks card and a One-time tasks card
   ================================================================== */
#tk-groups { display: flex; flex-direction: column; gap: 1.3rem; }
#tk-groups[hidden] { display: none; }
.tk-pane {
  --team: #0073ea; background: var(--bg-card); border: 1px solid var(--border); border-top: 4px solid var(--team);
  border-radius: 12px; padding: 1rem 1.1rem 1.1rem; min-width: 0;
}
.tk-pane-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.tk-pane-head h3 { margin: 0; font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; }
.tk-pane-sub { font-size: 0.78rem; color: var(--text-muted); }
.tk-pane-spacer { flex: 1; }
.tk-pane-add {
  font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; color: var(--text-secondary);
  background: none; border: 1px dashed var(--border-strong); border-radius: 8px; padding: 0.35rem 0.75rem;
}
.tk-pane-add:hover { color: var(--team); border-color: var(--team); background: var(--bg-soft); }
.tk-pane-empty { margin: 0; padding: 1.2rem; text-align: center; font-size: 0.86rem; color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: 10px; }

/* the tables inside the cards line up column for column, whichever table they are in */
.tk-pane .tk-table-wrap { border: 0; border-radius: 0; background: transparent; overflow-x: auto; }
.tk-pane .tk-table { table-layout: fixed; min-width: 640px; }
.tk-pane .tk-table .tk-col-title { width: auto; min-width: 0; }
.tk-pane .tk-table th:nth-child(2), .tk-pane .tk-table td:nth-child(2) { width: 4.2rem; }
.tk-pane .tk-table th:nth-child(3), .tk-pane .tk-table td:nth-child(3) { width: 9.6rem; }
.tk-pane .tk-table th:nth-child(4), .tk-pane .tk-table td:nth-child(4) { width: 7.4rem; }
.tk-pane .tk-table th:nth-child(5), .tk-pane .tk-table td:nth-child(5) { width: 6.2rem; }
.tk-pane .tk-table-head { margin-bottom: 0.2rem; }
.tk-pane .tk-table-head th { border-bottom: 1px solid var(--border); }

/* a schedule and the occurrences nested under it */
.tk-sched { border: 1px solid var(--border); border-radius: 10px; margin-top: 0.8rem; overflow-x: auto; background: var(--bg-card); }
.tk-sched .tk-rec { padding: 0.7rem 0.9rem; border: 0; background: var(--bg-soft); min-width: 640px; }
.tk-sched .tk-table-nested { margin: 0; }
.tk-sched.is-paused { opacity: 0.7; }
.tk-sched-empty { margin: 0; padding: 0.7rem 1rem; font-size: 0.8rem; color: var(--text-muted); }
.tk-showall { display: block; margin: 0; padding: 0.55rem 1rem 0.65rem 2.4rem; }
.tk-pane .tk-linkbtn { font: inherit; font-size: 0.78rem; color: #0060c2; background: none; border: 0; cursor: pointer; }
.tk-pane .tk-linkbtn:hover { text-decoration: underline; }

/* Dashboard team cards are links into the team's tasks */
a.db-team { display: block; color: inherit; text-decoration: none; transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s; }
a.db-team:hover { box-shadow: 0 6px 20px rgba(22, 21, 28, 0.09); transform: translateY(-1px); border-color: var(--border-strong); border-left-color: var(--team, #0073ea); }
a.db-team:focus-visible { outline: 2px solid #0073ea; outline-offset: 2px; }
.db-team-go { color: var(--text-muted); font-size: 1rem; transition: transform 0.15s, color 0.15s; }
a.db-team:hover .db-team-go { transform: translateX(3px); color: var(--team, #0073ea); }

/* ==================================================================
   Tasks: the header, the numbers and the filter bar
   One header for both views. On a team page it wears the team's colour
   (--team is set on the panel); on the overview it is the brand blue.
   ================================================================== */
#panel-tasks { --team: #0073ea; }

.tk-hero {
  position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem;
  padding: 1.5rem 1.8rem 1.6rem 2.2rem; margin: 0 0 1.4rem; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--team) 22%, var(--border)); border-radius: 18px;
  background: linear-gradient(115deg, color-mix(in srgb, var(--team) 15%, var(--bg-card)) 0%, var(--bg-card) 62%);
  box-shadow: 0 1px 2px rgba(22, 21, 28, 0.04), 0 8px 28px -14px color-mix(in srgb, var(--team) 40%, transparent);
}
.tk-hero::before { /* the team's colour, as a bar down the left edge */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 7px; background: var(--team);
}
.tk-hero::after { /* a soft glow behind the actions, so the right side is not empty */
  content: ""; position: absolute; right: -4rem; top: -5rem; width: 20rem; height: 20rem; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--team) 18%, transparent), transparent 68%);
}
.tk-hero > * { position: relative; z-index: 1; }
.tk-hero-body { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: flex-start; }

.tk-backlink {
  display: inline-flex; align-items: center; gap: 0.45rem; margin-bottom: 1.2rem;
  font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); text-decoration: none;
  padding: 0.4rem 0.85rem 0.4rem 0.7rem; border-radius: 999px;
  background: color-mix(in srgb, var(--bg-card) 80%, transparent); border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s, transform 0.15s;
}
.tk-backlink:hover { color: var(--team); border-color: var(--team); transform: translateX(-2px); }
.tk-backlink[hidden] { display: none; }

.tk-hero-title { display: flex; align-items: center; gap: 1rem; }
.tk-hero-mark {
  flex: none; width: 3.4rem; height: 3.4rem; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.6rem; font-weight: 800; color: #fff; background: var(--team);
  box-shadow: 0 8px 18px -8px var(--team), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}
.tk-eyebrow { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--team); margin-bottom: 0.15rem; }
.tk-hero h2 { margin: 0; font-size: 2.15rem; font-weight: 800; letter-spacing: -0.035em; line-height: 1.1; }
.tk-hero-desc { margin: 0.9rem 0 0; max-width: 54ch; font-size: 0.96rem; line-height: 1.6; color: var(--text-secondary); }
.tk-hero-people { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.1rem; }
.tk-hero-people[hidden] { display: none; }
.tk-stack { display: inline-flex; }
.tk-stack .wk-avatar { width: 34px; height: 34px; font-size: 0.72rem; box-shadow: 0 0 0 2.5px var(--bg-card); margin-left: -0.3rem; }
.tk-stack .wk-avatar:first-child { margin-left: 0; }
.tk-stack-more { background: var(--bg-soft) !important; color: var(--text-secondary) !important; }
.tk-crew-text { font-size: 0.8rem; color: var(--text-muted); }

.tk-hero-actions { flex: none; align-self: flex-end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.6rem; }
.tk-hero-actions .wk-btn { padding: 0.68rem 1.15rem; border-radius: 11px; font-size: 0.86rem; }
.tk-hero-actions .wk-btn-ghost { background: color-mix(in srgb, var(--bg-card) 85%, transparent); }
.tk-hero-actions .wk-btn-primary { box-shadow: 0 8px 18px -8px rgba(0, 115, 234, 0.8); padding-inline: 1.4rem; }

/* the numbers */
.tk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.8rem, 1fr)); gap: 0.8rem; margin: 0 0 1.4rem; }
.tk-stat {
  --k: var(--text-muted); position: relative; padding: 0.95rem 0.9rem 0.9rem 1.15rem; min-width: 0; border-radius: 14px;
  background: var(--bg-card); border: 1px solid var(--border); overflow: hidden; transition: transform 0.15s, box-shadow 0.15s;
}
.tk-stat::before { content: ""; position: absolute; left: 0; top: 0.9rem; bottom: 0.9rem; width: 4px; border-radius: 0 4px 4px 0; background: var(--k); }
.tk-stat:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -12px rgba(22, 21, 28, 0.25); }
.tk-stat strong { display: block; font-size: 2.1rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--k); }
.tk-stat span { display: block; margin-top: 0.4rem; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-stat-open { --k: var(--team); }
.tk-stat-overdue { --k: #e2445c; }
.tk-stat-today { --k: #f29b1d; }
.tk-stat-unassigned { --k: #784bd1; }
.tk-stat-done { --k: #00a85f; }
.tk-stat.is-zero { --k: var(--border-strong); }
.tk-stat.is-zero strong { color: var(--text-muted); font-weight: 700; }
.tk-stat-open.is-zero strong { color: var(--text-muted); }
/* these older rules coloured the number only for the alert tiles; the tile does it now */
.tk-stat-alert strong, .tk-stat-warn strong { color: var(--k); }

/* the filter bar */
.tk-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; margin: 0 0 1.4rem; padding: 0.7rem 0.9rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
}
.tk-filters[hidden] { display: none; }
.tk-filters-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin-right: 0.2rem; }
.tk-filters .tk-toggle {
  gap: 0.5rem; padding: 0.45rem 0.95rem 0.45rem 0.75rem; font-size: 0.82rem; font-weight: 600;
  background: var(--bg-soft); border: 1px solid transparent; border-radius: 999px; color: var(--text-secondary);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tk-filters .tk-toggle:hover { border-color: var(--border-strong); }
.tk-filters .tk-toggle input {
  appearance: none; -webkit-appearance: none; width: 1.05rem; height: 1.05rem; margin: 0; border-radius: 5px; flex: none; cursor: pointer;
  border: 1.5px solid var(--border-strong); background: var(--bg-card); display: grid; place-items: center; transition: background 0.15s, border-color 0.15s;
}
.tk-filters .tk-toggle input:checked { background: var(--team); border-color: var(--team); }
.tk-filters .tk-toggle input:checked::after { content: ""; width: 0.28rem; height: 0.55rem; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.tk-filters .tk-toggle:has(input:checked) { color: var(--text-primary); background: color-mix(in srgb, var(--team) 12%, var(--bg-card)); border-color: color-mix(in srgb, var(--team) 40%, transparent); }
.tk-filters .tk-search {
  flex: 1 1 15rem; min-width: 12rem; max-width: 26rem; margin: 0 0 0 auto; padding: 0.55rem 0.9rem 0.55rem 2.4rem; font-size: 0.85rem; border-radius: 999px;
  background: var(--bg-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238d8fa0' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 0.85rem center;
  border: 1px solid transparent;
}
.tk-filters .tk-search:focus { background-color: var(--bg-card); border-color: var(--team); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--team) 20%, transparent); }

@media (max-width: 900px) {
  .tk-hero { flex-direction: column; gap: 1.3rem; padding: 1.3rem 1.2rem 1.3rem 1.6rem; }
  .tk-hero-actions { align-self: stretch; justify-content: flex-start; }
  .tk-hero h2 { font-size: 1.7rem; }
  .tk-hero-mark { width: 2.8rem; height: 2.8rem; font-size: 1.3rem; border-radius: 12px; }
}
@media (max-width: 560px) {
  .tk-stats { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
  .tk-stat strong { font-size: 1.7rem; }
  .tk-stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .tk-filters .tk-search { flex-basis: 100%; max-width: none; margin-left: 0; }
  .tk-hero-actions .wk-btn { flex: 1 1 auto; justify-content: center; }
}

/* ==================================================================
   A repeating task: the button on the team page, and its details page
   ================================================================== */
.tk-sched-open { white-space: nowrap; padding: 0.45rem 0.9rem; font-size: 0.8rem; text-decoration: none; }
.tk-sched-open:hover { color: var(--team); border-color: var(--team); }
.tk-sched-title { color: inherit; text-decoration: none; }
.tk-sched-title:hover strong { color: var(--team); text-decoration: underline; }

#panel-recurring { --team: #0073ea; }
#rc-body[hidden], #rc-loading[hidden], #rc-error[hidden] { display: none; }
.rc-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1.1rem; }
.rc-chip {
  display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary);
  background: color-mix(in srgb, var(--bg-card) 85%, transparent); border: 1px solid var(--border); border-radius: 999px; padding: 0.3rem 0.8rem;
}
.rc-chip b { color: var(--text-primary); }
.rc-chip .wk-avatar { width: 22px; height: 22px; font-size: 0.58rem; margin-left: -0.35rem; }
.rc-chip-active { color: #037f4c; border-color: rgba(0, 168, 95, 0.4); background: rgba(0, 200, 117, 0.1); }
.rc-chip-paused { color: #b76e00; border-color: rgba(253, 171, 61, 0.55); background: rgba(253, 171, 61, 0.14); }
.tk-stat-text strong { font-size: 1.35rem; line-height: 1.5; letter-spacing: -0.02em; }

.rc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1.4rem; align-items: start; }
.rc-side { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.rc-table-wrap { border: 0; border-radius: 0; background: transparent; }
.rc-table th { padding-left: 0; }
.rc-table td { padding: 0.6rem 0.7rem 0.6rem 0; }
.rc-due { color: var(--text-primary); font-weight: 600; text-decoration: none; }
.rc-due:hover { color: #0060c2; text-decoration: underline; }
.rc-status { display: inline-flex; align-items: center; gap: 0.5rem; }
.rc-late { font-style: normal; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #b3261e; background: rgba(226, 68, 92, 0.1); border-radius: 4px; padding: 0.12rem 0.4rem; }
.rc-props > div { grid-template-columns: 5.6rem minmax(0, 1fr); align-items: start; }
.rc-val { font-size: 0.84rem; line-height: 1.45; overflow-wrap: anywhere; }

@media (max-width: 1180px) {
  .rc-grid { grid-template-columns: minmax(0, 1fr); }
  .rc-side { order: -1; }
}

/* ==================================================================
   Routine actions: log done, and the "Not completed" card
   ================================================================== */
.tk-sched-done { white-space: nowrap; padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.tk-sched .tk-rec { grid-template-columns: 1fr auto auto auto auto; }
.tk-skip-tag { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #676879; background: var(--bg-soft); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0.15rem 0.38rem; flex: none; }

/* a card that asks for attention: red top edge, quiet when everything is done */
.tk-pane-missed { border-top-color: #e2445c; background: linear-gradient(180deg, rgba(226, 68, 92, 0.05), var(--bg-card) 6rem); border-color: rgba(226, 68, 92, 0.28); }
.tk-pane-missed .tk-pane-head h3 { color: #b3261e; }
.tk-missed-pill { font-size: 0.74rem; font-weight: 700; color: #b3261e; background: rgba(226, 68, 92, 0.12); border-radius: 999px; padding: 0.2rem 0.65rem; }
.tk-missed-list { display: flex; flex-direction: column; }
.tk-missed-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.75rem 0; border-top: 1px solid var(--border);
}
.tk-missed-row:first-child { border-top: 0; padding-top: 0.2rem; }
.tk-missed-main { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.tk-missed-title { font-size: 0.92rem; font-weight: 650; color: var(--text-primary); text-decoration: none; overflow-wrap: anywhere; }
.tk-missed-title:hover { color: #0060c2; text-decoration: underline; }
.tk-missed-meta { font-size: 0.78rem; color: var(--text-muted); }
.tk-missed-meta b { color: #b3261e; font-weight: 700; margin-left: 0.35rem; }
.tk-missed-actions { display: flex; gap: 0.5rem; flex: none; }
.tk-missed-actions .wk-btn { padding: 0.45rem 0.9rem; font-size: 0.8rem; }

/* on a schedule's own page */
.rc-left { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.rc-missed { border-color: rgba(226, 68, 92, 0.3); background: linear-gradient(180deg, rgba(226, 68, 92, 0.05), var(--bg-card) 5rem); }
.rc-missed .tp-card-head h3 { color: #b3261e; }
.rc-missed.is-clear { border-color: var(--border); background: var(--bg-card); }
.rc-missed.is-clear .tp-card-head h3 { color: var(--text-muted); }
.rc-allclear { margin: 0; font-size: 0.88rem; color: #037f4c; font-weight: 600; }
.rc-done { box-shadow: 0 8px 18px -8px rgba(0, 115, 234, 0.8); }
.rc-done[hidden] { display: none; }
.rc-act { text-align: right; white-space: nowrap; }
.rc-link { font: inherit; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); background: none; border: 0; padding: 0.2rem 0; cursor: pointer; }
.rc-link:hover { color: #0060c2; text-decoration: underline; }
.rc-link-go { color: #037f4c; }
.rc-link-go:hover { color: #026a40; }
.rc-reason { display: block; margin-top: 0.25rem; font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; max-width: 24rem; overflow-wrap: anywhere; }
.rc-reason small { color: var(--text-muted); font-size: 0.7rem; }

#skip-reason { resize: vertical; }
@media (max-width: 640px) { .tk-missed-actions { width: 100%; } .tk-missed-actions .wk-btn { flex: 1; justify-content: center; } }
.tp-chip-skip { color: #676879; background: var(--bg-soft); border-style: dashed; max-width: 100%; }

/* a guide that belongs to a repeating task */
.tp-guide-note, .ht-shared { font-size: 0.78rem; color: var(--text-secondary); background: var(--bg-soft); border-radius: 8px; padding: 0.5rem 0.75rem; margin: 0 0 0.8rem; line-height: 1.45; }
.tp-guide-note[hidden], .ht-shared[hidden] { display: none; }
.tp-guide-note a, .ht-shared a { color: #0060c2; }

/* ==================================================================
   The task dialog: wider, with Google Calendar-style repeat choices
   ================================================================== */
#tk-dialog { width: min(680px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); }
#tk-dialog .tk-dialog-row > div { display: flex; flex-direction: column; min-width: 0; }
#tk-dialog .wk-input { width: 100%; box-sizing: border-box; }
#tk-dialog textarea.wk-input { resize: vertical; }
#tk-dialog .wk-dialog-form { padding: 1.5rem 1.7rem 1.3rem; }

.tk-repeat { margin-bottom: 0.4rem; }
.tk-repeat[hidden] { display: none; }
.tk-custom {
  border: 1px solid var(--border); background: var(--bg-soft); border-radius: 12px; padding: 0.9rem 1rem 0.2rem; margin: -0.3rem 0 0.9rem;
}
.tk-custom[hidden], .tk-custom-block[hidden] { display: none; }
.tk-custom-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.9rem; font-size: 0.86rem; color: var(--text-secondary); }
#tk-dialog .tk-custom-row .wk-input { width: auto; margin: 0; background: var(--bg-card); }
#tk-dialog .tk-custom-n { width: 4.4rem; text-align: center; }
.tk-custom-block { margin-bottom: 0.9rem; }
.tk-custom-label { display: block; font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.45rem; }
#tk-dialog .tk-custom-block .wk-input { margin: 0; background: var(--bg-card); }
.tk-weekdays { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tk-weekdays button {
  font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; min-width: 3rem; padding: 0.45rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-secondary); transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tk-weekdays button:hover { border-color: #0073ea; }
.tk-weekdays button[aria-pressed="true"] { background: #0073ea; border-color: #0073ea; color: #fff; }
.tk-repeat-summary {
  margin: -0.2rem 0 0.9rem; padding: 0.55rem 0.8rem; border-radius: 8px; font-size: 0.8rem; line-height: 1.45;
  color: #0b4f9c; background: rgba(0, 115, 234, 0.08);
}
.tk-repeat-summary[hidden] { display: none; }
.tk-repeat-summary.is-note { color: var(--text-secondary); background: var(--bg-soft); }

/* A routine action whose week or month is over: only "give a reason" is left */
.tk-lapsed {
  display: inline-flex; align-items: center; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: #9a5b00; background: rgba(255, 170, 0, 0.14); border-radius: 999px; padding: 0.28rem 0.65rem; white-space: nowrap;
}
