/* =====================================================================
   TaskFlow  -  look & feel
   Change the main colours here (first block). Card colours are the .c-xxx classes.
   ===================================================================== */
:root {
  --brand: #5b5bf0;          /* main colour (buttons, links, active menu) */
  --brand-2: #8b5cf6;        /* second colour (gradients) */
  --brand-dark: #4338ca;
  --ink: #0f172a;            /* main text */
  --muted: #64748b;          /* soft text */
  --line: #e6eaf2;           /* borders */
  --bg: #f4f6fb;             /* page background */
  --surface: #ffffff;        /* cards */
  --side-1: #0f172a;         /* sidebar gradient */
  --side-2: #1e1b4b;
  --sidebar-w: 252px;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 14px rgba(15,23,42,.05);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.12);

  --bs-primary: #5b5bf0; --bs-primary-rgb: 91,91,240;
  --bs-link-color: #4f46e5; --bs-link-hover-color: #4338ca;
  --bs-body-color: #0f172a; --bs-border-color: #e6eaf2;
  --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* card colour themes: every card/chip uses  background: linear-gradient(135deg, var(--c1), var(--c2)) */
.c-indigo { --c1:#4f46e5; --c2:#7c3aed; --cs:#eef2ff; --ct:#4338ca; }
.c-blue   { --c1:#2563eb; --c2:#0ea5e9; --cs:#eff6ff; --ct:#1d4ed8; }
.c-cyan   { --c1:#0e7490; --c2:#22d3ee; --cs:#ecfeff; --ct:#0e7490; }
.c-teal   { --c1:#0f766e; --c2:#14b8a6; --cs:#f0fdfa; --ct:#0f766e; }
.c-green  { --c1:#15803d; --c2:#22c55e; --cs:#f0fdf4; --ct:#166534; }
.c-amber  { --c1:#d97706; --c2:#fbbf24; --cs:#fffbeb; --ct:#b45309; }
.c-orange { --c1:#ea580c; --c2:#fb923c; --cs:#fff7ed; --ct:#c2410c; }
.c-rose   { --c1:#e11d48; --c2:#fb7185; --cs:#fff1f2; --ct:#be123c; }
.c-violet { --c1:#7c3aed; --c2:#d946ef; --cs:#faf5ff; --ct:#6d28d9; }
.c-slate  { --c1:#334155; --c2:#64748b; --cs:#f8fafc; --ct:#334155; }

body { background: var(--bg); color: var(--ink); font-size: .94rem; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5,h6 { letter-spacing: -.01em; }
.min-w-0 { min-width: 0; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }
.text-muted { color: var(--muted) !important; }

/* ---------- buttons / forms ---------- */
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
  background-image: linear-gradient(135deg, var(--brand), var(--brand-2)); border: 0; box-shadow: 0 4px 12px rgba(91,91,240,.28); }
.btn-primary:hover { background-image: linear-gradient(135deg, var(--brand-dark), #7c3aed); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: #c7d2fe; --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); }
.btn-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--line); color: #475569; border-radius: 12px; }
.btn-icon:hover { background: #f8fafc; color: var(--brand); }
.form-control, .form-select { border-radius: 10px; border-color: #dbe1ec; padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 .22rem rgba(91,91,240,.15); }
.form-label { font-weight: 500; font-size: .85rem; color: #334155; margin-bottom: .3rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.dropdown-menu { border-radius: 12px; border-color: var(--line); padding: .4rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; }
.modal-content { border: 0; border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--line); padding: 1rem 1.25rem; }
.modal-footer { border-top: 1px solid var(--line); }
.toast-container { z-index: 2000; }

/* ---------- layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: linear-gradient(180deg, var(--side-1), var(--side-2)); color: #c7d2fe; position: fixed; top: 0; bottom: 0; left: 0; z-index: 1030; display: flex; flex-direction: column; transition: transform .22s; }
.sidebar .brand { padding: 1.15rem 1.25rem; font-weight: 700; font-size: 1.25rem; color: #fff; display: flex; align-items: center; gap: .7rem; }
.brand-logo { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--brand), #22d3ee); color: #fff; font-size: 1.05rem; box-shadow: 0 6px 14px rgba(34,211,238,.25); }
.company-box { margin: .25rem 1rem .5rem; padding: .7rem .85rem; border-radius: 12px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); }
.company-label { font-size: .65rem; letter-spacing: .08em; color: #94a3b8; }
.company-name { color: #fff; font-weight: 600; }
.sidebar .nav-link { color: #c7d2fe; padding: .7rem 1rem; margin: .12rem .75rem; border-radius: 12px; display: flex; gap: .8rem; align-items: center; font-weight: 500; transition: background .15s; }
.sidebar .nav-link i { width: 1.2rem; text-align: center; opacity: .9; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 16px rgba(91,91,240,.4); }
.side-user { display: flex; gap: .7rem; align-items: center; padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); }
.side-role { color: #94a3b8; }
.side-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 1025; }
.side-backdrop.show { display: block; }
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: .6rem 1.5rem; display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 1020; }
.topbar-date { color: var(--muted); font-weight: 500; }
.user-btn { display: flex; align-items: center; gap: .55rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .3rem .7rem .3rem .35rem; font-weight: 500; }
.page-body { padding: 1.5rem; max-width: 1500px; width: 100%; }
.page-title { font-weight: 700; margin: 0; }
.page-sub { color: var(--muted); }

/* ---------- avatars ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; color: #fff; flex: none; border: 2px solid #fff; }
.avatar-lg { width: 40px; height: 40px; font-size: .85rem; border-color: rgba(255,255,255,.2); }
.avatar-sm { width: 24px; height: 24px; font-size: .6rem; border-width: 1.5px; }
.av-0 { background: linear-gradient(135deg,#6366f1,#8b5cf6); } .av-1 { background: linear-gradient(135deg,#0ea5e9,#2563eb); }
.av-2 { background: linear-gradient(135deg,#14b8a6,#0f766e); } .av-3 { background: linear-gradient(135deg,#f59e0b,#ea580c); }
.av-4 { background: linear-gradient(135deg,#f43f5e,#be123c); } .av-5 { background: linear-gradient(135deg,#22c55e,#15803d); }
.av-6 { background: linear-gradient(135deg,#d946ef,#7c3aed); } .av-7 { background: linear-gradient(135deg,#64748b,#334155); }
.avatar-stack { display: inline-flex; } .avatar-stack .avatar + .avatar { margin-left: -8px; }

/* ---------- pills / chips ---------- */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.pill i { font-size: .68rem; }
.pill-amber { background: #fef3c7; color: #92400e; } .pill-blue { background: #e0f2fe; color: #075985; }
.pill-green { background: #dcfce7; color: #166534; } .pill-red { background: #fee2e2; color: #991b1b; }
.pill-rose { background: #ffe4e6; color: #9f1239; } .pill-indigo { background: #e0e7ff; color: #3730a3; }
.pill-slate { background: #f1f5f9; color: #475569; } .pill-dark { background: #0f172a; color: #fff; }
.card-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- generic cards ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; padding: .9rem 1.1rem; }
.card-footer { background: transparent; border-top: 1px solid var(--line); }
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .8rem 1rem; border-bottom-color: var(--line); }
.table thead th { background: #f8fafc; color: #475569; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; border-bottom: 1px solid var(--line); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8faff; }
.list-group-item { border-color: var(--line); padding: .8rem 1.1rem; }
.list-group-item-action:hover { background: #f8faff; }

/* ---------- stat cards (dashboard) ---------- */
.stat-card { cursor: pointer; transition: transform .15s, box-shadow .15s; height: 100%; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card .icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 6px 14px rgba(15,23,42,.15); }
.stat-num { font-size: 1.8rem; font-weight: 700; line-height: 1; }

/* ---------- card tiles (the "cards" that hold tasks) ---------- */
.card-tile { position: relative; display: flex; flex-direction: column; height: 100%; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.card-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-tile .tile-top { padding: 1.1rem 1.1rem 1.4rem; color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); position: relative; }
.card-tile .tile-top::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.12); }
.tile-icon { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-bottom: .75rem; position: relative; z-index: 1; }
.tile-title { font-weight: 700; font-size: 1.08rem; margin: 0; position: relative; z-index: 1; }
.tile-desc { font-size: .82rem; opacity: .9; margin-top: .2rem; position: relative; z-index: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
.card-tile .tile-body { padding: 1rem 1.1rem 1.1rem; background: linear-gradient(180deg, var(--cs), #fff 60%); flex: 1; }
.tile-menu { position: absolute; top: .6rem; right: .6rem; z-index: 3; }
.tile-menu .btn { width: 32px; height: 32px; padding: 0; background: rgba(255,255,255,.2); color: #fff; border: 0; border-radius: 10px; }
.tile-menu .btn:hover { background: rgba(255,255,255,.35); }
.progress-slim { height: 8px; border-radius: 99px; background: rgba(15,23,42,.08); overflow: hidden; }
.progress-slim > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--c1), var(--c2)); transition: width .4s; }
.mini-stat { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .8rem; }
.mini-stat .pill { font-size: .7rem; }
.tile-add { border: 2px dashed #c7d2fe; background: rgba(255,255,255,.5); box-shadow: none; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--brand); min-height: 230px; border-radius: var(--radius); cursor: pointer; transition: background .15s, transform .15s; height: 100%; }
.tile-add:hover { background: #eef2ff; transform: translateY(-3px); }
.tile-add .plus { width: 52px; height: 52px; border-radius: 50%; background: #e0e7ff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: .6rem; }
.tile-archived { opacity: .75; filter: grayscale(.4); }

/* ---------- card page header + kanban board ---------- */
.card-hero { border-radius: var(--radius); color: #fff; padding: 1.4rem 1.5rem; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.card-hero::after { content: ""; position: absolute; right: -50px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.11); }
.card-hero > * { position: relative; z-index: 1; }
.hero-icon { width: 54px; height: 54px; border-radius: 16px; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex: none; }
.card-hero .btn-hero { background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.3); backdrop-filter: blur(4px); }
.card-hero .btn-hero:hover { background: rgba(255,255,255,.32); color: #fff; }
.card-hero .btn-white { background: #fff; color: var(--ct); border: 0; font-weight: 600; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.card-hero .progress-slim { background: rgba(255,255,255,.28); }
.card-hero .progress-slim > div { background: #fff; }

.board { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 1rem; align-items: start; overflow-x: auto; padding-bottom: .5rem; }
.kcol { background: #eceff7; border-radius: var(--radius); padding: .75rem; min-height: 220px; border: 2px solid transparent; transition: border-color .15s, background .15s; }
.kcol.drag-over { border-color: var(--brand); background: #e0e7ff; }
.kcol-head { display: flex; align-items: center; gap: .55rem; padding: .25rem .4rem .75rem; font-weight: 700; }
.kcol-dot { width: 10px; height: 10px; border-radius: 50%; }
.kcol-count { margin-left: auto; background: #fff; border-radius: 99px; padding: .05rem .6rem; font-size: .78rem; font-weight: 700; color: var(--muted); }
.ktask { background: #fff; border-radius: 12px; padding: .8rem .9rem; margin-bottom: .6rem; box-shadow: 0 1px 2px rgba(15,23,42,.08); border-left: 4px solid var(--prio, #6366f1); cursor: pointer; transition: transform .12s, box-shadow .12s; }
.ktask:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(15,23,42,.12); }
.ktask.dragging { opacity: .45; }
.ktask.prio-High { --prio: #f43f5e; } .ktask.prio-Normal { --prio: #6366f1; } .ktask.prio-Low { --prio: #94a3b8; }
.ktask.done .k-title { text-decoration: line-through; color: var(--muted); }
.ktask.overdue { background: #fff8f8; }
.k-title { font-weight: 600; line-height: 1.3; margin-bottom: .25rem; }
.k-meta { display: flex; flex-wrap: wrap; gap: .35rem .7rem; align-items: center; font-size: .78rem; color: var(--muted); }
.k-foot { display: flex; align-items: center; justify-content: space-between; margin-top: .6rem; gap: .5rem; }
.k-empty { text-align: center; color: #94a3b8; padding: 1.5rem .5rem; font-size: .85rem; border: 2px dashed #d5dbea; border-radius: 12px; }

/* ---------- task list page ---------- */
.task-row { cursor: pointer; }
.task-row.overdue td:first-child { border-left: 4px solid #f43f5e; }
.task-row.done .t-title { text-decoration: line-through; color: var(--muted); }
.seg { display: inline-flex; flex-wrap: wrap; gap: .35rem; background: #eef1f8; padding: .3rem; border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: .4rem .9rem; border-radius: 9px; font-weight: 500; color: #475569; }
.seg button.active { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(15,23,42,.12); }

/* ---------- notifications / comments / attachments ---------- */
.bell-badge { position: absolute; top: -5px; right: -6px; font-size: .62rem; }
.notif-menu { width: 370px; max-width: 92vw; max-height: 70vh; overflow: auto; padding: 0; }
.notif-head { background: #f8fafc; }
.notif-item { padding: .65rem .95rem; border-bottom: 1px solid #f1f5f9; cursor: pointer; }
.notif-item.unread { background: #eef2ff; }
.notif-item:hover { background: #e0e7ff; }
.comment { background: #f8fafc; border-radius: 12px; padding: .65rem .85rem; margin-bottom: .5rem; border: 1px solid var(--line); }
.comment.done { background: #f0fdf4; border-color: #bbf7d0; border-left: 3px solid #22c55e; }
.attach-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 12px; margin-bottom: .4rem; background: #fff; }
.attach-item .ico { width: 30px; text-align: center; font-size: 1.15rem; }
.detail-head { color: #fff; padding: 1.1rem 1.25rem; background: linear-gradient(135deg, var(--c1), var(--c2)); display: flex; align-items: flex-start; gap: .8rem; }
.detail-head .btn-close { filter: invert(1) grayscale(1) brightness(2); opacity: .9; margin-left: auto; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); background: linear-gradient(135deg, var(--c1), var(--c2)); cursor: pointer; padding: 0; }
.swatch.active { box-shadow: 0 0 0 2px var(--ink); }
.icon-opt { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: #475569; cursor: pointer; }
.icon-opt:hover { background: #f1f5f9; }
.icon-opt.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.emp-pick { max-height: 160px; overflow: auto; border: 1px solid #dbe1ec; border-radius: 10px; padding: .5rem .75rem; }

/* ---------- login / register ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-hero { background: linear-gradient(145deg, #0f172a 0%, #312e81 55%, #6d28d9 100%); color: #e0e7ff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-hero::before, .auth-hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.07); }
.auth-hero::before { width: 380px; height: 380px; right: -120px; top: -100px; } .auth-hero::after { width: 260px; height: 260px; left: -90px; bottom: -80px; }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero h1 { color: #fff; font-weight: 800; font-size: 2.3rem; line-height: 1.15; }
.hero-feature { display: flex; gap: .9rem; margin-top: 1.25rem; }
.hero-feature .f-ico { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; flex: none; color: #67e8f9; }
.hero-feature b { color: #fff; }
.mini-cards { display: flex; gap: .6rem; margin-top: 2rem; flex-wrap: wrap; }
.mini-cards span { padding: .45rem .8rem; border-radius: 12px; color: #fff; font-weight: 600; font-size: .82rem; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 8px 18px rgba(0,0,0,.25); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; background: #fff; }
.auth-box { width: 100%; max-width: 420px; }
.auth-logo { width: 52px; height: 52px; border-radius: 16px; background: linear-gradient(135deg, var(--brand), #22d3ee); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; box-shadow: 0 10px 22px rgba(91,91,240,.35); }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.input-icon .form-control { padding-left: 2.5rem; }

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: none; }
  .main { margin-left: 0; }
  .page-body { padding: 1rem; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .board { grid-template-columns: repeat(3, 280px); }
}
