:root {
  --ink: #1b2528;
  --muted: #6d7a7f;
  --line: #d8e0e3;
  --panel: #f7faf9;
  --accent: #16745f;
  --accent-2: #d33b31;
  --bg: #edf2ef;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--bg); }
body.resizing, body.panning { user-select: none; }
button, .button { border: 0; background: #e0ebe7; color: var(--ink); padding: 9px 13px; border-radius: 10px; cursor: pointer; text-decoration: none; font-size: 14px; }
button:hover, .button:hover { filter: brightness(0.96); }
button.primary { background: var(--accent); color: white; font-weight: 700; }
button.ghost, .button.ghost { background: #ffffff; border: 1px solid var(--line); }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font: inherit; background: white; }
textarea { min-height: 96px; resize: vertical; }
.hidden { display: none !important; }
.login-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 560px) 390px;
  gap: 72px;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background:
    radial-gradient(circle at 18% 22%, rgba(99,182,154,0.34), transparent 28%),
    radial-gradient(circle at 78% 70%, rgba(255,255,255,0.95), transparent 31%),
    linear-gradient(135deg, #e2f0eb 0%, #f8fbf9 52%, #d7e6df 100%);
  overflow: hidden;
}
.login-view::before {
  content: "";
  position: absolute;
  left: -8%;
  bottom: -18%;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.64), transparent 34%),
    radial-gradient(circle at 50% 50%, rgba(22,116,95,0.085), transparent 56%);
  box-shadow:
    inset 0 0 0 1px rgba(22,116,95,0.055),
    inset 0 0 0 42px rgba(22,116,95,0.026),
    inset 0 0 0 92px rgba(22,116,95,0.018);
}
.login-view::after {
  content: "";
  position: absolute;
  right: 9%;
  top: 13%;
  width: 170px;
  height: 260px;
  border-radius: 0 0 170px 170px;
  background: linear-gradient(180deg, rgba(22,116,95,0.10), rgba(22,116,95,0.00));
  transform: rotate(-16deg);
  transform-origin: top center;
  filter: blur(0.2px);
}
.login-hero {
  position: relative;
  max-width: 520px;
  padding-left: 22px;
  z-index: 1;
}
.login-hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 156px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), rgba(22,116,95,0.08));
}
.login-kicker { color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 16px; }
.login-hero h2 { margin: 0; font-size: 54px; line-height: 1.06; letter-spacing: -0.055em; }
.login-hero p {
  margin: 24px 0 28px;
  width: min(100%, 500px);
  color: #52635f;
  font-size: 17px;
  line-height: 1.85;
}
.login-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.login-pills span {
  padding: 10px 16px;
  border: 1px solid rgba(22,116,95,0.18);
  border-radius: 999px;
  background: rgba(255,255,255,0.70);
  color: var(--accent);
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 8px 20px rgba(23,59,50,0.06);
}
.login-card {
  position: relative;
  z-index: 1;
  width: 390px;
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(255,255,255,0.86);
  padding: 38px 36px;
  border-radius: 26px;
  box-shadow: 0 28px 84px rgba(23,59,50,0.20);
  display: grid;
  gap: 14px;
  backdrop-filter: blur(10px);
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 20px;
  border: 1px solid rgba(22,116,95,0.08);
  pointer-events: none;
}
.login-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(135deg, var(--accent), #1f8a71); color: white; font-weight: 900; letter-spacing: -0.04em; box-shadow: 0 14px 32px rgba(22,116,95,0.28); }
.login-card h1 { margin: 8px 0 0; font-size: 38px; letter-spacing: -0.04em; }
.login-card p { margin: 0 0 12px; color: var(--muted); }
.login-card input { min-height: 50px; border-radius: 14px; }
.login-card button { min-height: 50px; border-radius: 14px; background: linear-gradient(135deg, var(--accent), #1f8a71); color: white; font-weight: 800; box-shadow: 0 12px 26px rgba(22,116,95,0.20); }
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.icp-record {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
}
.police-record {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.police-record img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.login-view .site-footer {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 18px;
  z-index: 2;
}
.project-view .site-footer {
  max-width: 1180px;
  margin: 28px auto 0;
  padding: 16px 20px;
  border-top: 1px solid rgba(27,37,40,0.08);
}
.topbar { height: 58px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: white; border-bottom: 1px solid var(--line); }
.brand-area { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-area strong, .brand-area span { white-space: nowrap; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.sidebar-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid rgba(22,116,95,0.18);
  border-radius: 12px;
  background: #f7faf9;
  box-shadow: 0 8px 18px rgba(23,59,50,0.06);
}
.sidebar-toggle span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  transition: transform 160ms ease, opacity 160ms ease;
}
.sidebar-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
}
.sidebar-toggle.active span { background: white; }
.project-view {
  min-height: calc(100vh - 58px);
  padding: 28px;
  background:
    radial-gradient(circle at 12% 12%, rgba(22,116,95,0.14), transparent 26%),
    radial-gradient(circle at 86% 24%, rgba(255,255,255,0.95), transparent 22%),
    linear-gradient(135deg, #eef5f1 0%, #f9fbfa 58%, #e1ece7 100%);
}
.project-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto 18px;
}
.project-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.project-hero h1 {
  margin: 0;
  font-size: 36px;
  letter-spacing: -0.045em;
}
.project-hero p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}
.project-import, .project-list {
  max-width: 1180px;
  margin: 0 auto;
}
.project-import {
  padding: 18px;
  border: 1px solid rgba(22,116,95,0.14);
  border-radius: 20px;
  background: rgba(255,255,255,0.78);
  box-shadow: 0 16px 42px rgba(23,59,50,0.08);
  margin-bottom: 18px;
}
.project-import h3 { margin: 0 0 12px; }
.project-import-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.2fr 1fr auto;
  gap: 10px;
  align-items: center;
}
.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.project-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255,255,255,0.90);
  border: 1px solid rgba(22,116,95,0.12);
  box-shadow: 0 18px 48px rgba(23,59,50,0.10);
}
.project-card:hover {
  transform: translateY(-1px);
  filter: none;
  box-shadow: 0 22px 54px rgba(23,59,50,0.14);
}
.project-card strong {
  display: block;
  font-size: 21px;
  letter-spacing: -0.025em;
}
.project-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.project-card-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}
.rename-project-btn {
  padding: 7px 10px;
  border-radius: 999px;
  background: #e0ebe7;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}
.permission-project-btn {
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef3f1;
  color: #52635f;
  font-size: 12px;
  font-weight: 800;
}
.rename-project-btn:hover, .permission-project-btn:hover { filter: brightness(0.96); }
.project-users {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.project-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.project-stats span {
  padding: 9px 8px;
  border-radius: 12px;
  background: #eef6f3;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.project-stats b {
  display: block;
  color: var(--ink);
  font-size: 18px;
}
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(15,30,28,0.36); padding: 24px; }
.modal-card { width: min(980px, 96vw); max-height: 88vh; overflow: auto; background: white; border-radius: 20px; padding: 22px; box-shadow: 0 24px 80px rgba(18,42,36,0.28); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h3, .profile-section h4 { margin: 0; }
.profile-section { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; margin-top: 12px; }
.admin-create { grid-template-columns: 1fr 1fr 150px auto; }
.user-list { display: grid; gap: 8px; margin-top: 14px; }
.user-row { display: grid; grid-template-columns: 1fr 110px 1.3fr auto auto; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.user-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row small { grid-column: 1 / -1; color: var(--muted); }
.user-row .user-role { grid-column: auto; }
.user-row.deleted-user { opacity: 0.78; background: #f3f1ef; }
.user-row.deleted-user strong { text-decoration: line-through; }
.permission-card { width: min(560px, 94vw); }
.permission-list { display: grid; gap: 8px; margin-top: 8px; }
.permission-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
}
.permission-row input { width: auto; }
.permission-save { width: 100%; min-height: 44px; margin-top: 16px; }
button:disabled, select:disabled, input:disabled { opacity: 0.55; cursor: not-allowed; }
.danger { color: white; background: #9f322a; }
.layout {
  --left-width: 320px;
  --right-width: 330px;
  display: grid;
  grid-template-columns: var(--left-width) 8px minmax(520px, 1fr) 8px var(--right-width);
  gap: 8px;
  padding: 14px;
  height: calc(100vh - 58px);
}
.layout.sidebar-collapsed {
  grid-template-columns: minmax(520px, 1fr) 8px var(--right-width);
}
.layout.sidebar-collapsed .sidebar,
.layout.sidebar-collapsed #leftResizer {
  display: none;
}
.sidebar-backdrop { display: none; }
.sidebar, .panel, .viewer { background: white; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.resizer {
  cursor: col-resize;
  border-radius: 8px;
  background: linear-gradient(180deg, transparent, rgba(22,116,95,0.22), transparent);
}
.resizer:hover { background: rgba(22,116,95,0.26); }
.sidebar { display: flex; flex-direction: column; }
.filters { padding: 12px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; border-bottom: 1px solid var(--line); }
.task-count { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.export-select-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.export-select-bar button { min-height: 36px; padding: 7px 8px; font-size: 13px; }
.export-select-bar span { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.task-list { overflow: auto; padding: 6px; }
.pager { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.pager button, .pager select { min-height: 38px; padding: 7px 8px; font-size: 13px; }
.pager button:disabled { opacity: 0.45; cursor: not-allowed; }
.task-item { padding: 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; border-bottom-color: rgba(27,37,40,0.08); }
.task-item.has-checkbox { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; }
.task-export-check { width: auto; margin: 3px 0 0; cursor: pointer; }
.task-export-check:disabled { cursor: not-allowed; }
.task-item.status-pending { background: white; }
.task-item.status-corrected { background: #edf8f4; }
.task-item.status-deleted { background: #f8ecea; }
.task-item:hover { filter: brightness(0.98); }
.task-item.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(22,116,95,0.26); }
.task-item b { display: block; font-size: 14px; }
.task-item span { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.task-item.dual-line-task span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}
.task-item.dual-line-task strong {
  color: var(--ink);
  font-weight: 900;
}
.task-item.dual-line-task em {
  color: #9f322a;
  font-style: normal;
  font-weight: 900;
}
.viewer { display: flex; flex-direction: column; }
.viewer-head { min-height: 86px; display: flex; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.viewer h2 { margin: 0 0 7px; font-size: 21px; }
.meta { color: var(--muted); font-size: 13px; line-height: 1.5; }
.viewer-actions { display: flex; align-items: start; gap: 8px; }
.canvas-wrap { flex: 1; overflow: auto; background: #151819; cursor: grab; box-sizing: border-box; }
.canvas-wrap.panning { cursor: grabbing; }
canvas { display: block; background: #111; box-shadow: 0 0 0 1px rgba(255,255,255,0.16); touch-action: none; }
.panel { padding: 20px; overflow: auto; }
.panel h3 { margin: 0 0 20px; }
.hint { color: var(--muted); background: var(--panel); border-radius: 12px; padding: 10px; line-height: 1.5; margin-bottom: 12px; }
.coord-box { display: grid; gap: 8px; margin-bottom: 22px; }
.coord-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; row-gap: 16px; }
.coord-grid label { color: var(--muted); font-size: 12px; }
.coord-grid input { margin-top: 4px; }
.length-info { margin: 20px 0 18px; font-weight: 700; color: var(--accent); }
.save-buttons { display: grid; gap: 12px; margin-top: 20px; }
.nav-buttons { margin-top: 40px; }
.nav-buttons button:disabled { background: #e0ebe7; color: var(--muted); opacity: 1; }
.line-action-buttons {
  display: grid;
  gap: 12px;
  margin-top: 40px;
}
.line-action-buttons button {
  min-height: 44px;
  font-weight: 700;
}
.msg { min-height: 22px; color: var(--accent-2); font-size: 13px; margin-top: 8px; }
@media (max-width: 1100px) {
  .login-view { grid-template-columns: 1fr; gap: 28px; padding: 28px 18px 34px; min-height: 100dvh; overflow: auto; }
  .login-view .site-footer { position: relative; left: auto; right: auto; bottom: auto; margin-top: 18px; }
  .login-hero, .login-card { width: min(100%, 430px); justify-self: center; }
  .login-hero h2 { font-size: 34px; }
  .login-hero p { font-size: 15px; }
  .site-footer { row-gap: 4px; }
  .topbar {
    height: auto;
    min-height: 56px;
    padding: 8px 10px;
    gap: 8px;
    align-items: center;
  }
  .brand-area { font-size: 14px; }
  .sidebar-toggle { width: 38px; height: 38px; border-radius: 11px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .top-actions button, .top-actions .button { padding: 7px 9px; font-size: 13px; border-radius: 9px; }
  .layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100dvh - 56px);
    padding: 10px;
  }
  .layout.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 31;
    top: 68px;
    left: 10px;
    bottom: 10px;
    width: min(88vw, 380px);
    min-height: 0;
    transform: translateX(calc(-100% - 18px));
    transition: transform 160ms ease;
    box-shadow: 0 22px 60px rgba(15,30,28,0.24);
  }
  .layout.sidebar-open .sidebar { transform: translateX(0); }
  .layout.sidebar-collapsed .sidebar { display: flex; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(15,30,28,0.24);
  }
  .viewer { order: 1; min-height: 0; }
  .panel { order: 2; min-height: 0; padding: 14px; }
  .viewer-head {
    min-height: 0;
    display: grid;
    gap: 10px;
    padding: 12px;
  }
  .viewer-head > div:first-child { min-width: 0; }
  .viewer h2 { font-size: 18px; margin-bottom: 5px; }
  .meta { font-size: 12px; }
  .viewer-actions {
    width: 100%;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }
  .viewer-actions button { min-width: 38px; min-height: 36px; padding: 6px 9px; font-size: 13px; }
  .viewer-actions .icon-btn { width: 38px; height: 36px; line-height: 36px; font-size: 18px; }
  .save-buttons { margin-top: 14px; }
  .nav-buttons, .line-action-buttons { margin-top: 18px; }
  .project-hero { display: block; }
  .project-hero button { margin-top: 14px; }
  .project-import-grid { grid-template-columns: 1fr; }
  .resizer { display: none; }
  .canvas-wrap { min-height: 52dvh; max-height: 62dvh; }
}
.icon-btn { position: relative; width: 44px; height: 40px; padding: 0; font-size: 20px; line-height: 40px; }
.icon-btn.line-hidden { opacity: 0.85; }
.icon-btn.line-hidden::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 19px;
  width: 26px;
  height: 2px;
  background: #1b2528;
  border-radius: 2px;
  transform: rotate(-35deg);
}
.two-buttons { grid-template-columns: 1fr 1fr; }
.two-buttons button { min-height: 44px; font-weight: 700; }
.restore {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border-radius: 10px;
}
