:root {
  --ink: #1a2332;
  --ink-soft: #4a5568;
  --ink-mute: #718096;
  --line: #e2e8f0;
  --surface: #ffffff;
  --bg: #f0f3f7;
  --bg-warm: #f7f5f2;
  --accent: #c45c26;
  --accent-soft: #fdf0e9;
  --teal: #1a6b5a;
  --teal-soft: #e8f4f1;
  --blue: #2b4c7e;
  --warn: #b45309;
  --ok: #047857;
  --danger: #b91c1c;
  --phone-w: 375px;
  --phone-h: 780px;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(26, 35, 50, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Noto Sans SC", "PingFang SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #dce8e4 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, #f0e6dc 0%, transparent 50%),
    linear-gradient(180deg, #e8eef4 0%, var(--bg) 40%, #e4e9ef 100%);
  min-height: 100vh;
  line-height: 1.5;
}

.desk {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}
.desk.wide { max-width: 1400px; }

.brand {
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 8px;
}
.brand.accent { color: var(--accent); }
.brand.blue { color: var(--blue); }

.desk-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 20px;
}
.desk-header h1 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.desk-header p {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 15px;
  max-width: 560px;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  align-items: center;
}
.top-nav .label {
  font-size: 13px;
  color: var(--ink-mute);
  margin-right: 4px;
}
.top-nav a {
  text-decoration: none;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  transition: all 0.15s;
}
.top-nav a:hover { border-color: #a0aec0; }
.top-nav a.active-pm { background: var(--teal); border-color: var(--teal); color: #fff; }
.top-nav a.active-client { background: var(--blue); border-color: var(--blue); color: #fff; }
.top-nav a.active-admin { background: var(--accent); border-color: var(--accent); color: #fff; }

.hint {
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 22px;
}

.stage {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 36px;
  align-items: start;
}
.stage.pc-stage {
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (max-width: 980px) {
  .stage { grid-template-columns: 1fr; justify-items: center; }
  .stage.pc-stage { justify-items: stretch; }
  .desk-header { grid-template-columns: 1fr; }
}

.side-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 4px 24px rgba(26, 35, 50, 0.05);
  min-height: 200px;
  width: 100%;
}
.side-panel h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.side-panel .role-desc {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 20px;
  line-height: 1.6;
}
.mod-list { list-style: none; }
.mod-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
}
.mod-list li:last-child { border-bottom: none; }
.mod-list .num {
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--teal);
  padding-top: 2px;
}
.side-panel.client .mod-list .num { color: var(--blue); }
.side-panel.admin .mod-list .num { color: var(--accent); }
.mod-list .mt { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.mod-list .ms { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.mod-list .note {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 4px;
}
.side-foot {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.6;
}
.side-foot strong { color: var(--ink-soft); }

.side-panel.admin {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 28px 40px;
  align-items: start;
}
.side-panel.admin .mod-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.side-panel.admin .side-foot { grid-column: 1 / -1; margin-top: 0; }
@media (max-width: 900px) {
  .side-panel.admin { grid-template-columns: 1fr; }
  .side-panel.admin .mod-list { grid-template-columns: 1fr; }
}

/* Shared UI bits */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-mute);
  margin: 16px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title:first-child { margin-top: 4px; }

.card-list { display: flex; flex-direction: column; gap: 10px; }

.proj-card, .doc-row, .action-card, .todo-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.proj-card:hover, .doc-row:hover, .action-card:hover, .todo-card:hover {
  border-color: #cbd5e0;
  box-shadow: 0 4px 12px rgba(26, 35, 50, 0.06);
}
.proj-card .name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.proj-card .meta { font-size: 12px; color: var(--ink-mute); }
.proj-card .tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink-soft);
  font-weight: 500;
}
.tag.doing { background: #fef3c7; color: var(--warn); }
.tag.wait { background: #fee2e2; color: var(--danger); }
.tag.done { background: #d1fae5; color: var(--ok); }
.tag.info { background: var(--teal-soft); color: var(--teal); }

.doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
}
.doc-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--bg);
}
.doc-icon.pdf { background: #fef2f2; }
.doc-icon.img { background: #eff6ff; }
.doc-icon.chat { background: #f0fdf4; }
.doc-icon.confirm { background: var(--accent-soft); }
.doc-body { flex: 1; min-width: 0; }
.doc-body .t {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-body .s { font-size: 11px; color: var(--ink-mute); margin-top: 2px; }
.doc-status { font-size: 11px; font-weight: 600; flex-shrink: 0; }
.doc-status.ok { color: var(--ok); }
.doc-status.wait { color: var(--danger); }
.doc-status.pending { color: var(--warn); }

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.action-card { text-align: left; padding: 14px; }
.action-card .ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  font-size: 18px;
  background: var(--teal-soft);
}
.view-client .action-card .ico { background: #e8eef6; }
.action-card .t { font-size: 13px; font-weight: 600; }
.action-card .s { font-size: 11px; color: var(--ink-mute); margin-top: 4px; }

.todo-card { border-left: 3px solid var(--accent); }
.todo-card .t { font-size: 14px; font-weight: 600; }
.todo-card .s { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.todo-card .cta {
  margin-top: 10px;
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.btn {
  appearance: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--teal); color: #fff; width: 100%; }
.view-client .btn-primary { background: var(--blue); }
.btn-ghost {
  background: var(--bg);
  color: var(--ink);
  width: 100%;
  margin-top: 8px;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--ink);
  width: 100%;
  margin-top: 8px;
}

.upload-zone {
  border: 1.5px dashed #cbd5e0;
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover, .upload-zone.drag {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.upload-zone .big { font-size: 28px; margin-bottom: 8px; }
.upload-zone .t { font-size: 14px; font-weight: 500; }
.upload-zone .s { font-size: 12px; color: var(--ink-mute); margin-top: 4px; }

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(26, 107, 90, 0.12);
}
.form-group textarea { min-height: 72px; resize: vertical; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  color: var(--ink-soft);
}
.chip.on {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 600;
}

.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--line);
}
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -17px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--teal);
}
.tl-item.wait::before {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.tl-item .t { font-size: 13px; font-weight: 600; }
.tl-item .s { font-size: 11px; color: var(--ink-mute); margin-top: 2px; }

.preview-box {
  background: #1a2332;
  border-radius: var(--radius);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  margin-bottom: 14px;
  overflow: hidden;
}
.preview-box .fake-doc {
  width: 70%;
  height: 80%;
  background: #f8fafc;
  border-radius: 4px;
  padding: 12px;
  color: #64748b;
  font-size: 9px;
  line-height: 1.6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.info-banner {
  background: var(--teal-soft);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--teal);
  margin-bottom: 14px;
  line-height: 1.55;
}
.view-client .info-banner { background: #e8eef6; color: var(--blue); }
.info-banner.warn {
  background: #fef3c7;
  color: var(--warn);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}
.stat .n {
  font-family: "DM Sans", sans-serif;
  font-size: 20px;
  font-weight: 700;
}
.stat .l { font-size: 11px; color: var(--ink-mute); margin-top: 2px; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.search-bar input {
  border: none;
  outline: none;
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  background: transparent;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.page { display: none; padding: 14px 16px 24px; animation: fadeIn 0.25s ease; }
.page.active { display: block; }
