:root {
  --ink: #16312f;
  --ink-soft: #526b68;
  --paper: #f5f7f4;
  --surface: #ffffff;
  --line: #dfe7e3;
  --teal: #0d5d57;
  --teal-deep: #073f3c;
  --mint: #bfe6d8;
  --mint-soft: #e8f5ef;
  --amber: #d9a441;
  --danger: #b04f47;
  --shadow: 0 20px 60px rgba(17, 64, 58, 0.09);
  --radius: 18px;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); line-height: 1.7; }

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(159, 215, 194, 0.28), transparent 34%),
    radial-gradient(circle at 84% 88%, rgba(225, 202, 145, 0.13), transparent 30%),
    linear-gradient(145deg, #edf3ef 0%, #f7f5ef 60%, #eeeae1 100%);
}

.login-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(38px, 5vw, 82px);
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(250px, 0.85fr);
  gap: clamp(22px, 3vw, 48px);
  align-items: center;
  isolation: isolate;
}

.login-hero::before,
.login-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
}

.login-hero::before {
  inset: 0;
  background-image:
    linear-gradient(rgba(13, 93, 87, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 93, 87, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(90deg, rgba(0,0,0,.58), transparent 82%);
}

.login-hero::after {
  width: 520px;
  height: 760px;
  right: -310px;
  top: -180px;
  border-radius: 48% 0 0 48%;
  background: linear-gradient(165deg, rgba(255,255,255,.58), rgba(191,230,216,.12));
  border-left: 1px solid rgba(13, 93, 87, .08);
  transform: rotate(9deg);
}

.hero-copy-col {
  position: relative;
  z-index: 3;
  min-width: 0;
  max-width: 640px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(30px, 5vh, 54px);
}

.brand-emblem {
  width: 55px;
  height: 55px;
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 18px rgba(8, 72, 67, 0.18));
}

.brand-emblem svg {
  display: block;
  width: 100%;
  height: 100%;
}

.emblem-shell {
  fill: var(--teal);
  transition: fill .2s;
}

.emblem-line {
  fill: none;
  stroke: #dff3eb;
  stroke-width: 2.8;
  stroke-linecap: round;
  opacity: .62;
}

.emblem-check {
  fill: none;
  stroke: #bfe6d8;
  stroke-width: 3.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.emblem-dot {
  fill: #e3bd64;
}

.brand-emblem.small {
  width: 39px;
  height: 39px;
  filter: none;
}

.brand-emblem.small .emblem-shell { fill: #d6ece3; }
.brand-emblem.small .emblem-line { stroke: #164e49; opacity: .46; }
.brand-emblem.small .emblem-check { stroke: #164e49; }

.brand-lockup-copy strong {
  display: block;
  font-family: "Songti SC", "STSong", serif;
  font-size: 19px;
  letter-spacing: .08em;
}

.brand-lockup-copy span {
  display: block;
  margin-top: 3px;
  color: #78918d;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .16em;
}

.eyebrow {
  margin: 0 0 17px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
}

.eyebrow.dark { color: #68827f; }
.login-hero h1 {
  max-width: 700px;
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(44px, 5.1vw, 72px);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 1.06;
}

.login-hero h1 em { color: var(--teal); font-weight: 400; }
.hero-copy { max-width: 520px; margin: 26px 0 24px; color: #46615e; font-size: 15px; line-height: 1.85; }

.hero-features { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-features span {
  border: 1px solid rgba(13, 93, 87, 0.2);
  border-radius: 999px;
  padding: 8px 13px;
  color: #305c57;
  background: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  font-weight: 600;
}

.hero-line { width: 100%; max-width: 520px; height: 1px; background: rgba(13, 93, 87, 0.16); margin: 36px 0 16px; }
.hero-note { color: #738985; font-size: 12px; letter-spacing: 0.04em; }

.hero-visual {
  position: relative;
  width: min(100%, 390px);
  min-height: 530px;
  justify-self: center;
  perspective: 1200px;
  z-index: 2;
}

.visual-halo {
  position: absolute;
  width: 440px;
  height: 440px;
  left: -35px;
  top: 38px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 36%, rgba(255,255,255,.96), rgba(255,255,255,0) 53%),
    conic-gradient(from 145deg, rgba(13,93,87,.14), rgba(190,226,213,.5), rgba(225,198,128,.15), rgba(13,93,87,.14));
  filter: blur(1px);
}

.visual-halo::after {
  content: "";
  position: absolute;
  inset: 58px;
  border: 1px solid rgba(13, 93, 87, .12);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(255,255,255,.18), 0 0 0 68px rgba(13,93,87,.025);
}

.dossier {
  position: absolute;
  width: 300px;
  height: 400px;
  border-radius: 5px 6px 14px 6px;
}

.dossier-back {
  right: 4px;
  top: 30px;
  padding: 43px 26px 24px;
  background: #cfe3da;
  border: 1px solid rgba(13, 93, 87, .12);
  transform: rotate(8deg) translateZ(-20px);
  box-shadow: 0 28px 60px rgba(31, 77, 69, .12);
}

.dossier-tab {
  position: absolute;
  left: 20px;
  top: -1px;
  height: 26px;
  padding: 7px 11px 0;
  border-radius: 5px 5px 0 0;
  background: #b8d5c9;
  color: #477068;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .13em;
}

.back-rule {
  height: 1px;
  width: 76%;
  margin: 11px 0;
  background: rgba(13, 93, 87, .18);
}

.back-rule.wide { width: 100%; height: 6px; border-radius: 3px; background: rgba(255,255,255,.48); }
.back-rule.short { width: 48%; }

.back-table {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 25px;
}

.back-table i {
  height: 31px;
  border: 1px solid rgba(13, 93, 87, .1);
  border-radius: 3px;
  background: rgba(255,255,255,.27);
}

.dossier-front {
  right: 43px;
  top: 72px;
  padding: 24px 24px 23px;
  background:
    linear-gradient(90deg, rgba(13,93,87,.025) 1px, transparent 1px),
    linear-gradient(rgba(13,93,87,.025) 1px, transparent 1px),
    #fffdf8;
  background-size: 23px 23px;
  border: 1px solid rgba(13, 93, 87, .13);
  transform: rotate(-3.5deg) translateZ(20px);
  box-shadow: 0 36px 75px rgba(24, 69, 63, .23), 0 4px 0 #d9e6e0;
  overflow: hidden;
}

.dossier-front::before {
  content: "ISO";
  position: absolute;
  right: -9px;
  bottom: 87px;
  font-family: Georgia, serif;
  font-size: 76px;
  color: rgba(13, 93, 87, .045);
  letter-spacing: -.08em;
}

.dossier-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dossier-kicker {
  display: block;
  color: #7b918d;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .14em;
  margin-bottom: 6px;
}

.dossier-head strong {
  font-family: "Songti SC", serif;
  font-size: 20px;
  letter-spacing: .04em;
}

.dossier-no {
  color: var(--teal);
  font-family: Georgia, serif;
  font-size: 35px;
  font-style: italic;
  line-height: .9;
}

.visual-meta {
  display: flex;
  justify-content: space-between;
  margin: 19px 0 10px;
  padding-top: 10px;
  border-top: 1px solid #dfe8e4;
  color: #728783;
  font-size: 6px;
  font-weight: 800;
  letter-spacing: .1em;
}

.visual-progress {
  height: 4px;
  border-radius: 3px;
  overflow: hidden;
  background: #e8eeeb;
}

.visual-progress i {
  display: block;
  width: 82%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d5d57, #88bea9);
}

.visual-checklist {
  display: grid;
  gap: 4px;
  margin-top: 22px;
}

.visual-checklist > div {
  display: grid;
  grid-template-columns: 20px 14px 1fr;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  border-bottom: 1px solid #edf1ee;
  color: #4d6662;
  font-size: 8px;
}

.visual-checklist b {
  color: #9aaba7;
  font-family: Georgia, serif;
  font-size: 8px;
  font-weight: 400;
}

.check-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid #7eaa99;
  position: relative;
}

.check-dot::after {
  content: "✓";
  position: absolute;
  inset: -4px 0 0 1px;
  color: var(--teal);
  font-size: 7px;
  font-weight: 800;
}

.seal {
  position: absolute;
  right: 23px;
  bottom: 18px;
  width: 69px;
  height: 69px;
  border: 1px solid rgba(158, 64, 51, .72);
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  color: rgba(158, 64, 51, .72);
  transform: rotate(-11deg);
  box-shadow: inset 0 0 0 4px rgba(158, 64, 51, .07);
}

.seal::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(158, 64, 51, .45);
  border-radius: 50%;
}

.seal span, .seal small { font-size: 6px; font-weight: 800; letter-spacing: .12em; }
.seal b { font-size: 19px; line-height: .8; }

.visual-chip {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(13, 93, 87, .12);
  box-shadow: 0 12px 28px rgba(25, 72, 65, .13);
  color: #526d68;
  font-size: 7px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.visual-chip span {
  color: var(--teal);
  font-family: Georgia, serif;
  font-size: 16px;
}

.visual-chip.chip-top {
  top: 33px;
  left: -7px;
  transform: rotate(-4deg);
}

.visual-chip.chip-bottom {
  right: 3px;
  bottom: 54px;
  transform: rotate(3deg);
}

.visual-chip.chip-bottom i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #52a17f;
  box-shadow: 0 0 0 3px rgba(82,161,127,.13);
}

.visual-axis {
  position: absolute;
  left: 14px;
  bottom: 15px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #78908b;
  font-family: Georgia, serif;
  font-size: 8px;
}

.visual-axis i {
  width: 42px;
  height: 1px;
  background: #8db2a5;
}

.login-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(430px, 100%);
  padding: clamp(30px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.login-brand .brand-emblem {
  width: 44px;
  height: 44px;
}

.login-brand strong {
  display: block;
  font-family: "Songti SC", "STSong", serif;
  font-size: 19px;
  letter-spacing: 0.06em;
}

.login-brand span {
  display: block;
  margin-top: 3px;
  color: #7b8f8b;
  font-size: 11px;
}

.login-card h2 { margin: 0 0 9px; font-family: "Songti SC", serif; font-size: 34px; font-weight: 600; }
.login-card .muted { margin: 0 0 30px; font-size: 13px; }
.login-card form { display: grid; gap: 18px; }

label { display: grid; gap: 8px; font-size: 13px; font-weight: 600; color: #3c5753; }

input, select, textarea {
  width: 100%;
  border: 1px solid #d6e0dc;
  border-radius: 12px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

input:focus, select:focus, textarea:focus {
  border-color: #6ea99e;
  box-shadow: 0 0 0 3px rgba(13, 93, 87, 0.09);
  background: #fff;
}

textarea { resize: vertical; min-height: 120px; line-height: 1.75; }

.button {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 11px 17px;
  font-size: 13px;
  font-weight: 650;
  transition: transform .15s, box-shadow .15s, background .15s;
}

.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; pointer-events: none; }
.button.primary { color: #fff; background: var(--teal); box-shadow: 0 8px 20px rgba(13, 93, 87, 0.18); }
.button.primary:hover { background: var(--teal-deep); }
.button.secondary { color: var(--teal); border-color: #bdd5ce; background: #f4faf7; }
.button.ghost { color: #3e5e5a; background: transparent; border-color: #d8e2de; }
.button.danger { color: var(--danger); border-color: #ebd0cd; background: #fff8f7; }
.button.full { width: 100%; }
.button.small { padding: 7px 11px; font-size: 12px; }

.text-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--teal);
  padding: 15px 0 2px;
  font-size: 13px;
}

.form-error { min-height: 18px; color: var(--danger); font-size: 12px; margin: 12px 0 0; }
.local-proof { margin-top: 26px; color: #78908c; font-size: 11px; }
.local-proof span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #3e9a7c; margin-right: 7px; box-shadow: 0 0 0 4px rgba(62,154,124,.1); }

.workspace {
  height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--paper);
}

.sidebar {
  background: #113f3c;
  color: #f0f7f4;
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  min-height: 0;
}

.sidebar-brand { display: flex; align-items: center; gap: 13px; padding: 3px 7px 28px; }
.sidebar-brand strong { display: block; font-family: "Songti SC", serif; letter-spacing: .04em; }
.sidebar-brand small { display: block; color: #9bb7b2; font-size: 11px; margin-top: 2px; letter-spacing: .08em; }
.sidebar-section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 8px 7px; color: #92afaa; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

.icon-button {
  border: 0;
  background: rgba(255,255,255,0.08);
  color: inherit;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
}

.project-list { display: grid; gap: 6px; overflow-y: auto; padding: 5px 0 16px; }
.project-item {
  border: 0;
  border-radius: 12px;
  padding: 12px;
  text-align: left;
  background: transparent;
  color: #d6e5e1;
}

.project-item:hover, .project-item.active { background: rgba(255,255,255,.1); color: white; }
.project-item.active { box-shadow: inset 3px 0 0 var(--mint); }
.project-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.project-item small { display: flex; justify-content: space-between; margin-top: 7px; color: #8ea9a5; font-size: 10px; }
.project-empty { color: #89a5a0; font-size: 12px; padding: 10px; line-height: 1.7; }

.sidebar-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 15px; display: flex; align-items: center; gap: 8px; }
.user-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #d4ebdf; color: #17423f; font-family: "Songti SC", serif; }
.user-chip strong, .user-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { font-size: 12px; }
.user-chip small { color: #8da8a4; font-size: 10px; margin-top: 3px; }

.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 30px 14px; background: rgba(245,247,244,.93); border-bottom: 1px solid var(--line); }
.project-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.project-title h2 { margin: 2px 0 0; font-family: "Songti SC", serif; font-size: 23px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-title .eyebrow { margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.save-status { color: #82918e; font-size: 11px; min-width: 58px; text-align: right; }
.save-status.error { color: var(--danger); }
.mobile-projects { display: none; border: 0; background: transparent; color: var(--ink); font-size: 18px; }

.tabs { display: flex; overflow-x: auto; gap: 3px; padding: 9px 28px 0; background: #f5f7f4; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; flex: 0 0 auto; border: 0; background: transparent; color: #6d817e; padding: 11px 12px 14px; font-size: 12px; }
.tab.active { color: var(--teal); font-weight: 700; }
.tab.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--teal); border-radius: 2px; }

.content { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 30px 60px; }
.content-inner { max-width: 1380px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-family: "Songti SC", serif; font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
.page-head p { margin: 7px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 25px rgba(24, 65, 59, 0.035);
}

.panel-body { padding: 21px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 17px 20px; border-bottom: 1px solid #edf1ef; }
.panel-head h3 { margin: 0; font-size: 14px; }
.panel-head small { color: #899895; font-size: 11px; }
.panel-title-row { display: flex; align-items: center; gap: 10px; }

.stat-card { padding: 20px; min-height: 138px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; width: 100px; height: 100px; border-radius: 50%; right: -40px; bottom: -50px; background: var(--mint-soft); }
.stat-label { color: #738783; font-size: 11px; letter-spacing: .06em; }
.stat-value { font-family: Georgia, "Songti SC", serif; font-size: 32px; line-height: 1; color: var(--teal-deep); }
.stat-foot { color: #8a9b98; font-size: 10px; position: relative; z-index: 1; }
.stat-card.accent { background: linear-gradient(145deg, #0b514c, #0e655e); color: white; border-color: transparent; }
.stat-card.accent .stat-label, .stat-card.accent .stat-foot { color: #bddad4; }
.stat-card.accent .stat-value { color: white; }
.stat-card.accent::after { background: rgba(255,255,255,.07); }

.progress { height: 7px; border-radius: 7px; overflow: hidden; background: #eaf0ed; margin: 13px 0 9px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #2c8d72, #7dbfa4); border-radius: inherit; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #57aa86; display: inline-block; box-shadow: 0 0 0 4px rgba(87,170,134,.1); }

.flow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; line-height: 2; color: #385652; font-size: 13px; }
.flow span:not(.arrow) { background: #f0f6f3; border-radius: 7px; padding: 4px 8px; }
.flow .arrow { color: #9dafab; }
.callout { border-left: 3px solid #6ab49a; background: #f2f8f5; padding: 13px 15px; border-radius: 4px 10px 10px 4px; color: #3f5f5a; font-size: 12px; line-height: 1.7; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field-wide { grid-column: 1 / -1; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; }

.source-badge { border-radius: 999px; padding: 2px 6px; font-size: 9px; font-weight: 600; letter-spacing: .03em; background: #eef2f0; color: #73827f; }
.source-badge.manual { background: #ecf5f1; color: #287660; }
.source-badge.isc { background: #f5efdf; color: #89691e; }
.source-badge.consult { background: #eef0f8; color: #55669b; }
.source-badge.import { background: #e9f2ef; color: #347261; }
.source-badge.qcc { background: #e7f2f6; color: #31718a; }
.source-badge.field { background: #f4ebe7; color: #9a5f43; }

.check-row { display: flex; align-items: center; gap: 10px; padding-top: 8px; }
.check-row input { width: 17px; height: 17px; accent-color: var(--teal); }
.check-row span { font-weight: 500; color: #526562; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: #eef5f2; color: #34665a; border-radius: 999px; padding: 5px 8px; font-size: 10px; }
.qcc-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.settings-details { margin-top: 13px; border-top: 1px solid #edf1ef; padding-top: 11px; }
.settings-details summary { color: #58726d; font-size: 11px; cursor: pointer; }
.settings-details summary::-webkit-details-marker { color: var(--teal); }
.qcc-login-guide { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 9px; align-items: center; margin-top: 10px; padding: 9px 10px; border: 1px solid #e5ece9; border-radius: 9px; background: #fafcfa; }
.qcc-login-guide > span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #dff0e8; color: #1f6658; font-size: 9px; font-weight: 800; }
.qcc-login-guide p { margin: 0; color: #607470; font-size: 10px; line-height: 1.55; }
.qcc-login-guide a { text-decoration: none; white-space: nowrap; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.stage-material-card textarea { min-height: 490px; font-size: 12px; }
.credential-card { margin-bottom: 16px; padding: 16px 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; border: 1px solid #bfd8cd; border-radius: 14px; background: #edf8f2; box-shadow: 0 10px 30px rgba(24,88,72,.08); }
.credential-card span { display: block; color: #6d837d; font-size: 10px; }
.credential-card strong, .credential-card code { display: block; margin-top: 4px; color: #174f46; font-size: 15px; }
.credential-card code { font-family: "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
.credential-card p { grid-column: 1 / -1; margin: 0; color: #6b7f79; font-size: 10px; }
.ai-dialog { width: min(860px, calc(100vw - 28px)); max-height: min(88vh, 900px); padding: 22px; }
.ai-result { display: grid; gap: 14px; max-height: calc(88vh - 150px); overflow-y: auto; padding-right: 4px; }
.ai-meta { display: flex; flex-wrap: wrap; gap: 8px; color: #738580; font-size: 10px; }
.ai-meta span { background: #f1f6f3; border-radius: 999px; padding: 5px 8px; }
.ai-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #e1e9e5; border-radius: 11px; background: #f7faf8; }
.ai-toolbar .check-row { margin: 0; }
.ai-analysis { padding: 12px; border-radius: 11px; background: #eef6f2; color: #476962; font-size: 10px; line-height: 1.7; }
.ai-analysis strong { display: block; margin-bottom: 4px; color: #285f52; font-size: 11px; }
.ai-analysis p { margin: 3px 0; }
.ai-suggestion-group { display: grid; gap: 9px; }
.ai-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ai-group-head h3 { margin: 0; font-size: 13px; }
.ai-group-head small { color: #82918e; font-size: 9px; text-align: right; }
.ai-suggestion-list { display: grid; gap: 8px; }
.ai-suggestion { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid #e1e9e5; border-radius: 11px; background: #fbfcfa; }
.ai-check { display: block; margin-top: 2px; }
.ai-suggestion input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--teal); }
.ai-suggestion-copy { min-width: 0; display: grid; gap: 5px; }
.ai-suggestion-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 11px; }
.ai-suggestion code { color: #315c53; font-family: inherit; font-size: 11px; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; }
.ai-suggestion textarea { min-height: 76px; padding: 9px 10px; font-size: 11px; line-height: 1.65; }
.ai-suggestion small { color: #83938f; font-size: 9px; line-height: 1.5; }
.source-badge.ai { background: #edf1ec; color: #5f744f; }
.ai-warning { padding: 9px 12px; border-radius: 9px; background: #fff5e9; color: #896b38; font-size: 10px; }
.ai-warning p { margin: 2px 0; }
.ai-review-grid section { padding: 12px; border: 1px solid #e3ebe7; border-radius: 10px; background: #fafcfa; }
.ai-review-grid h3 { margin: 0 0 8px; font-size: 12px; }
.ai-review-grid ul { margin: 0; padding-left: 18px; color: #71827e; font-size: 10px; line-height: 1.8; }
.ai-review-grid li.complete { color: #2c735d; }
.stage-switch { display: flex; flex-wrap: wrap; gap: 8px; }
.stage-package { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; border: 1px solid #e3ebe7; border-radius: 11px; background: #fafcfa; }
.stage-package > span strong, .stage-package > span small { display: block; }
.stage-package > span strong { color: #35534e; font-size: 12px; }
.stage-package > span small { margin-top: 4px; color: #83938f; font-size: 9px; line-height: 1.5; }
.attachments-list { display: grid; gap: 8px; }
.attachment-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 10px; border: 1px solid #e3ebe7; border-radius: 10px; background: #fbfcfa; }
.attachment-name { min-width: 0; }
.attachment-name strong, .attachment-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-name strong { color: #3c5753; font-size: 11px; }
.attachment-name small { margin-top: 3px; color: #8b9996; font-size: 9px; }

.dept-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dept-card { border: 1px solid var(--line); border-radius: 15px; background: #fff; overflow: hidden; }
.dept-card-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 14px 16px; background: #f7faf8; border-bottom: 1px solid #edf1ef; }
.dept-index { width: 27px; height: 27px; border-radius: 8px; background: var(--teal); color: white; display: grid; place-items: center; font-family: Georgia, serif; font-size: 13px; }
.dept-card-body { padding: 15px 16px; display: grid; gap: 14px; }
.role-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.role-check { display: flex; align-items: center; gap: 5px; border: 1px solid #dfe8e4; border-radius: 8px; padding: 6px 8px; background: #fbfcfa; font-size: 10px; font-weight: 500; }
.role-check input { width: 13px; height: 13px; accent-color: var(--teal); }

.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.data-table th { text-align: left; color: #667d79; background: #f6f9f7; font-weight: 600; white-space: nowrap; padding: 10px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 7px; border-bottom: 1px solid #edf1ef; vertical-align: top; min-width: 110px; }
.data-table input { min-width: 100px; padding: 8px; border-radius: 8px; font-size: 11px; }
.data-table .row-actions { min-width: 45px; width: 45px; }
.table-empty { padding: 17px; color: #929f9c; text-align: center; font-size: 11px; }
.evidence-block + .evidence-block { margin-top: 14px; }
.evidence-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; }
.evidence-head strong { font-size: 12px; }
.count-chip { background: #edf5f1; color: #3d7567; border-radius: 20px; padding: 3px 7px; font-size: 10px; }

.record-list { display: grid; gap: 12px; }
.record-card { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.record-head { background: #f7faf8; padding: 11px 14px; display: flex; gap: 10px; align-items: center; }
.clause-code { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; font-weight: 700; background: #dff1e9; color: #1c695a; border-radius: 6px; padding: 3px 6px; }
.record-head strong { font-size: 12px; }
.record-card textarea { border: 0; border-radius: 0; background: #fff; min-height: 150px; font-size: 12px; }
.section-editor { display: grid; gap: 9px; }
.section-label { display: flex; gap: 8px; align-items: center; color: #526966; font-size: 11px; font-weight: 600; }
.section-label span { background: #ecf4f0; border-radius: 5px; padding: 3px 5px; font-family: monospace; }

.empty-state { min-height: 55vh; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-state h1 { margin: 24px 0 8px; font-family: "Songti SC", serif; font-size: 34px; }
.empty-state p { color: var(--ink-soft); margin: 0 0 22px; }
.empty-orbit { width: 88px; height: 88px; border: 1px solid #bad9cf; border-radius: 50%; position: relative; }
.empty-orbit::before { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%; background: var(--teal); left: 31px; top: 31px; box-shadow: 0 0 0 12px #e3f0ea, 0 0 0 24px #eff7f3; }

dialog { width: min(580px, calc(100vw - 30px)); border: 0; border-radius: 20px; padding: 0; color: var(--ink); box-shadow: 0 30px 100px rgba(14, 44, 41, 0.25); }
dialog::backdrop { background: rgba(12, 40, 37, 0.42); backdrop-filter: blur(4px); }
dialog form { padding: 24px; display: grid; gap: 17px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-head h2 { margin: 3px 0 0; font-family: "Songti SC", serif; font-size: 28px; }
.dialog-head .eyebrow { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: 380px; padding: 12px 16px; background: #123e3b; color: white; border-radius: 10px; box-shadow: var(--shadow); font-size: 12px; line-height: 1.6; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #703933; }
.global-loader { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(245,247,244,.48); backdrop-filter: blur(3px); }
.global-loader span { width: 34px; height: 34px; border: 3px solid #cfe0da; border-top-color: var(--teal); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.file-drop {
  position: relative;
  border: 1px dashed #a9c8bd;
  border-radius: 15px;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 0, rgba(211, 235, 225, .45), transparent 62%),
    #f7faf8;
  text-align: center;
  transition: border-color .15s, background .15s, transform .15s;
}
.file-drop.dragging { border-color: var(--teal); background: #edf7f2; transform: scale(.995); }
.file-drop-icon { width: 38px; height: 38px; margin: 0 auto 10px; border-radius: 12px; display: grid; place-items: center; background: var(--teal); color: white; font-size: 22px; box-shadow: 0 9px 20px rgba(13,93,87,.16); }
.file-drop strong { display: block; font-size: 13px; }
.file-drop p { margin: 7px auto 0; max-width: 360px; font-size: 11px; }
.file-drop input { margin-top: 14px; background: white; font-size: 11px; }
.file-picker-button { display: inline-flex; margin-top: 14px; padding: 9px 16px; border: 1px solid #b8d2c8; border-radius: 9px; background: white; color: var(--teal); font-size: 11px; font-weight: 700; cursor: pointer; box-shadow: 0 5px 14px rgba(18,74,66,.06); }
.file-input-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; clip-path: inset(50%); }
.upload-limits { margin: 9px 0; color: #82928f; font-size: 10px; text-align: center; }
.pending-files { display: grid; gap: 7px; max-height: 215px; margin: 12px 0; overflow-y: auto; }
.pending-file { display: grid; grid-template-columns: 38px minmax(0, 1fr) 30px; gap: 9px; align-items: center; padding: 9px; border: 1px solid #e2ebe7; border-radius: 10px; background: #fbfcfa; }
.pending-file > span:nth-child(2) { min-width: 0; }
.pending-file strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: #334e4a; }
.pending-file small { display: block; margin-top: 3px; color: #8b9996; font-size: 9px; }
.file-type { width: 38px; height: 30px; border-radius: 7px; display: grid; place-items: center; background: #e7f2ed; color: #317062; font-size: 8px; font-weight: 800; letter-spacing: .04em; }
.pending-file .icon-button { background: #eef2f0; color: #657b77; }
.import-record { border: 1px solid #e2eae7; border-radius: 12px; background: #fcfdfb; overflow: hidden; }
.import-record + .import-record { margin-top: 9px; }
.import-record summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; cursor: pointer; }
.import-record summary::-webkit-details-marker { display: none; }
.import-record summary > span:first-child strong { display: block; color: #36534e; font-size: 12px; }
.import-record summary > span:first-child small { display: block; margin-top: 4px; color: #899895; font-size: 10px; }
.import-counts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.import-counts i { border-radius: 999px; padding: 4px 7px; background: #f0f3f1; color: #6f817d; font-size: 9px; font-style: normal; }
.import-counts i.ok { background: #e5f3ec; color: #2d725d; }
.import-counts i.skip { background: #f6efe3; color: #8c6d33; }
.import-record-body { border-top: 1px solid #edf1ef; padding: 13px 14px 15px; }
.import-record-body h4 { margin: 15px 0 7px; font-size: 10px; color: #6d817d; letter-spacing: .04em; }
.import-files { display: flex; flex-wrap: wrap; gap: 6px; }
.import-file-chip { border-radius: 7px; padding: 6px 8px; background: #eef6f2; color: #397260; font-size: 9px; }
.import-file-chip.failed { background: #fff2ef; color: #a65148; }
.import-field-list { display: grid; gap: 5px; }
.import-field-row { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(160px, 1.4fr) auto; gap: 10px; align-items: center; padding: 8px 9px; border-radius: 8px; background: #f7faf8; }
.import-field-row.skipped { background: #fbf9f4; }
.import-field-row b { display: block; color: #435e59; font-size: 10px; }
.import-field-row small { display: block; margin-top: 2px; color: #91a09d; font-size: 8px; }
.import-value { color: #60736f; font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.import-warning { margin-top: 9px; border-radius: 8px; padding: 8px 10px; background: #fff5ea; color: #8b6c38; font-size: 9px; }
.import-warning p { margin: 2px 0; }
.banner { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border-radius: 13px; background: #f4f7ef; border: 1px solid #e4ead9; color: #51624a; font-size: 12px; line-height: 1.7; }
.banner strong { display: block; margin-bottom: 3px; color: #304b31; }

@media (max-width: 1180px) {
  .app-shell { padding: 20px; }
}

@media (max-width: 1080px) {
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-shell { padding: 18px; background: linear-gradient(155deg, #edf5f0, #f7f5ee); }
  .login-card { width: min(430px, 100%); padding: 30px 24px; }
  .login-card h2 { font-size: 32px; }
  .local-proof { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 15; inset: 0 auto 0 0; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); box-shadow: 15px 0 50px rgba(10,40,37,.25); }
  .mobile-projects { display: block; }
  .topbar { padding: 14px 16px; }
  .topbar-actions .button.secondary { display: none; }
  .content { padding: 20px 15px 50px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .grid.two, .dept-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

@media (max-width: 560px) {
  .grid.stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { min-height: 118px; padding: 15px; }
  .stat-value { font-size: 26px; }
  .form-grid, .form-grid.two, .form-grid.four { grid-template-columns: 1fr; }
  .topbar-actions .save-status { display: none; }
  .topbar-actions .button { padding: 9px 10px; font-size: 11px; }
  .project-title h2 { max-width: 170px; font-size: 19px; }
  .import-record summary { align-items: flex-start; flex-direction: column; }
  .import-counts { justify-content: flex-start; }
  .import-field-row { grid-template-columns: 1fr; gap: 4px; }
  .qcc-search { grid-template-columns: 1fr; }
  .stage-package { align-items: flex-start; flex-direction: column; }
  .attachment-row { grid-template-columns: 40px minmax(0, 1fr); }
  .attachment-row > .head-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media print {
  .sidebar, .topbar, .tabs, .page-head .head-actions, .panel-head .button { display: none !important; }
  .workspace, .main, .content { display: block; height: auto; overflow: visible; }
  .content { padding: 0; }
  .panel { break-inside: avoid; box-shadow: none; }
}
