:root {
  --bg: #f5f7f9;
  --ink: #16202a;
  --muted: #66727f;
  --line: #dbe2e8;
  --panel: #ffffff;
  --red: #c8102e;
  --red-soft: #fee9ed;
  --teal: #087f83;
  --blue: #2563eb;
  --green: #15803d;
  --amber: #b7791f;
  --gray: #7a8591;
  --shadow: 0 12px 30px rgba(32, 45, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  border-radius: 6px;
  min-height: 38px;
}

button:hover {
  border-color: #9fb0c0;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #111820;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--red);
  border-radius: 6px;
  font-weight: 800;
  font-size: 24px;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle {
  color: #b6c2ce;
  font-size: 13px;
  margin-top: 4px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dce5ee;
  background: transparent;
  border-color: transparent;
  justify-content: flex-start;
  padding: 10px 12px;
}

.nav-tab.active {
  background: #26323f;
  border-color: #344556;
}

.icon {
  width: 24px;
  text-align: center;
  font-weight: 700;
}

.filters {
  display: grid;
  gap: 16px;
  border-top: 1px solid #2c3946;
  padding-top: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: #cad5df;
  font-size: 13px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

.topbar p,
.panel-head span {
  color: var(--muted);
  margin-top: 7px;
  font-size: 13px;
}

.searchbar {
  width: min(420px, 42vw);
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.searchbar input {
  border: none;
  padding-left: 0;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  max-width: 760px;
}

.login-box,
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
}

.login-box input {
  width: 190px;
  border: none;
  padding: 6px 8px;
}

.login-box input[type="password"] {
  width: 120px;
}

.user-chip span {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.kpi .label {
  color: var(--muted);
  font-size: 13px;
}

.kpi .value {
  font-size: 30px;
  font-weight: 800;
  margin-top: 8px;
}

.kpi .hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel.wide {
  min-width: 0;
}

.panel.full {
  grid-column: 1 / -1;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 18px;
}

.bar-list,
.workload,
.focus-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 180px) 1fr 52px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.bar-track {
  height: 10px;
  background: #edf1f5;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--teal));
}

.donut-wrap {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  align-items: center;
}

.donut {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(var(--red) 0 30%, var(--amber) 30% 55%, var(--blue) 55% 75%, var(--gray) 75% 100%);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 33px;
  background: #fff;
  border-radius: 50%;
}

.legend {
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.legend-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.legend-key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.work-row,
.focus-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.work-row {
  display: grid;
  grid-template-columns: 72px 1fr 48px;
  gap: 10px;
  align-items: center;
}

.focus-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.gantt-list {
  display: grid;
  gap: 10px;
}

.gantt-row {
  display: grid;
  grid-template-columns: minmax(190px, 280px) 1fr;
  gap: 14px;
  align-items: center;
}

.gantt-label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.gantt-label strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-label span {
  color: var(--muted);
  font-size: 12px;
}

.gantt-track {
  position: relative;
  height: 18px;
  background: #edf1f5;
  border-radius: 999px;
  overflow: hidden;
}

.gantt-bar {
  position: absolute;
  top: 3px;
  bottom: 3px;
  min-width: 8px;
  border-radius: 999px;
  background: #cfe8ea;
  overflow: hidden;
}

.gantt-bar.overdue {
  background: #f8c7cf;
}

.gantt-progress {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--teal);
}

.gantt-bar.overdue .gantt-progress {
  background: var(--red);
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.segmented {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-radius: 0;
  padding: 0 14px;
}

.segmented button.active {
  background: #17212b;
  color: #fff;
}

.primary-btn {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  padding: 0 16px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.project-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.project-card header {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 12px;
  padding: 14px;
  align-items: start;
}

.avatar {
  width: 84px;
  height: 84px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e9eef3;
  color: var(--red);
  font-size: 22px;
  font-weight: 800;
  overflow: hidden;
  border: 1px solid transparent;
}

.avatar.has-image {
  background: #fff;
  border-color: var(--line);
  padding: 4px;
}

.avatar.has-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project-title {
  font-weight: 800;
  line-height: 1.35;
  white-space: pre-line;
}

.project-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 28px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.badge.risk {
  background: var(--red-soft);
  color: var(--red);
}

.progress-line {
  height: 7px;
  background: #edf1f5;
}

.progress-line span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.image-upload-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}

.image-upload-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.image-upload-row input[type="file"] {
  width: 100%;
}

.image-preview {
  width: 140px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f4f7fa;
  color: var(--muted);
  font-size: 12px;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-scale-row {
  display: grid;
  grid-template-columns: 120px minmax(180px, 1fr) 56px;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.image-scale-row input {
  width: 100%;
}

.image-scale-row strong {
  color: var(--ink);
  text-align: right;
}

.card-body {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.summary-text {
  color: #334250;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-line;
}

.project-report {
  color: #334250;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  min-height: 160px;
  max-height: 260px;
  overflow: auto;
}

.report-line {
  margin-bottom: 8px;
}

.report-groups {
  display: grid;
  gap: 8px;
}

.report-group {
  display: grid;
  gap: 4px;
}

.report-owner {
  color: var(--red);
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.report-owner em {
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
  font-size: 11px;
}

.report-row {
  display: grid;
  grid-template-columns: 66px 92px minmax(0, 1fr) 104px;
  gap: 8px;
  align-items: start;
  padding: 4px 0;
  border-top: 1px dashed #dbe3ea;
}

.report-status {
  font-weight: 800;
}

.report-row.risk .report-status {
  color: var(--red);
}

.report-row.doing .report-status {
  color: var(--amber);
}

.report-node {
  font-weight: 700;
  color: #1f2f3d;
}

.report-note,
.report-date {
  min-width: 0;
  overflow-wrap: anywhere;
}

.report-date {
  color: var(--muted);
}

.report-empty {
  color: var(--muted);
}

.milestones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  background: #eef2f6;
  color: #344250;
  max-width: 100%;
}

.chip.done {
  background: #e8f7ed;
  color: var(--green);
}

.chip.risk {
  background: var(--red-soft);
  color: var(--red);
}

.chip.doing {
  background: #fff3d8;
  color: var(--amber);
}

.chip.pending {
  background: #eef2f6;
  color: var(--gray);
}

.update-layout {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(280px, 390px) 1fr;
  gap: 16px;
}

.update-layout.simple {
  grid-template-columns: minmax(280px, 420px) 1fr;
  margin-top: 16px;
}

.entry-panel {
  padding-bottom: 10px;
}

.entry-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 220px) auto;
  gap: 12px;
  align-items: end;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.entry-actions button {
  padding: 0 12px;
}

.add-project-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.admin-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--ink);
}

.admin-panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.admin-only-disabled {
  opacity: 0.45;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  margin: 8px 0 12px;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.mini-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.mini-form label {
  color: var(--ink);
}

.milestone-board {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.milestone-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(260px, 1.35fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.milestone-row.weekly-reminder {
  border-color: #f1d18a;
  background: #fffaf0;
}

.milestone-row.weekly-reminder.missing-note {
  border-color: #f0a4af;
  background: #fff5f6;
}

.milestone-name {
  font-weight: 800;
  line-height: 1.35;
}

.reminder-chip {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ffe4e8;
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.milestone-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.status-switch {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.status-btn {
  min-height: 32px;
  padding: 0 6px;
  font-size: 12px;
  white-space: nowrap;
}

.status-btn.active {
  background: #17212b;
  border-color: #17212b;
  color: #fff;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.row-actions button {
  padding: 0 10px;
}

.stacked {
  color: var(--ink);
  margin-bottom: 14px;
}

.input-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 10px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.save-hint {
  min-height: 20px;
  margin-top: 10px;
  color: var(--teal);
  font-size: 13px;
}

.access-panel {
  max-width: 720px;
}

.request-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.request-list {
  display: grid;
  gap: 10px;
}

.request-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.request-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.reminder-panel {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #f1d18a;
  border-radius: 8px;
  background: #fff8e6;
  color: #5f4100;
  font-size: 13px;
}

.reminder-panel.urgent {
  border-color: #f0a4af;
  background: #fff0f2;
  color: #8a1026;
}

.output-panel {
  min-width: 0;
}

.output {
  min-height: 430px;
  background: #fbfcfd;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .filters {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-grid,
  .project-grid,
  .update-layout {
    grid-template-columns: 1fr;
  }

  .gantt-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .top-actions {
    justify-content: flex-start;
    max-width: none;
    width: 100%;
  }

  .milestone-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .toolbar {
    flex-direction: column;
  }

  .searchbar {
    width: 100%;
  }

  .login-box,
  .user-chip {
    width: 100%;
  }

  .login-box input {
    width: 100%;
  }

  .entry-toolbar,
  .status-switch {
    grid-template-columns: 1fr;
  }

  .entry-actions {
    justify-content: flex-start;
  }

  .mini-form {
    grid-template-columns: 1fr;
  }

  .kpi-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
  }

  .input-grid {
    grid-template-columns: 1fr;
  }

  .image-upload-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .image-preview {
    width: 100%;
    height: 160px;
  }

  .image-scale-row {
    grid-template-columns: 1fr;
  }

  .image-scale-row strong {
    text-align: left;
  }

  .bar-row {
    grid-template-columns: 1fr 1fr 44px;
  }

  .report-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .report-owner {
    display: grid;
  }

  .request-row,
  .request-item {
    grid-template-columns: 1fr;
  }

}
