:root {
  color-scheme:light;
  --bg:#f1f1f2; --card:#fff; --ink:#161918; --muted:#838585;
  --line:#e7e7e8; --accent:#ff861f; --soft:#fff0e4; --green:#5a927a;
  --body:#B9BEC6; --body-edge:#f1f1f2; --safe-bottom:env(safe-area-inset-bottom,0px);
}
* {box-sizing:border-box}
[hidden] {display:none!important}
body {margin:0;background:var(--bg);color:var(--ink);font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;-webkit-font-smoothing:antialiased}
button,input,select {font:inherit}
button,a,input,select {-webkit-tap-highlight-color:transparent}
button,a {touch-action:manipulation}
button {border:0;background:none;color:inherit;cursor:pointer}
button:disabled {opacity:.5;cursor:default}
button:focus-visible,a:focus-visible,[role=button]:focus-visible {outline:3px solid #df874780;outline-offset:3px}
input:focus-visible,select:focus-visible {outline:2px solid var(--accent);outline-offset:1px}
a {color:inherit;text-decoration:none}
h1,h2,h3,p {margin:0}
h1 {font-size:27px;line-height:1.2;letter-spacing:-.7px;font-weight:650}
h2 {font-size:17px;font-weight:600;letter-spacing:-.25px}
h3 {font-size:15px;font-weight:600}
.icon {display:block;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.asset-icon {background:currentColor;mask:var(--icon-url) center/contain no-repeat;-webkit-mask:var(--icon-url) center/contain no-repeat}
.icon-overview {--icon-url:url('/icons/overview.png')}
.icon-history {--icon-url:url('/icons/history.png')}
.icon-settings {--icon-url:url('/icons/settings.png')}
.shell {max-width:1000px;margin:auto;padding:0 28px calc(112px + var(--safe-bottom))}
.brandbar {padding:24px 0 20px}
.brand {display:inline-flex;align-items:center;gap:11px;font-size:23px;font-weight:650;letter-spacing:-.6px}
.brand small {display:block;color:var(--muted);font-size:12px;font-weight:400;letter-spacing:0;margin-top:2px}
.brand-icon {width:48px;height:48px;background:white;border-radius:13px;overflow:hidden;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.brand-icon img {width:72px;height:72px;max-width:none;flex-shrink:0}
.page-head {display:flex;justify-content:space-between;align-items:center;margin:8px 0 20px;min-height:40px;gap:16px}
.notice {color:var(--muted);font-size:11px;text-align:center;padding:16px 0 0;line-height:1.6}
.overview-grid {display:grid;grid-template-columns:1.1fr 1fr;gap:28px;align-items:start}
.map-card {padding:0 8px}
.segmented {display:flex;background:#e1e1e3;padding:3px;border-radius:24px;width:100%}
.segmented button {flex:1;border-radius:20px;min-height:44px;font-size:13px;color:var(--muted)}
.segmented button.active {background:var(--card);color:var(--ink);box-shadow:0 1px 5px #2233310a}
.body-stage {position:relative;display:flex;justify-content:center;align-items:center;padding:24px 0 12px}
.body-svg {display:block;height:275px;width:100%;max-width:200px;overflow:visible}
.body-region {fill:#B9BEC6;stroke:none;cursor:pointer;touch-action:manipulation}
.body-region.selected {fill:#FFAA00}
.body-region:focus-visible {outline:0;stroke:var(--ink);stroke-width:3}
.body-lines {fill:none;stroke:var(--body-edge);stroke-width:1.4;opacity:.8;pointer-events:none}
.side-label {position:absolute;top:45%;font-size:11px;color:var(--muted)}
.side-left {left:12%}.side-right {right:12%}
.formation-marker {cursor:pointer;outline:0}
.marker-hit {fill:transparent}
.marker-dot {fill:var(--ink);stroke:white;stroke-width:2}
.formation-marker text {font-size:10px;font-family:inherit;fill:white;pointer-events:none;font-weight:600}
.formation-marker:hover .marker-dot,.formation-marker:focus-visible .marker-dot {fill:var(--accent);stroke:var(--ink);stroke-width:2.5}
.region-caption {display:flex;flex-direction:column;align-items:center;gap:3px;margin-top:4px;text-align:center}
.region-caption strong {font-size:15px;font-weight:550}
.atlas-single {padding:16px 0 12px}
.atlas-single .body-svg {height:300px;width:auto;max-width:100%;aspect-ratio:540/960;overflow:visible}
.atlas-single .body-region:focus-visible {stroke:var(--ink);stroke-width:2}
.map-help {font-size:11px;color:var(--muted);text-align:center;margin:9px 0 0;line-height:1.5}
.text-button {display:inline-flex;align-items:center;justify-content:center;gap:6px;color:var(--accent);font-size:13px;min-height:44px}
.text-button .icon {width:16px;height:16px}
.primary,.secondary {width:100%;min-height:48px;display:flex;align-items:center;justify-content:center;gap:9px;padding:13px 15px;border-radius:15px;font-size:14px;font-weight:550}
.primary {background:var(--accent);color:#fff}
.secondary {background:var(--bg);color:var(--ink)}
.primary:hover:not(:disabled) {filter:brightness(.97)}
.overview-add {margin-top:14px}
.medical-note {font-size:11px;line-height:1.6;color:var(--muted);margin:14px 3px 0;text-align:center}
.section-heading {display:flex;align-items:center;justify-content:space-between;margin:2px 0 14px}
.section-heading span {font-size:13px;color:var(--muted)}
.region-empty {padding:26px 20px;background:var(--card);border-radius:20px;font-size:13px;color:var(--muted);text-align:center}
.region-empty p+p {margin-top:7px}
.all-history {display:flex;margin:14px auto 0}
.history-list {display:flex;flex-direction:column;gap:10px}
.history-card {width:100%;display:flex;align-items:center;gap:12px;background:var(--card);text-align:left;padding:12px;border-radius:19px;min-height:88px}
.history-card>.icon {width:17px;height:17px;color:var(--muted)}
.card-text {flex:1;min-width:0}
.card-text strong {display:block;font-size:14px;line-height:1.4;font-weight:550;overflow-wrap:anywhere}
.card-text>span {display:block;font-size:12px;color:var(--muted);margin:3px 0}
.card-text small {display:block;font-size:11px;color:var(--muted)}
.thumbnail {display:grid;place-items:center;width:62px;height:62px;flex-shrink:0;border-radius:13px;overflow:hidden;background:var(--bg);position:relative}
.thumbnail img,.thumbnail svg {width:100%;height:100%;object-fit:cover}
.photo-placeholder {display:grid;place-items:center;width:100%;height:100%;color:var(--muted)}
.photo-placeholder .text-button {font-size:11px;flex-direction:column;line-height:1.3;padding:6px}
.photo-placeholder .icon {width:24px;height:24px}
.history-layout,.settings-layout {max-width:700px;margin:auto}
.search {display:flex;align-items:center;gap:8px;border-radius:15px;background:var(--card);padding:0 14px}
.search>.icon {width:19px;height:19px;color:var(--muted)}
.search input {width:100%;min-height:49px;background:none;border:0;padding:12px 0;color:var(--ink);outline:none;font-size:14px}
.filters {display:flex;gap:7px;overflow:auto;padding:0 0 14px;scrollbar-width:none}
.filter {min-height:34px;background:var(--card);border-radius:22px;padding:6px 10px;font-size:11px;white-space:nowrap;color:var(--muted)}
.filter.active {background:var(--accent);color:white}
.history-layout .page-head,.settings-layout .page-head {margin:24px 0 8px}
.history-layout h1 {font-weight:700;font-size:27px}
.filter-heading {display:flex;align-items:center;justify-content:space-between;color:var(--muted);font-size:11px;min-height:38px}
.history-tool {display:grid;place-items:center;width:44px;height:38px}
.history-tool .icon {width:17px;height:17px}
.history-search-row {display:flex;gap:8px;margin-bottom:12px}
.history-search-row .search {flex:1;min-width:0}
.history-layout .history-card {padding:12px;border-radius:19px;box-shadow:0 4px 12px #00000003}
.history-layout .card-text strong {font-weight:600;font-size:14px;line-height:1.3}
.history-layout .card-text>span {font-size:11px;margin:3px 0 1px}
.history-layout .card-text small {font-size:10px;color:var(--muted)}
.history-layout .thumbnail {width:64px;height:64px;border-radius:9px}
.icon-button {width:44px;height:44px;display:grid;place-items:center;border-radius:50%;background:var(--bg);flex-shrink:0}
.icon-button .icon {width:20px;height:20px}
.settings-group {margin-bottom:26px}
.settings-group>h2 {font-size:12px;letter-spacing:.6px;color:var(--muted);text-transform:uppercase;margin:0 3px 10px;font-weight:500}
.setting-row {display:flex;gap:13px;align-items:center;background:var(--card);border-radius:18px;width:100%;padding:16px;text-align:left;margin:8px 0;min-height:76px}
.setting-icon {color:var(--accent);width:28px;display:grid;place-items:center}
.setting-row .text {flex:1;min-width:0}
.setting-row strong {display:block;font-size:14px;font-weight:550}
.setting-row small {display:block;font-size:12px;color:var(--muted);margin-top:3px}
.setting-row>.icon {width:17px;height:17px;color:var(--muted)}
.setting-help {color:var(--muted);font-size:12px;margin:10px 3px 16px;line-height:1.6}
.biometric-help {font-size:13px;line-height:1.6;text-align:left;margin-top:12px}
.biometric-help p {margin:9px 0}
.discard-confirm {position:fixed;inset:0;background:#22333165;display:flex;align-items:center;justify-content:center;padding:20px;z-index:10}
.discard-card {width:100%;max-width:350px;background:var(--card);border-radius:22px;padding:24px}
.discard-card h3 {font-size:18px}
.discard-card p {color:var(--muted);font-size:13px;margin:12px 0 20px}
.discard-card button+button {margin-top:10px}
.about {padding:2px 3px}
.about p:not(.medical-note) {font-size:12px;line-height:1.6;color:var(--muted);margin:8px 0}
.about .medical-note {text-align:left}
.support-link {color:var(--accent);text-decoration:underline;text-underline-offset:3px}
.toggle {position:relative;width:40px;height:24px;background:#d6dcd7;border-radius:20px;flex-shrink:0}
.toggle.on {background:var(--green)}
.toggle:after {content:"";position:absolute;left:3px;top:3px;width:18px;height:18px;background:white;border-radius:50%}
.toggle.on:after {left:19px}
.bottom-nav {position:fixed;left:50%;transform:translateX(-50%);bottom:calc(14px + var(--safe-bottom));display:flex;align-items:center;gap:5px;padding:7px;background:var(--card);border-radius:29px;width:430px;max-width:calc(100vw - 28px);box-shadow:0 5px 28px #2233310b;z-index:10}
.bottom-nav a {display:flex;align-items:center;justify-content:center;flex-direction:column;gap:3px;min-height:51px;border-radius:22px;flex:1;color:var(--ink);font-size:10px}
.bottom-nav a.active {background:#ededee;color:var(--accent)}
.bottom-nav .icon {width:21px;height:21px}
.nav-add {display:grid;place-items:center;width:51px;height:51px;border-radius:50%;background:var(--bg);color:var(--ink);margin-left:5px;flex-shrink:0}
.empty {padding:38px 20px;border-radius:22px;background:var(--card);text-align:center}
.empty>.icon {width:32px;height:32px;margin:0 auto 14px;color:var(--accent)}
.empty p {font-size:13px;color:var(--muted);margin:10px auto 20px;max-width:300px}
.empty .primary {max-width:300px;margin:auto}
.sheet {padding:0;border:0;border-radius:25px;background:var(--card);color:var(--ink);width:calc(100% - 24px);max-width:540px;max-height:calc(100dvh - 28px);overflow:auto;overscroll-behavior:contain;box-shadow:0 18px 70px #0002}
.sheet::backdrop {background:#192a2659}
.sheet-inner {padding:20px 22px 25px}
.sheet-header {display:flex;align-items:center;gap:12px;margin-bottom:20px}
.sheet-header .icon-button {width:38px;height:38px}
.sheet-header h2 {font-size:20px;line-height:1.35;overflow-wrap:anywhere}
.sheet-header p {font-size:12px;color:var(--muted);margin-top:3px;overflow-wrap:anywhere}
.field {display:flex;flex-direction:column;gap:7px;font-size:12px;color:var(--muted);margin:15px 0}
.field input,.field select {width:100%;min-height:48px;border:0;border-radius:12px;background:var(--bg);padding:12px;color:var(--ink);font-size:16px}
.field input[readonly] {color:var(--muted)}
.form-row {display:grid;grid-template-columns:1fr 1fr;gap:12px}
.fixed-location {padding:13px 14px;background:var(--bg);border-radius:12px;font-size:13px}
.fixed-location small {display:block;color:var(--muted);font-size:11px;margin-top:5px}
.upload-zone {display:flex;flex-direction:column;gap:7px;align-items:center;justify-content:center;position:relative;border-radius:17px;background:var(--bg);min-height:145px;padding:20px;text-align:center;cursor:pointer;overflow:hidden}
.upload-zone>.icon {width:29px;height:29px;color:var(--accent)}
.upload-zone strong {font-size:14px;font-weight:550}
.upload-zone span {font-size:12px;color:var(--muted)}
.upload-zone input {position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
.upload-zone img {max-width:100%;max-height:190px;object-fit:contain;border-radius:10px}
.upload-tips,.preview-hint {font-size:12px;line-height:1.6;color:var(--muted);margin:10px 0 15px}
.photo-tools {display:flex;gap:8px;margin-top:10px}
.photo-tools button {font-size:12px;min-height:44px;padding:10px}
.crop-overlay {position:fixed;inset:0;z-index:12;background:#0007;display:grid;place-items:center;padding:16px;overflow:auto;overscroll-behavior:contain}
.crop-card {width:100%;max-width:410px;max-height:calc(100dvh - 32px);overflow:auto;background:var(--card);border-radius:24px;padding:20px}
.crop-card h2 {font-size:20px}
.crop-card p {font-size:12px;color:var(--muted);line-height:1.5;margin:9px 0 14px}
.crop-stage {position:relative;width:100%;max-width:330px;aspect-ratio:1;margin:auto;background:var(--bg);border-radius:14px;overflow:hidden}
.crop-stage canvas {display:block;width:100%;height:100%;touch-action:none;cursor:grab}
.crop-stage canvas:active {cursor:grabbing}
.crop-stage canvas:focus-visible {outline:3px solid var(--accent);outline-offset:-3px}
.crop-loading {position:absolute;inset:0;display:grid;place-items:center;font-size:13px;color:var(--muted)}
.crop-zoom {display:block;margin-top:12px;color:var(--muted);font-size:12px}
.crop-zoom input {display:block;width:100%;height:36px;accent-color:var(--accent)}
.crop-card .crop-hint {font-size:11px;margin:2px 0 14px}
.crop-actions {display:grid;grid-template-columns:1fr 1fr;gap:9px}
.crop-card .crop-error {color:#a45c48}
.preview-hint {background:var(--soft);padding:10px 13px;border-radius:12px}
.consent {display:flex;align-items:flex-start;gap:9px;font-size:12px;color:var(--muted);margin:18px 0}
.consent input,.check-row input {width:18px;height:18px;flex-shrink:0;accent-color:var(--accent)}
.consent input {margin:2px 0 0}
.check-row {display:flex;align-items:center;gap:10px;padding:12px 0;font-size:13px;min-height:44px}
.option-row {display:flex;align-items:center;gap:12px;padding:13px 15px;background:var(--bg);border-radius:13px;margin:8px 0;min-height:48px;font-size:14px}
.option-row input {accent-color:var(--accent)}
.region-options {display:grid;grid-template-columns:1fr 1fr;gap:8px}
.option-button {min-height:48px;border-radius:13px;background:var(--bg);padding:10px;font-size:13px}
.option-button.active {color:var(--accent);background:var(--soft)}
.detail-actions {display:flex;gap:9px;margin-bottom:22px}
.detail-actions .primary {flex:2}.detail-actions .secondary {flex:1}
.detail-actions .icon {width:19px;height:19px}
.timeline {display:flex;flex-direction:column;gap:24px}
.timeline-item {padding-top:16px;border-top:1px solid var(--line)}
.timeline-item h3 {margin-bottom:12px}
.photo-frame {display:grid;place-items:center;border-radius:15px;overflow:hidden;background:var(--bg);min-height:150px;margin:10px 0 14px}
.photo-frame img {width:100%;max-height:300px;object-fit:contain}
.photo-frame .photo-placeholder {min-height:150px}
.demo-photo svg {width:140px;height:140px;border-radius:12px;margin:14px}
.result-name {font-size:15px;font-weight:550;margin:10px 0}
.result-text {font-size:13px;line-height:1.7;white-space:pre-wrap;overflow-wrap:anywhere}
.user-description {margin:16px 0;font-size:13px;line-height:1.6}
.user-description span {font-size:11px;color:var(--muted)}
.user-description p {margin:4px 0;white-space:pre-wrap;overflow-wrap:anywhere}
.shot-actions {display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px;margin-top:12px}
.shot-actions .text-button {font-size:12px;min-height:44px;padding:8px 0}
.danger-text {color:#a0584a}
.delete-actions {display:grid;gap:10px;margin-top:24px}
.danger-button {background:#a0584a}
.field textarea {width:100%;resize:vertical;min-height:130px;background:var(--bg);border:0;border-radius:12px;padding:13px;color:var(--ink);font:inherit;line-height:1.6}
.undo-button {pointer-events:auto;color:var(--card);text-decoration:underline;min-height:44px;font-weight:600;padding:0 6px}
.result-badge {display:inline-block;color:#417858;background:#edf4ee;padding:5px 9px;border-radius:12px;font-size:12px;margin:6px 0 10px}
.result-badge.medium {color:#8c6927;background:#f9f2df}
.result-badge.high {color:#a0584a;background:#faece7}
.confidence {font-size:11px;color:var(--muted);margin:4px 0 12px;line-height:1.6}
.report-summary {padding:14px;background:var(--bg);border-radius:13px;margin-bottom:14px}
.report-summary p {font-size:12px;color:var(--muted);margin-top:5px}
.form-error {color:#a45c48;background:#fff0ea;padding:12px;border-radius:12px;margin:12px 0;font-size:13px}
.loading {display:flex;align-items:center;justify-content:center;gap:12px;padding:70px 10px;font-size:13px;color:var(--muted)}
.spinner {display:inline-block;width:21px;height:21px;border:2px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:spin .85s linear infinite;flex-shrink:0}
@keyframes spin {to{transform:rotate(360deg)}}
.job-banner {display:flex;align-items:center;gap:12px;text-align:left;width:100%;padding:13px;background:var(--soft);border-radius:15px;margin-bottom:16px;font-size:13px}
.job-banner>span:not(.spinner) {flex:1}
.job-banner small {display:block;font-size:11px;color:var(--muted);margin-top:3px}
.job-banner .icon {width:16px;height:16px}
.job-status {text-align:center;padding:20px 0}
.job-status .spinner {width:34px;height:34px;margin-bottom:18px}
.job-status p {font-size:13px;color:var(--muted);margin:12px auto 20px;max-width:320px}
.toast {position:fixed;left:50%;transform:translateX(-50%);bottom:calc(94px + var(--safe-bottom));background:var(--ink);color:var(--card);padding:12px 17px;border-radius:14px;font-size:13px;width:max-content;max-width:calc(100vw - 32px);z-index:50;pointer-events:none}
@media(max-width:699px) {
  .shell {padding:0 18px calc(108px + var(--safe-bottom))}
  .brandbar {padding:22px 0 18px}
  .brand {font-size:22px}.brand small {font-size:11px}
  .page-head {margin:4px 0 16px}
  .overview-grid {grid-template-columns:1fr;gap:24px}
  .map-card {padding:0 2px}
  .body-svg {height:250px;max-width:185px}
  .sheet {margin:auto auto 12px}
  .sheet-inner {padding:18px 18px 24px}
  .detail-actions .primary,.detail-actions .secondary {font-size:12px}
}
@media(max-width:350px) {
  .shell {padding-left:14px;padding-right:14px}
  .form-row {grid-template-columns:1fr;gap:0}
  .region-options {grid-template-columns:1fr}
  .brand small {font-size:10px}
  .bottom-nav {max-width:calc(100vw - 20px);gap:3px}
  .nav-add {width:46px;height:46px;margin-left:1px}
}
@media(prefers-reduced-motion:reduce) {*{animation:none!important;transition:none!important}}
body.dark {color-scheme:dark;--bg:#192321;--card:#24312d;--ink:#eef2ed;--muted:#a4b2a8;--line:#35463c;--soft:#473628;--body:#81928a;--body-edge:#24312d}
body.dark .result-badge {background:#2d4936;color:#c3dec8}
body.dark .result-badge.medium {background:#4b4027;color:#eadbb5}
body.dark .result-badge.high {background:#4b302a;color:#e8bfb7}
body.dark .form-error {background:#4b302a;color:#e8bfb7}
body.dark .segmented,body.dark .bottom-nav a.active {background:#35413e}
