/* nesk/web/static/styles.css */
:root{
  color-scheme: light;
  --bg: #F5F6F7;
  --card: #FFFFFF;
  --surface-subtle: #FAFAFB;
  --surface-muted: #F0F2F4;
  --text: #161616;
  --muted: #62676D;
  --line: #E2E4E7;
  --line-strong: #CFD3D8;

  --current: var(--brand-primary);
  --current-hover: var(--brand-primary-hover);
  --hold: #D9D9D9;
  --overdue: #DA1E28;

  --shadow: 0 3px 12px rgba(20,28,38,0.045);
  --shadow-strong: 0 14px 34px rgba(20,28,38,0.09);
  --shadow-popover: 0 12px 30px rgba(0,0,0,0.14);
  --radius: 14px;
  --radius-sm: 9px;
  --pad: 14px;
  --control-height: 34px;
  --surface-hover: rgba(0,0,0,0.035);
  --focus-ring: 0 0 0 3px var(--brand-primary-focus);
  --focus-outline: var(--brand-primary-focus);
  --focus-outline-soft: color-mix(in srgb, var(--brand-primary) 12%, transparent);
  --accent-text: var(--brand-primary);
  --accent-text-hover: var(--brand-primary-hover);
  --surface-code: rgba(0,0,0,0.06);
  --surface-edit-hover: rgba(0,0,0,0.02);
  --shadow-next: 0 10px 28px rgba(20,28,38,0.07);
  --shadow-dialog: 0 22px 60px rgba(0,0,0,0.20);
  --dialog-backdrop: rgba(20,25,35,0.34);
  --tooltip-bg: #20252B;
  --tooltip-text: #FFFFFF;
  --score-tooltip-bg: #111;
  --score-tooltip-text: #eee;
  --score-tooltip-muted: #777;
  --score-tooltip-line: #444;
  --score-tooltip-divider: #333;
  --shadow-tooltip: 0 4px 15px rgba(0,0,0,0.8);
  --success: #198038;
  --on-overdue: #fff;
  --due-today: #F1C21B;
  --on-due-today: #000;
  --warning-text: #9a5a00;
  --warning-bg: rgba(255,174,66,0.10);
  --warning-line: rgba(184,108,0,0.28);
  --metadata-opacity: .78;
  --reason-opacity: .82;
  --disabled-opacity: .5;
  --readonly-opacity: .65;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --text-view: 17px;
  --text-task: 15px;
  --text-meta: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
}

/* Presentation tokens only: the independent brand palette is never overridden. */
[data-theme="dark"]{
  color-scheme: dark;
  --bg: #0F1115;
  --card: #161A20;
  --surface-subtle: #1B2027;
  --surface-muted: #242B34;
  --text: #F2F4F8;
  --muted: #B4BDCA;
  --line: #363F4C;
  --line-strong: #667386;
  --surface-hover: rgba(255,255,255,0.07);
  --surface-code: rgba(255,255,255,0.08);
  --surface-edit-hover: rgba(255,255,255,0.05);
  --hold: #667386;
  --overdue: #FF858D;
  --on-overdue: #211014;
  --success: #79D49A;
  --due-today: #F1C21B;
  --on-due-today: #000;
  --warning-text: #F2C66D;
  --warning-bg: rgba(242,198,109,0.10);
  --warning-line: rgba(242,198,109,0.40);
  --shadow: 0 10px 24px rgba(0,0,0,0.35);
  --shadow-strong: 0 14px 34px rgba(0,0,0,0.45);
  --shadow-popover: 0 12px 30px rgba(0,0,0,0.55);
  --shadow-next: 0 10px 28px rgba(0,0,0,0.35);
  --shadow-dialog: 0 22px 60px rgba(0,0,0,0.60);
  --dialog-backdrop: rgba(0,0,0,0.62);
  --tooltip-bg: #303946;
  --tooltip-text: var(--text);
  --score-tooltip-bg: var(--surface-subtle);
  --score-tooltip-text: var(--text);
  --score-tooltip-muted: var(--muted);
  --score-tooltip-line: var(--line-strong);
  --score-tooltip-divider: var(--line);
  --shadow-tooltip: var(--shadow-popover);
  /* Lift accent text for contrast; filled controls retain the chosen brand. */
  --accent-text: color-mix(in srgb, var(--brand-primary) 60%, var(--text));
  --accent-text-hover: color-mix(in srgb, var(--brand-primary) 40%, var(--text));
  --focus-ring: 0 0 0 3px var(--accent-text);
  --focus-outline: var(--accent-text);
  --focus-outline-soft: var(--accent-text);
  --metadata-opacity: 1;
  --reason-opacity: 1;
  --disabled-opacity: .85;
  --readonly-opacity: 1;
  --content-opacity: 1;
}

/* --- primary flow and secondary workspace --- */
.shell{
  display: block;
  height: 100%;
}

.pane{
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}

.management-panel{
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  flex-direction: column;
  padding: 18px;
  background: color-mix(in srgb, var(--card) 78%, var(--bg));
  border-color: var(--line);
  box-shadow: none;
}

.workspace-toggle{
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.workspace-toggle:hover,
.workspace-toggle:focus-visible{
  color: var(--accent-text);
  border-color: var(--current);
  outline: none;
}

.collapse-icon{
  font-size: 14px;
  line-height: 1;
}

.secondary-workspace{
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.workspace-switchbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 8px;
}

.workspace-switchbar .alternatives-heading{
  margin: 0;
}

.execution-workspace{
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.execution-workspace > .ranked-list{
  flex: 1 1 auto;
}

.shell:not(.workspace-collapsed) .execution-workspace{
  display: none;
}

.shell:not(.workspace-collapsed) .management-panel{
  display: flex;
}

/* Navigation occupies its own row; only the active view scrolls. */
.workspace-header{ flex: 0 0 auto; min-width: 0; }
.workspace-content{
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  padding: 4px;
  scroll-padding: 4px;
}
.workspace-content:focus-visible{
  outline: 2px solid var(--accent-text);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}
.workspace-header .project-list-header{ justify-content: flex-end; margin-bottom: 8px; }
.workspace-header .analytics-ranges{ margin-bottom: 8px; }

.pane-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* The ranked list owns scrolling; this pane must not crop the main shadow. */
  overflow: visible;
}

.execution-workspace > .list{
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

/* Right pane nav */
.view-tabs{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.management-toolbar{
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.management-toolbar .view-tabs{ margin-bottom: 0; }

.settings-input-row{ display: flex; align-items: center; gap: 7px; }
.settings-input-row input{
  min-width: 0;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  color: var(--text);
  background: var(--card);
}

.view-tab{
  text-decoration: none;
  display:inline-flex;
  align-items:center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: var(--text-meta);
  color: var(--muted);
  background: transparent;
}

.view-tab.active{
  border-color: var(--current);
}

.nav-strip{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nav-link{
  min-height: 30px;
  justify-content: center;
  border-radius: 999px;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.nav-link:hover{
  color: var(--accent-text);
  border-color: color-mix(in srgb, var(--current) 38%, var(--line));
  background: color-mix(in srgb, var(--current) 5%, var(--card));
}

.nav-link:focus-visible{
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--current);
}

.nav-link.active,
.nav-link[aria-current="page"]{
  color: var(--accent-text);
  border-color: color-mix(in srgb, var(--current) 48%, var(--line));
  background: color-mix(in srgb, var(--current) 7%, var(--card));
  font-weight: 650;
}

.nav-strip--compact .nav-link{ min-height: 28px; padding: 4px 9px; }

.overview-head{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}

.overview-title{
  font-weight: 650;
  font-size: 14px;
  color: var(--text);
}

.overview-review-nav{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.overview-review-label{
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}

.overview-horizon-tabs{
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.overview-horizon-tabs .view-tab{
  padding: 5px 9px;
}

.review-heading{
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 10px;
}

.review-heading .list-header{ margin-bottom: 2px; }

.schedule-planning-capacity{
  height: auto !important;
  overflow: visible !important;
  top: auto !important;
  display: grid;
  gap: 11px;
  margin-bottom: 10px;
  border-left: 3px solid var(--current);
}
.settings-input-row .next-action{ min-height: 34px; padding: 7px 11px; font-size: 12px; }
.schedule-capacity-warning{padding:9px 11px; margin-top:8px; border:1px solid var(--warning-line); border-radius:8px; background:var(--warning-bg); color:var(--warning-text); font-size:12px; line-height:1.5;}
.schedule-capacity-warning a{color:inherit; text-decoration:underline; margin-left:8px; white-space:nowrap;}
.schedule-warning-compact{display:none;}

.review-metrics{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.review-metric{
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 6px 10px;
  border: 0;
  border-left: 2px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.review-metric-accent{ border-left-color: var(--current); }
.review-metric-value{ font-size: 18px; font-weight: 700; color: var(--text); }
.review-partial-note{ margin: 8px 2px 0; font-size: 11px; }
.review-sections{ display: grid; gap: 12px; margin-top: 16px; }
.review-section{ display: grid; gap: 8px; }
.review-section + .review-section{ margin-top: 2px; }
.review-section-title{ font-size: 13px; font-weight: 700; margin: 0 2px; }
.review-group + .review-group{ margin-top: 2px; }
.review-group-card{ display: grid; gap: 7px; background: var(--surface-subtle); box-shadow: none; }
.review-card-head{ display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.review-task-list{ display: grid; }
.review-task-row{ padding: 9px 2px; border-top: 1px solid var(--line); }
.review-task-row:first-child{ border-top: 0; }
.review-task-row:hover{ background: var(--surface-hover); }
.review-task-row:hover .tree-edit-btn,
.review-task-row:focus-within .tree-edit-btn{ opacity: 1; }
.review-task-row .titleline{ display: flex; align-items: center; gap: 8px; width: 100%; line-height: 1.25; }
.review-empty-card{ box-shadow: none; text-align: center; }
.context-workspace-panel .review-metric,
.context-workspace-panel .review-group-card,
.context-workspace-panel .review-empty-card{
  height: auto;
  overflow: visible;
  top: auto;
}

/* Analytics V1 */
.analytics-head{ display:flex; justify-content:space-between; gap:12px; margin-bottom:10px; }
.analytics-ranges{ display:flex; flex-wrap:wrap; gap:6px; padding-bottom:12px; border-bottom:1px solid var(--line); }
.analytics-ranges .view-tab{ padding:5px 8px; }
.analytics-sections{ display:grid; gap:20px; margin-top:16px; }
.analytics-section{ display:grid; gap:9px; }
.analytics-section-head{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.analytics-section-head h3{ margin:0; font-size:14px; }
.analytics-grid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.context-workspace-panel .analytics-grid{ grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); }
.analytics-grid-five{ grid-template-columns:repeat(auto-fit,minmax(115px,1fr)); }
.analytics-card{ min-height:92px; padding:12px; border:1px solid var(--line); border-radius:11px; background:var(--surface-subtle); box-shadow:none; }
.context-workspace-panel .analytics-card{ height:auto; overflow:visible; top:auto; }
.analytics-card-wide{ grid-column:span 2; }
.analytics-card.analytics-alert{ border-left:3px solid var(--overdue); }
.analytics-label{ font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.035em; }
.analytics-value{ margin-top:5px; font-size:22px; line-height:1.1; font-weight:750; color:var(--text); }
.analytics-detail{ margin-top:7px; padding-top:7px; border-top:1px solid var(--line); font-size:11px; color:var(--muted); }
.analytics-empty{ margin-top:9px; font-size:12px; color:var(--muted); }
.analytics-bars{ display:grid; gap:5px; margin-top:8px; }
.analytics-bar-row{ display:grid; grid-template-columns:22px minmax(45px,1fr) 34px 20px; align-items:center; gap:7px; font-size:11px; }
.analytics-bar-row strong,.analytics-bar-row small{ text-align:right; }
.analytics-bar{ height:6px; overflow:hidden; border-radius:999px; background:var(--line); }
.analytics-bar i{ display:block; height:100%; border-radius:inherit; background:var(--current); }
.analytics-mix{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:9px; }
.analytics-mix span{ display:grid; gap:2px; padding:8px; border-radius:9px; background:var(--bg); font-size:12px; }
.analytics-mix strong{ font-size:18px; }.analytics-mix small{ color:var(--muted); }
@media (max-width: 760px){
  .analytics-grid{ grid-template-columns:1fr; }
  .context-workspace-panel .analytics-grid{ grid-template-columns:1fr; }
  .analytics-card-wide{ grid-column:auto; }
  .analytics-section-head{ align-items:flex-start; flex-direction:column; gap:2px; }
}

@media (max-width: 760px){
}

.add-btn{
  background: var(--card);
  width: 28px;
  height: 28px;
  cursor: pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height: 1;
}

.add-btn:hover{
  color: var(--accent-text);
}

/* --- Toggle Button (Icon Style) --- */
.toggle-btn {
    text-decoration: none;
    background: var(--card);

    width: 28px;  /* Square dimensions */
    height: 28px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    color: var(--muted);
    margin-left: auto; /* Pushes to left */
    transition: all 0.2s ease;
    cursor: pointer;
}

.toggle-btn:hover {
    color: var(--accent-text);
}

.toggle-btn.active {
    background: var(--line);
    color: var(--text);
}

/* Ensure SVG inherits color */
.toggle-btn svg {
    stroke: currentColor;
}

.add-project{
  text-decoration: none;
  background: transparent;
  border: none;
  width: auto;
  height: auto;
  padding: 0;
  font-size: 26px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: var(--muted);
  transition: all 0.2s ease;
  cursor: pointer;
}

.add-project:hover {
    color: var(--accent-text);
}

.tree .proj-del-btn{
  opacity: 0;
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
}

.tree summary:hover .proj-del-btn{
  opacity: 1;
}

.tree .proj-del-btn:hover{
  color: var(--overdue);
}

.flex-spacer{
  flex: 1;
}

/* Tree action buttons (add, move + delete): hidden until hover */
.tree .add-btn,
.tree .del-btn,
.tree .move-btn{
  margin-left: 0;
  opacity: 0;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
}

/* Slightly larger for visual balace */
.tree .add-btn,
.tree .del-btn{
  font-size: 22px;
  line-height: 1;
}

/* Reveal on node hover */
.tree summary:hover .add-btn,
.tree summary:hover .del-btn,
.tree summary:hover .move-btn{
  opacity: 1;
}

/* Hover affordance: colour only */
.tree .add-btn:hover,
.tree .move-btn:hover{
  color: var(--accent-text);
}

.tree .del-btn:hover{
  color: var(--overdue);
}

/* The Date Text (e.g. 05/01) */
.tree-date {
    font-size: 11px;
    color: var(--muted);    /* Faint grey */
    margin-left: 8px;       /* Space after title */
    opacity: var(--content-opacity, 0.7);
    font-family: "Consolas", monospace; /* Code font for alignment */
    letter-spacing: -0.5px;
}

/* Red text if overdue */
.tree-date.overdue-text {
    color: var(--overdue);
    opacity: 1;
    font-weight: 600;
}

/* Mini Icons (Red ! or Amber ★) */
.overdue.small,
.due-today.small {
    width: 16px;
    height: 16px;
    font-size: 10px;
    margin-right: 6px; /* Space before title */
    flex-shrink: 0;    /* Prevent squishing */
}

.project-summary-list{
  display: grid;
  gap: 10px;
}

.context-workspace-panel .project-summary-list{
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.project-summary{
  display: grid;
  gap: 10px;
  background: var(--surface-subtle);
  box-shadow: none;
}

.project-summary-head,
.project-progress-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-title-row{
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
}

.project-title-row .icon-button{ width: 28px; min-width: 28px; height: 28px; }
.project-last-touched{ white-space: nowrap; }
.project-editor-host{ position: relative; }
.project-editor-popover{
  position: fixed;
  z-index: 20;
  width: min(280px, calc(100vw - 40px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow-popover);
}
.project-editor-popover form{ display: grid; gap: 9px; }
.project-editor-popover label{ font-size: 12px; font-weight: 650; color: var(--text); }
.project-editor-popover input{
  box-sizing: border-box;
  width: 100%;
  min-height: var(--control-height);
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font: inherit;
}

.is-completed > summary,
.is-completed > summary .titletext{ color: var(--muted); }
.is-completed > summary .titletext{ text-decoration: line-through; text-decoration-color: var(--line); }
.completed-reopen-form{ margin: 0; }
.reopen-action{
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent-text);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}
.reopen-action:hover{ border-color: var(--current); background: color-mix(in srgb, var(--current) 5%, var(--card)); }
.reopen-action:focus-visible{ outline: none; box-shadow: var(--focus-ring); border-color: var(--current); }

.project-progress-track{
  flex: 1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.project-progress-track span{
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--current);
}

.project-estimate-note{
  font-size: 11px;
}

/* Overview tree */
.tree-create-help { margin: 0 0 10px; }
.tree-create { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 6px; }
.tree-create .qa-input { flex: 1 1 180px; min-width: 0; width: 100%; }
.tree-create-error { flex-basis: 100%; color: var(--muted); margin: 0; }
.tree-create-error:empty { display: none; }
.tree summary.tree-selected { background: var(--brand-primary-soft); outline: 2px solid var(--accent-text); outline-offset: -2px; }
.tree{
  font-size: 12.5px;
  color: var(--text);
}

.tree details{
  padding: 2px 0;
}

.tree summary{
  cursor: pointer;
  list-style: none;
  display:flex;
  align-items:center;
  gap: 7px;
  padding: 7px 6px;
  border-radius: 8px;
}

.tree summary:hover{
  background: var(--surface-hover);
}

.tree summary::-webkit-details-marker{
  display:none;
}

.tree .node{
  margin-left: 14px;
  border-left: 1px solid var(--line);
  padding-left: 10px;
}

.badge{
  display:inline-flex;
  align-items:center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--muted);
}

.badge.done{ opacity: var(--content-opacity, 0.7); }
.badge.hold{ }
.badge.active{ }

.badge.count{
  color: var(--muted);
  border-style: dashed;
}

.tree .titleline{
  display:flex;
  gap: 8px;
  align-items:center;
  min-width: 0;
}
.tree .titletext{
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  line-height: 1.3;
  font-weight: 560;
}

.review-task-row .titletext{ font-size: 13px; font-weight: 620; }
.tree-edit-btn{
  border: 0;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
}
.tree summary:hover .tree-edit-btn,
.tree-edit-btn:focus-visible{ opacity: 1; }
.tree-edit-btn:hover{ color: var(--accent-text); }
.tree .titleline.is-editing > :not(.tree-inline-edit){ display: none; }
.tree-inline-edit,
.inline-task-edit{ width: 100%; margin-top: 8px; }
.inline-edit-fields,
.tree-edit-fields{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.inline-edit-fields input,
.inline-edit-fields select,
.tree-edit-fields input,
.tree-edit-fields select,
.task-editor .stakeholder-field input,
.edit-form .edit-input{
  min-width: 0;
  max-width: 150px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
.inline-edit-fields input[name="title"],
.tree-edit-fields input[name="title"]{ flex: 1 1 220px; max-width: none; }
.inline-edit-actions{ display:flex; gap:6px; margin-top: 7px; }
.tree-inline-edit .inline-edit-actions{ margin-top: 6px; }
.edit-form-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top: 8px; }
.inline-edit-actions .next-action,
.edit-form-actions .next-action,
.floating-move .next-action{ min-height: 38px; padding: 8px 13px; font-size: 13px; }

.task-details-editor,
.task-details-view{
  margin-top: 9px;
  border-top: 1px solid var(--line);
}

.task-details-editor summary,
.task-details-view summary{
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  padding-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.disclosure > summary:hover{ color: var(--text); }
.disclosure > summary:focus-visible{
  outline: none;
  color: var(--accent-text);
  border-radius: 5px;
  box-shadow: var(--focus-ring);
}

.task-details-editor summary::-webkit-details-marker,
.task-details-view summary::-webkit-details-marker{
  display: none;
}

.task-details-editor summary::before,
.task-details-view summary::before{
  content: "›";
  display: inline-block;
  transition: transform 120ms ease;
}

.task-details-editor[open] summary::before,
.task-details-view[open] summary::before{
  transform: rotate(90deg);
}

.details-present{
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 650;
  text-transform: uppercase;
}

.task-details-editor textarea{
  box-sizing: border-box;
  width: 100%;
  min-height: 96px;
  max-height: 260px;
  margin-top: 8px;
  padding: 9px 10px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.task-details-editor textarea:focus{
  border-color: var(--current);
  outline: 2px solid var(--focus-outline-soft);
}

.task-details-content{
  max-height: 240px;
  overflow: auto;
  margin-top: 7px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.task-details-content > :first-child{ margin-top: 0; }
.task-details-content > :last-child{ margin-bottom: 0; }
.task-details-content p,
.task-details-content ul,
.task-details-content ol,
.task-details-content pre,
.task-details-content blockquote{ margin: 0 0 7px; }
.task-details-content ul,
.task-details-content ol{ padding-left: 20px; }
.task-details-content li + li{ margin-top: 2px; }
.task-details-content h1,
.task-details-content h2,
.task-details-content h3,
.task-details-content h4,
.task-details-content h5,
.task-details-content h6{
  margin: 9px 0 5px;
  font-size: 13px;
  line-height: 1.3;
}
.task-details-content h1{ font-size: 15px; }
.task-details-content h2{ font-size: 14px; }
.task-details-content a{ color: var(--accent-text); text-decoration-thickness: 1px; }
.task-details-content code{
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-code);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
}
.task-details-content pre{
  overflow: auto;
  padding: 8px;
  border-radius: 7px;
  background: var(--surface-code);
  white-space: pre-wrap;
}
.task-details-content pre code{ padding: 0; background: transparent; }
.task-details-content blockquote{
  padding-left: 9px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}
.task-details-content input[type="checkbox"]{ margin: 0 6px 0 0; accent-color: var(--current); }
.task-details-content .task-list-item{ list-style: none; margin-left: -18px; }

.tree-task-details{
  margin: 2px 0 7px 24px;
}

.review-task-details{
  margin-left: 2px;
}

@media (max-width: 980px){
  .wrap{
    overflow: auto;
  }
  .shell,
  .pane{
    height: auto;
    min-height: 100%;
    overflow: visible;
  }
  .secondary-workspace,
  .execution-workspace{
    min-height: 0;
  }
  .execution-workspace > .list{
    overflow: visible;
  }
  .management-panel{
    /* A viewport-sized workspace inside the existing mobile page scroller. */
    flex: 0 0 auto;
    height: calc(100svh - 28px);
    overflow: hidden;
  }
}

*{ box-sizing: border-box; }
html, body{
  margin:0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100%;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.wrap{
  max-width: 1280px;
  margin: 0px auto;
  padding: 16px 24px;
  height: 100vh;
}

.top{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.brand{
  display:flex;
  align-items:center;
  gap: 10px;
}

.brand-mark{
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-mark svg{
  color: var(--brand-mark);
  width: 24px;
  height: 24px;
  display: block;
}

.title{
  font-size: 18px;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.quickadd{
  display:flex;
  gap: 10px;
  align-items:center;
  width: 100%;
}

.quickadd-zone{
  margin: 14px 0 18px;
}

.quickadd-heading{
  margin: 0 2px 8px;
  color: var(--accent-text-hover);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.quickadd .qa-input{
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.quickadd-help{
  position: relative;
  flex: 0 0 auto;
}

.quickadd-help > .icon-button{
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  list-style: none;
}

.quickadd-help > .icon-button:hover,
.quickadd-help > .icon-button:focus-visible{
  color: var(--text);
  border-color: var(--muted);
  outline: none;
}

.quickadd-reference{
  position: fixed;
  z-index: 20;
  width: min(360px, calc(100vw - 40px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-popover);
  color: var(--muted);
  font-size: 12px;
}

.quickadd-reference-title{
  margin-bottom: 9px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.quickadd-reference dl{
  display: grid;
  gap: 5px;
  margin: 0;
}

.quickadd-reference dl div{
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr;
  gap: 12px;
}

.quickadd-reference dt{
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.quickadd-reference dd{
  margin: 0;
}

.quickadd-examples{
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.quickadd-examples code{
  color: var(--text);
  white-space: normal;
}

.quickadd-reference p{
  margin: 10px 0 0;
  line-height: 1.45;
}

.quickadd-feedback{
  margin: 6px 38px 0 0;
  color: var(--overdue);
  font-size: 12px;
  text-align: right;
}

.focus-control{
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.focus-control select{
  min-width: 132px;
  max-width: min(240px, 38vw);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  padding: 6px 26px 6px 10px;
  font-size: 12px;
}

.top{ flex-wrap: wrap; }
.domain-tabs{
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 180px;
  min-width: 0;
  overflow-x: auto;
  padding: 4px;
}
.domain-tabs form{ margin: 0; flex: 0 0 auto; }
.domain-tabs button{
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.workspace-settings-action{
  color: var(--muted);
  font-size: 12px;
  padding: 7px 2px;
  text-decoration: none;
  flex: 0 0 auto;
}
.workspace-settings-action.active,
.workspace-settings-action:hover{ color: var(--accent-text); }
.workspace-settings{ width: 100%; display: grid; gap: 24px; }
.workspace-settings h2{ font-size: 15px; margin: 0 0 8px; }
.workspace-settings h3{ font-size: 14px; margin: 20px 0 8px; }
.theme-control{ display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-subtle); }
.theme-control .next-action{ background: transparent; border-color: transparent; color: var(--muted); }
.theme-control .next-action[aria-pressed="true"]{ background: var(--card); border-color: var(--accent-text); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent-text); }
.theme-control .next-action:focus-visible{ box-shadow: var(--focus-ring); }
.theme-control .next-action[aria-disabled="true"]{ cursor: wait; }
.theme-status{ margin: 8px 0 0; }
.theme-status:empty{ display: none; }
.settings-account-form{ display: grid; gap: 8px; max-width: 460px; margin-top: 14px; }
.settings-account-form input{
  width: 100%; min-width: 0; padding: 8px 9px; font: inherit;
  color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 9px;
}
.settings-account-form > button{ justify-self: start; }
.settings-account-form .settings-input-row{ flex-wrap: wrap; }
.settings-disclosure{ margin-top: 16px; }
.settings-disclosure > summary{ cursor: pointer; font-size: 13px; }
.settings-danger-zone h2{ color: var(--muted); }
.delete-account-action{ color: var(--overdue); border-color: var(--overdue); }
.settings-feedback{ font-size: 13px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.settings-feedback.error{ color: var(--overdue); }
.workspace-settings section + section{ border-top: 1px solid var(--line); padding-top: 20px; }
.workspace-settings label{ display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.workspace-settings .settings-input-row{ margin-top: 7px; }
.domain-settings-list{ display: grid; gap: 12px; margin: 16px 0 20px; }
.domain-settings-row{ display: flex; align-items: flex-end; gap: 8px; }
.domain-edit-form{ display: flex; align-items: flex-end; gap: 8px; flex: 1; min-width: 0; }
.domain-edit-form label:first-of-type{ flex: 1; min-width: 0; }
.domain-edit-form label:nth-of-type(2){ width: 64px; flex: 0 0 auto; }
.domain-edit-form input{
  width: 100%; min-width: 0; padding: 8px 9px;
  border: 1px solid var(--line); border-radius: 9px;
  font: inherit; color: var(--text); background: var(--card);
}
.domain-current{ color: var(--accent-text); font-size: 12px; padding: 8px 0; }
.domain-create-form .settings-input-row{ flex-wrap: wrap; }
.domain-create-form input{ flex: 1 1 160px; }
@media (max-width: 600px){
  .domain-tabs{ order: 3; flex-basis: 100%; }
  .domain-settings-row{ flex-wrap: wrap; }
  .domain-edit-form{ flex-basis: 100%; }
}

.focus-empty{
  border-style: dashed;
}

.next-task-kicker{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 2px 8px;
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.next-task-kicker .hint{
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.card.next-task-card{
  padding: 30px 26px;
  border-color: var(--brand-primary-border);
  box-shadow: var(--shadow), var(--shadow-next);
}

.next-task-card .task-title{
  font-size: clamp(22px, 2.3vw, 30px);
  font-weight: 760;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.next-task-card .task-sub{
  margin-top: 10px;
  opacity: var(--metadata-opacity);
}

.next-task-card .card-row > .left{ flex: 1; min-width: 0; }
.next-task-card .card-row{ flex-wrap: wrap; }
.next-task-card .edit-form{ min-width: 0; }
/* Override .editable's negative margin so the divider clears wrapped metadata. */
.next-task-card .task-details-editor{ margin: 12px 0 0; padding: 0; }
.next-task-card #viewTitle{ overflow-wrap: anywhere; }
.next-task-card #viewTitle:focus-visible{
  outline: none;
  border-radius: 6px;
  box-shadow: var(--focus-ring);
}
.next-task-card #inpTitle{
  flex: 1;
  width: 100%;
  max-width: none;
  font-size: var(--text-task);
}
.next-task-card.task-editor-open .task-sub{
  gap: 6px;
  opacity: 1;
}
.next-task-card.task-editor-open .task-sub .editable{
  display: flex;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.next-task-card.task-editor-open [data-field="project"]{ flex: 0 1 180px; }
.next-task-card.task-editor-open #inpProject{ width: 100%; max-width: none; }
.next-task-card.task-editor-open #inpEst{ width: 72px; }
.next-task-card.task-editor-open .fit-warning,
.next-task-card.task-editor-open .task-sub .sep{ display: none; }

.next-task-card .overdue{
  width: 22px;
  height: 22px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--overdue) 12%, transparent);
}

.task-kind{
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
}

.task-kind.snack{
  color: var(--accent-text);
}

.task-kind.frog{
  color: var(--success);
}

.next-task-state{
  flex-shrink: 0;
  color: var(--muted);
  font-size: var(--text-meta);
}

.next-task-state.active{
  color: var(--accent-text);
}

.next-task-reason{
  margin: 20px 0 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  opacity: var(--reason-opacity);
}

.next-task-footer{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.next-task-actions{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.next-task-actions form{
  margin: 0;
}

.next-action{
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.next-action:hover,
.next-action:focus-visible{
  border-color: var(--current);
  outline: none;
}

.next-action:focus-visible{ box-shadow: var(--focus-ring); }
.next-action:not(.primary-action):not(.danger-action):hover{ background: var(--surface-muted); }

.next-action.primary-action{
  border-color: var(--current);
  background: var(--current);
  color: var(--brand-on-primary);
}

.next-action.primary-action:hover{
  background: var(--current-hover);
  border-color: var(--current-hover);
}

.next-action.reject-action{
  color: var(--muted);
  background: transparent;
}

.next-action.icon-action{
  width: 38px;
  padding: 0;
  color: var(--muted);
  font-size: 18px;
}

.next-action:disabled{
  cursor: not-allowed;
  opacity: var(--disabled-opacity);
  filter: saturate(.7);
}

.next-task-card.is-busy{
  opacity: 0.72;
  transition: opacity 120ms ease;
}

.next-save{
  padding: 8px 10px;
  font-size: 12px;
}

.next-task-empty{
  padding: 22px 20px;
}

.alternatives-heading{
  margin: 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ranked-list{
  gap: 2px;
}

.ranked-list .card{
  --ranked-surface-strength: 58%;
  --ranked-border-strength: 72%;
  --ranked-secondary-opacity: 0.96;
  --ranked-control-opacity: 0.94;
  background: color-mix(in srgb, var(--card) var(--ranked-surface-strength), var(--bg));
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) var(--ranked-border-strength), transparent);
  border-radius: 7px;
  box-shadow: none;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.ranked-list .up-nesk-prominence-1{
  --ranked-surface-strength: 62%;
  --ranked-border-strength: 80%;
  --ranked-secondary-opacity: 1;
  --ranked-control-opacity: 0.96;
}

.ranked-list .up-nesk-prominence-2{
  --ranked-surface-strength: 56%;
  --ranked-border-strength: 68%;
  --ranked-secondary-opacity: 0.96;
  --ranked-control-opacity: 0.92;
}

.ranked-list .up-nesk-prominence-3{
  --ranked-surface-strength: 50%;
  --ranked-border-strength: 56%;
  --ranked-secondary-opacity: 0.92;
  --ranked-control-opacity: 0.89;
}

.ranked-list .up-nesk-prominence-4{
  --ranked-surface-strength: 44%;
  --ranked-border-strength: 44%;
  --ranked-secondary-opacity: 0.88;
  --ranked-control-opacity: 0.86;
}

.ranked-list .card:hover,
.ranked-list .card:focus-within{
  background: color-mix(in srgb, var(--card) 78%, var(--bg));
  border-bottom-color: var(--line);
}

.ranked-list .card.is-hold{
  opacity: 1;
}

.ranked-list .task-title{
  font-size: var(--text-task);
  font-weight: 640;
  color: color-mix(in srgb, var(--text) 84%, var(--muted));
}

.ranked-list .task-editable:focus-visible{
  outline: none;
  border-radius: 5px;
  box-shadow: var(--focus-ring);
}

.ranked-list .task-sub{
  font-size: 12px;
  opacity: var(--content-opacity, var(--ranked-secondary-opacity));
}

.ranked-list .overdue{
  border: 1.5px solid color-mix(in srgb, var(--overdue) 76%, var(--line));
  background: transparent;
  color: var(--overdue);
}

.ranked-list .fit-warning{
  border-color: color-mix(in srgb, var(--muted) 36%, var(--line));
  background: transparent;
  color: var(--muted);
  font-weight: 550;
  opacity: var(--content-opacity, var(--ranked-secondary-opacity));
}

.ranked-complete{
  min-height: 30px;
  border-color: transparent;
  border-radius: 5px;
  padding: 4px 2px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.ranked-complete:hover,
.ranked-complete:focus-visible{
  border-color: transparent;
  background: transparent !important;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ranked-list .card-row{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, max-content);
  align-items: stretch;
}

.ranked-list .right{
  min-width: 0;
  height: 100%;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.ranked-list .right .pill{
  max-width: min(32ch, 38vw);
  border-color: color-mix(in srgb, var(--line) 78%, transparent);
  color: var(--muted);
  opacity: var(--content-opacity, var(--ranked-secondary-opacity));
  overflow-wrap: anywhere;
  text-align: right;
  white-space: normal;
}

.ranked-list .right .ranked-complete{
  opacity: var(--content-opacity, var(--ranked-control-opacity));
}

.ranked-list .card:hover .right .ranked-complete,
.ranked-list .card:focus-within .right .ranked-complete{
  opacity: 1;
}

@media (prefers-reduced-motion: reduce){
  .ranked-list .card{ transition: none; }
}

.completion-dialog{
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-dialog);
}

.completion-form{
  display: grid;
  gap: 14px;
  padding: 20px;
}

.completion-kicker{
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.completion-title{
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
}

.completion-effort{
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.completion-input-row{
  display: flex;
  align-items: center;
  gap: 8px;
}

.completion-input-row input{
  width: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}

.completion-input-row input:focus{
  border-color: var(--current);
  outline: 2px solid var(--focus-outline-soft);
}

.completion-actions{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.completion-form .form-error{
  color: var(--overdue);
  font-size: 12px;
}

.sr-only{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 620px){
  .next-task-card{
    padding: 18px 16px;
  }
  .next-task-footer{
    align-items: flex-start;
    flex-direction: column;
  }
}

.triage-list{
  margin-top: 10px;
}

.triage-title-row{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.card.is-triage{
  border-left: 3px solid var(--line);
  background: var(--surface-subtle);
  box-shadow: none;
}

.triage-card-actions{
  flex-shrink: 0;
  gap: 6px;
}

.triage-card-actions form{
  margin: 0;
}

.triage-recommit{
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-text);
}

.triage-recommit .action-label{
  font-size: 11px;
  font-weight: 650;
}

.triage-prompt{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
}

.triage-signal{
  flex-shrink: 0;
  border-style: dashed;
  color: var(--muted);
}

.triage-review{
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.triage-review summary{
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  outline: none;
}

.triage-review summary::-webkit-details-marker{
  display: none;
}

.triage-review summary:focus-visible{
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 4px;
}

.triage-review[open] .review-chevron{
  transform: rotate(180deg);
}

.review-chevron{
  display: inline-block;
  transition: transform 120ms ease;
}

.triage-review-body{
  padding-top: 10px;
}

.triage-edit{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.triage-edit label{
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.triage-edit input,
.triage-edit select,
.triage-edit textarea,
.triage-actions input{
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--card);
  color: var(--text);
}

.triage-details{
  grid-column: 1 / -1;
}

.triage-details textarea{
  min-height: 96px;
  max-height: 260px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
}

.triage-save{
  align-self: end;
  justify-self: start;
  padding: 8px 10px;
  font-size: 12px;
}

.triage-actions{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.triage-actions form{
  display: flex;
  gap: 8px;
}

.triage-actions form:first-child{
  flex: 1;
}

.triage-actions input{
  width: 100%;
  min-width: 0;
}

.triage-actions .btn{
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.triage-delete{
  font-size: 22px;
}

.triage-delete:hover{
  color: var(--overdue);
}

@media (max-width: 620px){
  .triage-prompt{
    align-items: flex-start;
    flex-direction: column;
  }
  .triage-edit{
    grid-template-columns: 1fr;
  }
}

.qa-input{
  width: min(560px, 100%);
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  outline: none;
}

.qa-input::placeholder{
  color: var(--muted);
}


.add-btn:hover{
  color: var(--accent-text);
}

.btn{
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
}

.btn.primary{
  opacity: 1 !important;
  margin-left: 0;
  border: none;
  background: transparent;
  font-size: 26px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  line-height: 1;
}

.btn.btn.primary:hover{
  color: var(--accent-text);
}

.btn.secondary{
  opacity: 1 !important;
  margin-left: 0;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  line-height: 1;
}

.btn.btn.secondary:hover{
  color: var(--accent-text);
}

.btn.ok{
  border-color: transparent;
}

.btn.icon{
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text)
}

.btn.icon svg{
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn.icon svg polygon{
  fill: currentColor;
  stroke: none;
}

/* Complete action styling */
.btn.complete{
  color: var(--text);
}

.action-btn{
  opacity: 1 !important;
  margin-left: 0;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  line-height: 1;
}

.action-btn:hover,
.hold-btn:hover,
.complete-btn:hover{
  color: var(--accent-text);
}

.hold-btn,
.complete-btn{
  opacity: 1 !important;
  margin-left: 0;
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  line-height: 1;
}

.list{
  display:flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--pad);
}

.list-header{
  color: var(--text);
  font-size: var(--text-view);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.card-row{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-expanded{
  padding: 18px 16px;
  border-left: 6px solid transparent;
}

.card-expanded.is-current{
  border-left-color: var(--current);
}

.card.is-hold{
  opacity: var(--content-opacity, 0.9);
  background: var(--surface-subtle);
  box-shadow: none;
}

.card-actions{
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

/* When hidden, keep the space but hide the button */
.card-actions .hidden{
  visibility: hidden !important;
}

.card-select { margin: 0; }
.card-button{
  all: unset;
  display: block;
  cursor: pointer;
}
.card-button:focus-visible{
  outline: 2px solid var(--accent-text);
  outline-offset: 4px;
  border-radius: var(--radius);
}

/* Editable hover affordance */
.editable{
  position: relative;
  cursor: text;
  border-radius: 8px;

  padding: 4px;
  margin: -4px;
  transition: box-shadow 120ms ease, background-color 120ms ease;
}

/* Hover only when not editing */
.editable:hover:not(.editing){
  box-shadow: inset 0 0 0 1px var(--line);
  background: var(--surface-edit-hover);
}

.editable[data-field="project"],
.editable[data-field="due"]{
  cursor: pointer;
}

.task-title{
  min-width: 0;
  font-size: var(--text-task);
  font-weight: 650;
  line-height: 1.3;
  display:flex;
  align-items:center;
  gap: 10px;
}

.task-sub{
  margin-top: 5px;
  display:flex;
  flex-wrap: wrap;
  column-gap: 7px;
  row-gap: 4px;
  align-items:center;
  color: var(--muted);
  font-size: var(--text-meta);
}

.meta{ color: var(--muted); }
.dim{ opacity: var(--content-opacity, 0.8); }
.sep{ opacity: 0.5; }
.fit-warning{
  display:inline-flex;
  align-items:center;
  border:1px solid var(--warning-line);
  border-radius:999px;
  padding:2px 7px;
  color:var(--warning-text);
  background:var(--warning-bg);
  font-size:11px;
  font-weight:650;
  white-space:nowrap;
}

.overdue{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--overdue);
  color: var(--on-overdue);
  font-size: 12px;
  font-weight: 800;
}

.due-today {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;

    /* Amber / Orange styling */
    background: var(--due-today);
    color: var(--on-due-today);         /* Black text on yellow/orange is high contrast */

    font-size: 12px;
    font-weight: 800;
    margin-right: 6px;   /* Spacing from title */
    line-height: 1;
}


.recur{
  margin-left: 6px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
}

.right{
  text-align: right;
  display:flex;
  flex-direction: column;
  align-items:flex-end;
  gap: 8px;
}

.actions{
  display:flex;
  gap: 8px;
}

.score{
  font-size: 12px;
  color: var(--muted);
}

.card-foot{
  margin-top: 12px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
}

.pill{
  display:inline-flex;
  align-items:center;
  border: 1px solid var(--line);
  background: transparent;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
}

.pill.small{
  font-size: 11px;
  padding: 3px 9px;
}

.hint{
  font-size: var(--text-meta);
  color: var(--muted);
  line-height: 1.45;
}

.card-compact{
  padding: 12px 14px;
}

.floating-snooze .snooze-card{
  padding: 12px;
  display:flex;
  flex-direction: column;
  gap: 10px;
  min-width: 320px;
}

.snooze-head{
  font-weight: 650;
  font-size: 13px;
  color: var(--text);
}

.snooze-row{
  display:flex;
  gap: 10px;
  align-items:center;
}

.snooze-units{
  display:flex;
  gap: 6px;
}

.snooze-unit{
  padding: 8px 10px;
  border-radius: 3px;
  font-size: 12px;
}

.snooze-unit.active{
  border-color: var(--current);
  color: var(--accent-text);
}

.snooze-amount{
  width: 60px;
  height: 24px;
  text-align: center;
  border-radius: 3px;
}

.snooze-actions{
  display:flex;
  justify-content: flex-end;
  gap: 8px;
}

.snooze-hint{
  font-size: 11px;
  color: var(--muted);
}

/* --- Nesk Hacker Tooltip --- */
.score-wrapper {
    position: relative;
    cursor: help;
    display: inline-block;
    transform: translateY(-50%);
}


.nesk-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    right: 120%;
    bottom: auto; /* Sits above the score */
    right: 120%;     /* Aligns to right edge so it doesn't overflow screen */
    transform: translateY(-50%);
    background-color: var(--score-tooltip-bg);
    border: 1px solid var(--score-tooltip-line);
    box-shadow: var(--shadow-tooltip);

    width: max-content;
    max-width: 280px;
    padding: 8px 10px;
    border-radius: 4px;
    z-index: 999;
    pointer-events: none; /* Let clicks pass through if needed */
    transition: opacity 0.1s ease;
}

.score-wrapper:hover .nesk-tooltip {
    visibility: visible;
    opacity: 1;
}

.tt-text {
    display: block;
    color: var(--score-tooltip-text);
    font-size: 0.85rem;
    margin-bottom: 4px;
    line-height: 1.3;
}

.tt-code {
    display: block;
    color: var(--score-tooltip-muted); /* The "Light Grey" */
    font-family: "Consolas", "Monaco", "Courier New", monospace; /* The "Codey Vibe" */
    font-size: 0.75rem;
    border-top: 1px solid var(--score-tooltip-divider);
    padding-top: 4px;
}

.toast{
  position: fixed;
  pointer-events: none;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text);
  z-index: 10000;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.show{
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

/* Shared interaction contracts */
.icon-button{
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--muted);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  position: relative;
}
.icon-button:hover{ color: var(--accent-text); background: var(--bg); }
.icon-button:focus-visible{
  opacity: 1 !important;
  color: var(--accent-text);
  border-color: var(--current);
  outline: 2px solid var(--focus-outline);
  outline-offset: 2px;
}

.control-tooltip{
  position: fixed;
  z-index: 10010;
  width: max-content;
  max-width: 210px;
  padding: 5px 7px;
  border-radius: 6px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  box-shadow: var(--shadow);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  pointer-events: none;
}
.task-row-actions { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 2px; }
.task-row-actions .icon-button { flex: 0 0 auto; margin: 0; vertical-align: middle; }
.task-control-icon { display: block; flex: none; pointer-events: none; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .task-control-icon { transition: transform 120ms ease; }
  .icon-button:not(:disabled):hover .task-control-icon { transform: translateY(-1px) scale(1.08); }
  .icon-button:not(:disabled):active .task-control-icon { transform: translateY(1px) scale(.96); }
}
.icon-button:has(.task-control-icon):hover,
.tree .add-btn:hover,
.tree .move-btn:hover,
.tree .tree-edit-btn:hover { color: var(--accent-text); }
.icon-button.delete-trigger:has(.task-control-icon):hover { color: var(--overdue); }
.tree summary:focus-within .tree-edit-btn,
.tree summary:focus-within .add-btn,
.tree summary:focus-within .del-btn,
.tree summary:focus-within .move-btn,
.tree summary:focus-within .proj-del-btn{ opacity: 1; }
@media (hover: none) {
  .tree .task-row-actions .icon-button,
  .review-task-row .tree-edit-btn { opacity: 1; }
}

.anchored-popover{
  z-index: 9999;
  color: var(--text);
}
.popover-card,
.floating-add{
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: min(320px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow-popover);
}
.popover-actions{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.project-list-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ranked-list .task-editor-open .task-sub,
.ranked-list .task-editor-open > .card-row > .right,
.ranked-list .task-editor-open > .task-details-view{
  display: none;
}
.ranked-list .task-editor-open > .card-row { grid-template-columns: minmax(0, 1fr); }
.task-editor textarea{
  width: 100%;
  min-height: 96px;
  max-height: 260px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  line-height: 1.45;
}

.next-task-card .task-edit-button { margin-inline-start: auto; }
.next-task-footer > .edit-form-actions { align-self: stretch; }
.next-task-collapsed .next-task-card .task-edit-button { display: none; }
.task-editor-open .task-edit-button { display: none; }
.task-edit-button { min-height: 32px; }
.task-editor .stakeholder-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  margin-block: 10px;
  min-width: 0;
}
.task-editor .stakeholder-field input { width: 100%; max-width: 150px; }
.task-editor .stakeholder-field .hint { font-weight: 400; overflow-wrap: anywhere; }

.app-dialog::backdrop{
  background: var(--dialog-backdrop);
  backdrop-filter: blur(2px);
}
.confirm-dialog{
  width: min(430px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-dialog);
}
.confirm-form{
  display: grid;
  gap: 14px;
  padding: 20px;
}
.danger-action{
  border-color: var(--overdue);
  background: var(--overdue);
  color: var(--on-overdue);
}
.danger-action:hover,
.danger-action:focus-visible{ filter: brightness(.94); }

.toast{
  display: flex;
  align-items: center;
  gap: 12px;
}
.toast-action{
  appearance: none;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--accent-text);
  font-weight: 700;
  font: inherit;
  cursor: pointer;
}
.toast-action:hover{ text-decoration: underline; }
.toast-action:focus-visible{ outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }
.toast.is-error{ border-color: color-mix(in srgb, var(--overdue) 45%, var(--line)); }

.empty-state{
  padding: 18px 14px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--bg) 55%, var(--card));
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

input:not([type="hidden"]),
select,
textarea{
  accent-color: var(--current);
}
input:not([type="hidden"]):focus-visible,
select:focus-visible,
textarea:focus-visible{
  border-color: var(--current) !important;
  outline: none !important;
  box-shadow: var(--focus-ring);
}

.task-editor label,
.workspace-settings label,
.completion-effort{
  color: var(--muted);
  font-size: var(--text-meta);
  font-weight: 600;
}

.task-editor input:not([type="hidden"]),
.task-editor select,
.workspace-settings input,
.completion-form input{
  min-height: var(--control-height);
}

/* Pass 4: responsive product polish */
@media (max-width: 980px){
  .wrap{ padding: 14px 18px; }
  .management-panel{ min-height: 0; padding: 16px; }
  .top{ gap: 12px; }
}

@media (max-width: 620px){
  .wrap{ padding: 12px; }

  .top{
    align-items: center;
    margin-bottom: 12px;
  }
  .brand{ min-height: 36px; }
  .title{ font-size: 17px; }
  .quickadd-zone{ margin: 12px 0 16px; }
  .quickadd{ width: 100%; gap: 7px; }
  .quickadd .qa-input{ min-width: 0; width: 100%; }
  .quickadd .btn.primary{ width: 38px; min-width: 38px; height: 38px; }
  .quickadd-help > .icon-button{ width: 38px; min-width: 38px; height: 38px; }

  .workspace-toggle{ min-height: 36px; }

  .focus-control{ margin: 0; }
  .focus-control label{ font-size: 11px; }
  .focus-control select{ min-height: 36px; min-width: 0; max-width: 48vw; }
  .next-task-kicker{ align-items: center; }
  .card.next-task-card{ padding: 21px 16px; }
  .next-task-card .card-row{ flex-direction: column; }
  .next-task-card .card-row > .left{ width: 100%; }
  .next-task-card .task-title{ font-size: 21px; }
  .next-task-footer{ margin-top: 16px; padding-top: 13px; }
  .next-task-actions{ gap: 7px; }
  .next-task-actions .next-action{ min-height: 40px; }

  .ranked-list .card{ padding: 12px; }
  .ranked-list .card-row{ grid-template-columns: minmax(0, 1fr) minmax(76px, 34vw); gap: 10px; }
  .ranked-list .right{ width: auto; }
  .ranked-list .right .pill{ max-width: 34vw; }
  .ranked-list .task-title{ overflow-wrap: anywhere; }

  .management-toolbar{ align-items: center; }
  .management-toolbar .view-tabs{
    min-width: 0;
    flex-wrap: wrap;
    gap: 5px;
    overflow: visible;
    padding: 4px;
  }
  .management-toolbar .view-tabs .nav-link{ flex: 0 0 auto; white-space: nowrap; }
  .nav-link{ min-height: 36px; }
  .overview-review-nav{ align-items: flex-start; flex-direction: column; }
  .overview-horizon-tabs{ justify-content: flex-start; }

  .tree summary{ align-items: flex-start; }
  .tree .titleline{ flex-wrap: wrap; line-height: 1.3; }
  .tree .node{ margin-left: 8px; padding-left: 7px; }
  .tree .icon-button{ width: 36px; min-width: 36px; height: 36px; }
  .project-summary-head{ align-items: flex-start; }
  .context-workspace-panel .project-summary-list{ grid-template-columns: 1fr; }
  .project-last-touched{ white-space: normal; text-align: right; }

  .anchored-popover,
  .floating-snooze .snooze-card,
  .popover-card,
  .floating-add{
    min-width: 0;
    width: min(340px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }
  .snooze-row{ flex-wrap: wrap; }
  .snooze-actions{ width: 100%; }
  .project-editor-popover{ width: min(300px, calc(100vw - 24px)); }

  .app-dialog{
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    overflow: auto;
  }
  .icon-button{ width: 38px; min-width: 38px; height: 38px; }
  .toast{ right: 12px; bottom: 12px; left: 12px; justify-content: space-between; }
}
.access-notice { padding: 12px 16px; border: 1px solid var(--brand-primary-border); border-radius: 12px; margin-bottom: 12px; }
.access-notice p { margin: 6px 0; }
.workflow-read-only :disabled { cursor: default; opacity: var(--readonly-opacity); }
