@font-face {
  font-family: OclumInter;
  src: url("/oclum-inter.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #061b2a;
  --blue: #1e7ec2;
  --sky: #55cee3;
  --ink: #0b1d2a;
  --muted: #667382;
  --line: #d8e0e7;
  --soft: #f4f7f9;
  --panel: #ffffff;
  --good: #16794c;
  --warn: #9a6700;
  --off: #8b97a3;
  --danger: #b3261e;
  --shadow: 0 12px 34px rgba(6, 27, 42, 0.14);
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--soft);
  color: var(--ink);
  font-family: OclumInter, Inter, Roboto, Arial, sans-serif;
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  grid-template-rows: 64px minmax(0, 1fr);
  background: #eef3f7;
}

.topbar {
  grid-column: 1 / -1;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 245px;
}

.brand img {
  width: 150px;
  height: auto;
  display: block;
}

.brand span {
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: #314252;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.range-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475766;
  font-weight: 800;
}

.range-label select,
.drawer-controls input {
  height: 38px;
  min-width: 130px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: #263646;
}

.button,
.icon-button {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 900;
  white-space: nowrap;
}

.button {
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
}

.button.primary {
  background: var(--blue);
  color: #ffffff;
}

.button.secondary,
.icon-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--navy);
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.asset-panel {
  grid-row: 2;
  z-index: 18;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) minmax(180px, 36vh);
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.panel-head {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-head h1 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 21px;
  line-height: 1.2;
  font-weight: 900;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.filters {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.search {
  position: relative;
}

.search input {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.search svg {
  position: absolute;
  top: 11px;
  left: 12px;
  width: 20px;
  height: 20px;
  color: #758392;
}

.segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fafc;
}

.segments button {
  height: 32px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #425160;
  font-weight: 900;
}

.segments button.active {
  background: #ffffff;
  color: var(--navy);
  box-shadow: 0 2px 8px rgba(6, 27, 42, 0.1);
}

.asset-list {
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.asset-row {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.asset-row + .asset-row {
  margin-top: 4px;
}

.asset-row:hover,
.asset-row.active {
  border-color: #c7d7e4;
  background: #f5f9fc;
}

.asset-row.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.asset-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #e7f4fb;
  color: var(--blue);
}

.asset-main {
  min-width: 0;
}

.asset-main strong,
.asset-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-main strong {
  color: #0b1d2a;
  font-size: 14px;
  font-weight: 900;
}

.asset-main span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.status-online {
  background: var(--good);
}

.status-unknown,
.status-idle {
  background: var(--warn);
}

.status-offline {
  background: var(--off);
}

.state-panel {
  min-height: 0;
  border-top: 1px solid var(--line);
  background: #fbfdfe;
  overflow: hidden;
}

.state-panel header {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.state-panel h2 {
  margin: 0;
  color: var(--navy);
  font-size: 14px;
  font-weight: 900;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #edf4f8;
  color: #2d4051;
  font-size: 12px;
  font-weight: 900;
  text-transform: capitalize;
}

.state-grid {
  height: calc(100% - 46px);
  overflow: auto;
  padding: 10px 16px 14px;
}

.state-row {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e8eef3;
}

.state-row span:first-child {
  color: #687687;
  font-weight: 800;
}

.state-row span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #112635;
  font-weight: 700;
}

.workspace {
  grid-row: 2;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.map {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #dce7ed;
  cursor: grab;
}

.map.dragging {
  cursor: grabbing;
}

.tile-layer,
.marker-layer,
.route-layer {
  position: absolute;
  inset: 0;
}

.tile {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
}

.route-layer {
  pointer-events: none;
  z-index: 3;
}

.route-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 6px rgba(6, 27, 42, 0.25));
}

.marker-layer {
  z-index: 5;
}

.marker {
  position: absolute;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
}

.marker.offline {
  background: #64717e;
}

.marker.unknown {
  background: var(--warn);
}

.marker.active {
  width: 42px;
  height: 42px;
  background: var(--navy);
  z-index: 6;
}

.marker-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  min-width: 116px;
  max-width: 220px;
  transform: translateX(-50%);
  padding: 6px 8px;
  border-radius: 6px;
  background: #ffffff;
  color: #0c1d2b;
  box-shadow: 0 8px 22px rgba(6, 27, 42, 0.16);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-point {
  position: absolute;
  z-index: 7;
  width: 18px;
  height: 18px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: var(--navy);
  box-shadow: 0 8px 22px rgba(6, 27, 42, 0.28);
  transform: translate(-50%, -50%);
}

.map-tools {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 9;
  display: flex;
  gap: 8px;
}

.map-tools .button,
.map-tools .icon-button,
.info-card,
.drawer {
  background: rgba(255, 255, 255, 0.97);
}

.info-card {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 9;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid rgba(216, 224, 231, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.info-card strong,
.info-card span {
  display: block;
}

.info-card strong {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 900;
}

.info-card span {
  color: var(--muted);
  line-height: 1.4;
}

.drawer {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  height: 284px;
  display: grid;
  grid-template-rows: 50px minmax(0, 1fr);
  border: 1px solid rgba(216, 224, 231, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.drawer-tabs button {
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4e5d6d;
  font-weight: 900;
}

.drawer-tabs button.active {
  background: #e8f4fb;
  color: var(--blue);
}

.drawer-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: 18px;
  padding: 16px;
}

.timeline {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 42px auto minmax(0, 1fr);
  gap: 12px;
}

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

.metric {
  padding: 10px 12px;
  border: 1px solid #e2e9ef;
  border-radius: 6px;
  background: #fbfdfe;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 3px;
  color: #0d2231;
  font-size: 18px;
  font-weight: 900;
}

.scrubber {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.scrubber input {
  width: 100%;
  accent-color: var(--blue);
}

.point-detail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  color: #1f3140;
}

.point-detail div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.report-table {
  min-height: 0;
  overflow: auto;
  border: 1px solid #e2e9ef;
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf2f5;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f6f9fb;
  color: #425160;
  font-size: 12px;
  font-weight: 900;
}

td {
  color: #1b2c3b;
}

.side-detail {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.side-detail h3 {
  margin: 0;
  color: var(--navy);
  font-size: 15px;
}

.side-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
}

.side-row {
  padding: 10px 12px;
  border: 1px solid #e2e9ef;
  border-radius: 6px;
  background: #fbfdfe;
}

.side-row strong {
  display: block;
  margin-bottom: 4px;
  color: #122b3d;
}

.side-row span {
  color: var(--muted);
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--navy);
  color: #ffffff;
  box-shadow: var(--shadow);
  font-weight: 800;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 58px minmax(0, 1fr);
  }

  .topbar {
    padding: 0 12px;
  }

  .brand img {
    width: 132px;
  }

  .brand span,
  .range-label {
    display: none;
  }

  .asset-panel {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    height: 46vh;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 18;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .state-panel {
    display: none;
  }

  .workspace {
    grid-row: 2;
  }

  .drawer {
    left: 10px;
    right: 10px;
    bottom: calc(46vh + 20px);
    height: 220px;
  }

  .drawer-body {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .side-detail {
    display: none;
  }

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

  .drawer-controls input {
    display: none;
  }

  .info-card {
    top: 12px;
    left: 12px;
    right: 12px;
    max-width: none;
  }

  .map-tools {
    top: 92px;
    left: 12px;
  }
}
