:root{
  --bg:#f7f8fc;
  --surface:#ffffff;
  --surface-2:#f9fafc;
  --text:#1f2430;
  --muted:#7b8190;
  --line:#e8eaf0;
  --brand:#6c5ce7;
  --brand-2:#8b7cf6;
  --brand-soft:#f0edff;
  --blue:#3b82f6;
  --green:#19a974;
  --green-soft:#e9fbf4;
  --yellow:#f4b740;
  --yellow-soft:#fff7df;
  --red:#e85d5d;
  --red-soft:#fff0f0;
  --orange:#ff8a3d;
  --shadow:0 8px 26px rgba(30,34,50,.055);
}
*{box-sizing:border-box}
html{background:var(--bg)}
body{margin:0;font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;background:var(--bg);color:var(--text);font-size:14px}
a{color:inherit;text-decoration:none}
.topbar{
  height:68px;background:rgba(255,255,255,.96);backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;
  padding:0 22px;position:sticky;top:0;z-index:30
}
.top-left,.top-actions,.user-chip,.file-meta,.file-actions,.page-head{display:flex;align-items:center}
.top-left{gap:11px}
.brandmark{width:34px;height:34px;border-radius:10px;background:linear-gradient(135deg,var(--brand),#4f46e5);display:grid;place-items:center;color:#fff;font-weight:900;box-shadow:0 5px 14px rgba(108,92,231,.24)}
.brand-title{font-weight:800;font-size:14px}.brand-sub{font-size:11px;color:var(--muted);margin-top:1px}
.top-actions{gap:10px}
.icon-btn{width:38px;height:38px;border:1px solid var(--line);border-radius:11px;display:grid;place-items:center;background:#fff;position:relative}
.icon-btn:hover{background:var(--surface-2)}
.notif-badge{position:absolute;right:-5px;top:-5px;background:var(--red);color:#fff;border:2px solid #fff;border-radius:99px;min-width:20px;height:20px;padding:0 5px;font-size:10px;font-weight:800;display:grid;place-items:center}
.hidden{display:none!important}
.user-chip{gap:9px;background:var(--surface-2);border:1px solid var(--line);padding:5px 9px 5px 5px;border-radius:12px}
.user-chip .avatar{width:30px;height:30px;border-radius:9px;background:linear-gradient(135deg,#60a5fa,#6366f1);color:#fff;display:grid;place-items:center;font-weight:800}
.user-chip strong{display:block;font-size:12px}.user-chip span{display:block;font-size:10px;color:var(--muted)}
.ghost-link{font-size:12px;color:var(--muted);font-weight:700;padding:9px 10px}
.shell{display:grid;grid-template-columns:220px minmax(0,1fr);min-height:calc(100vh - 68px)}
.sidebar{background:#fff;border-right:1px solid var(--line);padding:18px 12px;position:sticky;top:68px;height:calc(100vh - 68px);overflow:auto}
.side-section{margin-bottom:22px}.side-label{font-size:10px;letter-spacing:.09em;text-transform:uppercase;color:#a0a5b1;font-weight:800;padding:0 10px;margin-bottom:6px}
.sidebar a{display:flex;align-items:center;gap:10px;padding:9px 10px;margin:2px 0;border-radius:9px;color:#4a5060;font-weight:650;position:relative}
.sidebar a span{width:18px;text-align:center}.sidebar a:hover{background:#f6f5ff;color:var(--brand)}.sidebar a.active{background:var(--brand-soft);color:var(--brand)}
.sidebar a em{margin-left:auto;font-style:normal;background:var(--red);color:#fff;padding:2px 6px;border-radius:99px;font-size:10px}
.main{padding:28px 30px 50px;max-width:1480px;width:100%;margin:0 auto}
h1{font-size:28px;letter-spacing:-.03em;margin:0 0 5px}h2{font-size:17px;margin:0 0 14px}h3{font-size:14px;margin:0}
.sub{color:var(--muted);margin-bottom:20px}.page-head{justify-content:space-between;gap:20px;margin-bottom:20px}
.grid{display:grid;gap:16px}.grid4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid2{grid-template-columns:repeat(2,minmax(0,1fr))}
.card{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:18px;box-shadow:var(--shadow)}
.stat{position:relative;overflow:hidden}.stat:after{content:"";position:absolute;width:65px;height:65px;border-radius:50%;right:-20px;top:-20px;background:var(--brand-soft)}
.stat .label{color:var(--muted);font-size:12px}.stat .n{font-size:30px;font-weight:850;margin-top:8px;letter-spacing:-.04em}
.btn{display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:9px;background:var(--brand);color:#fff;padding:10px 14px;font-weight:750;cursor:pointer;box-shadow:0 4px 12px rgba(108,92,231,.13)}
.btn:hover{filter:brightness(.98)}.btn.secondary{background:#f2f0ff;color:var(--brand);box-shadow:none}.btn.danger{background:var(--red-soft);color:#b93838;box-shadow:none}.btn.success{background:var(--green-soft);color:#087a52;box-shadow:none}.btn.small{padding:7px 9px;font-size:11px}
.actions{display:flex;gap:8px;flex-wrap:wrap}
table{width:100%;border-collapse:collapse}th,td{padding:12px 10px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}th{font-size:10px;color:#9aa0ad;text-transform:uppercase;letter-spacing:.07em}
.tasktitle{font-weight:800}.muted{color:var(--muted)}
.badge{display:inline-flex;padding:5px 8px;border-radius:999px;background:#f1f2f5;color:#59606f;font-size:10px;font-weight:800}
.badge.urgent{background:var(--red-soft);color:#bb3e3e}.badge.pending{background:var(--yellow-soft);color:#936914}.badge.closed{background:var(--green-soft);color:#087a52}
form .row{display:grid;grid-template-columns:1fr 1fr;gap:12px}.field{margin-bottom:13px}.field label{display:block;font-size:12px;font-weight:750;margin-bottom:6px}
.field input,.field select,.field textarea{width:100%;padding:10px 11px;border:1px solid #dfe2e8;border-radius:9px;background:#fff;font:inherit;outline:none}
.field input:focus,.field select:focus,.field textarea:focus{border-color:#b5abff;box-shadow:0 0 0 3px rgba(108,92,231,.09)}
.field textarea{min-height:105px;resize:vertical}
.alert{padding:11px 13px;border-radius:9px;margin:0 0 14px;font-size:12px}.alert.success{background:var(--green-soft);color:#087a52}.alert.error{background:var(--red-soft);color:#a63636}.alert.info{background:#eef6ff;color:#2d5fa8}
.split{display:flex;align-items:center;justify-content:space-between;gap:16px}.pill{padding:10px 11px;background:var(--surface-2);border:1px solid var(--line);border-radius:10px}
.timeline{border-left:2px solid #eceef3;margin-left:6px;padding-left:16px}.event{margin:0 0 16px}.event small{color:#a0a5b1;font-size:10px}.event strong{display:block;margin-bottom:3px}
.file-row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:11px;background:var(--surface-2);border:1px solid var(--line);border-radius:10px;margin-bottom:8px}
.file-meta{gap:10px;min-width:0}.file-meta strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:420px}.file-icon{width:34px;height:34px;border-radius:8px;background:#eef2ff;display:grid;place-items:center}
.file-actions{gap:7px;flex-shrink:0}
.notification-row{display:flex;gap:12px;padding:14px 10px;border-bottom:1px solid var(--line);border-radius:8px}.notification-row:hover{background:#fafafe}.notification-row.unread{background:#faf9ff}
.notif-dot{width:8px;height:8px;border-radius:50%;background:#d2d6de;margin-top:5px;flex-shrink:0}.notification-row.unread .notif-dot{background:var(--brand)}
.notif-content strong{display:block;margin-bottom:3px}.notif-content div{color:#555d6d}.notif-content small{color:#a0a5b1}
.empty-state{min-height:220px;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--muted);gap:6px}.empty-icon{font-size:32px}
.loginwrap{min-height:100vh;display:grid;place-items:center;padding:30px;background:radial-gradient(circle at 20% 20%,#f0edff,transparent 38%),var(--bg)}
.login{width:min(440px,100%)}.login .card{padding:24px}
@media(max-width:980px){.grid4{grid-template-columns:repeat(2,1fr)}.grid2{grid-template-columns:1fr}.shell{grid-template-columns:190px 1fr}.main{padding:22px}}
@media(max-width:720px){.shell{grid-template-columns:1fr}.sidebar{display:none}.main{padding:16px}.grid4{grid-template-columns:1fr 1fr}.user-chip{display:none}.brand-sub{display:none}.file-row{align-items:flex-start;flex-direction:column}.file-actions{width:100%}.page-head{align-items:flex-start}.topbar{padding:0 14px}}
@media(max-width:480px){.grid4{grid-template-columns:1fr}form .row{grid-template-columns:1fr}.top-actions{gap:4px}}

/* ===== v0.2.1 UI hotfix ===== */
.topbar{
  min-width:0;
  gap:18px;
}
.top-left{
  flex:0 0 auto;
  min-width:190px;
}
.top-actions{
  margin-left:auto;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:10px!important;
  flex-wrap:nowrap!important;
  min-width:0;
}
.icon-btn{
  flex:0 0 38px;
}
.user-chip{
  flex:0 0 auto;
  min-width:0;
  white-space:nowrap;
}
.user-chip > div:last-child{
  min-width:0;
}
.user-chip strong{
  max-width:180px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.user-chip span{
  white-space:nowrap;
}
.ghost-link{
  flex:0 0 auto;
  white-space:nowrap;
}
.sidebar{
  width:220px;
}
.sidebar .side-section + .side-section{
  padding-top:12px;
  border-top:1px solid #f0f1f5;
}
.sidebar a{
  min-height:39px;
}
.main{
  min-width:0;
}
.card{
  overflow:hidden;
}
.stat:nth-child(1){border-top:3px solid #6c5ce7}
.stat:nth-child(2){border-top:3px solid #3b82f6}
.stat:nth-child(3){border-top:3px solid #e85d5d}
.stat:nth-child(4){border-top:3px solid #19a974}

@media(max-width:900px){
  .brand-sub{display:none}
  .user-chip strong{max-width:120px}
}
@media(max-width:760px){
  .user-chip{display:none!important}
  .ghost-link{display:none}
}

/* ===== v0.2.3 Task Discussion ===== */
.task-discussion{overflow:visible}
.discussion-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:14px}
.discussion-head h2{margin-bottom:4px}
.discussion-empty{
  padding:18px;border:1px dashed var(--line);background:var(--surface-2);
  color:var(--muted);border-radius:10px;text-align:center;margin-bottom:14px
}
.message-list{display:flex;flex-direction:column;gap:9px;margin-bottom:16px;max-height:440px;overflow:auto;padding-right:3px}
.task-message{
  max-width:88%;border:1px solid var(--line);border-radius:12px;padding:10px 12px;
  background:#fafbfe
}
.task-message.mine{align-self:flex-end;background:#f2efff;border-color:#ddd7ff}
.task-message.theirs{align-self:flex-start}
.task-message.msg-question{border-left:3px solid var(--orange);background:#fffaf3}
.task-message.msg-reply{border-left:3px solid var(--brand)}
.message-top{display:flex;align-items:center;gap:8px;margin-bottom:5px;font-size:12px}
.message-kind{
  display:inline-flex;padding:3px 7px;border-radius:999px;background:#eef0f5;
  color:var(--muted);font-size:9px;font-weight:800;text-transform:uppercase;letter-spacing:.04em
}
.msg-question .message-kind{background:#fff0dc;color:#a35a16}
.msg-reply .message-kind{background:var(--brand-soft);color:var(--brand)}
.message-body{line-height:1.55;color:#343a48}
.message-time{font-size:10px;color:#a0a5b1;margin-top:6px}
.discussion-form{padding-top:14px;border-top:1px solid var(--line)}
.discussion-type{display:flex;gap:16px;margin-bottom:10px}
.discussion-type label{
  display:flex;align-items:center;gap:6px;font-size:12px;font-weight:700;color:#555d6d;cursor:pointer
}
.discussion-type input{width:auto}
.discussion-form textarea{min-height:82px}
@media(max-width:720px){
  .task-message{max-width:96%}
  .discussion-head{flex-direction:column}
}
/* ===== v0.2.4 Live Web Notifications ===== */
.live-notif-toast{
  position:fixed;right:22px;top:82px;width:min(360px,calc(100vw - 30px));
  z-index:9999;display:flex;align-items:flex-start;gap:11px;padding:13px 14px;
  background:#fff;border:1px solid var(--line);border-radius:13px;
  box-shadow:0 18px 45px rgba(31,36,48,.16);opacity:0;
  transform:translateY(-10px) scale(.98);transition:opacity .2s ease,transform .2s ease
}
.live-notif-toast.show{opacity:1;transform:translateY(0) scale(1)}
.live-notif-icon{
  flex:0 0 34px;width:34px;height:34px;border-radius:9px;display:grid;
  place-items:center;background:var(--brand-soft)
}
.live-notif-copy{min-width:0;display:flex;flex-direction:column;gap:3px}
.live-notif-copy strong{font-size:12px;color:var(--text)}
.live-notif-copy span{
  color:var(--muted);font-size:11px;line-height:1.45;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;max-width:270px
}
@media(max-width:720px){.live-notif-toast{right:15px;top:76px}}

/* ===== v0.3 Professional Task Management ===== */
.task-meta-strip{
  display:flex;gap:18px;flex-wrap:wrap;margin-top:10px;padding-top:10px;
  border-top:1px solid var(--line);font-size:11px;color:var(--muted)
}
.task-meta-strip strong{color:var(--text)}
.task-filters{padding-bottom:14px}
.filter-grid{display:grid;grid-template-columns:2fr repeat(4,minmax(130px,1fr));gap:10px}
.checklist-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.check-percent{font-size:18px;color:var(--brand)}
.check-progress{height:6px;background:#eef0f5;border-radius:999px;overflow:hidden;margin-bottom:12px}
.check-progress span{display:block;height:100%;background:linear-gradient(90deg,var(--brand),var(--brand-2));border-radius:999px}
.check-list{display:flex;flex-direction:column;gap:6px}
.check-row{
  display:flex;align-items:center;gap:9px;padding:9px 8px;border-radius:9px;
  border:1px solid var(--line);background:var(--surface-2)
}
.check-row.done{opacity:.7}
.check-row.done .check-text{text-decoration:line-through}
.check-toggle{
  width:24px;height:24px;border:1px solid #d9dce4;border-radius:7px;background:#fff;
  color:#fff;display:grid;place-items:center;font-weight:900;cursor:pointer;padding:0
}
.check-row.done .check-toggle{background:var(--green);border-color:var(--green)}
.check-toggle.static{cursor:default}
.check-text{flex:1;min-width:0;font-size:12px;font-weight:650}
.check-text small{display:block;color:var(--muted);font-weight:400;margin-top:2px}
.check-delete{border:0;background:transparent;color:#aaa;font-size:18px;cursor:pointer}
.check-delete:hover{color:var(--red)}
.check-add{display:flex;gap:8px;margin-top:12px;padding-top:12px;border-top:1px solid var(--line)}
.check-add input{flex:1;padding:9px 10px;border:1px solid #dfe2e8;border-radius:9px}
.manager-controls{padding:0}
.manager-controls summary{
  list-style:none;display:flex;align-items:center;justify-content:space-between;gap:12px;
  cursor:pointer;padding:16px 18px
}
.manager-controls summary::-webkit-details-marker{display:none}
.manager-controls summary div strong{display:block}
.manager-controls summary div span{display:block;color:var(--muted);font-size:11px;margin-top:2px}
.manager-edit-form{padding:0 18px 18px;border-top:1px solid var(--line);padding-top:16px}
.danger-zone{
  border-top:1px solid #f2dede;background:#fff8f8;padding:14px 18px;border-radius:0 0 14px 14px
}
.danger-zone form{display:flex;gap:8px;margin-top:8px}
.danger-zone input{flex:1;padding:9px 10px;border:1px solid #efcccc;border-radius:9px;background:#fff}
@media(max-width:1100px){
  .filter-grid{grid-template-columns:1fr 1fr 1fr}
}
@media(max-width:720px){
  .filter-grid{grid-template-columns:1fr}
  .check-add,.danger-zone form{flex-direction:column}
}

/* ===== v0.4 Review Checkpoints + Organized Files ===== */
.review-gates .review-head,.organized-files .files-head{
  display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px
}
.review-list{display:flex;flex-direction:column;gap:10px}
.review-item{
  border:1px solid var(--line);border-radius:11px;padding:12px;background:var(--surface-2)
}
.review-item.status-pending{border-left:3px solid var(--yellow)}
.review-item.status-approved{border-left:3px solid var(--green)}
.review-item.status-revision_requested{border-left:3px solid var(--red)}
.review-item-top{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.review-item-top>div{display:flex;align-items:center;gap:8px}
.review-item-top small{color:var(--muted)}
.review-note{margin-top:9px;line-height:1.5}
.review-files{display:flex;flex-direction:column;gap:6px;margin-top:10px}
.mini-file{
  display:flex;justify-content:space-between;gap:10px;padding:8px 9px;
  border:1px solid var(--line);border-radius:8px;background:#fff;font-size:11px
}
.mini-file div{display:flex;gap:9px}.mini-file a{color:var(--brand);font-weight:700}
.manager-review-note{
  margin-top:10px;padding:10px;border-radius:9px;background:var(--brand-soft);font-size:11px
}
.manager-review-note strong{display:block;margin-bottom:4px}
.manager-review-note small{display:block;color:var(--muted);margin-top:5px}
.review-decision-form,.checkpoint-form{margin-top:13px;padding-top:13px;border-top:1px solid var(--line)}
.checkpoint-form h3{margin-bottom:4px}
.file-groups{display:flex;flex-direction:column;gap:15px}
.file-group{padding:12px;border:1px solid var(--line);border-radius:11px;background:var(--surface-2)}
.file-group-title{display:flex;align-items:center;justify-content:space-between;gap:10px}
.file-group-title span{font-size:10px;color:var(--muted)}
.file-group-sub{font-size:10px;margin:3px 0 9px}
.staged-upload-form{margin-top:14px;padding-top:14px;border-top:1px solid var(--line)}
@media(max-width:720px){
  .review-item-top,.mini-file,.file-group-title{flex-direction:column;align-items:flex-start}
}
/* ===== v0.5.1 Task Brief + Review Center ===== */
.time-zone-hint{
  margin:-3px 0 14px;padding:9px 11px;border-radius:8px;
  background:#f5f7ff;color:var(--muted);font-size:11px
}
.brief-mode-banner{
  display:flex;align-items:center;gap:11px;margin-bottom:16px;padding:12px 14px;
  border:1px solid #ddd8ff;border-radius:12px;
  background:linear-gradient(135deg,#faf9ff,#f5f8ff)
}
.brief-mode-icon{
  width:34px;height:34px;border-radius:10px;display:grid;place-items:center;
  background:var(--brand-soft);color:var(--brand);font-weight:900
}
.brief-mode-banner strong{display:block;font-size:13px}
.brief-mode-banner span{display:block;color:var(--muted);font-size:11px;margin-top:2px}

/* Before employee starts: show brief/specs, files, discussion and only Start Work action. */
.employee-task-brief .task-timing-card,
.employee-task-brief .checklist-card,
.employee-task-brief .review-gates,
.employee-task-brief .manager-controls{
  display:none!important
}
.employee-task-brief .task-actions-card{
  text-align:center;padding:14px
}
.employee-task-brief .task-actions-card h2{display:none}
.employee-task-brief .task-actions-card .btn:not(.start-work-icon),
.employee-task-brief .task-actions-card .field,
.employee-task-brief .task-actions-card hr{
  display:none!important
}
.start-work-icon{
  width:44px;height:44px;border-radius:50%;padding:0;
  display:inline-grid;place-items:center;font-size:15px;
  box-shadow:0 7px 20px rgba(108,92,231,.22)
}

/* Manager Review Center */
.review-center-filters{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:16px}
.review-center-filters a{
  padding:8px 11px;border:1px solid var(--line);border-radius:9px;
  background:#fff;color:var(--muted);font-size:11px;font-weight:700
}
.review-center-filters a.active{
  background:var(--brand-soft);border-color:#ddd7ff;color:var(--brand)
}
.review-center-grid{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px
}
.review-center-card{border-left:3px solid #d6d9e2}
.review-center-card.status-pending{border-left-color:var(--yellow)}
.review-center-card.status-approved{border-left-color:var(--green)}
.review-center-card.status-revision_requested{border-left-color:var(--red)}
.review-center-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.review-center-top h2{margin:3px 0 0}
.review-task-id{font-size:10px;color:var(--muted);font-weight:700}
.review-center-meta{
  display:flex;gap:16px;flex-wrap:wrap;margin:12px 0 10px;
  color:var(--muted);font-size:11px
}
.review-center-note{
  padding:11px;border:1px solid var(--line);border-radius:9px;
  background:var(--surface-2);line-height:1.55;margin-bottom:12px
}

/* Manager popup */
.review-modal-backdrop{
  position:fixed;inset:0;z-index:10000;display:grid;place-items:center;padding:20px;
  background:rgba(22,25,35,.32);backdrop-filter:blur(3px);
  opacity:0;transition:opacity .18s ease
}
.review-modal-backdrop.show{opacity:1}
.review-modal{
  position:relative;width:min(480px,100%);background:#fff;border:1px solid var(--line);
  border-radius:16px;padding:22px;box-shadow:0 25px 70px rgba(22,25,35,.24);
  transform:translateY(10px) scale(.985);transition:transform .18s ease
}
.review-modal-backdrop.show .review-modal{transform:translateY(0) scale(1)}
.review-modal-close{
  position:absolute;right:12px;top:10px;width:30px;height:30px;border:0;border-radius:8px;
  background:#f5f6f9;color:#777;cursor:pointer;font-size:18px
}
.review-modal-icon{
  width:44px;height:44px;border-radius:12px;display:grid;place-items:center;
  background:#fff6dd;color:#a56b00;font-size:20px;margin-bottom:10px
}
.review-modal-label{font-size:9px;letter-spacing:.09em;font-weight:900;color:#a56b00}
.review-modal h2{font-size:21px;margin:5px 0 10px}
.review-modal-meta{display:flex;gap:14px;flex-wrap:wrap;color:var(--muted);font-size:11px}
.review-modal-note{
  margin:14px 0;padding:12px;border:1px solid var(--line);border-radius:10px;
  background:var(--surface-2);line-height:1.55
}
.review-modal-actions{display:flex;gap:8px;flex-wrap:wrap}

@media(max-width:900px){
  .review-center-grid{grid-template-columns:1fr}
}