﻿:root {
  --bg: #f1f2f4;
  --panel: #ffffff;
  --panel-alt: #f7f8fa;
  --border: #e2e4e8;
  --text: #1f2430;
  --muted: #6c7280;
  --accent: #2d73ff;
  --accent-2: #12b886;
  --danger: #e03131;
  --warning: #f08c00;
  --ok: #2f9e44;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 12px 28px rgba(16, 24, 40, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-width: 320px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

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

button {
  font: inherit;
}

.app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
}

.menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.menu-btn:hover {
  background: var(--panel-alt);
  border-color: #d2d6dc;
}

.menu-icon {
  width: 18px;
  height: 12px;
  display: grid;
  gap: 3px;
}

.menu-icon span {
  height: 2px;
  background: #2b2f3a;
  border-radius: 2px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 600;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.topbar-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  font-size: 12px;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 30;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--sidebar-width);
  background: var(--panel);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 40;
  display: flex;
  flex-direction: column;
}

.sidebar.is-open {
  transform: translateX(0);
  box-shadow: var(--shadow);
}

.sidebar-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-header {
  padding: 18px 20px 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  grid-row: 1 / span 2;
  align-self: center;
}

.sidebar-title-text,
.sidebar-title-sub {
  display: block;
  line-height: 1.15;
  font-size: 16px;
  font-weight: 600;
}

.sidebar-title-text {
  grid-column: 2;
}

.sidebar-title-sub {
  grid-column: 2;
  color: var(--text);
}

.sidebar-nav {
  padding: 6px 10px 20px;
  overflow: auto;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.nav-group {
  margin: 10px 0;
  border-radius: 12px;
  border: 1px solid transparent;
}

.nav-group.is-open {
  background: #f7f8fb;
  border-color: #e6e8ee;
}

.nav-group-toggle {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
}

.nav-caret {
  margin-left: auto;
  width: 12px;
  height: 12px;
  border-right: 2px solid #7b8190;
  border-bottom: 2px solid #7b8190;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}

.nav-group.is-open .nav-caret {
  transform: rotate(45deg);
}

.nav-subitems {
  display: none;
  padding: 0 12px 10px 12px;
}

.nav-group.is-open .nav-subitems {
  display: grid;
  gap: 6px;
}

.nav-subitems a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.nav-subitems a:hover,
.nav-subitems a.is-active {
  background: var(--panel);
  color: var(--text);
}

.topbar-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
}

.topbar-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 320px;
  max-height: 70vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 50;
}

.chat-widget.is-open {
  display: flex;
}

.chat-list {
  display: grid;
  gap: 10px;
  padding: 14px 12px 8px;
  overflow: auto;
  scrollbar-width: none;
}

.chat-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.chat-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.chat-item:hover {
  background: #f6f8fb;
  border-color: #e2e6ee;
}

.chat-item.is-unread {
  background: #f0f6ff;
  border-color: #d8e6ff;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #eef1f6;
  display: grid;
  place-items: center;
  position: relative;
}

.chat-avatar img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.status {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: #8e94a3;
}

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

.status.away {
  background: var(--warning);
}

.chat-name {
  font-size: 12px;
  font-weight: 600;
}

.chat-preview {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.chat-meta {
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  display: grid;
  gap: 6px;
  justify-items: end;
}

.chat-badge {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 0 6px;
}

.chat-footer {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.chat-action {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--panel);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.chat-action.ghost {
  background: var(--panel-alt);
}

.main {
  padding: 22px 24px 40px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
}

.page-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.03);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-meta {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--muted);
}

.event-list {
  display: grid;
  gap: 10px;
}

.event-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: grid;
  gap: 8px;
  background: #fff7f7;
}

.event-title {
  font-weight: 600;
}

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

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--danger);
}

.priority-dot.warning {
  background: var(--warning);
}

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

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

.metric-mini {
  padding: 12px;
  border-radius: 12px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
}

.metric-mini .value {
  font-size: 20px;
  font-weight: 700;
}

.metric-mini .label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.metric-mini .trend {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ok);
}

.metric-mini .trend.down {
  color: var(--danger);
}

.edds-layout {
  display: grid;
  gap: 12px;
}

.edds-bottom {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.events-feed {
  display: grid;
  gap: 8px;
}

.feed-item {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  font-size: 13px;
}

.map-card {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  min-height: 180px;
  background: #e9edf5;
}

.map-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.map-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(45, 115, 255, 0.15);
  transform: translate(-50%, -50%);
}

.map-dot.danger {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(224, 49, 49, 0.15);
}

.map-dot.warning {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(240, 140, 0, 0.18);
}

.map-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(47, 158, 68, 0.18);
}

.summary-card {
  display: grid;
  gap: 10px;
}

.summary-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.summary-value {
  font-size: 26px;
  font-weight: 700;
}

.summary-trend {
  font-size: 12px;
  color: var(--ok);
}

.summary-trend.down {
  color: var(--danger);
}

.sparkline {
  width: 100%;
  height: 40px;
}

.progress {
  height: 8px;
  background: #e9edf3;
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
}


.ring {
  width: 120px;
  height: 120px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) 0 76%, #e6e9f0 0 100%);
}

.ring span {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  background: var(--panel);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.donut {
  width: 140px;
  height: 140px;
  border-radius: 999px;
  background: conic-gradient(var(--ok) 0 62%, var(--warning) 62% 84%, var(--danger) 84% 100%);
  display: grid;
  place-items: center;
}

.donut span {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background: var(--panel);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
}

.kpi-list {
  display: grid;
  gap: 10px;
}

.kpi-row {
  display: grid;
  gap: 6px;
}

.kpi-row .label {
  font-size: 12px;
  color: var(--muted);
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  height: 120px;
}

.bar {
  background: #cfe1ff;
  border-radius: 6px 6px 0 0;
  position: relative;
}

.bar.accent {
  background: var(--accent);
}

.line-chart {
  width: 100%;
  height: 140px;
}

.status-grid {
  display: grid;
  gap: 8px;
}

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

.status-row span {
  font-weight: 600;
  margin-left: 12px;
}

.stub {
  display: grid;
  place-items: center;
  min-height: 60vh;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1200px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .edds-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 12px 16px;
  }

  .main {
    padding: 18px 16px 32px;
  }
}

@media (max-width: 640px) {
  .topbar-right {
    display: none;
  }

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

html {
  scrollbar-width: thin;
  scrollbar-color: #cfd4dd transparent;
}

body::-webkit-scrollbar,
.main::-webkit-scrollbar {
  width: 10px;
}

body::-webkit-scrollbar-track,
.main::-webkit-scrollbar-track {
  background: transparent;
}

body::-webkit-scrollbar-thumb,
.main::-webkit-scrollbar-thumb {
  background: #cfd4dd;
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

body::-webkit-scrollbar-thumb:hover,
.main::-webkit-scrollbar-thumb:hover {
  background: #b8bec9;
}

