:root {
  --accent: #3b5bdb;
  --accent-dark: #2b46b8;
  --ink: #1f2023;
  --ink-2: #4a4b4f;
  --ink-3: #6b6c70;
  --muted: #8a8b8f;
  --faint: #b5b3ad;
  --line: #e3e1dc;
  --line-soft: #eeece8;
  --bg: #f7f6f4;
  --card: #ffffff;
  --soft: #faf9f7;
  --chip: #f0eeea;
  --red: #c2542e;
  --red-bg: #fdeeea;
  --green: #2f9e58;
  --green-bg: #e8f5ec;
  --amber: #b06018;
  --amber-bg: #fdf3e6;
  --blue-bg: #e9edfb;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px; line-height: 1.45; overflow-x: clip;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: 14px; color: var(--ink); }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d8d6d0; border-radius: 7px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(59,91,219,.35); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; min-height: 64px; }
label.f { display: block; font-size: 11px; font-weight: 700; color: var(--ink-3); margin: 0 0 4px; letter-spacing: .4px; text-transform: uppercase; }
h1 { margin: 0 0 2px; font-size: 20px; font-weight: 800; letter-spacing: -.4px; }
h1 + p, .sub { margin: 0; font-size: 13px; color: var(--ink-3); }
.mono { font-family: var(--mono); }

/* buttons */
.btn { cursor: pointer; border: none; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 700; background: var(--accent); color: #fff; }
.btn:hover { filter: brightness(1.07); }
.btn.secondary { background: #fff; color: var(--ink-2); border: 1px solid #d8d6d0; font-weight: 600; }
.btn.danger { background: var(--red); }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 7px; }
.btn.ghost { background: none; color: var(--ink-3); border: none; padding: 0; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }

/* header */
.hdr {
  background: #fff; border-bottom: 1px solid var(--line); height: 48px; padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  position: sticky; top: 0; z-index: 20;
}
.hdr .brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.hdr .logo { width: 24px; height: 24px; flex: 0 0 24px; background: var(--accent); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: #fff; }
.hdr .name { font-weight: 800; font-size: 15px; letter-spacing: -.2px; white-space: nowrap; }
.hdr .date { font-size: 11px; color: var(--muted); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr .who { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr .right { display: flex; align-items: center; gap: 10px; min-width: 0; }
@media (max-width: 640px) { .hdr .date, .hdr .who { display: none; } }

/* layout */
.page { max-width: 1180px; margin: 0 auto; padding: 14px 12px 60px; }
.page.narrow { max-width: 880px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
section.card { padding: 14px; margin-bottom: 12px; }
.sec-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 10px; }
.err { font-size: 13px; color: var(--red); background: var(--red-bg); border-radius: 7px; padding: 8px 11px; margin: 10px 0 0; }
.ok-note { font-size: 13px; color: var(--green); background: var(--green-bg); border-radius: 7px; padding: 8px 11px; font-weight: 600; margin: 10px 0 0; }

/* auth */
.auth-wrap { display: flex; justify-content: center; padding: 48px 12px; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px; width: 360px; max-width: 100%; box-shadow: 0 8px 30px rgba(0,0,0,.05); }
.auth-card .logo { width: 40px; height: 40px; background: var(--accent); border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: #fff; margin: 0 auto 10px; }
.auth-card h1 { text-align: center; font-size: 18px; }
.auth-card .sub { text-align: center; margin-bottom: 16px; }
.auth-card .fields { display: flex; flex-direction: column; gap: 11px; }
.kicker { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .7px; margin-bottom: 6px; }

/* profile bar */
.profile { padding: 12px 14px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.profile .lhs { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.avatar.lg { width: 42px; height: 42px; font-size: 15px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.pname { font-size: 15px; font-weight: 700; }
.pmeta { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.navlinks { display: flex; gap: 7px; margin-top: 5px; align-items: center; flex-wrap: wrap; }
.navlinks .sep { color: #d8d6d0; }
.navlink { cursor: pointer; border: none; background: none; padding: 0; font-size: 13px; font-weight: 500; color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; }
.navlink.on { font-weight: 700; color: var(--accent); text-decoration: underline; }
.badge { background: var(--red); color: #fff; font-size: 10px; font-weight: 800; border-radius: 20px; padding: 0 6px; line-height: 16px; }

/* pills / status */
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.pill.tiny { font-size: 9px; padding: 1px 7px; letter-spacing: .4px; vertical-align: middle; }
.pill.gray { background: var(--chip); color: var(--muted); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.blue { background: var(--blue-bg); color: var(--accent); }

/* place-of-work + entries */
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { cursor: pointer; padding: 8px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; border: 1.5px solid #d8d6d0; background: #fff; color: var(--ink-2); }
.seg button.on { border-color: var(--accent); background: var(--accent); color: #fff; }
.entry { background: var(--soft); border: 1px solid var(--line-soft); border-radius: 9px; padding: 10px; }
.entry + .entry { margin-top: 9px; }
.entry .row1 { display: grid; grid-template-columns: minmax(120px,1.4fr) 76px minmax(120px,1.2fr) 28px; gap: 8px; margin-bottom: 8px; }
.entry .row1 input { text-align: center; font-family: var(--mono); }
.entry .x { border: none; background: none; cursor: pointer; color: var(--faint); font-size: 17px; padding: 0; }
.entry .x:hover { color: var(--red); }
@media (max-width: 560px) { .entry .row1 { grid-template-columns: minmax(0,1fr) 76px 28px; } .entry .row1 select.status { grid-column: 1 / -1; } }
.add-entry { margin-top: 10px; cursor: pointer; border: 1.5px dashed #c9c7c1; background: none; border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.total { margin-top: 10px; font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; }
.stat .k { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.stat .v { font-size: 21px; font-weight: 800; margin-top: 1px; }
.stat .v small { font-size: 12px; font-weight: 600; color: var(--faint); }

/* dashboard columns */
.dash { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 12px; align-items: start; }
@media (max-width: 900px) { .dash { grid-template-columns: minmax(0,1fr); } }

/* team table */
.thead, .trow { display: grid; grid-template-columns: 34px minmax(0,1.6fr) 82px 56px 82px 92px; gap: 8px; align-items: center; padding: 8px 12px; }
.thead { border-bottom: 1px solid var(--line-soft); font-size: 10px; font-weight: 700; color: var(--faint); letter-spacing: .4px; }
.trow { border-bottom: 1px solid #f2f0ec; }
.trow:last-child { border-bottom: none; }
.tname { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.tname .nm { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tname:hover .nm { color: var(--accent); text-decoration: underline; }
.cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) {
  .thead, .trow { grid-template-columns: minmax(0,1.6fr) 50px 78px 88px; }
  .c-sr, .c-type { display: none; }
}
@media (max-width: 430px) {
  .thead, .trow { grid-template-columns: minmax(0,1.6fr) 78px 88px; }
  .c-hrs { display: none; }
}

/* filters/search */
.tbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip-btn { cursor: pointer; border: none; padding: 5px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--ink-3); }
.chip-btn.on { background: var(--ink); color: #fff; }
.letters { display: flex; flex-wrap: wrap; gap: 1px; padding: 6px 12px; border-bottom: 1px solid var(--line-soft); }
.letters button { cursor: pointer; border: none; padding: 3px 6px; border-radius: 5px; font-size: 11px; font-weight: 700; background: none; color: var(--ink-3); }
.letters button.on { background: var(--ink); color: #fff; }
.emp-name { cursor: pointer; border-radius: 8px; }
.emp-name:hover .avatar { outline: 2px solid var(--accent); }
.pcheck { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; border: 1px solid var(--line-soft); border-radius: 7px; padding: 5px 10px; margin: 6px 6px 0 0; cursor: pointer; user-select: none; }
.pcheck:has(input:checked) { border-color: var(--accent); background: var(--chip); font-weight: 600; }
.pcheck input { accent-color: var(--accent); margin: 0; cursor: pointer; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; flex-wrap: wrap; }
.pager .info { font-size: 12px; color: var(--muted); }

/* bars */
.bar-row { margin-bottom: 9px; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 3px; gap: 8px; }
.bar-row .top .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .top .h { color: var(--muted); font-family: var(--mono); flex: 0 0 auto; }
.track { height: 7px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.track .fill { height: 100%; border-radius: 4px; background: var(--accent); }
.blk { border-left: 3px solid var(--red); padding: 1px 0 1px 10px; margin-bottom: 9px; }
.blk .w { font-size: 12px; font-weight: 700; }
.blk .t { font-size: 12px; color: var(--ink-3); }

/* report cards (employee "All Reports") */
.rep-head { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 14px; background: var(--soft); border-bottom: 1px solid var(--line-soft); align-items: center; }
.kv .k { font-size: 9px; font-weight: 700; color: var(--faint); letter-spacing: .4px; }
.kv .v { font-size: 12px; font-weight: 600; }
.rep-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.task-line { font-size: 13px; color: var(--ink-2); padding: 2px 0; overflow-wrap: anywhere; }
.note-line { display: flex; gap: 8px; font-size: 12.5px; flex-wrap: wrap; }
.note-line .lbl { font-weight: 700; white-space: nowrap; }
.note-line .txt { color: var(--ink-3); overflow-wrap: anywhere; min-width: 0; }

/* project cards */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.proj-card { --tint: var(--accent); --tint-bg: #fff;
  background: var(--tint-bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  cursor: pointer; transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease; }
.proj-card:hover { border-color: var(--tint); box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-2px); }
.proj-card .nm { font-size: 15px; font-weight: 700; margin-bottom: 5px; overflow-wrap: anywhere; }
.proj-card .meta { display: flex; gap: 10px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.proj-card .prog { margin-top: 11px; }
.proj-card .prog .lbl { display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.proj-card .prog .pct { font-size: 11px; color: var(--tint); }
.proj-card .prog .track { height: 6px; border-radius: 999px; background: rgba(0,0,0,.07); overflow: hidden; }
.proj-card .prog .fill { height: 100%; border-radius: 999px; background: var(--tint); min-width: 2px; transition: width .3s ease; }
.proj-card .go { margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--tint); }
.proj-card.tint-0 { --tint: #4f63d2; --tint-bg: linear-gradient(135deg, #eef1ff, #f7f8ff); }
.proj-card.tint-1 { --tint: #0e9f6e; --tint-bg: linear-gradient(135deg, #e7f9f1, #f5fdf9); }
.proj-card.tint-2 { --tint: #d97706; --tint-bg: linear-gradient(135deg, #fff4e3, #fffaf1); }
.proj-card.tint-3 { --tint: #db2777; --tint-bg: linear-gradient(135deg, #fdeef5, #fef7fb); }
.proj-card.tint-4 { --tint: #0284c7; --tint-bg: linear-gradient(135deg, #e6f5fd, #f3fbff); }
.proj-card.tint-5 { --tint: #7c3aed; --tint-bg: linear-gradient(135deg, #f1ecfe, #f9f6ff); }

/* project master docs */
.doc-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 62px 92px auto; gap: 10px; align-items: center;
  padding: 9px 10px; border-bottom: 1px solid var(--line-soft); }
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: var(--soft); }
.doc-ic { font-size: 17px; }
.doc-nm { font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.doc-nm:hover { text-decoration: underline; }
.doc-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.doc-mcard { width: min(880px, 96vw); }
.doc-frame { width: 100%; height: min(72vh, 640px); border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.doc-frame.img { display: flex; align-items: center; justify-content: center; overflow: auto; }
.doc-frame.img img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* project entries table */
.pehead, .perow { display: grid; grid-template-columns: 34px minmax(0,2fr) minmax(80px,1fr) 108px 86px 96px; gap: 8px; align-items: center; padding: 8px 12px; }
.pehead { background: var(--soft); border-bottom: 1px solid var(--line-soft); }
.pehead button, .pehead .h { cursor: pointer; border: none; background: none; padding: 0; text-align: left; font-size: 10px; font-weight: 700; color: var(--ink-3); letter-spacing: .4px; }
.perow { border-bottom: 1px solid #f2f0ec; font-size: 13px; }
.perow:last-child { border-bottom: none; }
@media (max-width: 760px) {
  .pehead, .perow { grid-template-columns: minmax(0,2fr) minmax(70px,1fr) 96px; }
  .c-pe-sr, .c-pe-status, .c-pe-date { display: none; }
}

/* modals */
.modal { position: fixed; inset: 0; background: rgba(31,32,35,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 10px; }
.mcard { background: #fff; border-radius: 12px; width: 100%; max-width: min(480px, 90vw); max-height: 90vh; overflow-y: auto; overflow-x: hidden; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.mcard.wide { max-width: min(860px, 90vw); }
.mcard.center { text-align: center; max-width: min(420px, 90vw); }
.m-close { border: none; background: none; cursor: pointer; font-size: 20px; color: var(--faint); padding: 0 2px; }
.m-close:hover { color: var(--ink); }
.warn-ic { width: 46px; height: 46px; border-radius: 50%; background: var(--red-bg); color: var(--red); font-size: 24px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.ok-ic { width: 56px; height: 56px; border-radius: 50%; background: var(--green-bg); color: var(--green); font-size: 27px; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.emp-rep-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--soft); border: 1px solid var(--line-soft); border-radius: 8px; padding: 9px 12px; cursor: pointer; flex-wrap: wrap; }
.emp-rep-item:hover { border-color: var(--accent); }

/* team management */
.mrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #f2f0ec; flex-wrap: wrap; }
.mrow:last-child { border-bottom: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; }

.empty { padding: 24px; text-align: center; font-size: 13px; color: var(--muted); }
.center-note { text-align: center; padding: 44px 16px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mb12 { margin-bottom: 12px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .modal { position: static; padding: 0; background: none; display: block; }
  .mcard { max-width: 100%; max-height: none; box-shadow: none; overflow: visible; }
  .no-print { display: none !important; }
}

/* rendered Markdown (library .md docs + AI-refined documents) */
.md-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; overflow-wrap: anywhere; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 {
  color: var(--ink); letter-spacing: -.2px; margin: 18px 0 6px; line-height: 1.25; }
.md-body h1 { font-size: 19px; } .md-body h2 { font-size: 16px; } .md-body h3 { font-size: 14.5px; }
.md-body h4, .md-body h5, .md-body h6 { font-size: 13.5px; }
.md-body h1:first-child, .md-body h2:first-child { margin-top: 0; }
.md-body p { margin: 7px 0; }
.md-body ul, .md-body ol { margin: 7px 0; padding-left: 22px; }
.md-body li { margin: 3px 0; }
.md-body code { font-family: var(--mono); font-size: 12px; background: var(--chip); border-radius: 4px; padding: 1px 5px; }
.md-body pre { background: var(--soft); border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.md-body pre code { background: none; padding: 0; font-size: 12px; white-space: pre; }
.md-body blockquote { border-left: 3px solid var(--line); margin: 8px 0; padding: 2px 0 2px 12px; color: var(--ink-3); }
.md-body hr { border: none; border-top: 1px solid var(--line-soft); margin: 14px 0; }

/* staff-wise report */
.staff-card { cursor: default; }
.staff-card:hover { transform: none; }
.staff-card .scard-top { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.staff-card .scard-top .hrs { color: var(--tint); }
.staff-card .nm { cursor: pointer; }
.staff-card .nm:hover { color: var(--tint); text-decoration: underline; }
.staff-card .s-projects { margin-top: 9px; font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.staff-rep { padding: 12px 14px; }
.staff-rep .s-title { font-size: 13.5px; font-weight: 700; margin-top: 7px; overflow-wrap: anywhere; }
.staff-rep .s-sum { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; overflow-wrap: anywhere; }

/* message board */
.msg-item { border: 1px solid var(--line-soft); border-left: 3px solid var(--red); border-radius: 8px; padding: 8px 11px; margin-top: 8px; background: var(--soft); }
.msg-item.out { border-left-color: var(--accent); background: #fff; }
.msg-item .txt { font-size: 13px; color: var(--ink-2); margin-top: 3px; overflow-wrap: anywhere; }
.msg-item .when { font-size: 10.5px; color: var(--muted); white-space: nowrap; flex: 0 0 auto; }

/* IT Infrastructure tab */
.infra-grid { display: grid; grid-template-columns: 240px minmax(0,1fr); gap: 14px; align-items: start; }
@media (max-width: 760px) { .infra-grid { grid-template-columns: minmax(0,1fr); } }
