/* Sfera CRM · Task editor, same visual language as Quick Activity.
   A presentation-only layer: task.js, ids, controls and submit lifecycle stay canonical.
   Never apply these rules to #task-detail-modal or the Task workspace. */

#task-editor-modal.task-modal {
  --task-studio-navy: #0e2166;
  --task-studio-blue: #0b7ff0;
  --task-studio-line: #dde7f3;
  --task-studio-canvas: #f4f7fc;
  --task-studio-muted: #7286a2;
  --task-studio-green: #16835a;
  --task-studio-red: #d2443f;
  padding: max(18px,env(safe-area-inset-top)) max(18px,env(safe-area-inset-right)) max(18px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left));
  font-family: var(--sfera-font-family,"Schibsted Grotesk",Arial,sans-serif);
  color: #243957;
}
#task-editor-modal.task-modal .task-modal__backdrop {
  background: rgba(11,26,54,.43)!important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
#task-editor-modal #task-form.task-editor-dialog {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  width: min(920px,100%);
  height: min(830px,calc(100dvh - 36px));
  min-height: min(580px,calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dce7f4;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 65px rgba(12,30,65,.22);
  color: #243957;
  animation: none;
}
#task-editor-modal #task-form > * {
  min-width: 0;
  max-width: 100%;
}
#task-editor-modal .task-modal__header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 13px;
  flex: 0 0 auto;
  min-height: 86px;
  padding: 19px 24px;
  background: #fff;
  border-bottom: 1px solid #edf2f8;
  color: var(--task-studio-navy);
}
#task-editor-modal .task-studio__hero-icon {
  flex: 0 0 43px;
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 12px;
  background: #eaf3ff;
  color: var(--task-studio-navy);
}
#task-editor-modal .task-studio__hero-icon svg {
  display: block;
  width: 22px;
  height: 22px;
  stroke: currentColor;
}
#task-editor-modal .task-modal__header > div {
  flex: 1 1 auto;
  min-width: 0;
}
#task-editor-modal #task-form-eyebrow {
  display: none;
}
#task-editor-modal #task-form-title {
  margin: 0;
  color: var(--task-studio-navy);
  font: 680 23px/1.24 var(--sfera-font-family,"Schibsted Grotesk",Arial,sans-serif);
  letter-spacing: -.45px;
}
#task-editor-modal #task-form-intro {
  margin: 4px 0 0;
  color: #7385a2;
  font: 420 12.5px/1.5 var(--sfera-font-family,"Schibsted Grotesk",Arial,sans-serif);
}
#task-editor-modal #task-form-close {
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid #dce6f3;
  border-radius: 10px;
  background: #fff;
  color: #8295b2;
  font: 400 22px/1 var(--sfera-font-family,"Schibsted Grotesk",Arial,sans-serif);
  transition: background .16s,border-color .16s,color .16s;
}
#task-editor-modal #task-form-close:is(:hover,:focus-visible) {
  background: #f5f8fd;
  border-color: #b9d0ef;
  color: var(--task-studio-navy);
}

/* The task form has exactly one scrolling region; loading, metadata, warnings
   and the primary action bar are not swallowed by that scroll. */
#task-editor-modal #task-form-loader {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  min-height: 100px;
  margin: 0;
  padding: 26px;
  border: 0;
  border-radius: 0;
  background: #f5f8fc;
  color: #42638b;
  font-size: 13px;
}
#task-editor-modal #task-form-meta {
  flex: 0 0 auto;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 9px;
  margin: 0;
  padding: 11px 24px;
  background: #f8fbff;
  border-bottom: 1px solid #e7eef7;
}
#task-editor-modal #task-form-meta > div {
  padding: 9px 11px;
  border: 1px solid #e3ebf6;
  border-radius: 9px;
  background: #fff;
}
#task-editor-modal #task-form-meta dt {
  color: #8295ac;
  font-size: 10px;
  font-weight: 580;
  letter-spacing: .02em;
  text-transform: none;
}
#task-editor-modal #task-form-meta dd {
  font-size: 12px;
  font-weight: 600;
  color: var(--task-studio-navy);
}
#task-editor-modal #task-form-fields.task-form-fields {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 15px;
  flex: 1 1 0;
  height: auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #bfcfe4 transparent;
  padding: 18px 23px 23px;
  background: var(--task-studio-canvas);
}
#task-editor-modal .task-form-section {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 18px 19px 19px;
  border: 1px solid var(--task-studio-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 11px rgba(14,33,102,.035);
}
#task-editor-modal .task-form-section:nth-of-type(1) {
  border-top: 2px solid #b9d5f7;
}
#task-editor-modal .task-form-section:nth-of-type(2) {
  border-left: 3px solid #9fc5ed;
}
#task-editor-modal .task-form-section:nth-of-type(3) {
  border-top: 2px solid #d4e3f7;
  background: #fefeff;
}
#task-editor-modal .task-form-section:nth-of-type(4) {
  border-left: 3px solid #acd8d1;
}
#task-editor-modal .task-form-section:nth-of-type(5) {
  background: #fcfefe;
  border-top: 2px solid #c6e7de;
}
#task-editor-modal .task-form-section__accent {
  margin: 0 0 8px 49px;
  color: #8293ad;
  font-size: 10px;
  font-weight: 580;
  letter-spacing: .045em;
  line-height: 1.2;
  text-transform: uppercase;
}
#task-editor-modal .task-form-section h3 {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
  margin: 0 0 16px;
  padding: 0 0 14px;
  border-bottom: 1px solid #edf2f8;
  color: var(--task-studio-navy);
  font: 660 15px/1.3 var(--sfera-font-family,"Schibsted Grotesk",Arial,sans-serif);
  letter-spacing: -.12px;
}
#task-editor-modal .task-studio-section__icon {
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #edf4ff;
  color: #1459a7;
}
#task-editor-modal .task-studio-section__icon svg {
  display: block;
  width: 19px;
  height: 19px;
}
#task-editor-modal .task-form-section:nth-of-type(2) .task-studio-section__icon {
  background: #eaf3ff;
  color: #2469ae;
}
#task-editor-modal .task-form-section:nth-of-type(3) .task-studio-section__icon {
  background: #edf3ff;
  color: #436bab;
}
#task-editor-modal .task-form-section:nth-of-type(4) .task-studio-section__icon,
#task-editor-modal .task-form-section:nth-of-type(5) .task-studio-section__icon {
  background: #eaf6f3;
  color: #157b74;
}
#task-editor-modal .task-studio-section__index {
  display: inline-flex;
  justify-content: center;
  margin-left: auto;
  min-width: 30px;
  border: 1px solid #e8eef7;
  border-radius: 7px;
  padding: 5px 7px;
  background: #f2f6fc;
  color: #8a9db8;
  font-size: 10px;
  font-weight: 640;
}
#task-editor-modal .task-form-section > p:not(.task-form-section__accent) {
  margin: -5px 0 15px;
  color: #7b8ca6;
  font: 430 12px/1.48 var(--sfera-font-family,"Schibsted Grotesk",Arial,sans-serif);
}
#task-editor-modal .task-form-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  align-items: start;
  gap: 15px;
}
#task-editor-modal .task-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #405776;
  font-size: 12.5px;
  font-weight: 530;
}
#task-editor-modal .task-field--wide,
#task-editor-modal .task-field--full {
  grid-column: 1 / -1;
}
#task-editor-modal .task-field > span:first-child {
  color: #405776;
  font-size: 12.5px;
  font-weight: 580;
  line-height: 1.35;
}
#task-editor-modal .task-field :is(input,select,textarea) {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid #dce5f1;
  border-radius: 10px;
  background-color: #fff;
  color: #263d60;
  font: 520 13px/1.4 var(--sfera-font-family,"Schibsted Grotesk",Arial,sans-serif);
  transition: border-color .16s,box-shadow .16s,background-color .16s;
}
#task-editor-modal .task-field :is(input,textarea)::placeholder,
#task-editor-modal .task-microtask-composer input::placeholder {
  color: #94a3ba;
  opacity: 1;
}
#task-editor-modal .task-field textarea {
  min-height: 105px;
  resize: vertical;
  font-weight: 450;
  line-height: 1.55;
}
#task-editor-modal .task-field select {
  appearance: none;
  padding-right: 38px;
  background-image: 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='%236e88ad' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 17px;
}
#task-editor-modal .task-field input[readonly] {
  background: #f5f8fd;
  border-color: #e3ebf5;
  color: #657d9c;
  cursor: default;
}
#task-editor-modal .task-field :is(input,select,textarea):focus-visible {
  outline: 0;
  border-color: var(--task-studio-blue);
  box-shadow: 0 0 0 3px rgba(11,127,240,.13);
}
#task-editor-modal .task-field :is(input,select,textarea):hover:not(:disabled):not([readonly]) {
  border-color: #a9c6e8;
}
#task-editor-modal .task-field :is(input,select,textarea)[aria-invalid="true"],
#task-editor-modal .task-field :is(input,select):required:invalid:not(:disabled) {
  border-color: var(--task-studio-red);
  background-color: #fff9f8;
  box-shadow: 0 0 0 2px rgba(210,68,63,.055);
}
#task-editor-modal .task-field :is(input,select):required:valid:not(:disabled):not([aria-invalid="true"]) {
  border-color: #4ba77e;
  background-color: #fbfffc;
  box-shadow: 0 0 0 2px rgba(22,131,90,.045);
}
#task-editor-modal .task-field:has(:is(input,select)[required]:invalid:not(:disabled)) > span:first-child,
#task-editor-modal .task-field:has([aria-invalid="true"]) > span:first-child {
  color: #b84841;
}
#task-editor-modal .task-field:has(:is(input,select)[required]:valid:not(:disabled)) > span:first-child {
  color: var(--task-studio-green);
}
#task-editor-modal .task-field__error {
  margin: 0;
  color: #b42318;
  font-size: 11px;
  line-height: 1.45;
}
#task-editor-modal .task-field__warning {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 10px 12px;
  min-height: 46px;
  color: #986219;
  font: 470 12px/1.4 var(--sfera-font-family,"Schibsted Grotesk",Arial,sans-serif);
}
#task-editor-modal .task-field__warning:empty {
  min-height: 0;
  padding: 0;
}
#task-editor-modal .task-field:has(#task-due) {
  position: relative;
}
#task-editor-modal .task-field:has(#task-due) #task-due {
  padding-left: 41px;
  min-width: 0;
}
#task-editor-modal .task-field:has(#task-due)::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 37px;
  width: 17px;
  height: 17px;
  pointer-events: none;
  background: center / 17px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230b7ff0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M7 3v4M17 3v4M3 10h18'/%3E%3C/svg%3E");
}
#task-editor-modal .task-choice-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 17px;
  padding: 0;
  border: 0;
}
#task-editor-modal .task-choice-group legend {
  width: 100%;
  margin: 0 0 7px;
  font-size: 12.5px;
  font-weight: 590;
  color: #405776;
}
#task-editor-modal .task-choice-group label {
  display: inline-flex;
  flex: 1 1 200px;
  align-items: center;
  gap: 11px;
  min-width: 0;
  min-height: 60px;
  padding: 12px 14px;
  border: 1px solid #dce6f2;
  border-radius: 12px;
  background: #fbfdff;
  cursor: pointer;
  transition: border-color .16s,background-color .16s,box-shadow .16s;
}
#task-editor-modal .task-choice-group label:has(input:checked) {
  background: #edf5ff;
  border-color: #7eadeb;
  box-shadow: inset 0 0 0 1px rgba(11,127,240,.08);
}
#task-editor-modal .task-choice-group label:is(:hover,:focus-within) {
  border-color: #a1c2ed;
  background: #f5faff;
}
#task-editor-modal .task-choice-group input[type="radio"] {
  flex: 0 0 18px;
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--task-studio-blue);
}
#task-editor-modal .task-choice-group label > span {
  color: #234269;
  font-size: 12.5px;
  font-weight: 620;
  line-height: 1.4;
}
#task-editor-modal .task-choice-group label:has(input:checked) > span {
  color: var(--task-studio-navy);
}
/* Native controls remain wired to the existing client lookup / 100-item checklist. */
#task-editor-modal .task-client-search-control {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
  width: 100%;
}
#task-editor-modal #task-client-find,
#task-editor-modal #task-initial-microtask-add {
  flex: none;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid #c7dcf5;
  border-radius: 10px;
  background: #edf5ff;
  color: #1759a4;
  font-size: 12.5px;
  font-weight: 620;
  transition: border-color .16s,background .16s;
}
#task-editor-modal #task-client-find:hover:not(:disabled),
#task-editor-modal #task-initial-microtask-add:hover:not(:disabled) {
  border-color: #8db8ee;
  background: #e3f0ff;
}
#task-editor-modal .task-client-results {
  display: grid;
  gap: 7px;
  max-height: 240px;
  overflow: auto;
  margin: 12px 0 0;
  scrollbar-width: thin;
}
#task-editor-modal .task-client-result {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #dce7f4;
  border-radius: 9px;
  background: #fff;
  color: #263d60;
  font-size: 12.5px;
}
#task-editor-modal .task-client-result:is(:hover,[aria-selected="true"],:focus-visible) {
  border-color: #9bc1ee;
  background: #f0f7ff;
}
#task-editor-modal .task-client-selection {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 14px 0 0;
  padding: 12px 13px;
  border: 1px solid #e0ebf6;
  border-radius: 10px;
  background: #f7faff;
  color: #70829b;
  font-size: 12.5px;
}
#task-editor-modal .task-client-selection strong {
  color: var(--task-studio-navy);
  font-weight: 660;
}
#task-editor-modal #task-client-remove {
  margin-left: auto;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 11.5px;
}
#task-editor-modal #task-initial-microtasks-count {
  display: inline-flex;
  align-items: center;
  margin-left: 0;
  padding: 5px 8px;
  border: 1px solid #d2e7e3;
  border-radius: 7px;
  background: #eff9f5;
  color: #197762;
  font-size: 10.5px;
  font-weight: 660;
}
#task-editor-modal .task-initial-microtasks {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
#task-editor-modal .task-initial-microtask {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid #e2eaf3;
  border-radius: 10px;
  background: #f9fbfe;
}
#task-editor-modal .task-initial-microtask input {
  min-width: 0;
  min-height: 40px;
  background: #fff;
  font-size: 12.5px;
}
#task-editor-modal .task-initial-microtask__actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
}
#task-editor-modal .task-initial-microtask__actions button {
  min-width: 36px;
  min-height: 36px;
  padding: 6px 9px;
  border-radius: 9px;
}
#task-editor-modal .task-empty-copy {
  margin: 10px 0;
  color: #8293a9;
  font-size: 12px;
}
#task-editor-modal .task-microtask-composer {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
}
#task-editor-modal #task-initial-microtask-text {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid #dce5f1;
  border-radius: 10px;
  background: #fff;
  color: #263d60;
  font-size: 13px;
}
#task-editor-modal #task-initial-microtask-text:focus-visible {
  outline: 0;
  border-color: var(--task-studio-blue);
  box-shadow: 0 0 0 3px rgba(11,127,240,.13);
}
#task-editor-modal #task-form-state.task-form__state {
  flex: 0 0 auto;
  align-self: stretch;
  margin: 0;
  padding: 11px 23px;
  border-radius: 0;
  background: #fff8f6;
  border-top: 1px solid #f1dad7;
  color: #aa403d;
  font-size: 12px;
  line-height: 1.5;
}
#task-editor-modal #task-form-state:empty {
  display: none;
}
#task-editor-modal .task-modal__footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 9px;
  min-height: 67px;
  margin: 0;
  padding: 12px 23px;
  border-top: 1px solid #dde7f4;
  background: #fff;
  box-shadow: 0 -6px 22px rgba(14,33,102,.045);
}
#task-editor-modal .task-studio__footer-help {
  margin-right: auto;
  color: #8193aa;
  font-size: 11.5px;
  line-height: 1.4;
}
#task-editor-modal #task-cancel,
#task-editor-modal #task-save {
  flex: 0 0 auto;
  min-width: 120px;
  min-height: 41px;
  padding: 10px 14px;
  border-radius: 9px;
  font: 610 12.5px/1.2 var(--sfera-font-family,"Schibsted Grotesk",Arial,sans-serif);
  transition: background .16s,border-color .16s,box-shadow .16s;
}
#task-editor-modal #task-cancel {
  border: 1px solid #dce5ef;
  background: #fff;
  color: #60718b;
}
#task-editor-modal #task-cancel:hover:not(:disabled) {
  background: #f5f8fc;
  border-color: #bdcee5;
}
#task-editor-modal #task-save {
  border: 1px solid var(--task-studio-navy);
  background: var(--task-studio-navy);
  color: #fff;
}
#task-editor-modal #task-save:hover:not(:disabled) {
  border-color: #1a3c91;
  background: #1a3c91;
  box-shadow: 0 4px 13px rgba(14,33,102,.13);
}
#task-editor-modal #task-save:disabled {
  opacity: .52;
  background: #0e2166;
  color: #fff;
}
#task-editor-modal :is(button,input,select,textarea):focus-visible {
  outline-offset: 2px;
}
@media (max-width: 900px) {
  #task-editor-modal #task-form.task-editor-dialog {
    width: min(800px,100%);
  }
  #task-editor-modal .task-form-meta {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}
@media (max-width: 760px) {
  #task-editor-modal.task-modal {
    padding: 0;
  }
  #task-editor-modal #task-form.task-editor-dialog {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  #task-editor-modal .task-modal__header {
    min-height: 74px;
    padding: 15px 17px 14px;
  }
  #task-editor-modal #task-form-title {
    font-size: 20px;
  }
  #task-editor-modal #task-form-intro {
    font-size: 11.5px;
    line-height: 1.35;
  }
  #task-editor-modal .task-studio__hero-icon {
    flex-basis: 39px;
    width: 39px;
    height: 39px;
  }
  #task-editor-modal .task-form-fields {
    padding: 15px 13px 20px;
  }
  #task-editor-modal .task-form-section {
    padding: 16px 15px;
  }
  #task-editor-modal .task-form-section h3 {
    font-size: 14px;
  }
  #task-editor-modal .task-form-grid {
    grid-template-columns: minmax(0,1fr);
    gap: 13px;
  }
  #task-editor-modal .task-field--wide,
  #task-editor-modal .task-field--full {
    grid-column: 1;
  }
  #task-editor-modal .task-form-meta {
    gap: 7px;
    padding: 9px 13px;
  }
  #task-editor-modal .task-modal__footer {
    padding: 11px 13px max(11px,env(safe-area-inset-bottom));
  }
  #task-editor-modal .task-studio__footer-help {
    display: none;
  }
  #task-editor-modal .task-modal__footer button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
  }
}
@media (max-width: 430px) {
  #task-editor-modal .task-modal__header {
    gap: 10px;
  }
  #task-editor-modal .task-studio-section__icon {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }
  #task-editor-modal .task-form-section__accent {
    margin-left: 45px;
  }
  #task-editor-modal .task-microtask-composer {
    grid-template-columns: 1fr;
  }
  #task-editor-modal #task-initial-microtask-add {
    width: 100%;
  }
  #task-editor-modal .task-client-search-control {
    grid-template-columns: minmax(0,1fr);
  }
  #task-editor-modal #task-client-find {
    width: 100%;
  }
  #task-editor-modal .task-modal__footer {
    gap: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #task-editor-modal *,
  #task-editor-modal *::before,
  #task-editor-modal *::after {
    transition: none!important;
    animation: none!important;
    scroll-behavior: auto!important;
  }
}