/* SemAI — shared app layout for map pages */
body.app { background: #fff; min-height: 100vh; }
.layout { display: grid; grid-template-columns: 268px minmax(0, 1fr) 380px; min-height: calc(100vh - 68px); }

/* filters */
.filters { padding: 22px 20px; border-right: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; gap: 6px; }
.f-title { margin: 0 0 12px; font-size: 19px; font-weight: 700; color: var(--ink); }
.f-search { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); margin-bottom: 10px; }
.f-search input { border: 0; outline: 0; font: inherit; font-size: 13.5px; width: 100%; color: var(--ink); background: transparent; }
.f-search svg { width: 18px; height: 18px; flex: none; }
.f-group { border-bottom: 1px solid #f0f2f7; padding: 10px 0 14px; }
.f-group summary { list-style: none; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: var(--ink); cursor: pointer; margin-bottom: 10px; }
.f-group summary::-webkit-details-marker { display: none; }
.f-group summary svg { width: 18px; height: 18px; }
.f-group summary .caret { margin-left: auto; color: var(--muted); transition: .2s; }
.f-group:not([open]) summary .caret { transform: rotate(180deg); }
.checks { display: grid; gap: 4px; }
.check-row { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #334155; padding: 5px 2px; cursor: pointer; }
.check-row input { appearance: none; width: 18px; height: 18px; border: 1.5px solid #c7cedd; border-radius: 4px; margin: 0; display: grid; place-items: center; cursor: pointer; flex: none; transition: .15s; }
.check-row input:checked { background: var(--blue); border-color: var(--blue); }
.check-row input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check-row input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.check-row .cdot { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; }
.f-actions { display: grid; gap: 10px; margin-top: auto; padding-top: 18px; }
.f-actions .btn { height: 46px; border-radius: 10px; width: 100%; }
.btn-outline-blue { background: #fff; border: 1px solid #b9cbf5; color: var(--blue); border-radius: 10px; }
.btn-outline-blue:hover { background: #f2f6ff; }

/* panel */
.panel { border-left: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 14px; background: #fff; overflow: auto; }
.p-card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.p-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 17px; font-weight: 700; color: var(--ink); }
.p-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--blue); background: #eaf0ff; flex: none; }
.p-ic.amber { color: #d97706; background: #fff4dd; }
.p-ic svg { width: 17px; height: 17px; }
.p-sub { margin: 6px 0 14px; font-size: 13px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; transition: .25s; z-index: 99; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* dark controls on canvases */
.dark-pill {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px; border-radius: 10px;
  background: rgba(10, 18, 42, .82); border: 1px solid rgba(148, 163, 230, .22); color: #dbe4ff; font-size: 13px; backdrop-filter: blur(8px);
}
.switch.dark input { background: rgba(255,255,255,.18); }

@media (max-width: 1280px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr) 330px; }
}
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .filters { border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 20px; }
  .f-title, .f-search, .f-actions { grid-column: 1 / -1; }
  .f-actions { grid-template-columns: 1fr 1fr; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .f-actions { grid-template-columns: 1fr; }
}

/* ---------- desktop: whole app fits one screen, columns scroll on their own ---------- */
@media (min-width: 1081px) {
  body.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  body.app > .topbar, body.app > .em-head { flex: none; position: static; }
  body.app > .layout { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
  body.app .filters, body.app .panel { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
  body.app .cmap, body.app .graph-wrap { min-height: 0; }
}
