/* Task workspace shares the shell's light/dark tokens. */
.tasks-workspace {
  font: 400 14px/1.5 var(--font);
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 48px;
  color: var(--ink);
  overflow: auto;
}
.tasks-heading,
.tasks-row,
.tasks-actions,
.task-modal header,
.task-modal footer {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tasks-heading {
  justify-content: space-between;
  margin-bottom: 30px;
}
.tasks-heading h1 {
  font-size: 24px;
  font-weight: 500;
}
.tasks-workspace button:not(.bui-root *),
.task-modal button,
.message-actions button {
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.task-button {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 9px;
  padding: 9px 14px;
  color: var(--ink);
}
.task-button:hover,
.tasks-row:hover,
.message-actions button:hover {
  background: var(--bg);
}
.task-primary {
  background: var(--ink) !important;
  color: var(--bg-elevated) !important;
  border: 0;
}
.tasks-banner {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
  font-size: 14px;
  line-height: 1.6;
}
.tasks-banner button {
  margin-left: auto;
}
.tasks-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.tasks-filters button {
  border: 0;
  border-radius: 20px;
  background: transparent;
  padding: 8px 13px;
  color: var(--text-secondary);
}
.tasks-filters button[aria-pressed="true"] {
  background: var(--bg);
  color: var(--ink);
}
.tasks-row {
  padding: 20px 12px;
  border-radius: 12px;
  margin-bottom: 5px;
  min-height: 84px;
}
.tasks-row-main {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  text-align: left;
  display: grid;
  gap: 7px;
}
.tasks-row-main strong {
  font-weight: 500;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.tasks-row small,
.task-muted {
  color: var(--text-secondary);
  font-size: 13px;
}
.task-status {
  font-size: 12px;
  border-radius: 20px;
  padding: 5px 9px;
  background: var(--bg);
  white-space: nowrap;
}
.tasks-row .tasks-actions {
  opacity: 0;
}
.tasks-row:hover .tasks-actions,
.tasks-row:focus-within .tasks-actions {
  opacity: 1;
}
.tasks-empty {
  padding: 75px 24px;
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.8;
}
.task-error {
  color: var(--danger);
  padding: 12px 0;
  font-size: 14px;
}
.task-modal {
  background: var(--bg-elevated);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 30px 36px;
  width: min(720px, calc(100vw - 32px));
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 80px #0004;
  margin: auto;
  font: 14px/1.6 var(--font);
}
.task-modal::backdrop {
  background: #0008;
  backdrop-filter: blur(3px);
}
.task-modal header {
  justify-content: space-between;
  margin-bottom: 26px;
}
.task-modal h2 {
  font-size: 18px;
  margin: 0;
}
.task-modal h3 {
  font-size: 14px;
  margin: 24px 0 12px;
}
.task-modal label {
  display: block;
}
.task-modal textarea,
.task-modal select,
.task-modal input:not([type="checkbox"]) {
  font: inherit;
  color: var(--ink);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px;
  max-width: 100%;
}
.task-modal textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  border: 0;
  background: transparent;
  outline-offset: -2px;
}
.task-fields {
  display: flex;
  gap: 14px;
  align-items: end;
  flex-wrap: wrap;
  margin: 18px 0;
}
.task-fields label {
  display: grid;
  gap: 6px;
}
.task-days {
  display: flex;
  gap: 7px;
  margin: 18px 0;
}
.task-days button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: transparent;
}
.task-days button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg-elevated);
}
.task-modal footer {
  justify-content: flex-end;
  margin-top: 30px;
}
.task-modal button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.task-modal :focus-visible,
.message-actions :focus-visible,
.tasks-workspace :focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
.task-drawer {
  margin: 0 0 0 auto;
  height: 100vh;
  max-height: 100vh;
  border-radius: 18px 0 0 18px;
  width: min(620px, 100vw);
}
.task-detail-prompt {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 16px 0;
}
.task-run-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 13px 0;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.task-result {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.task-timeline {
  padding-left: 20px;
  color: var(--text-secondary);
}
.task-approval {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 20px;
}
.task-approval pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.5 var(--font);
}
.message-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 12px;
  color: var(--text-secondary);
}
.message-actions button {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 5px;
}
.message-actions svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.msg.user .message-actions {
  justify-content: flex-end;
  opacity: 0;
}
.msg.user:hover .message-actions,
.msg.user:focus-within .message-actions {
  opacity: 1;
}
.message-actions button[aria-pressed="true"] {
  color: var(--brand);
  background: var(--bg);
}
.task-badge {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 5px;
}
.task-source-list a {
  display: block;
  overflow-wrap: anywhere;
  padding: 8px 0;
}
@media (max-width: 700px) {
  .tasks-workspace {
    padding: 22px 16px;
  }
  .tasks-row {
    flex-wrap: wrap;
    padding: 16px 4px;
  }
  .tasks-row .tasks-actions {
    opacity: 1;
  }
  .tasks-row-main {
    min-width: 60%;
  }
  .task-modal {
    padding: 22px;
  }
  .task-fields {
    gap: 8px;
  }
  .tasks-heading h1 {
    font-size: 24px;
  }
  .tasks-banner {
    padding: 14px;
  }
  .msg.user .message-actions {
    opacity: 1;
  }
  .task-days {
    gap: 4px;
  }
}
@media (hover: none) {
  .msg.user .message-actions,
  .tasks-row .tasks-actions {
    opacity: 1;
  }
}

#tasks-nav svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  width: 18px;
  height: 18px;
}
.tasks-filters button {
  flex-shrink: 0;
  white-space: nowrap;
}
.task-modal textarea {
  min-height: 80px;
}
.task-modal h3 {
  margin-top: 18px;
}

/* ── Hareket ──────────────────────────────────────────────────────────
 * Uygulamanın geri kalanıyla aynı dil: kısa, yumuşak, 8-10 px kayma
 * (cmdkPop, assistantMessageIn). Hepsi prefers-reduced-motion'da kapanır. */
.tasks-workspace [hidden],
.task-modal [hidden] {
  display: none !important;
}
.task-modal[open] {
  animation: task-pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.task-drawer[open] {
  animation: task-slide-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.task-modal[open]::backdrop {
  animation: task-fade 0.2s ease both;
}
.task-modal.is-closing {
  animation: task-pop-out 0.18s ease-in both;
}
.task-drawer.is-closing {
  animation: task-slide-out 0.2s ease-in both;
}
.task-modal.is-closing::backdrop {
  animation: task-fade-out 0.18s ease-in both;
}
.tasks-row,
.task-button,
.tasks-filters button,
.task-days button,
.task-run-row,
.message-actions button {
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease,
    opacity 0.16s ease;
}
.tasks-row .tasks-actions,
.msg.user .message-actions {
  transition: opacity 0.16s ease;
}
.task-button:active,
.task-days button:active,
.tasks-filters button:active {
  transform: scale(0.97);
}
.tasks-row.is-entering {
  animation: task-row-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
.tasks-row.is-highlight {
  animation:
    task-row-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both,
    task-highlight 1.6s ease 0.15s both;
}
.tasks-empty,
.task-fade-in,
.schedule-fields,
.task-days,
[data-month] {
  animation: task-row-in 0.26s ease both;
}

/* Durum rozeti: çalışan görev nabız atar, sonuçlar renklenir. */
.task-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}
.task-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}
.task-status[data-status="RUNNING"],
.task-status[data-status="QUEUED"] {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 11%, transparent);
}
.task-status[data-status="RUNNING"]::before,
.task-status[data-status="QUEUED"]::before {
  opacity: 1;
  animation: task-pulse 1.2s ease-in-out infinite;
}
.task-status[data-status="COMPLETED"] {
  color: var(--success, #15803d);
  background: color-mix(in srgb, var(--success, #15803d) 11%, transparent);
}
.task-status[data-status="FAILED"],
.task-status[data-status="AUTH_REQUIRED"],
.task-status[data-status="NEEDS_INPUT"] {
  color: var(--danger, #b91c1c);
  background: color-mix(in srgb, var(--danger, #b91c1c) 10%, transparent);
}
.task-status[data-status="NEEDS_APPROVAL"] {
  color: var(--warning, #b45309);
  background: color-mix(in srgb, var(--warning, #b45309) 12%, transparent);
}

/* Yükleme iskeleti */
.task-skeleton {
  display: grid;
  gap: 10px;
  padding: 4px 0;
}
.task-skeleton span,
.task-skeleton-pill {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--bg) 25%,
    color-mix(in srgb, var(--border) 75%, var(--bg)) 50%,
    var(--bg) 75%
  );
  background-size: 200% 100%;
  animation: task-shimmer 1.2s linear infinite;
}
.task-skeleton span:nth-child(1) {
  width: 42%;
  height: 15px;
}
.task-skeleton span:nth-child(2) {
  width: 68%;
}
.task-skeleton span:nth-child(3) {
  width: 55%;
}
.task-skeleton span:nth-child(4) {
  width: 78%;
}
.task-skeleton span:nth-child(5) {
  width: 36%;
}
.task-skeleton-row {
  pointer-events: none;
  animation: task-row-in 0.3s ease both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.task-skeleton-row .task-skeleton {
  flex: 1;
}
.task-skeleton-pill {
  width: 76px;
  height: 24px;
  border-radius: 20px;
}
.task-inline-loading {
  display: inline-block;
  margin-left: 6px;
  animation: task-breathe 1.4s ease-in-out infinite;
}

/* Meşgul düğme */
.task-button.is-busy {
  position: relative;
  padding-left: 34px;
}
.task-button.is-busy::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-top: -6.5px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: task-spin 0.7s linear infinite;
}
.task-modal button.is-busy:disabled,
.tasks-workspace button.is-busy:disabled {
  opacity: 1;
  cursor: progress;
}

@keyframes task-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes task-pop-out {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
}
@keyframes task-slide-in {
  from {
    opacity: 0;
    transform: translateX(36px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes task-slide-out {
  to {
    opacity: 0;
    transform: translateX(36px);
  }
}
@keyframes task-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes task-fade-out {
  to {
    opacity: 0;
  }
}
@keyframes task-row-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes task-highlight {
  0%,
  45% {
    background: color-mix(in srgb, var(--brand) 12%, transparent);
  }
  100% {
    background: transparent;
  }
}
@keyframes task-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.8);
    opacity: 0.35;
  }
}
@keyframes task-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
@keyframes task-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
@keyframes task-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .task-modal,
  .task-modal::backdrop,
  .tasks-row,
  .tasks-empty,
  .task-fade-in,
  .schedule-fields,
  .task-days,
  [data-month],
  .task-status::before,
  .task-skeleton span,
  .task-skeleton-pill,
  .task-inline-loading,
  .task-button.is-busy::before {
    animation: none !important;
  }
  .tasks-row,
  .task-button,
  .tasks-filters button,
  .task-days button,
  .task-run-row,
  .task-status,
  .message-actions button {
    transition: none !important;
  }
}

/* UX v4: consistent native controls and an accessible end-date action. */
.task-modal select, .task-modal input:not([type="checkbox"]):not([type="hidden"]) {
  box-sizing: border-box; height: 44px; min-height: 44px; margin-block: 0;
}
.task-fields { align-items: flex-end; }
.task-fields label { min-width: 0; }
.task-clear-date { width: 44px; height: 44px; padding: 10px; border-color: transparent; background: transparent; }
.task-clear-date svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.task-modal form > h3:first-child { margin-top: 0; }

/* Pencere genişliği iç boşluğu da kapsasın: 390 px ekranda sağ kenar ve kapat
   düğmesi 8 px dışarı taşıyordu. */
.task-modal {
  box-sizing: border-box;
}

/* Zamanlama: Copilot "Bir plan oluştur" dizilimi — etiket solda, alanlar aynı satırda. */
.task-schedule-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--ink);
}
.task-schedule-summary svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.task-row-field {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
}
.task-modal label.task-row-label,
.task-modal label.task-row-joiner {
  display: inline;
  white-space: nowrap;
}
.task-row-joiner {
  color: var(--text-secondary);
}
.task-row-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.task-row-controls input[type="date"] {
  width: 172px;
}
/* UX v14: tarih bileşeni sarmalayıcısı tam genişliğe yayılıp saati ve silme
   düğmesini alt satıra itiyordu; tarih yerli kutu genişliğinde kalır. */
.task-row-controls .tarih-tr {
  width: 172px;
  flex: 0 0 172px;
}
.task-row-controls .tarih-tr input[type="text"] {
  width: 100%;
}
.task-row-controls input[type="time"] {
  width: 124px;
}
.task-row-controls select {
  width: auto;
  min-width: 132px;
}
.task-row-controls .task-days {
  margin: 0;
  gap: 8px;
}
/* Seçili olmayan gün: --border koyu zeminde (0.308 / 0.26) neredeyse görünmüyordu; diğer
   zamanlama kontrolleriyle aynı --line-strong jetonu, açık/koyu ikisinde de okunur. */
.task-row-controls .task-days button {
  border: 1px solid var(--line-strong);
}
.task-row-controls .task-days button[aria-pressed="true"] {
  border-color: var(--ink);
}
.task-monthday {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}
.task-monthday input {
  width: 72px;
}
@media (max-width: 560px) {
  .task-row-field {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .task-row-controls .task-days {
    gap: 4px;
  }
}

/* ── Yeni görev: İstem = tek kontrol (shadcn InputGroup → InputGroupTextarea +
 * InputGroupAddon align="block-end"), 01.10.2026.
 * Kök neden: sarmalayıcı 18px'lik kendi çerçevesini çiziyor, içindeki textarea
 * genel .task-modal :focus-visible ile ikinci bir 2px çerçeve alıyor, ajan seçici
 * ise ayrı 44px'lik çerçeveli kutu olarak duruyordu (kutu içinde kutu).
 * Şimdi sınır ve odak YALNIZ sarmalayıcıda; textarea ve seçici onun parçası. */
.task-modal .task-prompt {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-elevated);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.task-modal .task-prompt:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-line);
}
.task-modal .task-prompt textarea {
  display: block;
  width: 100%;
  min-height: 100px;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: 0;
  line-height: 1.5;
  resize: vertical;
}
.task-modal .task-prompt textarea:focus-visible { outline: 0; }
.task-modal .task-prompt textarea::placeholder { color: var(--ink-3); }
.task-prompt-addon {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-top: 1px solid var(--line);
}
.task-modal .task-prompt-addon select {
  -webkit-appearance: none;
  appearance: none;
  height: 32px;
  min-height: 32px;
  width: auto;
  max-width: 100%;
  padding: 0 30px 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b919c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px 14px;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
}
.task-modal .task-prompt-addon select:hover { background-color: var(--hover); }
.task-modal .task-prompt-addon select:focus-visible { outline: 0; background-color: var(--hover); box-shadow: inset 0 0 0 1px var(--brand); }
.task-prompt-addon small { margin: 0; }

/* ── Yeni görev: zamanlama kontrolleri tek geometri (shadcn Field + Input/Select/
 * Date Picker). Hepsi 44px kalır; fark yerli select/saat görünümünden, soluk
 * --border'dan ve kontrolden 3px uzağa çizilen odak çerçevesinden geliyordu. */
.task-modal .schedule-fields :is(select, input[type="time"], input[type="number"], .tarih-tr > input[type="text"]) {
  -webkit-appearance: none;
  appearance: none;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background-color: var(--bg-elevated);
  color: var(--ink);
  line-height: normal;
  text-align: left;
  box-shadow: none;
  transition: border-color .15s, box-shadow .15s;
}
.task-modal .schedule-fields .tarih-tr > input[type="text"] { padding-right: 40px; }
.task-modal .schedule-fields .tarih-tr .tarih-tr-takvim { right: 8px; color: var(--ink-3); }
.task-modal .schedule-fields select {
  padding-right: 34px;
  background: var(--bg-elevated) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b919c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px 14px;
  cursor: pointer;
}
.task-modal .schedule-fields input[type="time"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
.task-modal .schedule-fields :is(select, input[type="time"], input[type="number"], .tarih-tr > input[type="text"]):hover { border-color: var(--ink-3); }
.task-modal .schedule-fields :is(select, input[type="time"], input[type="number"], .tarih-tr > input[type="text"]):focus-visible {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-line);
}
[data-theme="dark"] .task-modal :is(.task-prompt-addon, .schedule-fields) select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a9b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
[data-theme="dark"] .task-modal .schedule-fields input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1); }
