/* Mô hình "công ty": Hôm nay (sổ việc), Văn phòng (mặt bằng các phòng), Nhân sự (hồ sơ nhân viên), Bộ não.
   Dùng lại thẻ kính, nút và màu của tokens.css và style.css; file này chỉ thêm dòng việc, mặt bằng, bàn làm việc và đèn trạng thái. */
body[data-view=today] #view-today, body[data-view=office] #view-office, body[data-view=team] #view-team, body[data-view=brain] #view-brain { display: block; }
/* Bốn màn này nhìn cả công ty, không theo một Page hay một khoảng ngày nên ẩn thanh ngữ cảnh */
body:is([data-view=today], [data-view=office], [data-view=team], [data-view=brain]) .ctx,
body:is([data-view=today], [data-view=office], [data-view=team], [data-view=brain]) .banner:not(.blocked) { display: none; }
@media (min-width: 900px) and (min-height: 700px) {
  body:is([data-view=today], [data-view=office], [data-view=team], [data-view=brain]) { --stick: var(--top-h); }
}
#today-body > * + *, #team-body > * + *, #office-body > * + * { margin-top: 16px; }
.office { max-width: 1180px; margin: 0 auto; }
.office > * + * { margin-top: 16px; }
.headline.tone-info { color: var(--ink); }
.modes-data { flex: none; }

/* Đèn trạng thái: luôn đi kèm chữ, màu chỉ là tín hiệu phụ. Đặc = đang chạy hoặc chờ bạn; rỗng = bị chặn hoặc đang tắt */
.lamp { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.lamp.s-working { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.lamp.s-approve { background: var(--honey); box-shadow: 0 0 0 3px color-mix(in srgb, var(--honey) 24%, transparent); }
.lamp.s-attention { background: transparent; border: 2.5px solid var(--bad); }
.lamp.s-error { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.lamp.s-blocked { background: transparent; border: 2px dashed var(--muted); }
.lamp.s-off { background: var(--line); }
@media (prefers-reduced-motion: no-preference) {
  .desk .lamp.s-approve, .desk .lamp.s-error { animation: lamp 2.4s ease-out 3; }
}
@keyframes lamp { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 50%, transparent); } 70%, 100% { box-shadow: 0 0 0 9px transparent; } }

/* ---------- Hôm nay: mỗi dòng một việc */
.today-group h2 { display: inline-flex; align-items: center; gap: 10px; }
.today-group.g-approve { border-color: color-mix(in srgb, var(--honey) 45%, var(--line)); }
.jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.job { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto auto; gap: 6px 16px; align-items: center; padding: 12px 14px; border-radius: 14px;
  background: var(--card-2); border: 1px solid var(--line-soft); }
.job-who { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; color: var(--muted); }
.job-who .ico { width: 16px; height: 16px; flex: none; }
.job h3 { font-size: 15px; margin: 0 0 2px; overflow-wrap: anywhere; }
.job p { color: var(--muted); max-width: 70ch; }
.job p b { color: var(--ink); font-weight: 650; }
.job-amt { font-family: var(--display); font-size: 16px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--honey); }
.job-time { white-space: nowrap; }
.job.tone-bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.job.tone-bad h3 { color: var(--bad); }
a.job-go { color: var(--accent); font-weight: 650; white-space: nowrap; padding: 6px 4px; text-underline-offset: 3px; }
.g-running .job, .g-done .job { background: none; }

/* ---------- Văn phòng: mặt bằng. Mỗi phòng là một ô có nền kẻ ô như bản vẽ, mỗi bàn là một nút bấm */
.floor { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.room { grid-column: span 4; border-radius: 18px; padding: 16px 18px 18px; border: 1px solid var(--line); border-top: 3px solid color-mix(in srgb, var(--accent) 60%, var(--line));
  background-color: var(--card-2);
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 28px 28px; background-position: -1px -1px; }
.room > * + * { margin-top: 12px; }
.room-channel:not(.closed) { grid-column: span 7; }
.room-shared { grid-column: span 5; }
.room.closed { border-style: dashed; border-top-width: 1px; background-image: none; color: var(--muted); }
.room-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.room-head h2 { margin: 0; font-size: 17px; }
.room-note { display: flex; align-items: baseline; gap: 10px; }
.room-note .lamp { transform: translateY(-1px); }
.room-links { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.desks { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
button.desk { --tone: var(--muted); display: grid; grid-template-columns: 42px minmax(0, 1fr); grid-template-areas: "face name" "face state" "text text"; gap: 2px 12px; align-items: center;
  text-align: left; white-space: normal; font-weight: 400; min-height: 0; padding: 14px 14px 13px; border-radius: 14px;
  background: var(--card-solid); color: var(--ink); border: 1px solid var(--line); border-bottom: 3px solid var(--tone); box-shadow: var(--shadow); }
button.desk:hover { filter: none; border-color: var(--accent); border-bottom-color: var(--tone); box-shadow: 0 0 0 4px var(--accent-soft); }
.desk.s-working { --tone: var(--good); }
.desk.s-approve { --tone: var(--honey); }
.desk.s-attention, .desk.s-error { --tone: var(--bad); }
.desk .desk-face { grid-area: face; }
.desk-face { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.desk-face .ico { width: 22px; height: 22px; }
.desk-name { grid-area: name; font-weight: 650; font-size: 15px; }
.desk-state { grid-area: state; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; color: var(--muted); }
.desk-text { grid-area: text; margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 12px; }
.legend li { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Nhân sự: hồ sơ từng nhân viên, xếp theo bộ phận */
.person { padding: 16px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line-soft); scroll-margin-top: calc(var(--stick, 60px) + 12px); }
.person > * + * { margin-top: 12px; }
.person.focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.person-head { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.person-head h3 { margin: 0; font-size: 16px; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag-ai { font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.person-head .state { display: inline-flex; align-items: center; gap: 8px; }
.state.st-approve { color: var(--honey); background: color-mix(in srgb, var(--honey) 16%, transparent); }
.state.st-working { color: var(--good); background: var(--good-soft); }
.state.st-attention, .state.st-error { color: var(--bad); background: var(--bad-soft); }
.person-goal { max-width: 70ch; }
.person-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.person-lines li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; }
.person-lines .lamp { transform: translateY(1px); }
.person-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px 28px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.person-cols h4 { margin: 0 0 8px; font-size: 12px; font-weight: 650; color: var(--muted); }
.skill-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.skill-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; }
.skill-list small { grid-column: 1 / -1; color: var(--warn); font-size: 12px; }
.level { font-size: 11px; font-weight: 650; padding: 1px 8px; border-radius: 999px; white-space: nowrap; background: var(--line-soft); color: var(--muted); }
.level.l-propose { background: color-mix(in srgb, var(--honey) 16%, transparent); color: var(--honey); }
.level.l-auto { background: var(--good-soft); color: var(--good); }
.person-facts { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 13px; align-content: start; }
.person-facts dt { color: var(--muted); font-weight: 650; font-size: 12px; white-space: nowrap; }
.person-facts dd { margin: 0; }
.dept > .person + .person { margin-top: 12px; }
.humans { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.human { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line-soft); }
.human .desk-face { width: 32px; height: 32px; border-radius: 50%; }
.human .desk-face .ico { width: 17px; height: 17px; }
.brain-users { margin: 0; padding-left: 18px; display: grid; gap: 6px; max-width: 74ch; }

@media (max-width: 980px) {
  .room, .room-channel:not(.closed), .room-shared { grid-column: span 12; }
  .room.closed { grid-column: span 6; }
}
@media (max-width: 760px) {
  /* Màn hẹp: dải phần của công ty xuống dòng riêng dưới thanh trên, chia đều và cuộn ngang được khi quá chật */
  .top { flex-wrap: wrap; }
  .top .modes { order: 9; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .top .modes button { flex: 1 0 auto; padding: 4px 8px; }
  .ctx .modes-data { width: 100%; }
  .ctx .modes-data button { flex: 1; }
}
@media (max-width: 640px) {
  /* Điện thoại: mỗi việc xếp dọc (ai làm, việc gì, bao nhiêu tiền, nút mở) để số tiền không bị nút che */
  .job { grid-template-columns: minmax(0, 1fr); }
  .job > span:empty { display: none; }
  .job-amt { white-space: normal; }
  .job-go { justify-self: start; }
  .room.closed { grid-column: span 12; }
  .person-cols { grid-template-columns: minmax(0, 1fr); }
  .person-head { grid-template-columns: 42px minmax(0, 1fr); }
  .person-head .state { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 480px) {
  /* Năm phần của công ty phải nằm vừa một hàng trên điện thoại, không bắt cuộn ngang mới thấy "Số liệu" */
  body .top .seg.modes button { flex: 1 1 auto; padding: 4px 4px; font-size: 13px; }
}
