/* Dispatch dashboard: dark control-room theme. See docs/design.md. */

:root {
  --bg: #0c0f13;
  --panel: #12161c;
  --raised: #181d24;
  --hover: #1c222a;
  --line: #232a33;
  --line-strong: #2f3742;
  --text: #dce1e7;
  --text-strong: #f3f5f8;
  --muted: #8790a0;
  --faint: #5a6370;
  --brand: #3b7cf0;
  --brand-strong: #1a5fd6;
  --brand-soft: rgba(59, 124, 240, 0.14);
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, 0.14);
  --warn: #d99a1e;
  --warn-soft: rgba(217, 154, 30, 0.14);
  --ok: #2e9e5b;
  --request: #c9a227;
  --radius: 4px;
  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-cond: 'Barlow Condensed', 'Barlow', 'Arial Narrow', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --topbar-h: 50px;
  --statusbar-h: 28px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::selection {
  background: rgba(59, 124, 240, 0.35);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-cond);
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: 0.01em;
}

p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #2f3742 transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background: #2f3742;
  border-radius: 4px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.92em;
}

.muted {
  color: var(--muted);
}

.faint {
  color: var(--faint);
}

.strong {
  font-weight: 600;
  color: var(--text-strong);
}

.center {
  text-align: center;
}

.pre {
  white-space: pre-wrap;
}

.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.icon {
  flex: none;
  display: block;
}

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand);
  cursor: pointer;
}

.link:hover {
  text-decoration: underline;
}

.link.strong {
  color: var(--text-strong);
}

/* ------------------------------------------------------------------ shell */

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.app > .topbar {
  flex: 0 0 var(--topbar-h);
}

.app > .statusbar {
  flex: 0 0 var(--statusbar-h);
}

.boot {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-family: var(--font-cond);
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.boot .logo-mark {
  color: var(--brand-strong);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 18px;
  margin-right: 6px;
  border-right: 1px solid var(--line);
  height: 100%;
  color: var(--text-strong);
  text-decoration: none !important;
}

.brand .logo-mark {
  color: #2a6ae0;
}

.brand-org {
  font-family: var(--font-cond);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.02em;
}

.brand-product {
  font-family: var(--font-cond);
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding-top: 3px;
}

.nav {
  display: flex;
  height: 100%;
  gap: 2px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none !important;
  border-bottom: 2px solid transparent;
  border-top: 2px solid transparent;
}

.nav-item:hover {
  color: var(--text);
  background: var(--hover);
}

.nav-item.is-active {
  color: var(--text-strong);
  border-bottom-color: var(--brand);
}

.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--request);
  color: #1b1505;
  font: 600 11px/18px var(--font-mono);
  text-align: center;
}

.nav-badge.is-alert {
  background: var(--danger);
  color: #fff;
  animation: blink 1s steps(2, jump-none) infinite;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.top-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
}

.top-icon:hover {
  color: var(--text);
  background: var(--hover);
}

.top-icon.is-warn {
  color: var(--warn);
  border-color: rgba(217, 154, 30, 0.5);
}

.conn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 4px;
}

.conn i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.conn.is-on {
  color: #3dbb71;
}

.conn.is-off {
  color: var(--danger);
}

.conn.is-off i {
  animation: blink 1s steps(2, jump-none) infinite;
}

.clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.05;
  padding: 0 12px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.clock-time {
  font-size: 19px;
  font-weight: 500;
  color: var(--text-strong);
}

.clock-date {
  font-size: 11px;
  color: var(--muted);
}

.user {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 500;
}

.user > span {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offline-bar {
  background: var(--danger);
  color: #fff;
  font-weight: 600;
  padding: 6px 16px;
  font-size: 13px;
}

.main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sb-item i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--c);
}

.sb-item b {
  color: var(--text-strong);
  font-weight: 500;
}

.sb-sep {
  flex: 1;
}

.sb-notice {
  color: #e8b44d;
  font-weight: 600;
}

.notice-backdrop {
  z-index: 4000;
  align-items: center;
  padding-top: 16px;
}

.notice {
  width: min(560px, calc(100vw - 32px));
  overflow: hidden;
}

.notice-band {
  padding: 7px 20px;
  background: var(--warn);
  color: #1b1305;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.notice-body {
  padding: 20px 22px 8px;
}

.notice-body h2 {
  font-size: 24px;
  margin-bottom: 12px;
}

.notice-body p {
  margin-bottom: 12px;
  line-height: 1.55;
  color: var(--text);
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--raised);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none !important;
  transition: background 0.12s, border-color 0.12s;
}

.btn:hover:not(:disabled) {
  background: #222932;
  border-color: #3a4350;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn--sm {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
  gap: 5px;
}

.btn--icon {
  width: 34px;
  padding: 0;
}

.btn--sm.btn--icon {
  width: 28px;
}

.btn--primary {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: #2269e4;
  border-color: #2269e4;
}

.btn--alarm {
  background: #b8401c;
  border-color: #b8401c;
  color: #fff;
}

.btn--alarm:hover:not(:disabled) {
  background: #cc4a22;
  border-color: #cc4a22;
}

.btn--danger {
  background: transparent;
  border-color: rgba(229, 72, 77, 0.6);
  color: #ff8a8d;
}

.btn--danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--hover);
  border-color: transparent;
  color: var(--text);
}

.chip-toggle {
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: none;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.chip-toggle.is-on {
  color: var(--text);
  border-color: var(--muted);
}

/* ----------------------------------------------------------------- inputs */

.input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  background: #0e1216;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-strong);
  font: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

textarea.input {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.45;
}

select.input {
  padding-right: 28px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238790a0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

select.input option {
  background: var(--raised);
}

.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 124, 240, 0.18);
}

.input::placeholder {
  color: var(--faint);
}

.input--sm {
  height: 28px;
  font-size: 13px;
  padding: 0 8px;
}

select.input--sm {
  padding-right: 26px;
}

.input--lg {
  height: 40px;
  font-size: 17px;
  font-weight: 500;
}

input[type='checkbox'] {
  accent-color: var(--brand);
  width: 15px;
  height: 15px;
  margin: 0;
}

input[type='date'] {
  color-scheme: dark;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  margin-bottom: 14px;
}

.field-label,
.panel-label,
.kv dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.field-hint {
  font-size: 12px;
  color: var(--faint);
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.form-row > .field {
  flex: 0 0 auto;
}

.form-row .grow {
  flex: 1 1 0;
}

.form-row--split {
  justify-content: space-between;
}

.form-row--end {
  align-items: flex-end;
}

.form-row--end > .btn {
  margin-bottom: 14px;
}

.w-220 {
  width: 220px;
}

.w-160 {
  width: 160px;
}

.form-group {
  margin-bottom: 14px;
  padding: 12px 12px 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.012);
}

.form-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  margin-bottom: 10px;
}

.form-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.form-group--optional .toggle-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text);
}

.form-group--optional.is-off {
  padding-bottom: 6px;
}

.form-group--optional.is-off .form-group-head {
  margin-bottom: 4px;
}

.form-group--optional.is-off .toggle-label {
  color: var(--muted);
}

.place-select {
  width: auto;
  min-width: 220px;
}

.place-hint {
  margin: -8px 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.legacy-text {
  margin: -6px 0 12px;
}

.w-90 {
  width: 90px;
}

.w-110 {
  width: 110px;
}

.w-170 {
  width: 170px;
}

.place-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.place-map {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.place-map .map {
  position: relative;
  height: 300px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.place-map-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.form-subhead {
  margin: 16px 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0e1216;
  flex: none;
}

.seg-item {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: none;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.seg-item:last-child {
  border-right: 0;
}

.seg-item:hover {
  color: var(--text);
  background: var(--hover);
}

.seg-item.is-active {
  background: var(--brand-soft);
  color: var(--text-strong);
  box-shadow: inset 0 -2px 0 var(--brand);
}

.seg--sm .seg-item {
  height: 26px;
  padding: 0 9px;
  font-size: 12.5px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 34px;
  height: 18px;
  border-radius: 9px;
  background: #2a313b;
  position: relative;
  transition: background 0.15s;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #c9ced6;
  transition: transform 0.15s;
}

.toggle input:checked + .toggle-track {
  background: #6d5bd0;
}

.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
  background: #fff;
}

.toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 140px;
}

.search .icon {
  position: absolute;
  left: 8px;
  color: var(--faint);
  pointer-events: none;
}

.search .input {
  padding-left: 29px;
}

.search--block {
  flex: none;
  margin: 0 12px 10px;
}

/* ------------------------------------------------------------ status bits */

.sblock {
  --c: #3a414c;
  --fg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--c);
  color: var(--fg);
  font-family: var(--font-cond);
  font-weight: 700;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.sblock--sm {
  width: 28px;
  height: 28px;
  font-size: 17px;
}

.sblock--md {
  width: 38px;
  height: 38px;
  font-size: 23px;
}

.sblock--lg {
  width: 58px;
  height: 58px;
  font-size: 34px;
}

.sblock--none {
  background: transparent;
  color: var(--faint);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.sblock--alarmed {
  animation: alarm-ring 1s steps(2, jump-none) infinite;
}

@keyframes alarm-ring {
  0% {
    box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px #e8a827;
  }
  100% {
    box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px transparent;
  }
}

@keyframes blink {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0.25;
  }
}

.schip {
  display: inline-flex;
  align-items: stretch;
  border-radius: 2px;
  overflow: hidden;
  font-size: 12.5px;
  line-height: 20px;
  white-space: nowrap;
  border: 1px solid var(--c);
  max-width: 100%;
}

.schip b {
  background: var(--c);
  color: var(--fg);
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 14px;
  padding: 0 6px;
  min-width: 22px;
  text-align: center;
}

.schip span {
  padding: 0 7px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.schip--none {
  border-color: var(--line-strong);
  padding: 0 7px;
  color: var(--faint);
}

.utag {
  --c: #3a414c;
  --fg: #fff;
  display: inline-flex;
  align-items: stretch;
  height: 22px;
  padding: 0;
  border: 1px solid var(--c);
  border-radius: 2px;
  background: var(--raised);
  overflow: hidden;
  cursor: pointer;
  font-size: 12.5px;
  line-height: 20px;
  white-space: nowrap;
}

.utag-cs {
  padding: 0 7px;
  font-weight: 600;
  color: var(--text-strong);
}

.utag-code {
  background: var(--c);
  color: var(--fg);
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 14px;
  min-width: 20px;
  padding: 0 5px;
  text-align: center;
}

.utag:hover {
  filter: brightness(1.15);
}

.utag--released {
  opacity: 0.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--exercise {
  background: #6d5bd0;
  color: #fff;
}

.badge--prio1 {
  background: var(--danger-soft);
  color: #ff8a8d;
  box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.5);
}

.badge--prio2 {
  background: var(--warn-soft);
  color: #e8b44d;
  box-shadow: inset 0 0 0 1px rgba(217, 154, 30, 0.45);
}

.badge--prio3 {
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.badge--open {
  color: #4fcf84;
  box-shadow: inset 0 0 0 1px rgba(46, 158, 91, 0.5);
}

.badge--closed {
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.alarm-pending {
  color: #e8b44d;
  font-weight: 600;
  animation: blink 1s steps(2, jump-none) infinite;
}

.flag {
  display: inline-block;
  height: 17px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 17px;
  text-transform: uppercase;
  vertical-align: 1px;
}

.flag--request {
  background: var(--request);
  color: #1b1505;
}

.flag--alert {
  background: var(--danger);
  color: #fff;
  animation: blink 0.8s steps(2, jump-none) infinite;
}

.sig {
  display: inline-flex;
}

.sig--lights {
  color: #4d8df5;
  animation: beacon-icon 0.9s steps(2, jump-none) infinite;
}

.sig--siren {
  color: #e8b44d;
}

@keyframes beacon-icon {
  0% {
    color: #4d8df5;
  }
  100% {
    color: #24406f;
  }
}

.on-lights {
  color: #4d8df5;
  font-weight: 600;
}

.on-siren {
  color: #e8b44d;
  font-weight: 600;
}

/* --------------------------------------------------------------- sections */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
}

.section-head h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-head .count {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--text);
}

.section-head--tight {
  padding: 0;
  min-height: 32px;
}

.section-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 20px;
  text-align: center;
  color: var(--faint);
}

.empty-title {
  color: var(--muted);
  font-weight: 600;
}

.empty-text {
  font-size: 13px;
  max-width: 320px;
}

.loading {
  padding: 30px;
  color: var(--muted);
}

/* --------------------------------------------------------------- overview */

.overview {
  height: 100%;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 370px;
}

.col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
}

.col--units {
  border-right: 1px solid var(--line);
}

.col--side {
  border-left: 1px solid var(--line);
}

.col-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
}

.col-tools .seg {
  display: flex;
}

.col-tools .seg-item {
  flex: 1;
}

.col-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.urow {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  background: none;
  text-align: left;
  cursor: pointer;
}

.urow:hover {
  background: var(--hover);
}

.urow.is-selected {
  background: var(--raised);
  border-left-color: var(--brand);
}

.urow-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.urow-l1 {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.urow-cs {
  font-family: var(--font-cond);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: 0.01em;
}

.urow.is-offline .urow-cs {
  color: var(--muted);
}

.urow-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.urow-sig {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
  align-self: center;
}

.urow-l2 {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.urow-inc {
  color: var(--text);
}

.urow-inc .mono {
  color: var(--muted);
}

.urow-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: none;
}

.urow-age {
  font-size: 12px;
  color: var(--muted);
}

.urow-conn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.urow-conn.is-on {
  color: #3dbb71;
}

.urow-conn.is-off {
  color: var(--faint);
  text-transform: uppercase;
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: 0.05em;
  font-size: 10px;
}

.side-block {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
  min-height: 0;
}

.side-block--grow {
  flex: 1 1 40%;
}

.side-block--feed {
  flex: 1 1 35%;
  border-bottom: 0;
}

.side-scroll {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}

.side-empty {
  padding: 4px 12px 14px;
  color: var(--faint);
  font-size: 13px;
}

.req-list {
  padding: 0 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.req {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 6px 6px 6px;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: rgba(201, 162, 39, 0.08);
  border-radius: var(--radius);
}

.req--alert {
  border-color: var(--danger);
  background: var(--danger-soft);
  animation: req-alert 1s steps(2, jump-none) infinite;
}

@keyframes req-alert {
  0% {
    background: rgba(229, 72, 77, 0.28);
  }
  100% {
    background: rgba(229, 72, 77, 0.06);
  }
}

.req-code {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  background: var(--c);
  color: var(--fg);
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 17px;
  flex: none;
}

.req-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  line-height: 1.2;
}

.req-main b {
  font-family: var(--font-cond);
  font-size: 16px;
  color: var(--text-strong);
}

.req-main span {
  font-size: 13px;
}

.req-age {
  font-size: 12px;
  color: var(--muted);
}

.icard {
  margin: 0 8px 8px;
  padding: 9px 11px 10px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
}

.icard--p1 {
  border-left-color: var(--danger);
}

.icard--p2 {
  border-left-color: var(--warn);
}

.icard:hover {
  border-color: var(--line-strong);
}

.icard.is-selected {
  border-color: var(--brand);
  background: #1a2130;
}

.icard-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.icard-age {
  margin-left: auto;
}

.icard-kw {
  margin-top: 4px;
  font-family: var(--font-cond);
  font-size: 19px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.15;
}

.icard-addr {
  font-size: 13px;
  color: var(--muted);
  margin-top: 1px;
}

.icard-units {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 12px;
}

.feed {
  padding: 0 0 8px;
}

.ev {
  display: grid;
  grid-template-columns: auto 16px 1fr;
  align-items: start;
  gap: 8px;
  padding: 4px 12px;
  font-size: 13px;
  line-height: 1.35;
}

.ev:hover {
  background: rgba(255, 255, 255, 0.02);
}

.ev-time {
  color: var(--faint);
  font-size: 11.5px;
  padding-top: 1px;
  white-space: nowrap;
}

.ev-mark {
  display: flex;
  justify-content: center;
  padding-top: 1px;
}

.ev-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 3px;
  border-radius: 2px;
  background: var(--c);
  color: var(--fg);
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 12.5px;
  margin-right: 6px;
  vertical-align: 1px;
}

.ev-mark .ev-code {
  margin-right: 0;
}

.ev-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  background: var(--faint);
}

.ev-dot--ok {
  background: var(--ok);
}

.ev-dot--signal {
  background: #4d8df5;
}

.ev-dot--alarm {
  background: #e06a3a;
}

.ev-dot--incident {
  background: var(--danger);
}

.ev-dot--brand {
  background: var(--brand);
}

.ev-dot--muted {
  background: #3a424e;
}

.ev-body {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ev-cs {
  color: var(--text-strong);
  font-weight: 600;
  margin-right: 6px;
}

.ev-inc {
  margin-left: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.ev-actor {
  display: block;
  font-size: 11.5px;
  color: var(--faint);
}

.ev--client {
  color: var(--muted);
}

.feed--compact .ev {
  padding: 3px 0;
}

/* -------------------------------------------------------------------- map */

.map-area {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.map {
  position: absolute;
  inset: 0;
}

.map-canvas {
  position: absolute;
  inset: 0;
}

.leaflet-container {
  background: #0c0f13;
  font-family: var(--font);
}

.map--light .leaflet-container {
  background: #dcdcdc;
}

.map--dark .tiles-darkable {
  filter: invert(1) hue-rotate(180deg) brightness(0.86) contrast(0.92) saturate(0.32);
}

/* Orthophotos are never inverted, only dimmed slightly in the dark theme. */
.map--dark .tiles-photo {
  filter: brightness(0.82) saturate(0.9);
}

.map-layers {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.map-layer {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.map-layer:last-child {
  border-right: 0;
}

.map-layer:hover {
  color: var(--text);
  background: var(--hover);
}

.map-layer.is-active {
  background: var(--brand-soft);
  color: var(--text-strong);
  box-shadow: inset 0 -2px 0 var(--brand);
}

.map-layers--compact {
  top: auto;
  bottom: 8px;
  left: auto;
  right: 8px;
  transform: none;
}

.map-layers--compact .map-layer {
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
}

.map-canvas.is-picking,
.map--picker .leaflet-container {
  cursor: crosshair;
}

.leaflet-bar {
  border: 1px solid var(--line-strong) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
}

.leaflet-bar a {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-bottom-color: var(--line-strong) !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 31px !important;
}

.leaflet-bar a:hover {
  background: var(--raised) !important;
}

.leaflet-control-attribution {
  background: rgba(12, 15, 19, 0.75) !important;
  color: var(--faint) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: var(--muted) !important;
}

.map--light .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.75) !important;
  color: #555 !important;
}

.leaflet-control-scale-line {
  background: rgba(12, 15, 19, 0.6);
  color: var(--muted);
  border-color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.map-tip {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  box-shadow: none;
  font-size: 12px;
}

.map-tip::before {
  display: none;
}

.map-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.map-tool {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--text);
  cursor: pointer;
}

.map-tool:last-child {
  border-bottom: 0;
}

.map-tool:hover {
  background: var(--raised);
}

/* markers */

.mk {
  background: none !important;
  border: 0 !important;
}

.mk-unit {
  --c: #4a5260;
  --fg: #fff;
  position: absolute;
  left: 0;
  top: 0;
}

.mk-unit::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 2px #0c0f13;
}

.mk-unit::after {
  content: '';
  position: absolute;
  left: -0.5px;
  top: -12px;
  width: 1px;
  height: 7px;
  background: var(--c);
}

.mk-unit-body {
  position: absolute;
  left: 0;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  white-space: nowrap;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--c), 0 2px 6px rgba(0, 0, 0, 0.5);
  font-family: var(--font-cond);
  line-height: 1;
  cursor: pointer;
}

.mk-code {
  background: var(--c);
  color: var(--fg);
  padding: 4px 6px;
  min-width: 22px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}

.mk-cs {
  background: #12161c;
  color: #eef1f5;
  padding: 4px 7px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.mk-unit.is-selected .mk-unit-body {
  box-shadow: 0 0 0 2px #fff, 0 2px 10px rgba(0, 0, 0, 0.6);
}

.mk-unit.is-selected::before {
  box-shadow: 0 0 0 2px #fff;
}

.mk-unit.has-lights::before {
  animation: beacon 0.9s steps(2, jump-none) infinite;
}

@keyframes beacon {
  0% {
    box-shadow: 0 0 0 2px #0c0f13, 0 0 0 7px rgba(77, 141, 245, 0.75);
  }
  100% {
    box-shadow: 0 0 0 2px #0c0f13, 0 0 0 7px rgba(77, 141, 245, 0);
  }
}

.mk-unit.is-alarmed .mk-code {
  animation: blink 0.8s steps(2, jump-none) infinite;
}

.mk-unit.is-stale,
.mk-unit.is-offline {
  opacity: 0.55;
}

.mk-inc {
  --ic: #8790a0;
  position: absolute;
  left: 0;
  top: 0;
}

.mk-inc.prio-1 {
  --ic: #e5484d;
}

.mk-inc.prio-2 {
  --ic: #d99a1e;
}

.mk-inc::before {
  content: '';
  position: absolute;
  left: -8px;
  top: -8px;
  width: 16px;
  height: 16px;
  background: var(--ic);
  transform: rotate(45deg);
  box-shadow: 0 0 0 2px #0c0f13, 0 2px 6px rgba(0, 0, 0, 0.5);
}

.mk-inc-body {
  position: absolute;
  left: 15px;
  top: -11px;
  display: flex;
  align-items: stretch;
  white-space: nowrap;
  border-radius: 3px;
  overflow: hidden;
  background: #12161c;
  box-shadow: 0 0 0 1px var(--ic), 0 2px 6px rgba(0, 0, 0, 0.5);
  line-height: 1;
  cursor: pointer;
}

.mk-inc-no {
  background: var(--ic);
  color: #fff;
  font-family: var(--font-cond);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 5px;
}

.mk-inc-kw {
  padding: 4px 7px;
  font-family: var(--font-cond);
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
}

.mk-inc.is-exercise .mk-inc-body {
  box-shadow: 0 0 0 1px var(--ic), 0 0 0 3px #6d5bd0, 0 2px 6px rgba(0, 0, 0, 0.5);
}

.mk-inc.is-selected .mk-inc-body {
  box-shadow: 0 0 0 2px #fff, 0 2px 10px rgba(0, 0, 0, 0.6);
}

.mk-pick {
  position: absolute;
  left: -9px;
  top: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.5);
  cursor: grab;
}

/* ----------------------------------------------------------- detail panel */

.detail-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  bottom: 12px;
  z-index: 600;
  width: 380px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: panel-in 0.14s ease-out;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
}

.detail-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  padding: 0 6px 0 14px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.panel-kind {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.panel-body {
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
}

.unit-head {
  display: flex;
  gap: 14px;
  align-items: center;
}

.unit-head-cs {
  font-family: var(--font-cond);
  font-size: 26px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.05;
}

.unit-head-st {
  margin-top: 2px;
  font-weight: 600;
}

.assign-box {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 9px 11px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
}

.assign-box:hover {
  border-color: var(--line-strong);
}

.assign-box b {
  font-family: var(--font-cond);
  font-size: 17px;
  color: var(--text-strong);
}

.assign-box > .muted:last-child {
  flex-basis: 100%;
  font-size: 12.5px;
}

.inline-form {
  display: flex;
  gap: 6px;
}

.sgrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.sbtn {
  --c: #4a5260;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 5px 7px 6px 9px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--c);
  border-radius: 3px;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}

.sbtn b {
  font-family: var(--font-cond);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-strong);
}

.sbtn span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sbtn:hover {
  background: var(--hover);
  border-color: var(--line-strong);
  border-left-color: var(--c);
}

.sbtn.is-current {
  background: var(--c);
  border-color: var(--c);
  cursor: default;
}

.sbtn.is-current b,
.sbtn.is-current span {
  color: var(--fg);
}

.track-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.client-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}

.client-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.client-main b {
  color: var(--text);
  font-weight: 600;
}

.client-main .muted {
  font-size: 12px;
}

.tag-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}

/* key/value */

.kv-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 24px;
  margin: 0 0 8px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kv-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.kv-list--2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.kv {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.kv dd {
  margin: 0;
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

.kv--full {
  grid-column: 1 / -1;
}

/* --------------------------------------------------------------- incident */

.inc-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.inc-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
}

.inc-no {
  color: var(--muted);
}

.inc-kw {
  font-size: 28px;
  line-height: 1.1;
}

.panel-body .inc-kw {
  font-size: 24px;
}

.inc-addr {
  font-size: 15px;
  color: var(--text);
}

.inc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inc-detail {
  padding: 20px 24px 40px;
  max-width: 1280px;
}

.inc-detail-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.inc-detail .section-head {
  padding: 0;
  margin-top: 18px;
}

.timeline {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 6px 0;
}

.timeline .ev {
  grid-template-columns: 74px 16px 1fr;
  padding: 5px 14px;
}

/* -------------------------------------------------------------- incident form */

.dialog--incident .dialog-body {
  padding: 0;
}

.incident-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  min-height: 0;
}

.if-fields {
  padding: 18px 20px 6px;
  overflow-y: auto;
}

.if-side {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--bg);
  min-height: 0;
}

.if-map {
  position: relative;
  height: 280px;
  flex: none;
  border-bottom: 1px solid var(--line);
}

.if-coords {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 500;
  padding: 3px 8px;
  background: rgba(12, 15, 19, 0.85);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-size: 11px;
  display: flex;
  gap: 10px;
}

.if-units {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 14px 10px;
}

.if-units .unit-picker {
  flex: 1;
  overflow-y: auto;
}

.addr-search {
  position: relative;
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.addr-search .input-icon {
  position: absolute;
  left: 9px;
  top: 6px;
  color: var(--faint);
}

.addr-search .input {
  height: 28px;
  padding-left: 31px;
  font-size: 13px;
}

.addr-results {
  list-style: none;
  margin: -6px 0 12px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--raised);
  max-height: 200px;
  overflow-y: auto;
}

.addr-results button {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 3px;
  background: none;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}

.addr-results button:hover {
  background: var(--brand-soft);
  color: var(--text-strong);
}

.unit-picker {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-height: 340px;
  overflow-y: auto;
  background: var(--panel);
}

.pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.pick-row:last-child {
  border-bottom: 0;
}

.pick-row:hover {
  background: var(--hover);
}

.pick-row.is-on {
  background: var(--brand-soft);
}

.pick-row.is-offline .pick-cs {
  color: var(--muted);
}

.pick-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.pick-cs {
  font-family: var(--font-cond);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-strong);
}

.pick-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pick-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 12px;
  color: var(--muted);
}

.picker-empty {
  padding: 20px;
  color: var(--faint);
  text-align: center;
}

.foot-note {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ----------------------------------------------------------------- dialog */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 16px;
  background: rgba(4, 6, 9, 0.66);
  animation: fade-in 0.12s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.dialog {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 12px 12px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  font-size: 21px;
}

.dialog-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.dialog-body {
  padding: 18px 20px 6px;
  overflow-y: auto;
  min-height: 0;
}

.dialog--incident {
  height: min(780px, 88vh);
}

.dialog--incident .dialog-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.dialog--incident .incident-form {
  flex: 1;
}

.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  border-radius: 0 0 6px 6px;
}

.confirm-text {
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 12px;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 40px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}

.toast {
  max-width: 420px;
  padding: 10px 14px;
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  color: var(--text-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-weight: 500;
  animation: toast-in 0.16s ease-out;
}

.toast--ok {
  border-left-color: var(--ok);
}

.toast--warn {
  border-left-color: var(--request);
}

.toast--error {
  border-left-color: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ----------------------------------------------------------------- tables */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-strong);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  white-space: nowrap;
}

.table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.table .num {
  text-align: right;
  white-space: nowrap;
}

.table .row-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.table .row-actions .btn + .btn {
  margin-left: 2px;
}

.table tr.is-released td {
  color: var(--muted);
}

.cell-text {
  font-size: 13px;
  line-height: 1.35;
  max-width: 280px;
}

.cell-text .note {
  color: #e8b44d;
}

.table--journal td {
  padding: 6px 12px;
}

.table--journal .day-sep td {
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 6px 12px;
}

.table--journal tr.k-client td {
  color: var(--muted);
}

.w-time {
  width: 90px;
}

.w-unit {
  width: 110px;
}

.w-inc {
  width: 100px;
}

.w-actor {
  width: 240px;
}

.w-code {
  width: 86px;
}

.w-short {
  width: 150px;
}

.w-cat {
  width: 210px;
}

.w-req {
  width: 110px;
  text-align: center !important;
}

.cat-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-select i {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex: none;
}

.client-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.ctag {
  padding: 0 6px;
  height: 19px;
  line-height: 19px;
  border-radius: 2px;
  background: rgba(46, 158, 91, 0.14);
  color: #4fcf84;
  font-size: 11.5px;
  font-weight: 600;
}

.keycell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.more {
  display: flex;
  justify-content: center;
  padding: 12px;
}

/* ------------------------------------------------------------------ pages */

.page {
  height: 100%;
  overflow-y: auto;
  padding: 22px 28px 40px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head h1 {
  font-size: 30px;
  line-height: 1.1;
}

.page-head p {
  margin-top: 3px;
}

.page--journal {
  display: flex;
  flex-direction: column;
}

.table-wrap--fill {
  flex: 1;
  min-height: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.filters select.input {
  width: auto;
  min-width: 150px;
}

.filters .search {
  max-width: 300px;
}

.filter-dates {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-dates .input {
  width: 140px;
}

.newer {
  align-self: center;
  margin: -4px 0 10px;
  padding: 5px 14px;
  border: 1px solid var(--brand);
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--text-strong);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.split {
  height: 100%;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
}

.split-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.split-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
}

.split-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  border-top: 1px solid var(--line);
}

.split-detail {
  overflow-y: auto;
  min-height: 0;
}

.irow {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px 11px;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  color: var(--text);
  text-decoration: none !important;
}

.irow:hover {
  background: var(--hover);
}

.irow.is-selected {
  background: var(--raised);
  border-left-color: var(--brand);
}

.irow-l1 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.irow-time {
  margin-left: auto;
}

.irow-kw {
  font-family: var(--font-cond);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.15;
  margin-top: 2px;
}

.irow-addr {
  font-size: 13px;
  color: var(--muted);
}

.irow-l3 {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--faint);
}

.irow.is-closed .irow-kw {
  color: var(--text);
}

/* ---------------------------------------------------------------- setup */

.setup-creds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.copyfield {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.copyfield-row {
  display: flex;
  gap: 6px;
}

.copyfield-row .input {
  height: 28px;
  font-size: 12.5px;
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.tab {
  padding: 8px 14px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--text-strong);
  border-bottom-color: var(--brand);
}

.setup-pane {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
}

.setup-pane--plain {
  grid-template-columns: 1fr;
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.setup-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
}

.setup-text p {
  line-height: 1.5;
  margin-bottom: 14px;
}

.qr {
  display: block;
  border-radius: 4px;
  border: 6px solid #fff;
  background: #fff;
}

.setup-warn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 12px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: #e8c37a;
  font-size: 13px;
}

/* -------------------------------------------------------------- settings */

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.settings-col {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.settings-block .section-head {
  padding: 0;
}

.settings-note {
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.settings-block .form-row {
  margin-top: 14px;
}

.settings-block--narrow {
  max-width: 420px;
}

.table--catalog td {
  padding: 4px 8px;
}

.table--catalog th {
  padding: 8px;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1500px) {
  .overview {
    grid-template-columns: 300px minmax(0, 1fr) 330px;
  }

  .brand-product,
  .user > span {
    display: none;
  }
}

@media (max-width: 1200px) {
  .nav-item span:not(.nav-badge) {
    display: none;
  }

  .topbar-right .btn--primary span {
    display: none;
  }

  .topbar-right .btn--primary {
    width: 34px;
    padding: 0;
  }

  .overview {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .col--side {
    display: none;
  }

  .incident-form {
    grid-template-columns: 1fr;
  }

  .if-side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .kv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
