:root {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #202830;
  background: #f4f6f5;
  --accent: #006953;
  --muted: #566369;
  --line: #dce4e0;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button, select, input, textarea {
  border: 1px solid #cbd7d1; border-radius: 8px; padding: 9px 12px;
  background: white; color: inherit;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 3px solid #29a289; outline-offset: 3px; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 650; }
.primary:hover:not(:disabled) { background: #005744; color: #fff; }
.site-header {
  height: 68px; display: flex; align-items: center; gap: 12px; padding: 0 clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line); background: #fff;
}
.mark { display: grid; place-items: center; width: 33px; height: 33px; background: var(--accent); border-radius: 8px; }
.mark i { width: 16px; height: 12px; border: 2px solid white; border-radius: 2px; position: relative; }
.mark i::after { content: ""; position: absolute; bottom: -6px; left: 3px; width: 6px; height: 2px; background: white; }
.mark.large { width: 48px; height: 48px; border-radius: 12px; }
.account { flex: 1; text-align: right; color: var(--muted); font-size: .9rem; }
.quiet { border-color: transparent; background: transparent; }
.login {
  width: min(440px, calc(100% - 32px)); margin: clamp(36px, 13vh, 140px) auto;
  padding: clamp(24px, 5vw, 40px); background: #fff; border: 1px solid var(--line); border-radius: 18px;
}
.login h1 { margin: 23px 0 10px; font-size: 2rem; line-height: 1.25; }
.login p { color: var(--muted); line-height: 1.6; margin: 0 0 22px; }
.login .error, #note-status, #workspace-message { color: #96322b; overflow-wrap: anywhere; }
.login .error { margin: 15px 0 0; }
.login .error:empty, #workspace-message:empty, #note-status:empty { display: none; }
form label, .version-select { font-size: .9rem; font-weight: 650; }
.login input, .login button { display: block; width: 100%; margin-top: 9px; min-height: 44px; }
.login button { margin-top: 15px; }
#workspace { max-width: 1600px; margin: auto; padding: clamp(16px, 4vw, 44px); }
.workspace-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.workspace-head h1 { margin: 4px 0 0; font-size: clamp(1.4rem, 3vw, 2rem); overflow-wrap: anywhere; }
.context { margin: 0; color: var(--accent); font-size: .9rem; font-weight: 650; }
.version-select { display: grid; gap: 6px; color: var(--muted); }
.version-select select { max-width: min(38vw, 430px); }
.layout { display: grid; grid-template-columns: 84px minmax(0, 1fr) minmax(250px, 306px); gap: 15px; align-items: start; }
.page-list, .preview, .notes { background: #fff; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.page-list { display: grid; gap: 7px; padding: 9px; max-height: 70vh; overflow: auto; }
.page-list button { padding: 8px 4px; white-space: nowrap; font-size: .88rem; }
.page-list button[aria-current="page"], #draw[aria-pressed="true"] {
  background: #e4f3ec; border-color: #76ad9a; color: var(--accent); font-weight: 650;
}
.toolbar { display: flex; padding: 10px 12px; justify-content: space-between; gap: 7px; align-items: center; }
.nav-buttons { display: flex; align-items: center; gap: 9px; font-size: .88rem; white-space: nowrap; }
.nav-buttons button { padding: 2px 10px; font-size: 1.4rem; }
#draw { font-size: .88rem; white-space: nowrap; }
.slide-stage { background: #e8eeeb; padding: clamp(8px, 2vw, 24px); min-height: 100px; }
.slide { position: relative; line-height: 0; }
.slide.loading { visibility: hidden; }
.slide img { width: 100%; height: auto; display: block; }
.slide canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.slide canvas.drawing { cursor: crosshair; pointer-events: auto; touch-action: none; }
.hint { padding: 0 12px; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.notes { padding: 16px; }
.notes h2 { margin: 0 0 12px; font-size: 1.05rem; }
.notes-list-empty { margin: 10px 0; color: var(--muted); font-size: .88rem; }
.note-card { width: 100%; display: grid; gap: 5px; text-align: left; margin: 8px 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.note-card small { color: var(--accent); font-size: .8rem; font-weight: 650; }
.note-card[aria-pressed="true"] { border-color: var(--accent); background: #f2faf6; }
.note-thumbnail { display: block; margin: 0 0 12px; }
.note-thumbnail img { display: block; max-width: 100%; max-height: 130px; border-radius: 6px; }
.notes form { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
.notes textarea { display: block; width: 100%; margin: 8px 0; resize: vertical; line-height: 1.45; }
#note-image { display: block; width: 100%; margin: 8px 0 4px; padding: 6px; font-size: .875rem; }
#note-image-hint { color: var(--muted); font-size: .8rem; margin: 0 0 10px; }
.form-actions { display: flex; gap: 8px; justify-content: end; }
@media (max-width: 950px) {
  .layout { grid-template-columns: 68px minmax(0, 1fr); }
  .notes { grid-column: 2; }
}
@media (max-width: 520px) {
  .workspace-head { display: grid; gap: 10px; }
  .version-select select { max-width: 100%; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .page-list { display: flex; max-height: none; gap: 5px; }
  .page-list button { min-width: 62px; }
  .notes { grid-column: auto; }
}

.portal-card { padding: clamp(16px, 3vw, 28px); margin-bottom: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.portal-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.portal-heading h2,.portal-heading p { margin: 3px 0; }
.portal-heading p,.portal-heading small { color: var(--muted); }
.portal-card form label { display:grid; gap:6px; margin: 10px 0; }
.portal-card input,.portal-card select,.portal-card textarea { max-width: 100%; min-width: 0; }
.portal-card fieldset { border: 0; margin:0; padding:0; }
.portal-card textarea { width:100%; resize:vertical; }
.portal-stages { display:flex; flex-wrap:wrap; gap:6px; padding:0; list-style:none; }
.portal-stages li { background:#f0f4f2; color:var(--muted); padding:6px 10px; border-radius:6px; font-size:.875rem; }
.portal-stages [aria-current] { background:#e4f3ec; color:var(--accent); font-weight:bold; }
.portal-proposal { border:1px solid var(--line); padding:16px; border-radius:8px; }
.portal-proposal h3 { margin-top:0; }
.portal-proposal p,.portal-copy,.portal-records p { white-space:pre-wrap; overflow-wrap:anywhere; }
.portal-grid { display:grid; grid-template-columns: 1.5fr 1fr; gap:16px; }
.portal-delivery { display:flex; flex-wrap:wrap; gap:12px; align-items:center; padding:12px 0; }
.portal-records { list-style:none; padding:0; }
.portal-records li { border-top:1px solid var(--line); padding:10px 0; }
.portal-records p { margin: 4px 0; }
.portal-records p:empty,#application-status:empty,#portal-action-status:empty { display:none; }
.portal-card details summary { cursor:pointer; margin-top:12px; }
@media(max-width:650px){.portal-grid{grid-template-columns:1fr}}
#application-files-hint,#application-files-status { color:var(--muted); font-size:.875rem; }
#application-files-status:empty { display:none; }
#application-files-progress { display:block; width:100%; margin:8px 0 12px; accent-color:var(--accent); }
.portal-styles{margin:14px 0}
.style-gallery{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));gap:12px;margin:12px 0}
.style-gallery article{border:1px solid var(--line);border-radius:8px;padding:9px}
.style-gallery img{display:block;width:100%;height:auto;border-radius:5px}
.style-gallery article label{display:flex;align-items:center;gap:8px}
.style-gallery p{font-size:.88rem;color:var(--muted);margin:4px 0}
#application-received { width:min(440px,calc(100vw - 32px)); border:1px solid var(--line); border-radius:12px;padding:24px;color:inherit }
#application-received h2 { margin-top:0 }
#application-received::backdrop { background:#172b3d80 }
