:root {
  --bg: #f4f6f3;
  --panel: #ffffff;
  --panel-soft: #eef3ef;
  --text: #1f2a24;
  --muted: #68736d;
  --line: #dce4df;
  --primary: #1e5c4c;
  --primary-dark: #173f35;
  --primary-soft: #dcebe5;
  --accent: #c58a42;
  --danger: #b54747;
  --danger-soft: #f7e4e4;
  --income: #2c7d59;
  --expense: #b6534c;
  --shadow: 0 12px 35px rgba(29, 51, 40, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar: 258px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
.hidden { display: none !important; }
.align-right { text-align: right; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar {
  background: linear-gradient(180deg, #173f35 0%, #123229 100%);
  color: #fff;
  padding: 24px 18px;
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: 9px 0 28px rgba(16, 42, 34, .16);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 26px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #f5d6a5; font-size: 23px; }
.brand strong { display: block; font-size: 15px; letter-spacing: .01em; }
.brand span { display: block; font-size: 11px; color: rgba(255,255,255,.67); margin-top: 3px; }
.main-nav { display: grid; gap: 5px; padding-top: 24px; }
.nav-item { border: 0; background: transparent; color: rgba(255,255,255,.76); text-align: left; display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 12px; transition: .18s ease; }
.nav-item span { width: 20px; text-align: center; font-size: 17px; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: #fff; color: var(--primary-dark); font-weight: 750; box-shadow: 0 8px 22px rgba(0,0,0,.12); }
.sidebar-footer { margin-top: auto; padding: 18px 8px 2px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-footer p { margin: 12px 0 0; color: rgba(255,255,255,.55); font-size: 11px; line-height: 1.45; }
.storage-status { display: flex; align-items: center; gap: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 999px; background: #75d39b; box-shadow: 0 0 0 4px rgba(117,211,155,.12); }
.storage-status strong { display: block; font-size: 12px; }
.storage-status small { color: rgba(255,255,255,.6); font-size: 10px; }

.main-area { grid-column: 2; min-width: 0; }
.topbar { height: 92px; display: flex; align-items: center; gap: 18px; padding: 18px 30px; background: rgba(244,246,243,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 500; }
.topbar h1 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; }
.mobile-menu { display: none !important; }

.view { display: none; padding: 26px 30px 38px; }
.view.active { display: block; }
.view.map-view { padding: 0; height: calc(100vh - 92px); overflow: hidden; }

.btn { border: 1px solid transparent; border-radius: 11px; padding: 10px 15px; font-weight: 750; font-size: 13px; transition: .18s ease; display: inline-flex; justify-content: center; align-items: center; gap: 8px; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { color: #fff; background: var(--primary); box-shadow: 0 8px 20px rgba(30,92,76,.18); }
.btn.primary:hover { background: #174d40; }
.btn.secondary { color: var(--text); background: #fff; border-color: var(--line); }
.btn.secondary:hover { border-color: #b8c8bf; background: #fafcfb; }
.btn.danger { color: #fff; background: var(--danger); }
.btn.full { width: 100%; margin-top: 8px; }
.text-btn { color: var(--primary); border: 0; background: transparent; font-weight: 750; font-size: 13px; }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; font-size: 18px; color: var(--text); }
.icon-btn:hover { background: var(--panel-soft); }

.dashboard-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; display: flex; gap: 14px; align-items: center; box-shadow: 0 6px 25px rgba(25,52,39,.04); }
.metric-icon { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 15px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 850; font-size: 18px; }
.metric-icon.income { background: #ddf2e5; color: var(--income); }
.metric-icon.expense { background: #f7e4e1; color: var(--expense); }
.metric-card small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 750; }
.metric-card strong { display: block; margin: 5px 0 2px; font-size: 24px; letter-spacing: -.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-card span:not(.metric-icon) { color: var(--muted); font-size: 11px; }

.two-column-layout { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(310px,.75fr); gap: 20px; margin-bottom: 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 25px rgba(25,52,39,.04); }
.panel-header { padding: 18px 20px 14px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.panel-header h2, .settings-card h2, .credits-panel h2 { font-size: 16px; margin: 0; }
.panel-header p, .settings-card p, .credits-panel p { color: var(--muted); font-size: 12px; margin: 4px 0 0; line-height: 1.55; }
.dashboard-map-placeholder { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; background: radial-gradient(circle at 30% 20%, rgba(66,121,87,.16), transparent 28%), linear-gradient(145deg, #e7eee8, #f5f8f5); border-radius: 0 0 var(--radius) var(--radius); }
.dashboard-map-placeholder strong { display: block; margin-top: 12px; }
.dashboard-map-placeholder p { color: var(--muted); max-width: 380px; font-size: 13px; }
.mini-map-art { width: 120px; height: 72px; border: 2px solid rgba(30,92,76,.25); transform: rotate(-4deg); border-radius: 18px; position: relative; overflow: hidden; background: #dce8df; }
.mini-map-art::before, .mini-map-art::after, .mini-map-art span { content: ""; position: absolute; border: 2px solid rgba(30,92,76,.34); border-radius: 45%; }
.mini-map-art::before { width: 75px; height: 45px; left: -17px; top: 14px; }
.mini-map-art::after { width: 62px; height: 37px; right: -10px; top: -8px; }
.mini-map-art span:nth-child(1) { width: 31px; height: 31px; right: 23px; bottom: 5px; background: rgba(197,138,66,.2); }
.list-stack { padding: 8px 18px 16px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid #edf1ee; }
.list-item:last-child { border-bottom: 0; }
.list-item-main { min-width: 0; flex: 1; }
.list-item strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item small { color: var(--muted); font-size: 11px; display: block; margin-top: 3px; }
.item-badge { border-radius: 999px; padding: 5px 8px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge-high { background: #f8dede; color: #9f3f3f; }
.badge-medium { background: #fff0d9; color: #9a682a; }
.badge-low { background: #e2f0e7; color: #33704c; }
.property-summary-grid { padding: 17px 20px 20px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.property-summary { border: 1px solid var(--line); border-radius: 13px; padding: 13px; position: relative; overflow: hidden; }
.property-summary::before { content:""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--property-color, var(--primary)); }
.property-summary strong { display:block; font-size: 13px; }
.property-summary span { color:var(--muted); font-size:11px; }
.property-summary b { display:block; margin-top:8px; font-size:14px; }
.empty-inline { padding: 22px; color: var(--muted); font-size: 13px; text-align: center; }

.section-toolbar { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:18px; }
.section-toolbar.wrap { flex-wrap:wrap; }
.search-filter { flex:1; max-width:520px; }
.section-toolbar input[type="search"], .section-toolbar select, .toolbar-left input, .toolbar-left select, .toolbar-right select { min-height:42px; border:1px solid var(--line); border-radius:11px; background:#fff; padding:0 13px; color:var(--text); outline:none; }
.section-toolbar input[type="search"] { width:100%; }
.section-toolbar input:focus, .section-toolbar select:focus { border-color:#75a493; box-shadow:0 0 0 3px rgba(30,92,76,.08); }
.toolbar-left, .toolbar-right { display:flex; gap:10px; flex-wrap:wrap; }
.cards-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:17px; }
.property-card { background:#fff; border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; box-shadow:0 6px 22px rgba(25,52,39,.04); }
.property-card-top { height:9px; background:var(--property-color,var(--primary)); }
.property-card-body { padding:18px; }
.property-card h3 { margin:0; font-size:17px; }
.property-card .location { color:var(--muted); font-size:12px; margin-top:5px; }
.property-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:9px; margin:17px 0; }
.property-stat { background:var(--panel-soft); border-radius:11px; padding:10px; }
.property-stat small { display:block; color:var(--muted); font-size:9px; text-transform:uppercase; letter-spacing:.05em; }
.property-stat strong { display:block; margin-top:3px; font-size:13px; }
.property-meta { font-size:12px; color:var(--muted); min-height:42px; }
.property-card-actions { border-top:1px solid var(--line); padding:12px 18px; display:flex; gap:8px; justify-content:flex-end; }
.card-empty { border:2px dashed #cbd8d0; border-radius:var(--radius); min-height:250px; display:grid; place-items:center; text-align:center; padding:24px; color:var(--muted); }
.card-empty strong { display:block; color:var(--text); margin-bottom:7px; }

.segmented { display:inline-flex; background:#e7ece8; border-radius:12px; padding:4px; }
.segmented button { border:0; background:transparent; border-radius:9px; padding:8px 13px; color:var(--muted); font-size:12px; font-weight:750; }
.segmented button.active { background:#fff; color:var(--text); box-shadow:0 3px 10px rgba(0,0,0,.08); }
.task-board { display:grid; gap:12px; }
.task-card { background:#fff; border:1px solid var(--line); border-radius:15px; padding:15px 17px; display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:14px; align-items:center; }
.task-check { width:24px; height:24px; border-radius:8px; border:2px solid #b9c8bf; background:#fff; display:grid; place-items:center; color:#fff; }
.task-check.done { background:var(--primary); border-color:var(--primary); }
.task-main h3 { margin:0; font-size:14px; }
.task-main p { margin:5px 0 0; color:var(--muted); font-size:11px; line-height:1.45; }
.task-tags { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.tag { border-radius:999px; background:var(--panel-soft); color:var(--muted); padding:4px 8px; font-size:10px; font-weight:700; }
.task-actions { display:flex; gap:4px; }
.task-card.completed { opacity:.68; }
.task-card.completed h3 { text-decoration:line-through; }

.finance-metrics { margin-bottom:18px; }
.table-panel { overflow:hidden; }
.table-wrap { overflow:auto; }
.data-table { width:100%; border-collapse:collapse; min-width:790px; }
.data-table th { text-align:left; font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; padding:13px 16px; background:#f8faf8; border-bottom:1px solid var(--line); }
.data-table td { padding:14px 16px; border-bottom:1px solid #edf1ee; font-size:12px; }
.data-table tbody tr:hover { background:#fbfcfb; }
.amount-income { color:var(--income); font-weight:800; }
.amount-expense { color:var(--expense); font-weight:800; }
.row-actions { white-space:nowrap; text-align:right; }
.row-actions button { border:0; background:transparent; color:var(--muted); padding:4px 6px; }

.document-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.document-card { background:#fff; border:1px solid var(--line); border-radius:16px; padding:17px; display:grid; grid-template-columns:auto minmax(0,1fr); gap:13px; position:relative; }
.document-icon { width:44px; height:50px; border-radius:10px; background:var(--primary-soft); color:var(--primary); display:grid; place-items:center; font-weight:850; font-size:11px; text-transform:uppercase; }
.document-main { min-width:0; }
.document-main h3 { font-size:13px; margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.document-main p { color:var(--muted); font-size:11px; margin:5px 0 9px; }
.document-meta { color:var(--muted); font-size:10px; display:flex; gap:9px; flex-wrap:wrap; }
.document-actions { grid-column:1/-1; display:flex; justify-content:flex-end; gap:7px; padding-top:10px; border-top:1px solid var(--line); }

.settings-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.settings-card { padding:20px; }
.settings-card .button-stack { display:flex; gap:9px; flex-wrap:wrap; margin-top:16px; }
.status-box { margin-top:14px; background:var(--panel-soft); border-radius:11px; padding:11px 12px; color:var(--muted); font-size:11px; line-height:1.45; }
.danger-zone { border-color:#e8c6c6; }
.credits-panel { padding:20px; margin-top:18px; }
.helper-text { color:var(--muted); font-size:10px !important; line-height:1.5; }

.map-layout { display:grid; grid-template-columns:minmax(0,1fr) 330px; height:100%; }
.map-stage { position:relative; min-width:0; }
.mobile-map-panel-btn { display:none; position:absolute; right:12px; top:15px; z-index:35; background:#fff; border:1px solid var(--line); border-radius:11px; padding:10px 12px; font-size:11px; font-weight:800; box-shadow:var(--shadow); }
#map { position:absolute; inset:0; background:#d9e1db; }
.map-panel { background:#fff; border-left:1px solid var(--line); overflow:auto; z-index:10; }
.map-panel-tabs { display:grid; grid-template-columns:1fr 1fr; position:sticky; top:0; background:#fff; z-index:4; border-bottom:1px solid var(--line); }
.map-panel-tabs button { border:0; background:#fff; padding:15px; color:var(--muted); font-weight:800; font-size:12px; border-bottom:2px solid transparent; }
.map-panel-tabs button.active { color:var(--primary); border-bottom-color:var(--primary); }
.map-tab { display:none; }
.map-tab.active { display:block; }
.map-panel-section { padding:17px 18px; border-bottom:1px solid var(--line); }
.map-panel-section h3 { font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); margin:0 0 9px; }
.layer-row { display:flex; gap:10px; align-items:center; padding:9px 0; cursor:pointer; position:relative; }
.layer-row input { accent-color:var(--primary); }
.layer-row > span { flex:1; min-width:0; }
.layer-row strong { display:block; font-size:12px; }
.layer-row small { display:block; color:var(--muted); font-size:10px; margin-top:2px; line-height:1.35; }
.switch-row input { position:absolute; opacity:0; pointer-events:none; }
.switch { width:35px; height:20px; border-radius:999px; background:#cbd4cf; position:relative; transition:.18s; }
.switch::after { content:""; position:absolute; width:14px; height:14px; border-radius:50%; background:#fff; left:3px; top:3px; transition:.18s; box-shadow:0 1px 4px rgba(0,0,0,.18); }
.switch-row input:checked ~ .switch { background:var(--primary); }
.switch-row input:checked ~ .switch::after { transform:translateX(15px); }
.floating-card { position:absolute; z-index:20; background:rgba(255,255,255,.94); border:1px solid rgba(211,222,215,.95); box-shadow:var(--shadow); backdrop-filter:blur(10px); }
.map-search { top:15px; left:15px; border-radius:13px; padding:5px; display:flex; gap:5px; width:min(390px,calc(100% - 30px)); }
.map-search input { flex:1; min-width:0; border:0; background:transparent; padding:0 10px; outline:none; font-size:12px; }
.map-search .icon-btn { border:0; background:transparent; width:34px; height:34px; }
.map-tools { left:15px; top:72px; border-radius:13px; padding:6px; display:flex; gap:4px; }
.map-tools button { border:0; background:transparent; color:var(--text); border-radius:9px; min-width:55px; padding:8px 7px; font-weight:850; }
.map-tools button span { display:block; font-size:9px; font-weight:700; color:var(--muted); margin-top:3px; }
.map-tools button:hover, .map-tools button.active { background:var(--primary-soft); color:var(--primary); }
.map-tools .draw-action { min-width:34px; background:var(--primary); color:#fff; }
.map-tools .draw-action.danger { background:var(--danger); }
.map-legend { left:15px; bottom:15px; border-radius:12px; padding:9px 11px; display:flex; gap:12px; flex-wrap:wrap; font-size:9px; color:var(--muted); }
.map-legend span { display:flex; align-items:center; gap:5px; }
.legend-swatch { width:12px; height:12px; display:inline-block; border-radius:3px; }
.legend-swatch.parcel { background:rgba(48,126,99,.4); border:2px solid #1e6b53; }
.legend-swatch.zone { background:rgba(197,138,66,.35); border:2px solid #b77932; }
.legend-swatch.line { height:3px; background:#455e77; border-radius:99px; }
.legend-swatch.point { width:10px; height:10px; border-radius:50%; background:#b84b4b; }
.drawing-help { position:absolute; z-index:25; top:132px; left:15px; background:#173f35; color:#fff; padding:9px 12px; border-radius:10px; font-size:11px; box-shadow:var(--shadow); max-width:320px; }
.maplibregl-ctrl-bottom-right { right:8px; bottom:8px; }
.maplibregl-popup-content { border-radius:12px; box-shadow:var(--shadow); padding:12px; }

.feature-inspector { padding:18px; }
.empty-inspector { text-align:center; color:var(--muted); padding-top:70px; }
.empty-inspector .empty-illustration { width:55px; height:55px; margin:0 auto 12px; display:grid; place-items:center; border-radius:18px; background:var(--panel-soft); color:var(--primary); font-size:25px; }
.empty-inspector h3 { color:var(--text); font-size:15px; margin:0; }
.empty-inspector p { font-size:11px; line-height:1.55; }
.inspector-title { display:flex; align-items:flex-start; gap:12px; }
.inspector-symbol { width:40px; height:40px; border-radius:13px; background:var(--primary-soft); color:var(--primary); display:grid; place-items:center; }
.inspector-title h3 { margin:0; font-size:16px; }
.inspector-title p { color:var(--muted); font-size:10px; margin:3px 0 0; }
.inspector-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:17px 0; }
.inspector-stat { background:var(--panel-soft); border-radius:11px; padding:10px; }
.inspector-stat small { color:var(--muted); font-size:9px; display:block; }
.inspector-stat strong { font-size:12px; display:block; margin-top:4px; }
.inspector-section { border-top:1px solid var(--line); padding-top:14px; margin-top:14px; }
.inspector-section h4 { font-size:10px; text-transform:uppercase; letter-spacing:.07em; color:var(--muted); margin:0 0 7px; }
.inspector-section p { font-size:11px; line-height:1.55; margin:0; white-space:pre-wrap; }
.inspector-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:18px; }
.inspector-actions .btn:last-child:nth-child(odd) { grid-column:1/-1; }

.modal-backdrop { position:fixed; inset:0; z-index:3000; background:rgba(19,35,28,.55); display:grid; place-items:center; padding:20px; backdrop-filter:blur(4px); }
.modal { width:min(680px,100%); max-height:min(820px,calc(100vh - 40px)); background:#fff; border-radius:20px; box-shadow:0 28px 90px rgba(0,0,0,.25); overflow:hidden; display:flex; flex-direction:column; }
.modal-header { padding:19px 21px; display:flex; align-items:flex-start; justify-content:space-between; gap:12px; border-bottom:1px solid var(--line); }
.modal-header h2 { font-size:18px; margin:0; }
.modal-header p { color:var(--muted); font-size:11px; margin:4px 0 0; }
#modalForm { min-height:0; display:flex; flex-direction:column; }
.modal-body { padding:19px 21px; overflow:auto; display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-group { display:grid; gap:6px; min-width:0; }
.form-group.full { grid-column:1/-1; }
.form-group label { font-size:11px; font-weight:750; color:#4f5f56; }
.form-group input, .form-group select, .form-group textarea { width:100%; border:1px solid var(--line); border-radius:10px; padding:10px 11px; outline:none; background:#fff; color:var(--text); }
.form-group textarea { min-height:88px; resize:vertical; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color:#75a493; box-shadow:0 0 0 3px rgba(30,92,76,.08); }
.form-group small { color:var(--muted); font-size:9px; line-height:1.4; }
.checkbox-field { display:flex; gap:9px; align-items:center; }
.checkbox-field input { width:auto; }
.modal-footer { padding:14px 21px; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:9px; }

.toast-container { position:fixed; right:18px; bottom:18px; z-index:4000; display:grid; gap:9px; width:min(360px,calc(100% - 36px)); }
.toast { background:#173f35; color:#fff; border-radius:13px; box-shadow:var(--shadow); padding:12px 14px; display:flex; align-items:flex-start; gap:10px; animation:toast-in .22s ease; }
.toast.error { background:#8f3f3f; }
.toast.warn { background:#85622f; }
.toast strong { display:block; font-size:12px; }
.toast p { font-size:10px; margin:3px 0 0; color:rgba(255,255,255,.76); line-height:1.4; }
@keyframes toast-in { from { transform:translateY(8px); opacity:0; } }

@media (max-width: 1180px) {
  .dashboard-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .cards-grid, .document-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .two-column-layout { grid-template-columns:1fr; }
}

@media (max-width: 860px) {
  :root { --sidebar: 250px; }
  .app-shell { display:block; }
  .sidebar { transform:translateX(-105%); transition:.22s ease; }
  .sidebar.open { transform:translateX(0); }
  .main-area { width:100%; }
  .topbar { height:auto; min-height:78px; padding:14px 16px; }
  .mobile-menu { display:grid !important; }
  .topbar h1 { font-size:20px; }
  .topbar p { display:none; }
  .topbar-actions .secondary { display:none; }
  .view { padding:18px 16px 30px; }
  .view.map-view { height:calc(100vh - 78px); padding:0; }
  .map-layout { grid-template-columns:1fr; }
  .map-panel { position:absolute; right:0; top:0; bottom:0; width:min(340px,88vw); z-index:40; box-shadow:-12px 0 32px rgba(0,0,0,.12); transform:translateX(100%); transition:.22s ease; }
  .map-panel.open { transform:translateX(0); }
  .mobile-map-panel-btn { display:block; }
  .settings-grid { grid-template-columns:1fr; }
}

@media (max-width: 620px) {
  .dashboard-grid { grid-template-columns:1fr; }
  .cards-grid, .document-grid { grid-template-columns:1fr; }
  .property-summary-grid { grid-template-columns:1fr; }
  .topbar-actions .btn { padding:9px 11px; font-size:11px; }
  .metric-card { padding:15px; }
  .map-tools { right:12px; left:12px; top:auto; bottom:54px; justify-content:center; }
  .map-tools button { min-width:50px; }
  .map-search { right:12px; left:12px; width:auto; }
  .map-legend { display:none; }
  .drawing-help { top:auto; bottom:113px; left:12px; right:12px; max-width:none; }
  .modal-body { grid-template-columns:1fr; }
  .form-group.full { grid-column:auto; }
  .section-toolbar { align-items:stretch; }
  .section-toolbar, .toolbar-left, .toolbar-right { flex-direction:column; }
  .section-toolbar .btn, .toolbar-left > *, .toolbar-right > * { width:100%; }
  .segmented { width:100%; overflow:auto; }
  .segmented button { flex:1; white-space:nowrap; }
  .task-card { grid-template-columns:auto minmax(0,1fr); }
  .task-actions { grid-column:2; justify-content:flex-end; }
}

.map-label-marker {
  border: 1px solid rgba(20, 47, 38, .22);
  background: rgba(255,255,255,.93);
  color: #173f35;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 9px;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(15,38,30,.18);
  pointer-events: auto;
}
.map-label-marker:hover { background:#fff; transform:translateY(-1px); }

.infrastructure-grid, .grants-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.infrastructure-card, .grant-card { background:#fff; border:1px solid var(--line); border-radius:16px; overflow:hidden; box-shadow:0 6px 22px rgba(25,52,39,.04); }
.infrastructure-card-header, .grant-card-header { padding:16px 17px; display:flex; gap:12px; align-items:flex-start; border-bottom:1px solid var(--line); }
.infrastructure-type-icon, .grant-type-icon { width:42px; height:42px; border-radius:13px; display:grid; place-items:center; background:var(--primary-soft); color:var(--primary); font-size:18px; flex:0 0 auto; }
.infrastructure-card h3, .grant-card h3 { margin:0; font-size:15px; }
.infrastructure-card-header p, .grant-card-header p { margin:4px 0 0; color:var(--muted); font-size:10px; }
.infrastructure-card-body, .grant-card-body { padding:15px 17px; }
.detail-pairs { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.detail-pair { background:var(--panel-soft); border-radius:10px; padding:9px; min-width:0; }
.detail-pair small { display:block; color:var(--muted); font-size:9px; text-transform:uppercase; letter-spacing:.05em; }
.detail-pair strong { display:block; margin-top:4px; font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.card-note { color:var(--muted); font-size:11px; line-height:1.5; margin:13px 0 0; min-height:32px; }
.card-footer-actions { padding:11px 17px; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:7px; }
.status-chip { display:inline-flex; align-items:center; border-radius:999px; padding:5px 8px; font-size:9px; font-weight:800; }
.status-active, .status-strong, .status-normal, .status-granted { background:#dff1e6; color:#286847; }
.status-maintenance, .status-weak, .status-review, .status-submitted { background:#fff0d7; color:#8b612b; }
.status-incident, .status-queenless, .status-drone_laying, .status-denied { background:#f6dede; color:#963f3f; }
.status-planned, .status-draft { background:#e3eaf2; color:#455e77; }
.status-inactive, .status-closed { background:#e8eae9; color:#68736d; }
.reports-toolbar { display:flex; gap:9px; flex-wrap:wrap; margin-bottom:18px; }
.report-sheet { background:#fff; border:1px solid var(--line); border-radius:18px; padding:28px; box-shadow:0 6px 25px rgba(25,52,39,.04); }
.report-header { display:flex; justify-content:space-between; align-items:flex-start; gap:20px; padding-bottom:20px; border-bottom:2px solid var(--primary); }
.report-header h2 { margin:0; font-size:22px; }
.report-header p { color:var(--muted); font-size:11px; margin:5px 0 0; }
.report-logo { width:48px; height:48px; border-radius:15px; background:var(--primary); color:#fff; display:grid; place-items:center; font-size:24px; }
.report-summary-grid { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:10px; margin:20px 0; }
.report-summary-grid > div { background:var(--panel-soft); border-radius:12px; padding:12px; }
.report-summary-grid small { display:block; color:var(--muted); font-size:9px; text-transform:uppercase; letter-spacing:.05em; }
.report-summary-grid strong { display:block; margin-top:5px; font-size:15px; }
.report-section { margin-top:24px; }
.report-section h3 { font-size:14px; margin:0 0 11px; }
.report-alerts { display:grid; gap:8px; }
.report-alert { border-left:4px solid var(--accent); background:#faf7f1; border-radius:9px; padding:11px 12px; font-size:11px; }
.report-alert strong { display:block; font-size:12px; }
.report-alert span { color:var(--muted); display:block; margin-top:3px; }

@media (max-width:1180px) {
  .infrastructure-grid, .grants-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .report-summary-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:620px) {
  .infrastructure-grid, .grants-grid { grid-template-columns:1fr; }
  .report-sheet { padding:18px; }
  .report-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media print {
  body { background:#fff; }
  .sidebar, .topbar, .reports-toolbar { display:none !important; }
  .main-area { grid-column:auto; }
  .view { display:none !important; padding:0; }
  #view-reports { display:block !important; }
  .report-sheet { box-shadow:none; border:0; padding:0; }
  .report-table { min-width:0; }
}
