:root{
  --nav:#073e69;--nav2:#0b588f;--blue:#0879d1;--blue2:#e9f4ff;--ink:#15324b;--muted:#6b7f91;
  --line:#d9e3ec;--bg:#f3f6fa;--white:#fff;--green:#0b8a55;--green-bg:#e9f8f1;--red:#c93636;--red-bg:#fff0f0;
  --orange:#c87500;--orange-bg:#fff7e8;--purple:#7c3aed;--shadow:0 10px 28px rgba(14,48,77,.12)
}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:Inter,"Segoe UI",Arial,sans-serif;color:var(--ink);background:var(--bg)}
button,input,select,textarea{font:inherit}button{cursor:pointer}.hidden{display:none!important}.subtle{color:var(--muted);font-size:12px}.muted{color:var(--muted)}
.auth-shell{min-height:100vh;display:grid;place-items:center;padding:24px;background:linear-gradient(135deg,#063b65 0%,#0b75b8 55%,#dff2ff 170%)}
.auth-card{width:min(430px,96vw);background:#fff;border-radius:16px;box-shadow:0 24px 70px #001e3866;padding:28px}.auth-brand{display:flex;gap:12px;align-items:center;margin-bottom:20px}.auth-brand strong{display:block;font-size:22px}.auth-brand small{display:block;color:var(--muted);margin-top:3px}.logo-mark{font-size:25px;color:#2a9be9}
.auth-tabs{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid var(--line);margin-bottom:18px}.auth-tab{border:0;background:transparent;padding:10px;color:var(--muted);font-weight:700}.auth-tab.active{color:var(--blue);border-bottom:2px solid var(--blue)}
.auth-form{display:grid;gap:12px}.auth-form label{font-size:12px;font-weight:650;color:#496175}.auth-form input,.auth-form select{display:block;width:100%;padding:11px 12px;margin-top:5px;border:1px solid #cbd8e4;border-radius:8px;background:#fff}.hint{font-size:11px;color:var(--muted);line-height:1.45}.message{padding:10px 12px;border-radius:8px;margin-top:12px;background:var(--blue2);border:1px solid #b9dcf7}.message.error{background:var(--red-bg);border-color:#efbbbb;color:#8d2525}
.app-shell{min-height:100vh}.sidebar{position:fixed;inset:0 auto 0 0;width:242px;background:linear-gradient(180deg,#063d68,#052f52);color:#dceeff;display:flex;flex-direction:column;z-index:30}.brand{height:72px;padding:16px 18px;display:flex;align-items:center;gap:10px;border-bottom:1px solid #ffffff1d}.brand strong{font-size:18px;color:white}.brand small{display:block;font-size:11px;color:#a9cde8;margin-top:2px}
.sidebar nav{padding:10px 9px;overflow:auto}.sidebar nav button{width:100%;border:0;background:transparent;color:#d8eafa;display:flex;align-items:center;gap:11px;padding:10px 12px;border-radius:8px;text-align:left;font-size:13px;margin:1px 0}.sidebar nav button span{display:inline-grid;width:20px;place-items:center;font-size:16px}.sidebar nav button:hover,.sidebar nav button.active{background:#ffffff18;color:white}.sidebar-foot{margin-top:auto;border-top:1px solid #ffffff1f;padding:13px}.sidebar-foot #who{font-size:12px;line-height:1.4;margin-bottom:8px}.main{margin-left:242px;min-height:100vh}.topbar{height:72px;background:#fff;border-bottom:1px solid var(--line);padding:0 22px;display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:20}.breadcrumb{font-weight:800}.top-actions{display:flex;align-items:center;gap:8px}.searchbox{width:320px;border:1px solid #cbd8e4;border-radius:8px;display:flex;align-items:center;gap:7px;padding:0 10px;background:#f9fbfd}.searchbox input{width:100%;border:0;outline:0;background:transparent;padding:9px 0}.content{padding:18px 22px 30px}
.btn{border:1px solid #c9d6e3;background:#fff;color:#294960;border-radius:8px;padding:8px 12px;font-weight:650;font-size:12px}.btn:hover{background:#f4f8fc}.btn.primary{background:var(--blue);border-color:var(--blue);color:#fff}.btn.danger{background:#fff1f1;border-color:#efc2c2;color:#ad2828}.btn.success{background:#07834f;border-color:#07834f;color:#fff}.btn.ghost{background:transparent}.btn.dark{border-color:#ffffff35;color:white}.btn.wide{width:100%;padding:11px}.btn.small{padding:5px 8px;font-size:11px}.btn:disabled{opacity:.55;cursor:not-allowed}
.filters{background:#fff;border:1px solid var(--line);border-radius:10px;padding:12px;display:flex;gap:10px;align-items:end;flex-wrap:wrap;margin-bottom:14px}.filter-check{display:flex;align-items:center;gap:7px;padding:8px 10px;border:1px solid #d7e2ec;border-radius:7px;background:#f8fbfd;font-size:12px;font-weight:650;color:#40566b}.filter-check input{accent-color:var(--blue)}.filter label{display:block;font-size:11px;color:var(--muted);font-weight:700;margin-bottom:4px}.filter select,.filter input{min-width:160px;padding:8px;border:1px solid #cbd8e4;border-radius:7px;background:white}.kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.kpi{background:#fff;border:1px solid var(--line);border-radius:10px;padding:15px;position:relative;overflow:hidden}.kpi .label{font-size:12px;color:var(--muted);font-weight:650}.kpi .value{font-size:25px;font-weight:850;margin-top:5px;letter-spacing:-.4px}.kpi .unit{font-size:11px;color:var(--muted);margin-left:3px}.kpi.green .value{color:var(--green)}.kpi.red .value{color:var(--red)}.kpi.blue .value{color:var(--blue)}.kpi.orange .value{color:var(--orange)}
.grid{display:grid;gap:14px}.grid.two{grid-template-columns:minmax(0,1.25fr) minmax(360px,.75fr)}.grid.equal{grid-template-columns:1fr 1fr}.mt{margin-top:14px}.panel{background:#fff;border:1px solid var(--line);border-radius:10px;overflow:hidden}.panel-head{padding:13px 15px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:10px}.panel-head h3{margin:0;font-size:14px}.panel-body{padding:14px}.panel-note{font-size:11px;color:var(--muted);line-height:1.45;margin-top:10px}
.table-tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.table-tools input,.table-tools select{padding:7px 9px;border:1px solid #cbd8e4;border-radius:7px}.tablewrap{overflow:auto;max-height:68vh}.data-table{border-collapse:collapse;width:100%;font-size:12px}.data-table th{position:sticky;top:0;background:#f2f6fa;color:#40586e;font-size:11px;text-align:left;padding:9px;border-bottom:1px solid var(--line);white-space:nowrap;z-index:2}.data-table td{padding:9px;border-bottom:1px solid #edf2f6;vertical-align:top;white-space:nowrap}.data-table tr:hover td{background:#fafcfe}.data-table td.wrap{white-space:normal;min-width:220px}.actions-cell{display:flex;gap:4px}.badge{display:inline-flex;align-items:center;gap:5px;padding:3px 7px;border-radius:999px;background:#eaf3fb;color:#27608b;font-size:10px;font-weight:750}.badge.green{background:var(--green-bg);color:var(--green)}.badge.red{background:var(--red-bg);color:var(--red)}.badge.orange{background:var(--orange-bg);color:var(--orange)}
.map{height:430px;min-height:300px;background:#e9eef3}.map.large{height:calc(100vh - 175px);min-height:560px}.map-legend{background:#fff;padding:8px 10px;border-radius:7px;box-shadow:0 1px 6px #0003;font-size:11px;line-height:1.6}.legend-dot{width:9px;height:9px;display:inline-block;border-radius:50%;margin-right:6px}.dot-source{background:#0b8a55}.dot-potential{background:#7c3aed}.dot-transport{background:#0879d1}.dot-shortage{background:#d53b3b}
.bar-chart{display:grid;gap:9px}.bar-row{display:grid;grid-template-columns:54px 1fr 90px;gap:8px;align-items:center;font-size:11px}.bar-track{height:18px;background:#eef3f7;border-radius:4px;overflow:hidden;display:flex}.bar-supply{height:100%;background:#2a8fd4}.bar-demand{height:100%;background:#e65b5b}.bar-labels{display:flex;gap:10px;font-size:10px;color:var(--muted);margin-bottom:8px}.swatch{width:9px;height:9px;display:inline-block;border-radius:2px;margin-right:3px}.swatch.supply{background:#2a8fd4}.swatch.demand{background:#e65b5b}
.balance-table .positive{color:var(--green);font-weight:750}.balance-table .negative{color:var(--red);font-weight:750}.alert{padding:11px 12px;border-radius:8px;border:1px solid #f0c7c7;background:#fff4f4;color:#9a2e2e;font-size:12px}.info{padding:11px 12px;border-radius:8px;border:1px solid #bbd9f0;background:#f0f8ff;color:#275f89;font-size:12px}.successbox{padding:11px 12px;border-radius:8px;border:1px solid #b9dfcc;background:#f0fbf6;color:#176c48;font-size:12px}
.modal-backdrop{position:fixed;inset:0;background:#001b325e;z-index:100;display:grid;place-items:center;padding:18px}.modal{width:min(1120px,97vw);max-height:94vh;background:#fff;border-radius:12px;box-shadow:var(--shadow);display:flex;flex-direction:column;overflow:hidden}.modal.small{width:min(560px,95vw)}.modal-head{padding:13px 16px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}.modal-head h2{margin:0;font-size:16px}.modal-tabs{display:flex;gap:0;overflow:auto;border-bottom:1px solid var(--line);background:#f8fafc}.modal-tabs button{border:0;border-right:1px solid var(--line);background:transparent;padding:10px 13px;color:#496175;font-size:11px;font-weight:750;white-space:nowrap}.modal-tabs button.active{background:#fff;color:var(--blue);box-shadow:inset 0 -2px var(--blue)}.modal-body{padding:15px;overflow:auto}.modal-foot{padding:12px 15px;border-top:1px solid var(--line);display:flex;justify-content:flex-end;gap:8px;background:#fafcfd}
.form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.field label{display:block;font-size:11px;color:#566f84;font-weight:700;margin-bottom:5px}.field .required{color:#d22;margin-left:2px}.field input,.field select,.field textarea{width:100%;padding:8px 9px;border:1px solid #cbd8e4;border-radius:7px;background:white;color:var(--ink)}.field textarea{min-height:82px;resize:vertical}.field input[readonly]{background:#eef5fb;color:#526b80}.field.span2{grid-column:span 2}.field.span3{grid-column:span 3}.field-help{font-size:10px;color:var(--muted);margin-top:4px;line-height:1.35}.form-section{display:none}.form-section.active{display:block}.form-map{height:310px;border:1px solid var(--line);border-radius:8px;margin-top:10px}.calc-box{background:#eff8ff;border:1px solid #bfdef4;border-radius:8px;padding:10px;display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.calc-box b{display:block;font-size:16px;color:var(--blue)}
.upload-box{border:2px dashed #b8cad9;border-radius:9px;padding:18px;text-align:center;background:#fbfdff}.preview-list{font-size:11px;max-height:280px;overflow:auto}.preview-list pre{white-space:pre-wrap;background:#f5f8fb;padding:8px;border-radius:6px}.error-list{color:#a62626}.warning-list{color:#8a5b00}.steps{display:flex;gap:6px;margin-bottom:12px}.step{padding:6px 9px;border-radius:999px;background:#edf2f6;color:#60758a;font-size:11px}.step.active{background:#e3f2ff;color:#096cae;font-weight:750}
.card-menu{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.menu-card{border:1px solid var(--line);border-radius:10px;background:#fff;padding:16px}.menu-card h4{margin:0 0 6px}.menu-card p{margin:0 0 12px;color:var(--muted);font-size:12px;line-height:1.45}.status-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.progress{height:8px;background:#edf2f6;border-radius:999px;overflow:hidden}.progress>span{display:block;height:100%;background:var(--blue)}
.toast-root{position:fixed;right:18px;bottom:18px;z-index:200;display:grid;gap:8px}.toast{min-width:280px;max-width:430px;background:#153b58;color:#fff;border-radius:8px;padding:11px 13px;box-shadow:var(--shadow);font-size:12px}.toast.error{background:#9f2f2f}.toast.success{background:#126b49}
.empty{padding:35px;text-align:center;color:var(--muted)}.mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.nowrap{white-space:nowrap}
@media(max-width:1150px){.sidebar{width:210px}.main{margin-left:210px}.searchbox{display:none}.kpis{grid-template-columns:repeat(2,1fr)}.grid.two,.grid.equal{grid-template-columns:1fr}.form-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:760px){.sidebar{width:68px}.brand div,.sidebar nav button:not(.active){font-size:0}.sidebar nav button span{font-size:17px}.sidebar-foot{display:none}.main{margin-left:68px}.topbar{padding:0 10px}.top-actions .btn:not(.primary){display:none}.content{padding:12px}.kpis{grid-template-columns:1fr}.form-grid{grid-template-columns:1fr}.field.span2,.field.span3{grid-column:span 1}.modal{width:99vw}.card-menu{grid-template-columns:1fr}}

.quality-strip{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.quality-strip>div{border:1px solid #d9e5f0;border-radius:10px;padding:12px;background:#f8fbfe}.quality-strip b{display:block;font-size:22px;color:#123d63}.quality-strip span{display:block;margin-top:4px;font-size:12px;color:#61758a}@media(max-width:900px){.quality-strip{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* v2.2 GIS coordinate editor */
.spatial-editor{border:1px solid #b9d8ee;border-radius:10px;background:#f8fcff;padding:12px;grid-column:1/-1}
.spatial-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:10px}.spatial-head h4{margin:0 0 4px;color:#174f78}.spatial-head>div:last-child{white-space:nowrap}
.crs-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:10px;border:1px solid #d8e5ef;border-radius:8px;background:#fff}
.important-note{margin:10px 0;padding:10px 12px;border-left:4px solid #df8b00;background:#fff7e6;color:#6e4b0b;border-radius:6px;font-size:11px;line-height:1.5}
.paste-coordinates{display:grid;grid-template-columns:140px minmax(280px,1fr) auto;gap:8px;align-items:center;margin:10px 0}.paste-coordinates label{font-size:11px;font-weight:750;color:#526a7d}.paste-coordinates textarea{min-height:58px;padding:8px;border:1px solid #cbd8e4;border-radius:7px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;resize:vertical}
.coord-table{max-height:310px;border:1px solid #d9e5ef;border-radius:8px}.coord-table input{width:100%;min-width:105px;border:1px solid #cbd8e4;border-radius:6px;padding:6px 7px;background:#fff}.coord-table .cp-code{min-width:75px}.coord-table .cp-wgs{font-size:10px;color:#315d7d}.coord-order{font-weight:800;text-align:center;color:#1c5f8d}
.map-coordinate-readout{background:#ffffffeb;border:1px solid #c9d9e6;border-radius:6px;padding:5px 8px;box-shadow:0 1px 5px #0002;font-size:10px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.leaflet-control-layers{font-size:11px}.leaflet-control-layers-expanded{max-height:340px;overflow:auto}
@media(max-width:900px){.crs-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.paste-coordinates{grid-template-columns:1fr}.spatial-head{flex-direction:column}.spatial-head>div:last-child{white-space:normal}}
@media(max-width:620px){.crs-grid{grid-template-columns:1fr}}

.map.compact{height:360px;min-height:320px}
