@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600;700&display=swap");

:root {
    --ink: #17211f;
    --muted: #68716e;
    --paper: #fbfaf6;
    --surface: #ffffff;
    --accent: #cb4b2f;
    --teal: #136f63;
    --line: #d8d7cf;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { color: var(--ink); background: var(--paper); font-family: "Source Sans 3", sans-serif; }
button, input { font: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(19, 111, 99, 0.3); outline-offset: 1px; }

.create-shell { display: grid; grid-template-columns: minmax(330px, 390px) 1fr; height: 100%; }
.location-sidebar { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; min-width: 0; padding: 24px; border-right: 1px solid var(--line); background: var(--paper); }
.sidebar-header { margin-bottom: 24px; }
.eyebrow { margin: 0; color: var(--teal); font-size: 13px; font-weight: 700; text-transform: uppercase; }
h1 { margin: 1px 0 0; font-size: 30px; letter-spacing: 0; }

.location-form { display: grid; grid-template-columns: 1fr auto; gap: 7px 8px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.location-form label { grid-column: 1 / -1; color: var(--muted); font-size: 14px; font-weight: 700; }
.location-form > input, .search-field { grid-column: 1 / -1; }
.location-form input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: var(--surface); }
.search-field { display: grid; grid-template-columns: 1fr 40px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); }
.search-field input { min-width: 0; border: 0; background: transparent; }
.icon-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 24px; }
.icon-button:hover { color: var(--accent); }

.primary-button, .secondary-button { min-height: 42px; padding: 0 16px; border: 1px solid var(--teal); border-radius: 3px; cursor: pointer; font-weight: 700; }
.primary-button { grid-column: 1 / -1; margin-top: 5px; background: var(--teal); color: white; }
.secondary-button { background: transparent; color: var(--teal); }
button:disabled { cursor: not-allowed; opacity: 0.45; }

.list-heading { display: flex; align-items: center; justify-content: space-between; padding: 17px 0 9px; }
.list-heading h2 { margin: 0; font-size: 17px; }
.list-heading h2 span { display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-left: 5px; border-radius: 50%; background: #e1ebe7; color: var(--teal); font-size: 13px; }
.text-button { padding: 4px; border: 0; background: transparent; color: var(--teal); cursor: pointer; font-weight: 700; }

.location-list { min-height: 0; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.location-list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.location-details { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.location-number { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: white; font-size: 13px; font-weight: 700; }
.location-copy { min-width: 0; }
.location-copy strong, .location-copy > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.location-copy > span { margin-top: 2px; color: var(--muted); font-size: 13px; }
.location-list-item:hover .location-number, .location-list-item:focus-within .location-number { background: var(--teal); }
.location-actions { display: flex; gap: 5px; align-items: center; }
.location-actions button { padding: 5px 7px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 13px; }
.location-actions button:last-child:hover { border-color: var(--accent); color: var(--accent); }
.inline-label-input { width: 100%; height: 34px; border: 1px solid var(--teal); border-radius: 3px; }
.share-bar { display: flex; align-items: center; gap: 12px; min-height: 65px; padding-top: 16px; border-top: 1px solid var(--line); }
.share-bar span { color: var(--muted); font-size: 13px; line-height: 1.2; }
.create-map { position: relative; min-width: 0; min-height: 0; }
#create-map { width: 100%; height: 100%; background: #dce5df; }
.map-unavailable { background: repeating-linear-gradient(135deg, #e7ebe6 0, #e7ebe6 18px, #dde3de 18px, #dde3de 36px); }
.boundary-panel { position: absolute; z-index: 2; top: 18px; left: 18px; width: min(420px, calc(100% - 36px)); max-height: calc(100% - 36px); padding: 20px; overflow: auto; border-left: 5px solid var(--accent); border-radius: 0 4px 4px 0; background: var(--paper); box-shadow: 0 8px 28px rgba(23, 33, 31, 0.22); }
.panel-close { position: absolute; top: 5px; right: 7px; }
.selection-label, .boundary-type { margin: 0 32px 8px 0; color: var(--muted); font-size: 14px; }
.boundary-type { margin-top: 18px; color: var(--teal); font-weight: 700; text-transform: uppercase; }
.boundary-panel h2 { margin: 0; font-size: 25px; letter-spacing: 0; }
.boundary-tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.boundary-tabs button { padding: 8px 10px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap; }
.boundary-tabs button[aria-selected="true"] { border-color: var(--accent); font-weight: 700; }
.map-status { position: absolute; top: 18px; left: 18px; max-width: min(430px, calc(100% - 36px)); padding: 10px 14px; border-radius: 4px; background: var(--ink); color: white; box-shadow: 0 4px 16px rgba(23, 33, 31, 0.2); }
.map-status--error { background: #8f2f20; }
.is-loading::before { display: inline-block; width: 14px; height: 14px; margin-right: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -2px; content: ""; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }

@media (max-width: 760px) {
    html, body { height: auto; min-height: 100%; }
    .create-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(420px, 55vh); min-height: 100vh; }
    .location-sidebar { display: block; padding: 18px; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar-header { margin-bottom: 18px; }
    h1 { font-size: 26px; }
    .location-list { max-height: 300px; }
    .share-bar { margin-top: 12px; }
    .create-map { min-height: 420px; }
    .boundary-panel { top: auto; bottom: 0; left: 0; width: 100%; max-height: 48%; border-left: 0; border-top: 5px solid var(--accent); border-radius: 0; }
}