/* ===== Core UI ===== */

.pill{padding:8px 12px; border:1px solid var(--border); border-radius:999px; background:linear-gradient(180deg,var(--surface-2),var(--surface)); color:var(--text-2); cursor:pointer; font-weight:600}
.pill.danger { background:#d93b3b; color:#fff; }
.pill.danger:hover { filter:brightness(0.95); }
.pill.primary{
  background: var(--accent, var(--brand, #3a74ff));
  color: #fff;
  border-color: var(--accent, var(--brand, #3a74ff));
}
.pill.primary:hover{ filter: brightness(0.98); }

.card{background:linear-gradient(180deg,var(--surface),var(--surface-2)); border:1px solid var(--border); border-radius:14px; padding:14px; box-shadow:var(--shadow)}
.card h3{margin:0 0 8px; font-size:13px; text-transform:uppercase; letter-spacing:.08em; color:var(--text-2)}

.task-list{display:flex; flex-direction:column; gap:8px}

/* Task row -> proper grid to avoid overlaps: [chk] [prio] [title] [due] [actions] */
.task-row{
  display:grid;
  grid-template-columns: auto auto 1fr auto auto;
  align-items:center;
  column-gap:10px;

  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:linear-gradient(180deg,var(--surface-2),var(--surface));
  border-left:4px solid var(--border);
}

/* Title (truncates gracefully) */
.task-title{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  background:none; border:0; padding:0;
  font-weight:600; color:var(--text); text-align:left;
}

/* Small metadata text */
.k{font-size:11px; color:var(--sub)}
.muted{color:var(--sub)}

.strip{display:flex; gap:10px; overflow:auto; padding-bottom:2px}
.chip{border:1px solid var(--border); border-radius:12px; padding:9px 12px; min-width:130px; background:linear-gradient(180deg,var(--surface-2),var(--surface))}

.toolbar{display:flex; gap:8px; align-items:center}
.input{height:var(--ctl-h); padding:8px 10px; border:1px solid var(--border); border-radius:12px; background:var(--surface); color:var(--text)}
.notes{width:100%; min-height:260px; background:var(--surface); color:var(--text); border:1px solid var(--border); border-radius:12px; padding:12px; resize:vertical}

/* ===== Full Calendar (Calendar tab) ===== */

.cal-header{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:12px;
}
.cal-title{ font-weight:600; font-size:1.1rem; }
.cal-nav{ display:flex; gap:8px; }

.cal-grid{
  display:grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap:8px;
}

.cal-dow{
  text-align:center;
  font-weight:600;
  opacity:.7;
  padding:6px 0;
}

/* day cells */
.cal-cell{
  position:relative;
  border:1px solid var(--border, var(--muted, #e5e9f2));
  background: var(--card, var(--surface, #fff));
  border-radius:10px;
  padding:8px;
  min-height:90px;
  transition: box-shadow .15s ease;
}
.cal-cell:hover{ box-shadow: 0 2px 10px rgba(0,0,0,.06); }

.cal-empty{ background:transparent; border:0; min-height:0; padding:0; }
.cal-day{ font-weight:600; margin-bottom:6px; opacity:.9; }

/* task indicators */
.cal-dots{ display:flex; gap:4px; flex-wrap:wrap; }
.cal-dots .dot{
  width:6px; height:6px; border-radius:50%;
  background: var(--accent, #3a74ff);
  opacity:.9;
}

/* numeric badge (shown only for 2+ tasks by JS) */
.cal-count{
  position:absolute; right:6px; bottom:6px;
  font-size:.72rem; line-height:1;
  padding:3px 6px; border-radius:999px;
  background: color-mix(in oklab, var(--accent, #3a74ff) 14%, transparent);
  color:inherit; opacity:.9;
}

/* subtle fill for days that have tasks */
.cal-has{ background: color-mix(in oklab, var(--accent, #3a74ff) 6%, transparent); }

.cal-tasks{
  display:flex; flex-direction:column; gap:2px; margin-top:4px; font-size:.75rem;
}
.cal-task{ padding:2px 4px; border-radius:4px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }

/* ===== Mini Calendar ===== */

.mini-cal{
  display:grid; grid-template-columns: repeat(7, 1fr); gap:6px;
}
.mini-cal .dow{ text-align:center; font-weight:600; opacity:.7; padding:4px 0; }
.mini-cal .cell{
  border:1px solid var(--border, var(--muted, #e5e9f2));
  border-radius:8px; padding:6px; min-height:48px;
  background: var(--card, var(--surface, #fff));
}
.mini-cal .d{ font-weight:600; margin-bottom:4px; }

/* Mini calendar dots use priority color */
.mini-cal .dots{ display:flex; flex-wrap:wrap; gap:3px; align-content:flex-start; max-height:calc(2 * 5px + 1 * 3px); overflow:hidden; }
.mini-cal .dot{ flex:0 0 5px; width:5px; height:5px; border-radius:50%; background:var(--pri); opacity:.9; }
.mini-cal .more-count{
  font-size:10px; line-height:1; padding:1px 4px; border-radius:6px;
  background: color-mix(in oklab, var(--text) 12%, transparent);
  color: var(--text); opacity:.75;
}
[data-theme="dark"] .mini-cal .more-count{ background: color-mix(in oklab, #fff 10%, transparent); opacity:.85; }

/* ===== Dark mode tweaks ===== */

body[data-theme="dark"] .cal-cell{ border-color: var(--border, #2a2f3a); background: var(--card, #111419); }
body[data-theme="dark"] .cal-dow{ opacity:.8; }

/* ===== Priority palette ===== */

.p-high   { --pri:#ff6b6b; }
.p-normal { --pri:#f6c343; }
.p-low    { --pri:#38d996; }
[data-theme="dark"] .p-high   { --pri:#ff8787; }
[data-theme="dark"] .p-normal { --pri:#ffd43b; }
[data-theme="dark"] .p-low    { --pri:#63e6be; }

.prio-dot{ width:10px; height:10px; border-radius:50%; background:var(--pri); box-shadow:0 0 0 2px color-mix(in oklab, var(--pri) 25%, transparent); }
.dot{ width:5px; height:5px; border-radius:50%; background:var(--pri); opacity:.9; }

/* Map row attribute to a priority color variable (so badges/rails use same hue) */
.task-row[data-priority="High"]   { --pri:#ff6b6b; }
.task-row[data-priority="Normal"] { --pri:#f6c343; }
.task-row[data-priority="Low"]    { --pri:#38d996; }
[data-theme="dark"] .task-row[data-priority="High"]   { --pri:#ff8787; }
[data-theme="dark"] .task-row[data-priority="Normal"] { --pri:#ffd43b; }
[data-theme="dark"] .task-row[data-priority="Low"]    { --pri:#63e6be; }

/* ===== Modal ===== */

.modal-root { position:fixed; inset:0; z-index:9999; }
.modal-backdrop{ position:absolute; inset:0; background: color-mix(in oklab, var(--bg,#000) 35%, transparent); backdrop-filter: blur(8px); }
.modal{
  position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
  width:min(680px, 92vw);
  background: var(--surface); color: var(--text);
  border:1px solid var(--border); border-radius:16px;
  box-shadow: var(--shadow, 0 12px 50px rgba(0,0,0,.25));
}
.modal-header, .modal-footer{ display:flex; align-items:center; gap:8px; padding:14px 16px; }
.modal-header{ border-bottom:1px solid var(--border); }
.modal-footer{ border-top:1px solid var(--border); }
.modal-footer .spacer{ flex:1; } /* Save/Cancel on the right when a spacer div is present */
.modal-body{ padding:14px 16px; display:flex; flex-direction:column; gap:12px; }
.fld .lbl{ display:block; font-size:12px; color:var(--sub); margin-bottom:6px; }
.inp{ width:100%; height:auto; padding:10px 12px; border:1px solid var(--border); border-radius:10px; background:var(--surface-2, var(--surface)); color:var(--text); }
.grid.two{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.icon.close{ background:transparent; border:0; font-size:18px; cursor:pointer; color:var(--sub); }

/* ===== Premium polish (safe, additive) ===== */

/* Motion (respects reduced motion) */
@media (prefers-reduced-motion:no-preference){
  .fade-slide-in{ animation: btFadeSlideIn .18s ease-out both; }
  @keyframes btFadeSlideIn{
    from{ opacity:0; transform: translateY(6px); }
    to  { opacity:1; transform: translateY(0); }
  }
  .task-row{
    transition: background-color .18s, box-shadow .18s, transform .18s;
  }
  .task-row:hover{
    background: color-mix(in oklab, var(--pri) 8%, transparent);
    box-shadow: 0 6px 18px color-mix(in oklab, var(--pri) 25%, transparent);
    transform: translateY(-1px);
  }
}

/* ===== Due badge — unified, priority-colored, today glow ===== */
.due-badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px; line-height:1.6; font-weight:600;
  border:none;
  background: var(--muted);
  color: var(--text-2);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
  white-space:nowrap;
}

/* Badge picks up the row's priority color */
.task-row .due-badge{
  background: var(--pri, var(--accent));
  color:#fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}

/* Overdue stays strong (explicit red) */
.due-badge.is-overdue{
  background:#ff6b6b;
  color:#fff;
}

/* Extra emphasis only when due today: subtle priority-colored glow */
.task-row.is-today .due-badge{
  box-shadow:
    0 0 0 2px color-mix(in oklab, var(--pri) 25%, transparent),
    0 2px 10px color-mix(in oklab, var(--pri) 35%, transparent);
}

/* Row: neutral by default (already has border-left) */
.task-row{ border-left:4px solid var(--border); }

/* When due today, use the priority color for the rail + light tint */
.task-row.is-today{
  position:relative;
  background: color-mix(in oklab, var(--pri) 10%, transparent);
  border-left-color: var(--pri);
}

/* ===== Calendar priority fill + today glow ===== */

/* Use same priority hues for calendar chips */
.cal-task.p-high, .cal-task.p-normal, .cal-task.p-low{
  background: var(--pri); color:#fff;
}

/* Glow only for tasks visible in today's cell */
.cal-cell.cal-today .cal-task{
  box-shadow: 0 0 10px color-mix(in oklab, var(--pri) 45%, transparent);
}

/* Optional: subtle outline on today's cell for quick scanning */
.cal-cell.cal-today{
  box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--accent, #3a74ff) 35%, transparent);
  border-radius:10px;
}

/* ===== Global icon base + row-action masks (shared across app) ===== */
/* Keep notes.css scoped (#view-notes .icon ...). This one is global for task rows, etc. */
.icon{
  inline-size:18px; block-size:18px; display:inline-block; background:currentColor;
  -webkit-mask: var(--icon) no-repeat center / contain;
          mask: var(--icon) no-repeat center / contain;
  vertical-align:-3px;
}
.i-check{ --icon: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><path d="m20 6-11 11-5-5"/></svg>'); }
.i-edit { --icon: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5Z"/></svg>'); }
.i-trash{ --icon: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6M14 11v6"/></svg>'); }

/* ===== Row actions: ALWAYS visible + ghost buttons + semantic hover ===== */
.row-actions{
  display:inline-flex; align-items:center; gap:10px;
  opacity:1;                 /* always visible */
  transform:none;            /* no slide-in */
  pointer-events:auto;       /* clickable */
  transition:opacity .18s ease, transform .18s ease;
}

/* Ensure no reveal-on-hover overrides */
.task-row:hover .row-actions,
.task-row:focus-within .row-actions{
  opacity:1; transform:none; pointer-events:auto;
}

/* Button base */
.row-actions .btn-ghost{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:34px; height:34px; border-radius:10px;
  background:transparent; border:1px solid transparent;
  font-weight:600;
  transition: background .18s, transform .18s, box-shadow .18s, border-color .18s;
}
.row-actions .label{ margin-inline-start:6px; opacity:.8; }

/* Variants */
.task-row .row-actions .act-complete{ color:#2e7d32; } /* green */
.task-row .row-actions .act-complete:hover{
  background:#e9f9e9;
  box-shadow:0 2px 6px rgba(46,125,50,.15);
}

.task-row .row-actions .act-edit{ color:#1976d2; }     /* blue */
.task-row .row-actions .act-edit:hover{
  background:#e6f0ff;
  box-shadow:0 2px 6px rgba(25,118,210,.15);
}

.task-row .row-actions .act-delete{ color:#c62828; }   /* red */
.task-row .row-actions .act-delete:hover{
  background:#ffe5e5;
  box-shadow:0 2px 6px rgba(198,40,40,.15);
}

/* ===== Next 7: priority-aware chips ===== */

/* Neutral shape already defined via .chip above */

/* Map priority for chips (same hues as rows/dots) */
.chip[data-priority="High"]   { --pri:#ff6b6b; }
.chip[data-priority="Normal"] { --pri:#f6c343; }
.chip[data-priority="Low"]    { --pri:#38d996; }
[data-theme="dark"] .chip[data-priority="High"]   { --pri:#ff8787; }
[data-theme="dark"] .chip[data-priority="Normal"] { --pri:#ffd43b; }
[data-theme="dark"] .chip[data-priority="Low"]    { --pri:#63e6be; }

/* Hover: tint with priority if present; otherwise remain neutral */
@media (prefers-reduced-motion:no-preference){
  .chip:hover{
    background:
      linear-gradient(
        180deg,
        color-mix(in oklab, var(--surface-2) 88%, var(--pri, transparent) 12%),
        color-mix(in oklab, var(--surface)   88%, var(--pri, transparent) 12%)
      );
    box-shadow: 0 6px 18px color-mix(in oklab, var(--pri, rgba(0,0,0,0)) 22%, transparent);
  }
}

/* Optional: emphasis ring if the chip is Today */
.chip.is-today{
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--pri, var(--accent)) 25%, transparent);
  border-radius:12px;
}

/* ===== Premium Quick Add (Create New Task) ===== */
/* Applies automatically if your inputs live in a .toolbar; 
   you can also wrap them in <div class="toolbar quick-add">…</div> */
.quick-add,
.toolbar:has(#qa-title){
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow, 0 8px 24px rgba(10,20,30,.08));
}

.quick-add:focus-within,
.toolbar:has(#qa-title):focus-within{
  box-shadow:
    0 8px 28px color-mix(in oklab, var(--accent, #3a74ff) 18%, transparent),
    var(--shadow, 0 8px 24px rgba(10,20,30,.08));
  outline: none;
}

/* Inputs — elevated, crisp */
#qa-title, #qa-due, #qa-priority{
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  height: var(--ctl-h, 38px);
  padding: 10px 12px;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.04);
}
#qa-title{
  flex: 1;
  font-weight: 600;
}
#qa-title::placeholder{ color: var(--sub); }

/* Control focus rings */
#qa-title:focus, #qa-due:focus, #qa-priority:focus{
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent, #3a74ff) 30%, transparent);
}

/* Add button — premium pill with icon */
#qa-add.pill{
  display:inline-flex; align-items:center; gap:8px;
  padding: 8px 14px; min-height: 38px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--accent, #3a74ff) 94%, #fff 6%),
    var(--accent, #3a74ff)
  );
  color:#fff;
  border-color: var(--accent, #3a74ff);
  box-shadow: 0 8px 18px color-mix(in oklab, var(--accent, #3a74ff) 30%, transparent);
  transition: transform .12s ease, box-shadow .18s ease, filter .12s ease;
}
#qa-add.pill::before{
  content:"";
  inline-size:18px; block-size:18px; background: currentColor;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><path d="M12 5v14M5 12h14"/></svg>') no-repeat center / contain;
          mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><path d="M12 5v14M5 12h14"/></svg>') no-repeat center / contain;
}
#qa-add.pill:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 22px color-mix(in oklab, var(--accent, #3a74ff) 38%, transparent);
  filter: brightness(1.02);
}
#qa-add.pill:active{
  transform: translateY(0);
  filter: brightness(0.98);
}
#qa-add[disabled]{ opacity: .55; cursor: not-allowed; filter: grayscale(.1); box-shadow: none; }

/* Compact responsive behavior */
@media (max-width: 640px){
  .quick-add,
  .toolbar:has(#qa-title){ flex-wrap: wrap; }
  #qa-title{ flex: 1 1 100%; }
}

/* Dark theme polish for Quick Add */
body[data-theme="dark"] #qa-title,
body[data-theme="dark"] #qa-due,
body[data-theme="dark"] #qa-priority{
  background: var(--surface-2, #161a21);
  border-color: var(--border, #2a2f3a);
}
body[data-theme="dark"] #qa-add.pill{
  box-shadow: 0 10px 22px color-mix(in oklab, var(--accent, #3a74ff) 40%, transparent);
}

/* Bell icon button reset (ensure transparent background) */
.icon-btn{
  background: transparent;    /* <-- fixes the black background */
  border: 0;
  line-height: 1;
  padding: 0 8px;             /* horizontal breathing room */
  font-size: 20px;
  cursor: pointer;
  color: inherit;             /* use current text color */
}
.icon-btn .ping{
  position:absolute; top:2px; right:2px;
  width:8px; height:8px; border-radius:999px;
  background:#ef4444; display:none;
}
.icon-btn.has-news .ping{ display:block; }

/* --- Trash: always show Restore/Purge --- */
#trashList .task-row.always-actions .row-actions {
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  pointer-events: auto !important;
  display: flex !important;        /* in case your default uses display:none */
  gap: 6px;
}

/* ===== Files (Dashboard drop zone) — scoped & on-brand ===== */
#dash-filedrop-root {
  /* no base changes; the <article.card> already matches your cards */
}

/* Drop area */
#dash-filedrop-root .fdrop-area,
#dash-filedrop-root .filedrop-area,
#dash-filedrop-root .dropzone{
  display:flex; align-items:center; justify-content:center; gap:10px;
  min-height:120px;
  padding:14px;
  border:1px dashed var(--border);
  border-radius:12px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease;
  text-align:center;
}
#dash-filedrop-root .fdrop-area:hover,
#dash-filedrop-root .filedrop-area:hover,
#dash-filedrop-root .dropzone:hover{
  box-shadow: var(--shadow, 0 6px 18px rgba(0,0,0,.08));
  transform: translateY(-1px);
}

/* Drag/focus state */
#dash-filedrop-root .is-dragover,
#dash-filedrop-root .fdrop-area:focus-within,
#dash-filedrop-root .filedrop-area:focus-within,
#dash-filedrop-root .dropzone:focus-within{
  outline: none;
  border-color: color-mix(in oklab, var(--accent, #3a74ff) 60%, var(--border));
  box-shadow:
    0 8px 28px color-mix(in oklab, var(--accent, #3a74ff) 18%, transparent),
    var(--shadow, 0 8px 24px rgba(10,20,30,.08));
  background:
    linear-gradient(
      180deg,
      color-mix(in oklab, var(--surface-2) 85%, var(--accent, #3a74ff) 15%),
      color-mix(in oklab, var(--surface)   90%, var(--accent, #3a74ff) 10%)
    );
}

/* Hint/label inside drop area */
#dash-filedrop-root .fdrop-hint{
  font-size:.95rem; line-height:1.35; color: var(--text);
}
#dash-filedrop-root .fdrop-hint .k{ font-weight:600; }

/* Optional icon circle (reuses your icon system colors) */
#dash-filedrop-root .fdrop-ico{
  inline-size:28px; block-size:28px; border-radius:50%;
  display:inline-grid; place-items:center;
  background: color-mix(in oklab, var(--accent, #3a74ff) 18%, transparent);
  color: var(--text);
  font-size:14px;
}

/* List of selected/dropped files */
#dash-filedrop-root .fdrop-list{
  margin-top:12px;
  display:grid; gap:8px;
}

/* File row — matches task row feel */
#dash-filedrop-root .fdrop-item{
  display:grid;
  grid-template-columns: 24px 1fr auto;
  align-items:center; gap:10px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
#dash-filedrop-root .fdrop-item .fdrop-name{
  min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;
  font-weight:600; color: var(--text);
}
#dash-filedrop-root .fdrop-item .fdrop-size{
  font-size:11px; color: var(--sub); margin-left:8px;
}
#dash-filedrop-root .fdrop-item .fdrop-actions{
  display:inline-flex; gap:6px;
}
#dash-filedrop-root .fdrop-item .btn-ghost{
  /* if your filedrop emits plain buttons, you can style like your row ghost buttons */
  display:inline-flex; alig

