:root {
  --ink: #17231f;
  --muted: #61706a;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --line: #d9ded9;
  --green: #245c48;
  --green-dark: #12261f;
  --lime: #d8ff83;
  --shadow: 0 16px 45px rgba(18, 38, 31, .10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  color: white; background: var(--green-dark);
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.55rem; letter-spacing: -.04em; }
h2 { margin-bottom: 22px; font-size: clamp(1.7rem, 6vw, 2.5rem); letter-spacing: -.05em; }
h3 { margin-bottom: 10px; }
.eyebrow { display: block; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.topbar .eyebrow { color: #9db3aa; }
.brand-smallprint { display: block; margin-top: 2px; color: #9db3aa; font-size: .58rem; letter-spacing: .04em; }
.brand-smallprint a { color: inherit; }
.icon-button { border: 1px solid #456257; border-radius: 50%; color: white; background: transparent; width: 44px; height: 44px; }
.drawer {
  position: fixed; z-index: 1000; top: 82px; right: 14px; width: min(320px, calc(100vw - 28px));
  padding: 8px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: var(--shadow);
}
.drawer button { display: block; width: 100%; padding: 14px; border: 0; border-radius: 12px; text-align: left; background: transparent; }
.drawer button:hover { background: #f1f4ef; }
main { width: min(980px, 100%); margin: auto; padding: 20px 14px 100px; }
#permit-form { display: grid; gap: 18px; }
.step {
  padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow);
}
.section-heading { display: flex; gap: 15px; align-items: flex-start; justify-content: space-between; }
#map { height: min(52vh, 480px); margin: 0 -20px 12px; background: #dde4dc; }
.flight-area-shape { stroke-linecap: round; stroke-linejoin: round; }
.hint, .optional, .status { color: var(--muted); font-size: .86rem; }
.restriction-status { margin-top: -6px; }
.map-layer-select { max-width: 240px; margin: 4px 0 12px; }
.area-mode-select { max-width: 280px; margin: 0 0 10px; }
.restriction-map-card-stack { display: grid; grid-template-columns: 112px; gap: 5px; pointer-events: auto; }
.restriction-map-card-stack.columns-2 { grid-template-columns: repeat(2, 112px); }
.restriction-map-card {
  width: 112px; min-height: 42px; padding: 6px 7px; border: 0; border-left: 5px solid #4967a7; border-radius: 10px;
  cursor: pointer; text-align: left; color: var(--ink); background: rgba(255, 255, 255, .94); box-shadow: 0 7px 18px rgba(18, 38, 31, .16);
}
.restriction-map-card.prohibited { border-left-color: #9f1d20; }
.restriction-map-card.authorisation { border-left-color: #b46b00; }
.restriction-map-card strong, .restriction-map-card span, .restriction-map-card small { display: block; }
.restriction-map-card strong { font-size: .7rem; }
.restriction-map-card span { color: var(--ink); font-size: .58rem; font-weight: 750; }
.restriction-map-card small { color: var(--muted); font-size: .62rem; font-weight: 750; }
.restriction-detail-popup .leaflet-popup-content { width: min(220px, 70vw) !important; margin: 12px 14px; }
.restriction-popup { max-height: min(58vh, 360px); overflow-y: auto; overflow-wrap: anywhere; line-height: 1.32; }
.restriction-popup h3 { margin: 0 0 5px; font-size: .98rem; }
.restriction-popup p { margin: 7px 0; font-size: .78rem; }
.restriction-popup-meta { color: var(--muted); font-size: .7rem; font-weight: 750; }
label { display: block; margin: 14px 0; color: #34463f; font-size: .85rem; font-weight: 750; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 13px; border: 1px solid #c8d0ca; border-radius: 11px; color: var(--ink); background: white;
}
input[readonly] { color: var(--muted); background: #f4f6f3; }
textarea { resize: vertical; }
.field-grid { display: grid; gap: 0 12px; }
.search-row { display: grid; gap: 8px; align-items: end; }
.search-row label { margin-bottom: 0; }
.suggestions { display: grid; gap: 6px; margin: 8px 0 10px; }
.suggestions button { padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; text-align: left; color: var(--ink); background: #f8faf6; }
.suggestions small { display: block; margin-top: 2px; color: var(--muted); }
.inline-option { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; }
.inline-option input { width: auto; margin: 0; }
.date-time-summary { display: grid; gap: 10px; margin-bottom: 16px; }
.date-time-card { padding: 14px; border: 1px solid var(--line); border-radius: 16px; text-align: left; color: var(--ink); background: #f8faf6; }
.date-time-card.active { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 92, 72, .12); }
.date-time-card span, .date-time-card strong { display: block; }
.date-time-card span { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.date-time-card strong { margin-top: 3px; font-size: 1.05rem; }
.date-picker-panel { padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: #fbfcfa; }
.calendar-header { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 8px; margin-bottom: 10px; text-align: center; }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.calendar-weekdays { margin-bottom: 5px; color: var(--muted); font-size: .75rem; font-weight: 800; text-align: center; }
.calendar-days button { min-height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: white; font-weight: 750; }
.calendar-days button.selected { border-color: var(--green); color: white; background: var(--green); }
.calendar-days button.today { border-color: var(--green); }
.calendar-days button:disabled { color: #b6bfba; background: #f2f3f1; }
.calendar-empty { min-height: 42px; }
.time-picker { margin-top: 18px; }
.time-picker h3 { margin-bottom: 12px; }
fieldset { margin: 20px 0; border: 1px solid var(--line); border-radius: 12px; }
.radio { display: inline-flex; align-items: center; gap: 7px; margin-right: 20px; }
.radio input, .option input { width: auto; margin: 0; }
.primary, .secondary {
  min-height: 44px; padding: 10px 16px; border-radius: 12px; font-weight: 800;
}
.primary { border: 1px solid var(--green); color: white; background: var(--green); }
.secondary { border: 1px solid var(--line); color: var(--ink); background: white; }
.button-link { display: inline-flex; align-items: center; text-decoration: none; }
.wide { width: 100%; }
.option-list { display: grid; gap: 8px; }
.option { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.option small { display: block; color: var(--muted); font-weight: 500; }
.selection-block + .selection-block { margin-top: 25px; }
.generate-block { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.review { display: grid; gap: 12px; margin-bottom: 22px; }
.review-card, .card { padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.review-card strong { display: block; margin-bottom: 3px; }
.install-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.install-card strong { display: block; margin-bottom: 4px; }
.install-card p { margin-bottom: 0; }
.export-panel { margin-top: 18px; padding: 16px; border: 1px solid #bad0c5; border-radius: 16px; background: #f1f7f3; }
.export-ready { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.export-ready strong, .export-ready small { display: block; }
.export-ready small { margin-top: 2px; color: var(--muted); }
.export-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; color: white; background: var(--green); font-size: .72rem; font-weight: 900; }
.export-actions { display: grid; gap: 8px; }
.share-destinations { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.share-destinations button { padding: 7px 11px; border: 1px solid #bad0c5; border-radius: 999px; color: var(--green-dark); background: white; font-size: .82rem; font-weight: 750; }
.card-list { display: grid; gap: 12px; }
.card-actions { display: flex; gap: 8px; margin-top: 13px; }
.data-columns { display: grid; gap: 18px; }
.data-columns ul { padding-left: 20px; }
.manager-sections { display: grid; gap: 24px; }
.manager-section { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: var(--shadow); }
.backup-section { margin-bottom: 24px; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.warning { margin: 14px 0 0; color: #7a5420; }
.manager-section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.manager-section-header h3 { margin: 0; }
.manager-list { display: grid; gap: 9px; }
.manager-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; }
.manager-card strong, .manager-card small { display: block; }
.manager-card small { margin-top: 2px; color: var(--muted); }
.manager-card button { flex: 0 0 auto; }
.manager-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
dialog { width: min(620px, calc(100% - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: 22px; box-shadow: 0 25px 80px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(18, 38, 31, .55); backdrop-filter: blur(4px); }
#record-form { padding: 20px; overflow: auto; }
.icon-button.dark { color: var(--ink); border-color: var(--line); background: white; }
.dialog-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }
.danger { min-height: 44px; padding: 10px 16px; border: 1px solid #d9a6a6; border-radius: 12px; color: #8b2424; background: #fff4f4; font-weight: 800; }
.prose { max-width: 650px; }

@media (min-width: 680px) {
  main { padding-top: 35px; }
  .field-grid.two { grid-template-columns: 1fr 1fr; }
  .field-grid.three { grid-template-columns: 1fr 1fr 1fr; }
  .search-row { grid-template-columns: 1fr auto; }
  .date-time-summary { grid-template-columns: 1fr 1fr; }
  .option-list, .data-columns { grid-template-columns: repeat(2, 1fr); }
  .export-actions { grid-template-columns: repeat(3, 1fr); }
}
