/* ---- Brand: change these to re-skin the whole app ---- */
:root {
  /* NextGen Forensic palette (from nextgenforensic.com) */
  --brand: #017a2d;
  --brand-dark: #015f23;
  --brand-soft: #ecfaf0;
  --accent: #00c949;
  --bg: #f7f8f3;
  --panel: #ffffff;
  --text: #0f1316;
  --muted: #6b7185;
  --line: #e6e8f0;
  --green: #12805c; --green-bg: #e3f6ee;
  --blue: #2563eb;  --blue-bg: #e6eefe;
  --amber: #b45309; --amber-bg: #fdf0d9;
  --red: #c42b2b;   --red-bg: #fde8e8;
  --gray: #5b6176;  --gray-bg: #eceef4;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20,24,50,.05), 0 4px 16px rgba(20,24,50,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 13px; margin: 0; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
h3 { font-size: 17px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---- Layout ---- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 236px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 4px 10px 22px; }
.brand .mark { height: 30px; width: auto; flex: none; }
.brand .word { height: 26px; width: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--muted);
  text-decoration: none; font-weight: 500; margin-bottom: 2px;
}
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--brand-dark); }
.nav .sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #9aa0b4; padding: 16px 12px 6px; }
.me { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; flex: none; }
.me .who { min-width: 0; flex: 1; line-height: 1.25; }
.me .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { flex: 1; min-width: 0; padding: 32px 40px 60px; max-width: 1100px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---- Controls ---- */
.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 8px 16px; cursor: pointer;
  font-weight: 600; transition: .12s; white-space: nowrap;
}
.btn:hover { border-color: #cdd1e0; background: #fafbff; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: #f3bcbc; }
.btn.primary { box-shadow: 0 1px 0 rgba(0,0,0,.05); }
.btn.sm { padding: 4px 12px; font-size: 13px; border-radius: 7px; }
.btn.link { border: 0; background: none; color: var(--brand); padding: 4px 6px; }
.btn:disabled { opacity: .55; cursor: default; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
label .opt { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; border: 1px solid #d5d9e6; border-radius: 9px; padding: 9px 11px; background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,201,73,.2); }
textarea { resize: vertical; min-height: 76px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; } .row > * { flex: 1; min-width: 0; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.error { background: var(--red-bg); color: var(--red); border-radius: 9px; padding: 9px 12px; margin-bottom: 14px; font-size: 14px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filters select { width: auto; min-width: 150px; }

/* ---- Cards & lists ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { padding: 16px 18px; }
.stat .n { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat.warn .n { color: var(--red); }
.bar { height: 7px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.group { margin-bottom: 26px; }
.group > h2 { margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.group > h2 .count { background: var(--gray-bg); color: var(--gray); border-radius: 99px; padding: 0 8px; font-size: 12px; letter-spacing: 0; }
.group.bad > h2 { color: var(--red); } .group.bad > h2 .count { background: var(--red-bg); color: var(--red); }
.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.task {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.task:last-child { border-bottom: 0; }
.task:hover { background: #fafbff; }
.tick {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid #c3c8da; background: #fff; cursor: pointer; flex: none;
  display: grid; place-items: center; padding: 0; transition: .12s;
}
.tick:hover { border-color: var(--green); background: var(--green-bg); }
.task.completed .tick, .task.completed_late .tick { background: var(--green); border-color: var(--green); }
.task.completed_late .tick { background: var(--amber); border-color: var(--amber); }
.tick svg { width: 13px; height: 13px; stroke: #fff; opacity: 0; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.task.completed .tick svg, .task.completed_late .tick svg { opacity: 1; }
.t-main { flex: 1; min-width: 0; }
.t-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.completed .t-title, .task.completed_late .t-title { color: var(--muted); text-decoration: line-through; text-decoration-color: #b9bdce; }
.t-meta { display: flex; gap: 6px 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 2px; align-items: center; }
.t-meta .due.late { color: var(--red); font-weight: 600; }
.t-side { display: flex; align-items: center; gap: 10px; flex: none; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; background: var(--gray-bg); color: var(--gray); }
.pill.in_progress { background: var(--blue-bg); color: var(--blue); }
.pill.completed { background: var(--green-bg); color: var(--green); }
.pill.completed_late { background: var(--amber-bg); color: var(--amber); }
.pill.overdue { background: var(--red-bg); color: var(--red); }
.tag { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-dark); }
.tag.admin { background: #fdeefc; color: #a21caf; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }

/* ---- Team ---- */
.team { display: grid; gap: 16px; }
.person { padding: 18px 20px; }
.person-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.person-head .grow { flex: 1; min-width: 160px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--gray-bg); color: var(--gray); }
.chip.red { background: var(--red-bg); color: var(--red); } .chip.blue { background: var(--blue-bg); color: var(--blue); } .chip.green { background: var(--green-bg); color: var(--green); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--bg); border-radius: 10px; padding: 10px 14px; }
.kpi b { font-size: 20px; } .kpi span { display: block; color: var(--muted); font-size: 12.5px; }
.person .list { box-shadow: none; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fbfbfe; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.tbl { overflow-x: auto; }
.act-detail { color: var(--muted); font-size: 13px; margin-top: 2px; word-break: break-word; }
.act-detail s { color: #a0a5b8; } .act-detail b { color: var(--text); font-weight: 600; }
.ev { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--gray-bg); color: var(--gray); white-space: nowrap; }
.ev.good { background: var(--green-bg); color: var(--green); } .ev.bad { background: var(--red-bg); color: var(--red); } .ev.info { background: var(--blue-bg); color: var(--blue); }

/* ---- Modal ---- */
#modal-root .backdrop { position: fixed; inset: 0; background: rgba(20,24,50,.45); display: grid; place-items: start center; padding: 6vh 16px; overflow-y: auto; z-index: 50; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; padding: 24px 26px; box-shadow: 0 20px 60px rgba(20,24,50,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.modal-head h3 { font-size: 19px; }
.x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; align-items: center; }
.modal-foot .left { margin-right: auto; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 14px; margin: 14px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.box { background: var(--brand-soft); border-radius: 10px; padding: 11px 14px; font-size: 14px; margin: 12px 0; }
.box b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-dark); margin-bottom: 2px; }
.seg { display: inline-flex; background: var(--gray-bg); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--gray); }
.seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); color: var(--text); }
.files { margin: 8px 0; }
.file { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 6px; font-size: 14px; }
.file a { color: var(--brand-dark); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.sect { margin-top: 18px; }

/* ---- Time tracking ---- */
.mono { font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.late { color: var(--red); font-weight: 600; }
.tag.late-tag { background: var(--red-bg); color: var(--red); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: #c3c8da; flex: none; }
.dot.live { background: var(--accent); box-shadow: 0 0 0 4px rgba(0,201,73,.2); animation: pulse 2s infinite; }
.dot.brk { background: #f59e0b; } .dot.done { background: var(--gray); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(0,201,73,0); } }
.daybar { padding: 18px 22px; margin-bottom: 22px; border-left: 4px solid #c3c8da; }
.daybar.working { border-left-color: var(--accent); } .daybar.on_break { border-left-color: #f59e0b; } .daybar.ended { border-left-color: var(--gray); }
.db-main { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.db-title { font-weight: 700; font-size: 17px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 0; }
.db-clock { display: flex; align-items: baseline; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.db-clock > .mono:first-child { font-size: 30px; font-weight: 500; letter-spacing: -.02em; }
.db-btns { display: flex; gap: 10px; }
.db-warn { background: var(--amber-bg); color: var(--amber); border-radius: 9px; padding: 8px 12px; margin-top: 12px; font-size: 14px; font-weight: 500; }
.nowtask { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.nowtask > span:first-child { flex: 1; min-width: 160px; }
.btn.timer { color: var(--brand); border-color: #bfe6cc; }
.btn.timer.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.bar.sm { height: 5px; margin-top: 5px; width: 80px; } .bar.blue i { background: var(--blue); }
.clickrow { cursor: pointer; } .clickrow:hover td { background: #fafbff; }
.pill.present { background: var(--green-bg); color: var(--green); }
.pill.working, .pill.pending { background: var(--blue-bg); color: var(--blue); }
.pill.open, .pill.not_started { background: var(--amber-bg); color: var(--amber); }
.pill.absent { background: var(--red-bg); color: var(--red); }
.pill.leave { background: #f1eafe; color: #6d28d9; }
.days { display: flex; gap: 6px 14px; flex-wrap: wrap; } .dayck { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; margin: 0; }
.dayck input { width: auto; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; align-items: start; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 15px); gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.hc { display: inline-block; width: 15px; height: 15px; border-radius: 4px; background: var(--gray-bg); }
.hc.blank { background: none; } .hc.l0 { background: var(--gray-bg); } .hc.l1 { background: #a9e8bd; } .hc.l2 { background: #5fd68a; }
.hc.l3 { background: #00c949; } .hc.l4 { background: #017a2d; } .hc.abs { background: #f3a5a5; } .hc.lv { background: #cdb8f5; } .hc.off { background: #f4f5f9; border: 1px dashed #dfe2ec; }
.legend { display: flex; align-items: center; gap: 4px; margin-top: 12px; flex-wrap: wrap; } .legend .hc { width: 12px; height: 12px; }
@media print {
  .side, .noprint, .btn, #toasts, #modal-root { display: none !important; }
  body { background: #fff; } .main { padding: 0; max-width: none; } .card, .list { box-shadow: none; }
  a { color: inherit; text-decoration: none; }
}

/* ---- CRM ---- */
.board { display: grid; grid-template-columns: repeat(5, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: #eceef6; border-radius: var(--radius); padding: 10px; min-height: 120px; }
.col-head { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 10px; }
.col-head b { font-size: 13px; }
.col-head span { font-size: 12px; color: var(--muted); }
.col.won .col-head b { color: var(--green); } .col.lost .col-head b { color: var(--red); }
.lead { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow); }
.lead:hover { border-color: #c5c9e0; }
.lead .nm { font-weight: 600; } .lead .co { color: var(--muted); font-size: 13px; }
.lead .ft { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); align-items: center; }
.fu { font-weight: 600; } .fu.late { color: var(--red); }
.tl { border-left: 2px solid var(--line); margin: 8px 0 0 6px; padding-left: 14px; }
.tl .it { margin-bottom: 12px; font-size: 14px; position: relative; }
.tl .it::before { content: ''; position: absolute; left: -20px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: #c3c8da; }
.tl .it .w { color: var(--muted); font-size: 12.5px; }
.seg.wrap { flex-wrap: wrap; }

/* ---- Toasts ---- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 99; display: grid; gap: 8px; }
.toast { background: #1c2033; color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 14px; }
.toast.err { background: var(--red); }

/* ---- Login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--brand-soft), var(--bg) 60%); }
.login .card { width: 100%; max-width: 390px; padding: 34px 32px; }
.login .brand { padding: 0 0 14px; }
.login .brand .mark { height: 44px; } .login .brand .word { height: 38px; }
.login p { color: var(--muted); margin: 0 0 22px; }
.login .btn { width: 100%; padding: 11px; }

/* ---- Mobile ---- */
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 12px; overflow-x: auto; gap: 8px; }
  .brand { padding: 0 8px 0 0; } .brand span { display: none; }
  .nav { display: flex; gap: 2px; } .nav a { margin: 0; white-space: nowrap; } .nav .sep { display: none; }
  .me { margin: 0 0 0 auto; border: 0; padding: 0; } .me .who { display: none; }
  .main { padding: 20px 16px 50px; }
  .row { flex-direction: column; gap: 0; }
  .t-side .btn { display: none; }
  .kv { grid-template-columns: 90px 1fr; }
}
