:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2533;
  --muted: #6b7280;
  --line: #e4e8f0;
  --brand: #3b5bdb;
  --brand-dark: #2f49b0;
  --green: #2f9e44;
  --green-bg: #e8f7ed;
  --amber: #f08c00;
  --amber-bg: #fff4e2;
  --red: #e03131;
  --red-bg: #ffe9e9;
  --slate-bg: #eef1f7;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 30, 60, .08), 0 8px 24px rgba(20, 30, 60, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; }
.navlinks { display: flex; align-items: center; gap: 18px; }
.navlinks a { color: var(--ink); font-weight: 500; }
.whoami { color: var(--muted); font-size: 14px; }
.whoami em { font-style: normal; color: var(--brand); }

.container { max-width: 1500px; margin: 0 auto; padding: 24px 32px; }

h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 24px; }

/* ---- cards ---- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 20px;
}
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---- buttons ---- */
button, .btn {
  font: inherit; cursor: pointer; border: none; border-radius: 8px;
  padding: 9px 16px; font-weight: 600; background: var(--brand); color: #fff;
  transition: background .15s, opacity .15s;
}
button:hover, .btn:hover { background: var(--brand-dark); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 7px 14px; font-weight: 600; border-radius: 8px;
}
.btn-ghost:hover { background: var(--slate-bg); text-decoration: none; }
.btn-green { background: var(--green); }
.btn-green:hover { background: #268a3a; }
.btn-amber { background: var(--amber); }
.btn-amber:hover { background: #d97c00; }
.btn-danger-ghost {
  background: transparent; color: var(--red); border: 1px solid transparent;
  padding: 4px 8px; font-weight: 600;
}
.btn-danger-ghost:hover { background: var(--red-bg); }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ---- forms ---- */
label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > div { flex: 1; min-width: 120px; }

/* ---- entry / data tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- pills / badges ---- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill-cat { background: var(--slate-bg); color: var(--muted); }
.pill-work { background: #e7ecff; color: var(--brand-dark); }
.pill-overtime { background: #ede0ff; color: #6741d9; }
.pill-leave, .pill-holiday, .pill-sick { background: var(--amber-bg); color: var(--amber); }
.pill-billable { background: var(--green-bg); color: var(--green); }
.pill-internal { background: var(--slate-bg); color: var(--muted); }
.pill-issue { background: var(--red-bg); color: var(--red); }
.pill-due-over { background: var(--red-bg); color: var(--red); }
.status { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.status-draft { background: var(--slate-bg); color: var(--muted); }
.status-submitted { background: #e7ecff; color: var(--brand-dark); }
.status-approved { background: var(--green-bg); color: var(--green); }
.status-changes_requested { background: var(--amber-bg); color: var(--amber); }

/* ---- hours bar ---- */
.hoursbar-wrap { margin: 8px 0 4px; }
.hoursbar { height: 14px; background: var(--slate-bg); border-radius: 999px; overflow: hidden; }
.hoursbar > span { display: block; height: 100%; background: var(--brand); width: 0; transition: width .25s; }
.hoursbar.full > span { background: var(--green); }
.hoursbar.over > span { background: var(--amber); }
.hours-label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.hours-label b { color: var(--ink); }

/* ---- comments thread ---- */
.thread { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.msg { padding: 10px 14px; border-radius: 10px; background: var(--slate-bg); max-width: 80%; }
.msg .who { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.msg .when { font-size: 11px; color: var(--muted); float: right; }
.msg.from-manager { background: var(--amber-bg); align-self: flex-start; }
.msg.from-employee { background: #e7ecff; align-self: flex-end; }

/* ---- misc ---- */
.muted { color: var(--muted); }
.right { text-align: right; }
.flex { display: flex; gap: 12px; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.empty { color: var(--muted); text-align: center; padding: 28px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--red); }

/* Slim top progress bar driven by api() — global "something's loading" cue. */
#loadbar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 9999;
  background: var(--brand); box-shadow: 0 0 8px rgba(59,91,219,.6);
  opacity: 0; pointer-events: none;
}
.split { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

/* ---- tools hub ---- */
.tools-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 20px; }
@media (min-width: 1100px) { .tools-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px) { .tools-grid { grid-template-columns: 1fr; } }
.tool-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; text-decoration: none; color: var(--ink);
  transition: border-color .12s, transform .12s;
}
.tool-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.tool-icon {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
  background: var(--slate-bg); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.tool-body { flex: 1; min-width: 0; }
.tool-body p { margin: 4px 0 0; font-size: 13px; }
.tool-open { align-self: center; color: var(--brand); font-weight: 600; white-space: nowrap; }
.queue-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 8px; cursor: pointer; background: #fff;
}
.queue-item:hover { border-color: var(--brand); }
.queue-item.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(59,91,219,.15); }
.queue-item .meta { font-size: 13px; color: var(--muted); }
.queue-item input[type=checkbox] { width: auto; margin-right: 4px; }

/* tabs (manager queue filter) */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer;
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tab .n { opacity: .8; }

/* badge */
.badge {
  display: inline-block; min-width: 18px; padding: 1px 7px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 700; text-align: center;
}

/* day strips (missing-day on employee, week context on manager) */
.daystrip { display: flex; gap: 6px; flex-wrap: wrap; }
.daychip {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px;
  text-align: center; cursor: pointer; min-width: 58px; background: #fff;
}
.daychip .dow { font-weight: 700; }
.daychip .st { font-size: 10px; color: var(--muted); }
.daychip.miss { border-color: var(--amber); background: var(--amber-bg); }
.daychip.miss .st { color: var(--amber); font-weight: 700; }
.daychip.ok { border-color: var(--green); }
.daychip.ok .st { color: var(--green); }

/* table wrappers scroll inside their card instead of pushing the whole page */
.tablewrap { overflow-x: auto; }

/* horizontal bar charts (Insights) — no chart library, just CSS */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 120px; gap: 10px; align-items: center; }
.bar-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--slate-bg); border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 6px; transition: width .3s; }
.bar-fill.bill { background: var(--green); }
.bar-val { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.winbtn {
  padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff;
  color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; margin-left: 4px;
}
.winbtn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (max-width: 640px) { .bar-row { grid-template-columns: 92px 1fr 84px; } }

/* checklist progress + rows */
.prog { height: 10px; background: var(--slate-bg); border-radius: 999px; overflow: hidden; margin: 6px 0; }
.prog > span { display: block; height: 100%; background: var(--brand); transition: width .25s; }
.prog.full > span { background: var(--green); }
.grouphead { margin: 16px 0 4px; padding-top: 10px; border-top: 2px solid var(--line);
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.grouphead:first-child { border-top: none; padding-top: 0; margin-top: 4px; }
.checkrow { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rowhead { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.checkrow:last-child { border-bottom: none; }
.checkrow input[type=checkbox] { width: auto; margin-top: 3px; transform: scale(1.25); cursor: pointer; }
.checkrow .ttl { flex: 1; }
.checkrow.done .ttl b { color: var(--muted); text-decoration: line-through; }
.checkrow .who { font-size: 12px; color: var(--green); }
.checkmeta { font-size: 12px; color: var(--muted); }

/* client doc rendered body */
.doc .docbody p { margin: 6px 0; }
.doc .docbody ul { margin: 6px 0; padding-left: 20px; }
.doc .docbody li { margin: 2px 0; }
.doc .docbody table { margin: 8px 0; }
.doc .docbody th { font-size: 12px; }
.doc .docbody { white-space: normal; }

/* notification bell + panel */
.notif-wrap { position: relative; display: inline-flex; }
.notif-bell { background: transparent; border: none; font-size: 18px; cursor: pointer; padding: 2px 4px; position: relative; line-height: 1; }
.notif-bell:hover { background: transparent; }
.notif-bell .badge { position: absolute; top: -3px; right: -5px; min-width: 16px; padding: 0 5px; font-size: 11px; }
.notif-panel { position: absolute; right: 0; top: 34px; width: 320px; max-height: 420px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 60; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #eef2ff; }
.notif-viewall { display: block; text-align: center; padding: 10px; font-size: 13px; font-weight: 600; border-top: 1px solid var(--line); }
.notif-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-row:last-child { border-bottom: none; }
.notif-row.unread { background: #eef2ff; }

/* Asana-style notifications feed */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 50%; font-size: 12px; font-weight: 800; letter-spacing: .3px; }
.notif-daygroup { padding: 12px 16px 4px; font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); }
.notif-item2 { display: flex; align-items: center; gap: 12px; padding: 11px 16px; cursor: pointer; border-left: 3px solid transparent; }
.notif-item2:hover { background: var(--slate-bg); }
.notif-item2.active { background: var(--slate-bg); border-left-color: var(--brand); }
.notif-item2.unread { background: #eef2ff; }
.notif-item2.unread:hover { background: #e4ebff; }
.notif-text { font-size: 14px; color: var(--ink); line-height: 1.35; }
.notif-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }

/* wiki page-list rows */
.pagerow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pagerow:last-child { border-bottom: none; }
.pagerow:hover { background: var(--slate-bg); }
.pagerow.active { background: var(--slate-bg); }
.pagerow.active b { color: var(--brand-dark); }

/* editable spreadsheet grid */
.gridtbl td, .gridtbl th { padding: 2px 4px; border-bottom: none; }
.gridtbl input { padding: 5px 7px; }
#textEditor textarea { width: 100%; }

/* expand-to-read modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,30,60,.45);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 40px 16px; overflow: auto;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 900px; padding: 26px 32px;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal .docbody { font-size: 15px; line-height: 1.6; }
.modal .docbody p { margin: 8px 0; }
.modal .docbody ul { margin: 8px 0; padding-left: 22px; }

/* responsive: tighten padding and let rows wrap on small screens */
@media (max-width: 640px) {
  .container { padding: 14px; }
  .topbar { padding: 10px 14px; }
  .card { padding: 14px; }
  table { font-size: 13px; }
  th, td { padding: 8px 8px; }
  .row > div { min-width: 100%; }          /* form fields stack */
  .navlinks { gap: 10px; }
  .whoami { display: none; }
}
