:root {
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  color: #17221f;
  background: #e9efec;
  letter-spacing: 0;
  --forest: #17483b;
  --green: #1b765b;
  --mint: #e0f1e9;
  --yellow: #efb94d;
  --red: #d84b42;
  --paper: #fff;
  --panel: #f7faf8;
  --line: #d2ddd8;
  --muted: #65736e;
  --shadow: 0 14px 36px rgba(15, 45, 35, .18);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
h1, h2, p { margin-top: 0; }

.app-shell { width: 100%; height: 100%; }
.topbar { height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; color: #fff; background: var(--forest); border-bottom: 3px solid var(--yellow); }
.brand, .topbar-actions { display: flex; align-items: center; gap: 11px; }
.brand > div { display: grid; gap: 2px; }
.brand strong { font-size: 15px; }
.brand span:last-child { color: #c0d6ce; font-size: 11px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; color: var(--forest); background: var(--yellow); border-radius: 4px; font-size: 11px; font-weight: 900; }
.brand-mark.large { width: 54px; height: 54px; font-size: 16px; }
.user-label { color: #d5e4df; font-size: 12px; }
.permission-badge, .status-chip { padding: 4px 7px; border-radius: 3px; font-size: 11px; font-weight: 750; }
.permission-badge { color: #173f35; background: #dff3e9; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; color: inherit; background: transparent; border: 0; border-radius: 4px; }
.icon-button:hover { background: rgba(255,255,255,.12); }
.icon-button svg, .tool-button svg, .primary-button svg, .text-button svg, .floating-panel-button svg { width: 18px; height: 18px; }

.workspace { position: relative; height: calc(100% - 62px); }
#map { position: absolute; inset: 0 380px 0 0; background: #d9e3df; }
.leaflet-control-zoom a, .leaflet-popup-content-wrapper { border-radius: 3px !important; }
.leaflet-tooltip.parcel-label { padding: 0; color: var(--feature-label-color, #fff); background: transparent; border: 0; border-radius: 0; box-shadow: none; font-size: var(--feature-label-size, 16px) !important; font-weight: 750; line-height: 1.2; text-align: center; white-space: nowrap; pointer-events: none; }
.leaflet-tooltip.parcel-label::before { display: none; }
.parcel-label-line { display: block; }
#labelField { min-height: 132px; }
#labelField option { padding: 7px 8px; }
.label-style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.label-style-grid label { display: grid; gap: 7px; }
.label-style-grid input[type="color"] { width: 100%; min-height: 42px; padding: 3px; }

.map-tools { position: absolute; z-index: 500; top: 18px; left: 16px; display: grid; gap: 7px; }
.tool-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; color: var(--forest); background: #fff; border: 1px solid rgba(23,72,59,.12); border-radius: 4px; box-shadow: var(--shadow); }
.tool-button.active { color: #fff; background: var(--green); }
.tool-button.danger { color: var(--red); }
.tool-button:disabled { cursor: not-allowed; opacity: .42; }
.tool-divider { height: 1px; margin: 2px 4px; background: rgba(23,72,59,.25); }
.coordinate-strip { position: absolute; z-index: 480; left: 16px; bottom: 18px; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 430px); min-height: 36px; padding: 8px 11px; color: #fff; background: rgba(23,72,59,.9); border-radius: 3px; box-shadow: var(--shadow); font-size: 12px; }
.coordinate-strip svg { width: 16px; flex: 0 0 auto; }
.floating-panel-button { display: none; }
.basemap-menu { position: absolute; z-index: 650; top: 18px; left: 68px; width: min(290px, calc(100% - 90px)); padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); }
.menu-heading { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 9px; margin-bottom: 7px; border-bottom: 1px solid var(--line); }
.menu-heading span { color: var(--muted); font-size: 10px; }
.basemap-option { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 38px; padding: 7px 8px; color: var(--forest); background: transparent; border: 0; border-bottom: 1px solid #edf1ef; text-align: left; }
.basemap-option.active { color: #fff; background: var(--green); }

.side-panel { position: absolute; z-index: 600; top: 0; right: 0; width: 380px; height: 100%; padding: 18px; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); }
.panel-titlebar { display: flex; align-items: flex-start; justify-content: space-between; }
.panel-titlebar h1 { margin: 4px 0 14px; font-size: 22px; }
.eyebrow { color: var(--green); font-size: 10px; font-weight: 850; }
.panel-tabs { display: flex; margin: 0 -18px 18px; padding: 0 18px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.panel-tab { flex: 1 0 72px; height: 42px; color: var(--muted); background: transparent; border: 0; border-bottom: 3px solid transparent; font-weight: 700; }
.panel-tab.active { color: var(--green); border-bottom-color: var(--green); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.empty-state { display: grid; place-items: center; min-height: 320px; padding: 34px; color: var(--muted); text-align: center; }
.empty-state svg { width: 42px; height: 42px; margin-bottom: 16px; color: #8da69c; }
.empty-state strong { margin-bottom: 8px; color: #263732; }
.empty-state span { font-size: 13px; line-height: 1.65; }
.feature-summary { display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: 10px 12px; margin-bottom: 12px; background: var(--mint); border-left: 4px solid var(--green); }
.feature-summary div { display: grid; min-width: 0; gap: 3px; }
.feature-summary span { color: var(--muted); font-size: 11px; }
.feature-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-chip { flex: 0 0 auto; color: var(--green) !important; background: #fff; }
.permission-notice { padding: 10px 11px; margin-bottom: 14px; color: #805d1d; background: #fff4d9; border: 1px solid #efd89f; font-size: 12px; line-height: 1.55; }
.attribute-heading { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 10px; }
.attribute-heading h2, .section-intro h2 { margin-bottom: 0; font-size: 16px; }
.text-button { display: flex; align-items: center; gap: 5px; padding: 6px; color: var(--green); background: transparent; border: 0; font-size: 12px; font-weight: 750; }
.attribute-rows { display: grid; gap: 8px; margin-bottom: 16px; }
.attribute-row { display: grid; grid-template-columns: minmax(90px,.7fr) minmax(130px,1.3fr) 32px; gap: 6px; }
.attribute-row input, .field-control select { width: 100%; min-width: 0; min-height: 40px; padding: 8px 9px; color: #17221f; background: #fff; border: 1px solid #bdcbc5; border-radius: 3px; outline: 0; }
.attribute-row input:focus, .field-control select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(27,118,91,.12); }
.remove-field { display: grid; place-items: center; width: 32px; height: 40px; padding: 0; color: var(--red); background: #fff; border: 1px solid #e0c2bf; border-radius: 3px; }
.remove-field svg { width: 15px; }
.primary-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; padding: 10px 14px; color: #fff; background: var(--green); border: 0; border-radius: 3px; font-weight: 800; }
.primary-button:disabled { cursor: wait; opacity: .55; }
.secondary-button { min-height: 38px; padding: 8px 10px; color: var(--forest); background: #fff; border: 1px solid #aebfb7; border-radius: 3px; font-weight: 700; }
.secondary-button:hover { border-color: var(--green); }
.secondary-button.active { color: #fff; background: var(--green); border-color: var(--green); }
.feature-action-row { display: grid; grid-template-columns: minmax(110px,.75fr) minmax(160px,1.25fr); gap: 8px; }
.feature-action-row button { width: 100%; }
.feature-action-row svg { width: 17px; height: 17px; vertical-align: middle; }
.full-width { width: 100%; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.style-controls { padding: 12px; margin-bottom: 14px; background: #edf4f1; border: 1px solid var(--line); }
.style-controls label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 12px; font-weight: 750; }
.style-controls input[type="color"] { width: 54px; height: 34px; padding: 2px; border: 1px solid #aebfb7; }
.style-controls > div { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.section-intro { padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-intro p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.field-control { display: grid; gap: 8px; margin-bottom: 18px; }
.field-control > span { display: flex; justify-content: space-between; font-size: 13px; font-weight: 750; }
.field-control output { color: var(--green); }
.field-control input[type="range"] { width: 100%; accent-color: var(--green); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 0; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.toggle-row > span { display: grid; gap: 3px; }
.toggle-row strong { font-size: 13px; }
.toggle-row small { color: var(--muted); }
.toggle-row input { width: 18px; height: 18px; accent-color: var(--green); }
.label-preview { display: grid; place-items: center; min-height: 110px; margin-top: 22px; color: #fff; background: var(--forest); }
.label-preview span { color: #bcd1ca; font-size: 10px; }
.label-preview strong { font-size: 16px; }
.fixed-label-note { display: grid; gap: 5px; padding: 12px; margin: 16px 0; color: var(--forest); background: var(--mint); border-left: 4px solid var(--green); }
.fixed-label-note span { color: var(--muted); font-size: 12px; line-height: 1.55; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.stat-grid div { display: grid; gap: 5px; min-height: 72px; padding: 11px; color: #fff; background: var(--forest); }
.stat-grid span { color: #bcd1ca; font-size: 10px; }
.stat-grid strong { font-size: 19px; }
.category-statistics { display: grid; margin-top: 16px; }
.category-row { display: grid; grid-template-columns: 12px minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.category-swatch { width: 10px; height: 10px; border-radius: 2px; }
.user-list { display: grid; }
.user-row { display: grid; grid-template-columns: 40px minmax(0,1fr); gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.user-avatar { display: grid; place-items: center; width: 36px; height: 36px; color: #fff; background: var(--forest); border-radius: 50%; font-size: 12px; font-weight: 800; }
.user-row div { min-width: 0; }
.user-row strong, .user-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row small { margin-top: 3px; color: var(--muted); }
.user-row input { width: 18px; height: 18px; accent-color: var(--green); }
.user-actions { grid-column: 2; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.user-actions label { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }
.user-actions button { min-height: 32px; padding: 5px 9px; color: var(--forest); background: #fff; border: 1px solid #aebfb7; border-radius: 3px; font-weight: 750; }
.user-actions .approve-user { color: #fff; background: var(--green); border-color: var(--green); }
.user-actions .delete-user { display: grid; place-items: center; width: 32px; padding: 0; color: var(--red); }
.user-actions .delete-user svg { width: 16px; height: 16px; }

.parcel-info-popup .leaflet-popup-content { margin: 14px 16px; }
.parcel-popup-content { max-height: min(55vh,420px); overflow-y: auto; }
.parcel-popup-content h3 { margin: 0 0 10px; color: var(--forest); font-size: 16px; }
.parcel-popup-content dl { display: grid; gap: 0; margin: 0; }
.parcel-popup-content dl div { display: grid; grid-template-columns: minmax(80px,.8fr) minmax(120px,1.2fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid #e4ebe8; }
.parcel-popup-content dt { color: var(--muted); font-size: 12px; }
.parcel-popup-content dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: #17221f; font-size: 12px; }
.parcel-popup-content footer { margin-top: 10px; color: var(--muted); font-size: 10px; line-height: 1.6; }

.login-view { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(340px,.75fr); width: 100%; height: 100%; }
.login-visual { position: relative; display: flex; align-items: flex-end; padding: 7vw; overflow: hidden; color: #fff; background: var(--forest); }
.field-pattern { position: absolute; inset: -15%; opacity: .25; background-image: linear-gradient(28deg, transparent 47%, #aad4c4 48% 50%, transparent 51%), linear-gradient(152deg, transparent 47%, #aad4c4 48% 50%, transparent 51%); background-size: 170px 110px; transform: rotate(-7deg); }
.login-copy { position: relative; max-width: 650px; }
.login-copy h1 { max-width: 620px; margin: 24px 0 14px; font-size: clamp(36px,5vw,66px); line-height: 1.08; }
.login-copy p { max-width: 570px; margin-bottom: 0; color: #c7dbd3; font-size: 17px; line-height: 1.7; }
.login-form { display: flex; flex-direction: column; justify-content: center; padding: clamp(30px,6vw,82px); background: #fff; }
.login-form h2 { margin: 7px 0 32px; font-size: 28px; }
.login-form label { display: grid; gap: 6px; margin-bottom: 14px; }
.login-form label span { font-size: 13px; font-weight: 750; }
.login-form input { min-height: 42px; padding: 9px 10px; border: 1px solid #bdcbc5; border-radius: 3px; outline: 0; }
.form-error { min-height: 20px; color: #af352c; font-size: 12px; }
.login-form small { margin-top: 12px; color: var(--muted); }
.auth-switch { margin-top: 12px; padding: 8px; color: var(--green); background: transparent; border: 0; font-weight: 750; }
.toast { position: fixed; z-index: 2000; left: 50%; bottom: 22px; max-width: min(90vw,460px); padding: 11px 16px; color: #fff; background: #17221f; border-radius: 3px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%,12px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%,0); }
.mobile-only { display: none; }

@media (max-width: 760px) {
  .topbar { height: 58px; padding: 0 10px; }
  .workspace { height: calc(100% - 58px); }
  .brand strong { font-size: 13px; }
  .brand span:last-child, .user-label, .permission-badge { display: none; }
  #map { inset: 0; }
  .map-tools { top: 12px; left: 10px; }
  .tool-button { width: 40px; height: 40px; }
  .coordinate-strip { left: 10px; right: 10px; bottom: calc(62px + env(safe-area-inset-bottom)); max-width: none; }
  .floating-panel-button { position: absolute; z-index: 520; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 8px 12px; color: #fff; background: var(--forest); border: 0; border-radius: 4px; box-shadow: var(--shadow); font-weight: 750; }
  .side-panel { top: auto; bottom: 0; width: 100%; height: min(82%,720px); padding: 16px; border: 0; border-top: 1px solid var(--line); box-shadow: 0 -16px 36px rgba(15,45,35,.2); transform: translateY(105%); transition: transform .22s ease; }
  .side-panel.open { transform: translateY(0); }
  .mobile-only { display: grid; color: var(--forest); }
  .panel-tabs { margin: 0 -16px 16px; padding: 0 16px; }
  .login-view { grid-template-columns: 1fr; overflow-y: auto; }
  .login-visual { min-height: 35vh; padding: 30px 22px; }
  .login-copy h1 { margin: 16px 0 8px; font-size: 32px; }
  .login-copy p { font-size: 13px; }
  .login-form { min-height: 65vh; padding: 32px 22px; justify-content: flex-start; }
}
