* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7f8;
  color: #172124;
}
.hidden { display: none !important; }
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: #ffffff;
  border-bottom: 1px solid #dde5e8;
  position: sticky;
  top: 0;
  z-index: 5;
}
h1, h2, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
#entryHint { margin-top: 4px; color: #5b6b72; font-size: 13px; }
button, select, input, textarea {
  height: 36px;
  border: 1px solid #b9c7cc;
  background: #ffffff;
  color: #172124;
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}
textarea {
  height: auto;
  min-height: 72px;
  padding: 9px 10px;
  resize: vertical;
}
label {
  display: grid;
  gap: 6px;
  color: #46565c;
  font-size: 13px;
}
button {
  border-color: #087ea4;
  background: #087ea4;
  color: #ffffff;
  cursor: pointer;
}
button.secondary {
  border-color: #b9c7cc;
  background: #ffffff;
  color: #172124;
}
button:disabled { opacity: .65; cursor: progress; }
main { padding: 18px; max-width: 1200px; margin: 0 auto; }
.home-panel {
  background: #ffffff;
  border: 1px solid #d6e2e6;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.home-head {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px);
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}
.home-user-select { color: #46565c; }
.home-identity {
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7fafb;
  border: 1px solid #e3eaed;
  margin-bottom: 14px;
}
.identity-name {
  font-size: 18px;
  font-weight: 700;
}
.identity-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #075b73;
  background: #edf7fa;
  font-size: 12px;
}
.metric-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e3eaed;
  border-radius: 8px;
}
.metric-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  text-align: left;
}
.metric-table th,
.metric-table td {
  padding: 12px;
  border-bottom: 1px solid #edf1f2;
  white-space: nowrap;
}
.metric-table th {
  color: #5b6b72;
  font-size: 13px;
  background: #f7fafb;
}
.metric-table td {
  font-size: 22px;
  font-weight: 700;
}
.metric-table tbody tr:last-child td { border-bottom: 0; }
.home-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.sub-nav {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
  margin-bottom: 12px;
  background: #f5f7f8;
  border-bottom: 1px solid #dde5e8;
}
.sub-nav .nav-tile {
  flex: 0 0 auto;
  min-width: 116px;
  min-height: 40px;
}
.nav-tile {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #cfe0e5;
  background: #f7fbfc;
  color: #173941;
  font-weight: 700;
  cursor: pointer;
}
.nav-tile:hover {
  border-color: #087ea4;
  color: #075b73;
}
.nav-tile.active {
  border-color: #087ea4;
  background: #e8f6fa;
  color: #075b73;
}
.panel {
  background: #ffffff;
  border: 1px solid #dde5e8;
  border-radius: 8px;
  padding: 16px;
}
.status-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  padding: 0;
  border: 0;
  background: transparent;
}
.label {
  display: block;
  color: #5b6b72;
  font-size: 12px;
  margin-bottom: 6px;
}
strong { font-size: 20px; }
.grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 16px;
}
.hierarchy-panel { margin-bottom: 16px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.hint {
  color: #6a7c82;
  font-size: 13px;
}
.demo-panel { margin-bottom: 16px; }
.demo-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 16px;
}
.demo-form {
  display: grid;
  gap: 12px;
}
.demo-preview {
  display: grid;
  gap: 14px;
  align-content: start;
}
.flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.flow div {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #f0f6f7;
  border: 1px solid #d9e6ea;
  color: #24464f;
  font-size: 13px;
  text-align: center;
}
.demo-card {
  border: 1px solid #e3eaed;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}
.demo-list {
  display: grid;
  gap: 8px;
}
.demo-item {
  border: 1px solid #e3eaed;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
}
.demo-item-title {
  font-weight: 700;
  margin-bottom: 5px;
}
.demo-item-meta {
  color: #6a7c82;
  font-size: 12px;
  line-height: 1.5;
}
.task-panel { margin-bottom: 16px; }
.task-create-card {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid #d6e2e6;
  border-radius: 8px;
  background: #ffffff;
}
.task-create-card h2 {
  margin: 0 0 14px;
  font-size: 17px;
}
.task-create-grid {
  display: grid;
  grid-template-columns: .8fr 1.1fr 1.55fr .6fr 1.1fr .45fr .45fr .6fr;
  gap: 12px;
  align-items: end;
}
.task-create-grid .wide-2 {
  grid-column: span 2;
}
.task-create-grid button {
  min-width: 120px;
}
.task-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e3eaed;
  border-radius: 8px;
}
.task-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  text-align: left;
}
.task-table th,
.task-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f2;
  vertical-align: top;
  font-size: 13px;
}
.task-table th {
  color: #5b6b72;
  background: #f7fafb;
  white-space: nowrap;
}
.task-table tbody tr:last-child td { border-bottom: 0; }
.task-link {
  height: auto;
  min-height: 0;
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #075b73;
  font-weight: 700;
  text-align: left;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #24464f;
  background: #edf1f2;
  font-size: 12px;
  white-space: nowrap;
}
.status-active { background: #edf7fa; color: #075b73; }
.status-paused { background: #fff5dc; color: #7a5412; }
.status-handover { background: #eef2ff; color: #33458f; }
.status-pending { background: #f0f6f7; color: #24464f; }
.status-done { background: #edf7ef; color: #236335; }
.warn-dot {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff5dc;
  color: #7a5412;
  font-size: 12px;
  white-space: nowrap;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 33, 36, .38);
}
.task-detail-modal {
  width: min(1080px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 8px;
  border: 1px solid #dde5e8;
  background: #ffffff;
  padding: 16px;
}
.task-detail-body {
  display: grid;
  gap: 14px;
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.detail-actions .active-action {
  border-color: #087ea4;
  background: #087ea4;
  color: #ffffff;
}
.task-action-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d9e6ea;
  border-radius: 8px;
  background: #f7fafb;
}
.compact-head {
  margin-bottom: 0;
}
.compact-head h3 {
  margin: 0;
  font-size: 15px;
}
.task-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.wide-field {
  grid-column: 1 / -1;
}
.action-hint {
  padding: 8px 10px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e3eaed;
}
.detail-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.detail-stats > div {
  padding: 10px 12px;
  border: 1px solid #e3eaed;
  border-radius: 8px;
  background: #f7fafb;
}
.detail-stats strong {
  display: block;
  font-size: 16px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.detail-block {
  border: 1px solid #e3eaed;
  border-radius: 8px;
  padding: 12px;
}
.detail-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.detail-item {
  padding: 9px 0;
  border-bottom: 1px solid #edf1f2;
}
.detail-item:last-child { border-bottom: 0; }
.detail-item.compact {
  color: #46565c;
  font-size: 13px;
}
.tree, .people { min-height: 280px; }
.empty { color: #6a7c82; }
.management-tree {
  display: grid;
  gap: 12px;
}
.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.role-label {
  min-width: 72px;
  color: #5b6b72;
  font-size: 13px;
}
.person-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #edf7fa;
  color: #075b73;
  font-size: 13px;
}
.dept-group {
  border: 1px solid #e3eaed;
  border-radius: 8px;
  overflow: hidden;
}
.dept-group-head {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 10px 12px;
  background: #f7fafb;
  border-bottom: 1px solid #e3eaed;
}
.dept-group-members {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 10px 12px;
}
.member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dept-node {
  padding: 8px 10px;
  border-left: 3px solid #087ea4;
  background: #f7fafb;
  margin-bottom: 8px;
}
.dept-meta, .person-meta {
  color: #6a7c82;
  font-size: 12px;
  margin-top: 4px;
}
.person {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #edf1f2;
}
.person:last-child { border-bottom: 0; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 8px;
  background: #172124;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.toast.show { opacity: 1; }
@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  main { padding: 12px; }
  .home-head { grid-template-columns: 1fr; align-items: stretch; }
  .home-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-panel, .grid, .demo-layout, .flow, .detail-stats, .detail-grid, .task-action-grid, .task-create-grid { grid-template-columns: 1fr; }
  .task-create-grid .wide-2 { grid-column: auto; }
  .dept-group-head, .dept-group-members { grid-template-columns: 1fr; }
  button, select, input, textarea { width: 100%; }
  .task-link { width: auto; }
  .section-head, .section-actions { align-items: stretch; flex-direction: column; }
}
