/* ============================
   BUTTONS
============================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--r);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  border: none; white-space: nowrap; line-height: 1;
}
.btn-brand { background: var(--brand); color: #0e0f0a; }
.btn-brand:hover { background: var(--brand-dark); }
.btn-ghost {
  background: var(--surface-2); color: var(--text-sec);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text-primary); border-color: var(--border-h); }
.btn-danger { background: var(--red-dim); color: #f87171; border: 1px solid rgba(239,68,68,0.22); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-danger-ghost { color: var(--text-muted); }
.btn-danger-ghost:hover { color: #f87171; border-color: rgba(239,68,68,0.35); background: var(--red-dim); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: all 0.15s;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text-primary); border-color: var(--border-h); }
.btn-icon.danger:hover { background: var(--red-dim); color: #f87171; border-color: rgba(239,68,68,0.22); }

/* ============================
   FILTERS AND SEARCH
============================ */
.filter-bar {
  display: flex; align-items: center;
  gap: 8px; margin-bottom: 14px; flex-wrap: wrap;
  padding: 8px 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r);
}
.filter-bar-date-range {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.filter-bar-date-range label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); white-space: nowrap;
}
#tasks-filter-bar .filter-bar-sep,
#tasks-filter-bar .filter-bar-lbl,
#tasks-time-total {
  display: none !important;
}
.filter-tabs {
  display: flex;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r); padding: 3px; gap: 2px;
}
.filter-tab {
  padding: 5px 13px; border-radius: 5px;
  cursor: pointer; font-size: 12.5px; font-weight: 500;
  color: var(--text-sec);
  transition: all 0.13s; border: none;
  background: none; font-family: 'DM Sans', sans-serif;
}
.filter-tab:hover { color: var(--text-primary); background: var(--surface-2); }
.filter-tab.active { background: var(--brand); color: #0e0f0a; }

.filter-sel {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r); padding: 6px 11px;
  color: var(--text-sec); font-family: 'DM Sans', sans-serif;
  font-size: 12.5px; cursor: pointer; outline: none;
  transition: border-color 0.15s; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234e5040' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
  padding-right: 28px;
}
.filter-sel:focus { border-color: var(--brand); }
.filter-sel option { background: var(--surface-2); color: var(--text-primary); }

.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r); padding: 6px 11px 6px 32px;
  color: var(--text-primary); font-family: 'DM Sans', sans-serif;
  font-size: 13px; outline: none;
  transition: border-color 0.18s;
}
.search-input:focus { border-color: var(--brand); }
.search-input::placeholder { color: var(--text-muted); }

.filter-bar-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}
.filter-bar-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ============================
   BADGES AND TAGS
============================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap;
}
.badge-high   { background: rgba(239,68,68,0.13);   color: #f87171; }
.badge-medium { background: rgba(74,222,128,0.16);  color: #4ade80; }
.badge-low    { background: rgba(187,193,59,0.15);  color: var(--brand); }
.badge-hold   { background: rgba(148,163,184,0.15); color: #94a3b8; }

.badge-not-started { background: rgba(78,80,64,0.35);    color: var(--text-muted); }
.badge-in-progress { background: rgba(96,165,250,0.14);  color: #60a5fa; }
.badge-in-review   { background: rgba(245,158,11,0.14);  color: #fbbf24; }
.badge-done        { background: rgba(74,222,128,0.14);  color: #4ade80; }
.badge-active      { background: rgba(187,193,59,0.15);  color: var(--brand); }
.badge-prospect    { background: rgba(96,165,250,0.14);  color: #60a5fa; }
.badge-inactive    { background: rgba(78,80,64,0.35);    color: var(--text-muted); }

.tag-chip {
  padding: 2px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--brand-dim); color: var(--brand);
  border: 1px solid rgba(187,193,59,0.2);
  letter-spacing: 0.3px;
}
.tag-chip-rm {
  background: none; border: none; cursor: pointer;
  color: inherit; opacity: 0.6; margin-left: 3px; font-size: 11px;
  line-height: 1; padding: 0;
}
.tag-chip-rm:hover { opacity: 1; }
.tag-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 4px; width: 13px; height: 13px; border-radius: 50%;
  font-size: 11px; line-height: 1; cursor: pointer; opacity: 0.55;
  transition: opacity 0.1s, background 0.1s;
}
.tag-chip-x:hover { opacity: 1; background: rgba(0,0,0,0.15); }
.tag-chip-add {
  cursor: pointer; opacity: 0.55;
  border: 1px dashed currentColor !important;
  background: transparent !important; color: var(--brand) !important;
  transition: opacity 0.15s;
}
.tag-chip-add:hover { opacity: 1; }
.tag-chip-link { cursor:pointer; transition:all 0.1s; }
.tag-chip-link:hover { background:var(--brand-dim) !important; color:var(--brand) !important; }

/* ============================
   QUICK EDIT AND CHECKBOXES
============================ */
.qedit-badge { cursor: pointer; transition: filter 0.12s, transform 0.12s; }
.qedit-badge:hover { filter: brightness(1.2); transform: scale(1.06); }
.qedit-date-cell { cursor: pointer; transition: color 0.12s; }
.qedit-date-cell:hover { color: var(--brand) !important; }
.qedit-assign-cell { cursor: pointer; transition: color 0.12s; }
.qedit-assign-cell:hover { color: var(--brand) !important; }
.qedit-drop {
  position: fixed; z-index: 9999;
  background: var(--surface-2);
  border: 1px solid var(--border-h);
  border-radius: var(--r);
  box-shadow: 0 10px 32px rgba(0,0,0,0.4);
  min-width: 150px; overflow: hidden;
  animation: qeditIn 0.1s ease;
}
@keyframes qeditIn {
  from { opacity:0; transform:translateY(-4px); }
  to   { opacity:1; transform:translateY(0); }
}
.qedit-drop-header {
  padding: 6px 12px 4px;
  font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.qedit-opt {
  padding: 8px 14px; font-size: 12.5px;
  cursor: pointer; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
  transition: background 0.1s;
}
.qedit-opt:hover { background: var(--surface-3); }
.qedit-opt.current { color: var(--brand); font-weight: 600; }
.qedit-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.qedit-date-wrap {
  position: fixed; z-index: 9999;
  background: var(--surface-2); border: 1px solid var(--border-h);
  border-radius: var(--r); padding: 8px 10px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.4);
}
.qedit-input {
  background: var(--surface-3); border: 1px solid var(--brand);
  border-radius: 5px; padding: 5px 8px;
  color: var(--text-primary); font-size: 12.5px;
  font-family: 'DM Sans', sans-serif;
}
.qedit-input:focus { outline: none; }
.qedit-clear-opt {
  padding: 6px 14px 8px; font-size: 11.5px;
  color: var(--text-muted); cursor: pointer;
  border-top: 1px solid var(--border); transition: color 0.1s;
}
.qedit-clear-opt:hover { color: var(--red); }
.qedit-empty { color:var(--text-muted); opacity:0.35; font-size:10.5px; font-style:italic; pointer-events:none; }

.cb {
  width: 15px; height: 15px;
  border: 1.5px solid var(--border-h);
  border-radius: 4px; background: transparent;
  cursor: pointer; appearance: none; -webkit-appearance: none;
  transition: all 0.15s; position: relative; display: block;
}
.cb:checked { background: var(--brand); border-color: var(--brand); }
.cb:checked::after {
  content: ''; position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 8px;
  border: 1.5px solid #0e0f0a;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}
.cb:hover:not(:checked) { border-color: var(--brand); }
.cb:disabled { opacity: 0.4; cursor: default; }

/* ============================
   EMPTY, MODALS, TOASTS
============================ */
.empty-state {
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-icon { font-size: 36px; opacity: 0.35; margin-bottom: 12px; }
.empty-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.empty-sub { font-size: 12px; opacity: 0.7; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.55); display: none;
  align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(5px);
}
.modal-overlay.open { display: flex; animation: fadeUp 0.15s ease; }
.modal {
  width: 640px; max-width: 96vw; max-height: 88vh;
  background: var(--surface-1);
  border: 1px solid var(--border-h);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal.sm { max-width: 380px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: 'Bebas Neue', cursive;
  font-size: 24px; letter-spacing: 1px; color: var(--text-primary);
}
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  padding: 4px 6px; border-radius: 6px; transition: color 0.13s, background 0.13s;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 18px 22px; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border);
  background: var(--surface-2);
}

#toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  min-width: 250px; max-width: 360px;
  background: var(--surface-1);
  border: 1px solid var(--border-h); border-left: 3px solid var(--brand);
  border-radius: var(--r);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  padding: 12px 14px;
  animation: toastIn 0.18s ease;
}
.toast.t-err  { border-left-color: var(--red); }
.toast.t-warn { border-left-color: var(--orange); }
.toast-head { font-weight: 600; margin-bottom: 2px; }
.toast-msg  { color: var(--text-sec); font-size: 12px; }
.toast-undo-btn {
  margin-top: 8px; background: none; border: none; cursor: pointer;
  color: var(--brand); font-size: 11px; font-weight: 600;
  padding: 4px 8px; border-radius: 5px;
}
.toast-undo-btn:hover { background: var(--brand-glow); }

/* ============================
   SHARED PILLS AND TOGGLES
============================ */
.assign-filter { display:flex; align-items:center; border:1px solid var(--border); border-radius:20px; overflow:hidden; }
.assign-btn { background:none; border:none; padding:3px 10px; font-size:11px; font-weight:600; color:var(--text-muted); cursor:pointer; font-family:'DM Sans',sans-serif; white-space:nowrap; transition:all 0.13s; }
.assign-btn:hover { color:var(--text-sec); background:var(--surface-2); }
.assign-btn.active { background:var(--brand); color:#000; }

.layout-toggle { display:flex; align-items:center; border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.layout-btn { background:none; border:none; padding:5px 8px; cursor:pointer; color:var(--text-muted); display:flex; align-items:center; transition:all 0.13s; }
.layout-btn:hover { background:var(--surface-2); color:var(--text-sec); }
.layout-btn.active { background:var(--brand-dim); color:var(--brand); }

.sort-pill { background:var(--surface-1); border:1px solid var(--border); border-radius:20px; padding:3px 10px; font-size:11px; font-weight:600; color:var(--text-muted); cursor:pointer; white-space:nowrap; transition:all 0.13s; font-family:'DM Sans',sans-serif; }
.sort-pill:hover { border-color:var(--border-h); color:var(--text-sec); }
.sort-pill.th-sorted { border-color:var(--brand); color:var(--brand); background:var(--brand-dim); }

/* ============================
   RESPONSIVE COMPONENTS
============================ */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .filter-tabs { width: 100%; }
  .filter-tab { flex: 1; text-align: center; padding: 5px 6px; font-size: 11.5px; }
  .filter-sel { font-size: 12px; }
  #toasts { bottom: 14px; right: 14px; left: 14px; }
  .toast { min-width: 0; max-width: 100%; }
  .modal-overlay { padding: 12px; }
  .modal-body { padding: 16px 18px; }
  .modal-head { padding: 16px 18px 12px; }
  .modal-foot { padding: 12px 18px; }
}
