/* FIELDNOTE — layout */
.top, .guide, .board { position: relative; z-index: 1; }

.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 20px;
  background: rgba(11, 16, 14, .78); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), #3b9e75); color: var(--accent-ink);
  font: 800 16px/1 var(--mono); box-shadow: 0 6px 18px -6px rgba(127, 209, 168, .6);
}
.brand-name { font: 700 13px/1 var(--mono); letter-spacing: .18em; }
.case-title {
  flex: 1 1 200px; max-width: 360px; min-height: 34px; padding: 0 12px;
  background: transparent; border-color: transparent; font-weight: 500;
}
.case-title:hover { border-color: var(--line); }
.save-ind { font: 500 10px/1 var(--mono); letter-spacing: .1em; color: var(--ink-3); white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.key-dot { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }
.key-dot.is-ok { background: var(--accent); }

.guide {
  display: flex; align-items: center; gap: 14px;
  margin: 16px 20px 0; padding: 12px 16px;
  border: 1px solid rgba(127, 209, 168, .3); border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(127, 209, 168, .12), rgba(127, 209, 168, .03) 60%, transparent);
  overflow: hidden;
}
.guide-step {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font: 700 13px/1 var(--mono);
}
.guide-text { flex: 1; font-size: 14px; color: var(--ink); }
.guide-text b { color: var(--accent); font-weight: 600; }

.board {
  display: grid; grid-template-columns: minmax(380px, 5fr) minmax(420px, 6fr);
  gap: 16px; padding: 16px 20px 40px; align-items: start;
}
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-right { position: sticky; top: 72px; }

.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: 0 18px 40px -26px rgba(0, 0, 0, .8);
}
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font: 700 16px/1.2 var(--sans); letter-spacing: -.01em; }
.card-sub { font: 500 11px/1.2 var(--mono); color: var(--ink-3); }

/* Карта */
.map-card { padding: 12px; display: flex; flex-direction: column; gap: 10px; height: calc(100vh - 90px); min-height: 480px; overflow: hidden; }
.map-osm .leaflet-tile-pane { filter: brightness(.8) saturate(.85) contrast(1.06); }
.map-search { position: relative; display: flex; align-items: center; gap: 8px; }
.map-search input { min-height: 40px; padding: 0 12px 0 34px; }
.ms-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.map-stage { position: relative; flex: 1 1 0; min-height: 220px; border-radius: 11px; overflow: hidden; border: 1px solid var(--line); background: #0a0f0d; }
#map { position: absolute; inset: 0; background: #0a0f0d; }
.layer-switch {
  position: absolute; top: 10px; right: 10px; z-index: 500; display: flex; padding: 3px; gap: 2px;
  background: rgba(11, 16, 14, .82); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 10px;
}
.layer-switch button {
  border: 0; background: transparent; color: var(--ink-2); padding: 6px 10px; border-radius: 7px;
  font: 600 11px/1 var(--sans); cursor: pointer; transition: background .18s, color .18s;
}
.layer-switch button:hover { color: var(--ink); }
.layer-switch button.is-on { background: var(--accent); color: var(--accent-ink); }
.map-empty {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 400; width: min(300px, 86%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 18px 20px;
  border-radius: 16px; border: 1px solid var(--line); background: rgba(11, 16, 14, .82); backdrop-filter: blur(6px);
  color: var(--ink-2); pointer-events: none;
}
.map-empty strong { color: var(--ink); font-size: 15px; }
.map-empty span:last-child { font-size: 12px; color: var(--ink-2); }

/* Диалоги */
dialog { color: var(--ink); padding: 0; border: 1px solid var(--line); background: var(--panel); }
dialog::backdrop { background: rgba(5, 8, 7, .62); backdrop-filter: blur(3px); }
.modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border-radius: 16px; overflow: auto; box-shadow: 0 40px 80px -30px #000; }
.drawer {
  margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(460px, 100vw);
  border-radius: 16px 0 0 16px; border-right: 0; flex-direction: column; box-shadow: -30px 0 70px -30px #000;
}
.drawer[open] { display: flex; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex: none; }
.dlg-head h2 { font: 700 17px/1.2 var(--sans); margin-top: 6px; }
.dlg-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.dlg-sub { font: 600 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-top: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 24px); opacity: 0; pointer-events: none;
  max-width: min(520px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 11px;
  background: var(--panel-3); border: 1px solid var(--accent); color: var(--ink); font-size: 13px;
  box-shadow: 0 18px 40px -16px #000; transition: opacity .25s, transform .35s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: var(--danger); }

.case-title { min-width: 0; }
.guide { flex-wrap: wrap; }
.guide-text { flex: 1 1 220px; min-width: 0; }

@media (max-width: 640px) {
  .top { gap: 6px; padding: 0 8px; }
  .top-actions { gap: 4px; }
  .top-actions .btn-icon { width: 32px; min-height: 32px; }
  .btn-ai { padding: 0 10px; }
  .case-title { flex: 1 1 0; padding: 0 6px; font-size: 13px; }
  .brand-mark { width: 28px; height: 28px; }
  .guide { padding: 10px 12px; gap: 10px; }
  .guide .btn-cta { width: 100%; }
  .card { padding: 12px; }
  .map-search input { font-size: 16px; }
  .sheet-tools select { max-width: 100%; flex: 1; }
}

@media (max-width: 1000px) {
  .board { grid-template-columns: 1fr; padding: 12px 12px 32px; }
  .col-right { position: static; order: -1; }
  .map-card { max-height: none; }
  .map-stage { min-height: 52vh; }
  .top { padding: 0 12px; gap: 8px; }
  .case-title { max-width: none; }
  .save-ind, .btn-ai .btn-label, .brand-name { display: none; }
  .guide { margin: 12px 12px 0; }
  .drawer { width: 100vw; border-radius: 0; }
}
