/* Tasks board, cards and dialogs share the platform's semantic theme tokens. */
:root:not([data-theme="light"]):has(#appShell:not(.hidden) #tasksSection.active:not(.is-calendar)) {
  --workspace-bg:#0b1421;--sidebar-bg:#0c1b2d;--topbar-bg:#101e30;
  --panel-bg:#111f31;--panel-strong-bg:#182a40;--panel-border:#26384d;
  --primary-text:#eef3f9;--secondary-text:#9eafc3;--accent-gold:#d0ae62;
  --accent-blue:#66a0df;--accent-emerald:#52c49b;--danger:#ef7f86;
  --field-bg:#0c1b2d;--tk-hover:#1c3047;
}
#tasksSection {
  --tk-blue: var(--accent-blue);
  --tk-cyan: #66b5d9;
  --tk-amber: #d7a84c;
  --tk-green: var(--accent-emerald);
}
:root[data-theme="light"] #tasksSection { --tk-cyan:#237e9f;--tk-amber:#946910;--tk-hover:#eef3f8; }
#tasksSection:not(.is-calendar) .tasks-section-head { display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 0 4px; }
#tasksSection:not(.is-calendar) .tasks-section-head h2 { margin:0;font-size:28px;font-weight:650;letter-spacing:-.6px; }
#tasksSection:not(.is-calendar) .tasks-section-head p { margin:6px 0 0;font-size:14px;color:var(--secondary-text); }
#tasksSection:not(.is-calendar) .tasks-view-switch { display:flex;flex-wrap:nowrap;gap:0;border:1px solid var(--panel-border);padding:3px;border-radius:10px; }
#tasksSection:not(.is-calendar) .tasks-view-switch .tab-btn { border:0;border-radius:7px;min-height:38px;padding:8px 16px;background:transparent;color:var(--secondary-text);font-size:14px; }
#tasksSection:not(.is-calendar) .tasks-view-switch .tab-btn.active { background:var(--accent-gold);color:#101e30; }
#tasksSection :is(.tk-board,.tk-toolbar,.tk-dialog) *, #tasksSection :is(.tk-board,.tk-toolbar,.tk-dialog) { box-sizing:border-box;min-width:0; }
#tasksSection [class*="tk-"] svg { width:20px;height:20px;flex-shrink:0;display:block; }
#tasksSection .tk-sr-only { position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap; }
#tasksSection :is(.tk-button,.tk-link,.tk-drag-handle,.tk-menu button,.tk-mobile-tabs button) { font:inherit;cursor:pointer;transition:background-color .15s,border-color .15s;box-shadow:none;transform:none; }
#tasksSection .tk-button { display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:44px;padding:10px 16px;border-radius:9px;border:1px solid var(--panel-border);background:transparent;color:var(--primary-text);font-size:14px;font-weight:500; }
#tasksSection .tk-primary { background:var(--accent-gold);border-color:var(--accent-gold);color:#101e30;font-weight:600; }
#tasksSection .tk-icon-button { width:36px;min-height:36px;padding:7px;flex-shrink:0;border:0; }
#tasksSection .tk-link { display:inline-flex;align-items:center;gap:8px;background:transparent;border:0;border-radius:6px;color:var(--accent-gold);font-size:13px;font-weight:500;padding:6px 0;min-height:32px; }
#tasksSection :is(.tk-button,.tk-link,.tk-drag-handle,.tk-menu button,.tk-mobile-tabs button):hover:not(:disabled) { background:var(--panel-strong-bg); }
#tasksSection .tk-primary:hover:not(:disabled) { background:color-mix(in srgb,var(--accent-gold) 86%,white); }
#tasksSection :is(.tk-button,.tk-link,.tk-drag-handle,.tk-menu button,.tk-mobile-tabs button,input,select,textarea):focus-visible { outline:2px solid var(--accent-blue);outline-offset:3px; }
#tasksSection :is(.tk-button,.tk-link,.tk-drag-handle):disabled { opacity:.65;cursor:wait; }
#tasksSection .tk-toolbar { display:flex;gap:12px;align-items:center; }
#tasksSection .tk-search { flex:1;display:flex;align-items:center;gap:10px;border:1px solid var(--panel-border);border-radius:9px;padding:0 12px;background:var(--field-bg);color:var(--secondary-text); }
#tasksSection .tk-search input { width:100%;padding:11px 0;border:0;background:transparent;color:var(--primary-text);font-size:14px;min-height:44px; }
#tasksSection .tk-search:focus-within { outline:2px solid var(--accent-blue);outline-offset:2px; }
#tasksSection .tk-search input:focus { outline:0;box-shadow:none; }
#tasksSection .tk-filter-controls { display:grid;grid-template-columns:repeat(3,minmax(120px,1fr)) minmax(158px,1.2fr);gap:12px;flex:1.8; }
#tasksSection .tk-filter-controls label { display:block; }
#tasksSection .tk-filter-controls select { width:100%;min-height:44px;border:1px solid var(--panel-border);background:var(--field-bg);color:var(--primary-text);border-radius:9px;font:inherit;font-size:13px;padding:10px 28px 10px 12px; }
#tasksSection :is(.tk-mobile-filters,.tk-mobile-tabs) { display:none; }
#tasksSection .tk-filter-summary { display:flex;flex-wrap:wrap;align-items:center;gap:12px;font-size:12px;color:var(--secondary-text);min-height:18px; }
#tasksSection .tk-filter-summary .tk-link { min-height:18px;padding:0;font-size:12px; }
#tasksSection .tk-feedback { display:flex;gap:12px;align-items:center;color:var(--secondary-text);font-size:14px; }
#tasksSection .tk-board { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;align-items:stretch; }
#tasksSection .tk-column { background:var(--panel-bg);border:1px solid var(--panel-border);border-radius:13px;display:flex;flex-direction:column;color:var(--primary-text); }
#tasksSection .tk-todo { --tk-status:var(--tk-blue); }
#tasksSection .tk-progress { --tk-status:var(--tk-cyan); }
#tasksSection .tk-hold { --tk-status:var(--tk-amber); }
#tasksSection .tk-done { --tk-status:var(--tk-green); }
#tasksSection .tk-column-head { display:flex;align-items:center;gap:10px;justify-content:space-between;padding:14px;border-bottom:1px solid var(--panel-border); }
#tasksSection .tk-column-head h3 { display:flex;align-items:center;gap:10px;font-size:15px;font-weight:600;margin:0; }
#tasksSection .tk-status-dot { display:block;width:12px;height:12px;border-radius:50%;background:var(--tk-status);flex-shrink:0; }
#tasksSection .tk-count { min-width:30px;padding:4px 7px;text-align:center;border-radius:7px;background:var(--panel-strong-bg);font-size:15px;font-weight:600;font-variant-numeric:tabular-nums; }
#tasksSection .tk-column-body { padding:12px;display:flex;flex-direction:column;gap:12px;flex:1;min-height:390px;max-height:max(440px,calc(100dvh - 290px));overflow-y:auto;scrollbar-width:thin;border-radius:0 0 12px 12px; }
#tasksSection .tk-drop-target { background:color-mix(in srgb,var(--accent-blue) 10%,var(--panel-bg));outline:2px solid var(--accent-blue);outline-offset:-3px; }
#tasksSection .tk-card { position:relative;flex-shrink:0;padding:15px;background:var(--panel-strong-bg);border:1px solid var(--panel-border);border-radius:12px;color:var(--primary-text);overflow-wrap:anywhere; }
#tasksSection .tk-card:hover { background:var(--tk-hover,var(--panel-strong-bg)); }
#tasksSection .tk-card:focus-within { border-color:var(--accent-blue); }
#tasksSection .tk-card-top { display:flex;align-items:center;gap:5px;flex-wrap:wrap;margin-bottom:10px; }
#tasksSection .tk-priority { padding:4px 7px;display:inline-flex;align-items:center;min-height:24px;border-radius:6px;font-size:11px;font-weight:600; }
#tasksSection :is(.tk-priority-medium,.tk-priority-high) { color:var(--accent-gold);background:color-mix(in srgb,var(--accent-gold) 14%,transparent); }
#tasksSection .tk-priority-low { color:var(--accent-emerald);background:color-mix(in srgb,var(--accent-emerald) 12%,transparent); }
#tasksSection .tk-priority-urgent { color:var(--danger);background:color-mix(in srgb,var(--danger) 12%,transparent); }
#tasksSection .tk-status { margin-left:auto;font-size:11px;padding:4px 6px;border-radius:6px;color:var(--tk-status);background:color-mix(in srgb,var(--tk-status) 12%,transparent); }
#tasksSection .tk-drag-handle { border:0;background:transparent;color:var(--secondary-text);padding:4px;width:26px;min-height:32px;border-radius:6px;cursor:grab;-webkit-user-drag:element;user-select:none; }
#tasksSection .tk-drag-handle svg { pointer-events:none; }
#tasksSection .tk-dragging { opacity:.5; }
#tasksSection .tk-card h3 { margin:0 0 6px;font-size:16px;font-weight:600;line-height:1.4; }
#tasksSection .tk-description { margin:0 0 16px;font-size:13px;color:var(--secondary-text);line-height:1.5;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;white-space:pre-wrap; }
#tasksSection .tk-dates { display:grid;grid-template-columns:1fr 1fr;gap:10px;padding-bottom:14px;margin-bottom:14px;border-bottom:1px solid var(--panel-border);font-size:12px;line-height:1.5; }
#tasksSection .tk-dates > div { display:flex;gap:7px;align-items:flex-start; }
#tasksSection .tk-dates svg { width:17px;height:17px;color:var(--secondary-text); }
#tasksSection .tk-dates > div + div { border-left:1px solid var(--panel-border);padding-left:10px; }
#tasksSection :is(.tk-dates,.tk-person) small { display:block;font-size:11px;color:var(--secondary-text);margin-bottom:4px; }
#tasksSection .tk-dates strong { display:block;color:var(--accent-gold);font-size:11px;margin-top:4px;font-weight:500; }
#tasksSection .tk-dates .tk-overdue strong { color:var(--danger); }
#tasksSection .tk-person { display:flex;gap:10px;align-items:center;margin-bottom:12px;font-size:12px;line-height:1.4; }
#tasksSection .tk-person > svg { width:30px;color:var(--secondary-text); }
#tasksSection .tk-avatar { width:30px;height:30px;border:1px solid var(--panel-border);border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:color-mix(in srgb,var(--accent-blue) 12%,transparent);color:var(--primary-text);font-size:11px; }
#tasksSection .tk-open { display:flex;margin-left:auto; }
#tasksSection .tk-menu-wrap { position:relative; }
#tasksSection .tk-menu { position:absolute;z-index:5;top:calc(100% + 4px);right:0;width:160px;padding:5px;background:var(--panel-bg);border:1px solid var(--panel-border);border-radius:9px;box-shadow:0 8px 24px #0002; }
#tasksSection .tk-menu button { display:block;width:100%;text-align:left;border:0;border-radius:5px;color:var(--primary-text);background:transparent;padding:10px;font-size:13px;min-height:36px; }
#tasksSection .tk-menu .tk-danger { color:var(--danger); }
#tasksSection .tk-empty { padding:72px 4px 28px;display:flex;flex-direction:column;align-items:center;text-align:center; }
#tasksSection .tk-empty > svg { width:36px;height:36px;color:var(--secondary-text);margin-bottom:14px; }
#tasksSection .tk-empty h4 { margin:0 0 8px;font-size:14px;font-weight:600; }
#tasksSection .tk-empty p { margin:0 0 14px;line-height:1.5;color:var(--secondary-text);font-size:12px; }
#tasksSection .tk-empty-note { color:var(--secondary-text);font-size:13px; }
#tasksSection .tk-skeleton { display:grid;gap:12px;padding:16px; }
#tasksSection .tk-skeleton span { height:18px;background:var(--panel-strong-bg);border-radius:5px; }
#tasksSection .tk-skeleton span:last-child { width:65%; }
body.tasks-modal-open { overflow:hidden; }
#tasksSection .tk-dialog { color:var(--primary-text);background:var(--panel-bg);border:1px solid var(--panel-border);border-radius:14px;padding:20px;width:min(480px,calc(100% - 32px));max-height:calc(100vh - 32px);max-height:calc(var(--tk-viewport-height,100dvh) - 32px);overflow:auto; }
#tasksSection .tk-dialog::backdrop { background:rgb(3 10 20 / .65); }
#tasksSection .tk-drawer { position:fixed;inset:0 0 0 auto;margin:0;width:min(480px,100%);height:100vh;height:var(--tk-viewport-height,100dvh);max-height:none;border-radius:14px 0 0 14px; }
#tasksSection .tk-dialog-head { display:flex;align-items:center;justify-content:space-between;gap:16px;position:sticky;top:-20px;z-index:6;background:var(--panel-bg);padding:12px 0;border-bottom:1px solid var(--panel-border);margin-bottom:20px; }
#tasksSection .tk-dialog-head h2 { font-size:21px;font-weight:600;margin:0;overflow-wrap:anywhere; }
#tasksSection .tk-form { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px; }
#tasksSection .tk-wide { grid-column:1/-1; }
#tasksSection .tk-form label { display:block;font-size:13px;font-weight:500;color:var(--primary-text); }
#tasksSection .tk-form :is(input,select,textarea) { display:block;width:100%;min-height:44px;margin-top:8px;border:1px solid var(--field-border);border-radius:8px;padding:10px;background:var(--field-bg);color:var(--field-text);font:inherit;font-size:16px; }
#tasksSection .tk-form textarea { resize:vertical;min-height:100px; }
#tasksSection .tk-form input[readonly] { color:var(--secondary-text); }
#tasksSection :is(.tk-filter-controls,.tk-form) select {
  appearance:none;
  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='%23788ca3' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 10px center;padding-right:32px;
}
#tasksSection .tk-form [aria-invalid="true"] { border-color:var(--danger); }
#tasksSection .tk-muted { color:var(--secondary-text);font-weight:400; }
#tasksSection .tk-error { margin:0;color:var(--danger);font-size:13px;line-height:1.5; }
#tasksSection .tk-error:empty { display:none; }
#tasksSection .tk-form-actions { display:flex;flex-wrap:wrap;justify-content:flex-end;gap:12px;padding-top:6px; }
#tasksSection .tk-detail-tools { display:flex;align-items:center;gap:12px;font-size:13px; }
#tasksSection .tk-detail-tools .tk-menu-wrap { margin-left:auto; }
#tasksSection .tk-detail-description { white-space:pre-wrap;overflow-wrap:anywhere;font-size:15px;line-height:1.7;margin:24px 0; }
#tasksSection .tk-detail-fields { display:grid;grid-template-columns:auto minmax(0,1fr);gap:14px 20px;font-size:14px; }
#tasksSection .tk-detail-fields dt { color:var(--secondary-text); }
#tasksSection .tk-detail-fields dd { margin:0;overflow-wrap:anywhere; }
@media (max-width:1319px) and (min-width:768px) {
  #tasksSection .tk-board { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #tasksSection .tk-toolbar { flex-wrap:wrap; }
  #tasksSection .tk-search { flex-basis:100%; }
  #tasksSection .tk-filter-controls { flex-basis:100%; }
  #tasksSection .tk-column-body { min-height:300px;max-height:600px; }
  #tasksSection .tk-empty { padding-top:48px; }
}
@media (max-width:767px) {
  #tasksSection:not(.is-calendar) .tasks-section-head { flex-direction:column;align-items:stretch;gap:16px; }
  #tasksSection:not(.is-calendar) .tasks-section-head h2 { font-size:26px; }
  #tasksSection:not(.is-calendar) .tasks-page-actions { flex-direction:column;align-items:stretch;gap:10px; }
  #tasksSection:not(.is-calendar) .tasks-view-switch { align-self:flex-start; }
  #tasksSection:not(.is-calendar) .tasks-view-switch .tab-btn { min-height:44px;padding:8px 12px; }
  #tasksSection .tk-toolbar { flex-wrap:wrap;gap:8px; }
  #tasksSection .tk-search { flex-basis:100%; }
  #tasksSection .tk-search input { font-size:16px; }
  #tasksSection .tk-mobile-filters { display:inline-flex; }
  #tasksSection .tk-mobile-tabs { display:flex;gap:6px;overflow-x:auto;scrollbar-width:thin;padding:4px 2px; }
  #tasksSection .tk-mobile-tabs button { display:flex;align-items:center;justify-content:center;gap:6px;flex-shrink:0;min-height:44px;padding:10px;border:1px solid var(--panel-border);border-radius:8px;color:var(--secondary-text);background:var(--panel-bg);font-size:13px; }
  #tasksSection .tk-mobile-tabs button[aria-selected="true"] { background:var(--panel-strong-bg);color:var(--accent-gold);border-color:var(--accent-gold); }
  #tasksSection .tk-board { grid-template-columns:minmax(0,1fr); }
  #tasksSection .tk-column { display:none; }
  #tasksSection .tk-column.tk-mobile-active { display:flex; }
  #tasksSection .tk-column-body { min-height:0;max-height:none;overflow:visible;padding:12px; }
  #tasksSection .tk-empty { padding:28px 12px; }
  #tasksSection .tk-card { padding:14px; }
  #tasksSection .tk-card h3 { font-size:17px; }
  #tasksSection .tk-description { display:block;font-size:14px; }
  #tasksSection .tk-dates { font-size:12px; }
  #tasksSection .tk-person { font-size:13px; }
  #tasksSection :is(.tk-button,.tk-icon-button,.tk-link,.tk-menu button) { min-height:44px; }
  #tasksSection .tk-icon-button { width:44px; }
  #tasksSection .tk-drag-handle { display:none; }
  #tasksSection .tk-status { font-size:11px; }
  #tasksSection .tk-filter-summary .tk-link { min-height:44px; }
  #tasksSection .tk-dialog { top:var(--tk-viewport-top,0);max-width:100%; }
  #tasksSection .tk-drawer { width:100%;border:0;border-radius:0;padding:env(safe-area-inset-top,0) max(16px,env(safe-area-inset-right,0)) max(24px,env(safe-area-inset-bottom,0)) max(16px,env(safe-area-inset-left,0)); }
  #tasksSection .tk-dialog-head { top:calc(-1 * env(safe-area-inset-top,0));padding:12px 0; }
  #tasksSection .tk-form { gap:16px; }
  #tasksSection .tk-form-actions { padding-bottom:8px; }
  #tasksSection .tk-filter-controls { display:grid;grid-template-columns:minmax(0,1fr);gap:16px;grid-column:1/-1; }
  #tasksSection .tk-filter-controls .tk-sr-only { position:static;width:auto;height:auto;clip-path:none;display:block;white-space:normal;font-size:13px;color:var(--secondary-text); }
  #tasksSection .tk-filter-controls select { font-size:16px; }
  #tasksSection #taskFiltersDialog > .tk-form-actions { margin-top:18px; }
}
@media (max-width:374px) {
  #tasksSection .tk-dates { grid-template-columns:minmax(0,1fr); }
  #tasksSection .tk-dates > div + div { border:0;padding:0; }
  #tasksSection .tk-form > label { grid-column:1/-1; }
}
@media (prefers-reduced-motion:reduce) {
  #tasksSection :is(.tk-button,.tk-link,.tk-drag-handle,.tk-menu button,.tk-mobile-tabs button) { transition:none; }
}
