:root {
  --bg: #0b1723;
  --bg-soft: #111c2a;
  --bg-softer: #182436;
  --card-bg: #131f30;
  --border-subtle: #22324a;
  --accent: #36c690;
  --accent-soft: rgba(54, 198, 144, 0.1);
  --accent-warn: #f5a623;
  --accent-error: #ff5c5c;
  --accent-info: #2d9cdb;
  --text: #f4f7fb;
  --text-soft: #a7b4cb;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.35);
  --transition-fast: 0.18s ease-out;
  --sidebar-width: 250px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #1d3148 0, #050a10 45%, #020308 100%);
  color: var(--text);
}

/* Layout */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: rgba(6, 13, 24, 0.96);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar__logo {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: radial-gradient(circle at 20% 20%, #36c690, #1a7c58);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px rgba(54, 198, 144, 0.3);
}

.topbar__logo i {
  color: #f4fff9;
  font-size: 1.1rem;
}

.topbar__title-group {
  display: flex;
  flex-direction: column;
}

.topbar__title {
  font-weight: 600;
  font-size: 0.98rem;
}

.topbar__subtitle {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.topbar__meta-item i {
  margin-right: 0.3rem;
}

.topbar__menu-btn {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.2rem;
  display: none;
  cursor: pointer;
}

/* Layout inner */

.layout {
  display: flex;
  min-height: calc(100vh - 52px);
}

/* Sidebar */

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #050b15 0, #050910 55%, #05060b 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  padding: 0.9rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--text-soft);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}

.sidebar__link i {
  width: 18px;
  text-align: center;
}

.sidebar__link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  transform: translateX(2px);
}

.sidebar__link.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 0 1px rgba(54, 198, 144, 0.4);
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.7rem;
  color: var(--text-soft);
}

/* Content */

.content {
  flex: 1;
  padding: 1.2rem 1.2rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section {
  display: none;
  animation: fadeIn 0.22s ease-out;
}

.section--active {
  display: block;
}

.section__header {
  margin-bottom: 1rem;
}

.section__header h1 {
  margin: 0 0 0.2rem;
  font-size: 1.45rem;
}

.section__header p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-soft);
}

/* Cards */

.card {
  background: radial-gradient(circle at top left, #1e2b3d, #0c141f);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 0.9rem 1rem 1rem;
  box-shadow: var(--shadow-soft);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.card__header--flex {
  align-items: center;
}

.card__header h2 {
  margin: 0;
  font-size: 1rem;
}

.card__tag {
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
}

.card__tag--soft {
  background: var(--accent-soft);
  color: var(--accent);
}

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* KPI Cards */

.kpi-card {
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}

.kpi-card__label {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 0.35rem;
}

.kpi-card__value {
  font-size: 1.7rem;
  font-weight: 600;
}

.kpi-card__value--ok {
  color: var(--accent);
}

.kpi-card__unit {
  font-size: 0.95rem;
  margin-left: 0.2rem;
}

.kpi-card__meta {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-soft);
  display: flex;
  gap: 0.7rem;
}

/* Grid */

.grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Chart container */

.chart-container {
  position: relative;
  height: 220px;
  width: 100%;
}

/* Table */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.table thead {
  background: rgba(0, 0, 0, 0.12);
}

.table th,
.table td {
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  text-align: left;
  white-space: nowrap;
}

.table th {
  font-weight: 500;
  color: var(--text-soft);
}

.table--compact th,
.table--compact td {
  padding: 0.4rem 0.45rem;
}

/* Inputs & Buttons */

.input {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(4, 9, 16, 0.9);
  color: var(--text);
  font-size: 0.8rem;
}

.input:focus {
  outline: none;
  border-color: rgba(54, 198, 144, 0.7);
  box-shadow: 0 0 0 1px rgba(54, 198, 144, 0.4);
}

.input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.input--sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.45rem;
}

.btn {
  border-radius: 999px;
  border: none;
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast), color var(--transition-fast);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn i {
  font-size: 0.8rem;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
}

.btn--primary {
  background: linear-gradient(135deg, #36c690, #1e9d71);
  color: #02140b;
  font-weight: 500;
}

.btn--outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.26);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.04);
}

.btn--sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
}

.btn--xs {
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
}

/* Status badges */

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  background: rgba(255, 255, 255, 0.08);
}

.status--ok {
  background: rgba(54, 198, 144, 0.12);
  color: var(--accent);
}

.status--warn {
  background: rgba(245, 166, 35, 0.12);
  color: var(--accent-warn);
}

.status--error {
  background: rgba(255, 92, 92, 0.12);
  color: var(--accent-error);
}

.status--info {
  background: rgba(45, 156, 219, 0.12);
  color: var(--accent-info);
}

/* Timeline */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline__item {
  display: flex;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.timeline__item:last-child {
  border-bottom: none;
}

.timeline__icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.timeline__item--warning .timeline__icon {
  background: rgba(245, 166, 35, 0.15);
  color: var(--accent-warn);
}

.timeline__item--ok .timeline__icon {
  background: rgba(54, 198, 144, 0.15);
  color: var(--accent);
}

.timeline__item--info .timeline__icon {
  background: rgba(45, 156, 219, 0.15);
  color: var(--accent-info);
}

.timeline__content {
  font-size: 0.8rem;
}

.timeline__title {
  font-weight: 500;
  margin-bottom: 0.1rem;
}

.timeline__meta {
  color: var(--text-soft);
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

/* Tasks */

.task-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
}

.task-list__item + .task-list__item {
  margin-top: 0.4rem;
}

.task-list__item input[type="checkbox"] {
  margin-right: 0.4rem;
}

/* Forms */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
}

.form-field label {
  color: var(--text-soft);
}

.form-field--full {
  grid-column: 1 / -1;
}

/* Notes */

.notes {
  list-style: disc;
  padding-left: 1.1rem;
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.notes li + li {
  margin-top: 0.2rem;
}

/* Map Placeholder */

.map-placeholder {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: radial-gradient(circle at center, #142237, #0a131f);
  padding: 1.2rem;
  text-align: center;
}

.map-placeholder__badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
}

.map-placeholder__inner {
  position: relative;
  height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--text-soft);
  font-size: 0.8rem;
}

.map-placeholder__inner::before {
  content: "";
  position: absolute;
  inset: 20% 15%;
  border-radius: 30px;
  border: 1px dashed rgba(54, 198, 144, 0.7);
}

.map-placeholder__pin {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
  color: var(--accent);
}

/* Logs */

.log {
  margin: 0;
  font-family: "Fira Code", "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.74rem;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  color: #e2f3ff;
  max-height: 200px;
  overflow: auto;
}

/* Modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.modal--open {
  display: block;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.modal__dialog {
  position: relative;
  max-width: 620px;
  margin: 4vh auto;
  background: radial-gradient(circle at top left, #1e2b3d, #050810);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 0.9rem 1rem 0.8rem;
  box-shadow: var(--shadow-soft);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__header h2 {
  margin: 0;
  font-size: 1rem;
}

.modal__close {
  border: none;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 1rem;
}

.modal__body {
  margin-top: 0.7rem;
  font-size: 0.82rem;
}

.modal__summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.modal__summary h3 {
  margin: 0 0 0.2rem;
}

.modal__summary p {
  margin: 0.05rem 0;
  color: var(--text-soft);
}

.modal__summary-meta p {
  margin: 0.05rem 0;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

/* Animation */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */

@media (max-width: 960px) {
  .grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .topbar__menu-btn {
    display: inline-flex;
    margin-right: 0.3rem;
  }

  .sidebar {
    position: fixed;
    inset: 52px 0 0 auto;
    width: 230px;
    transform: translateX(100%);
    transition: transform var(--transition-fast);
    z-index: 25;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .content {
    padding: 1rem 0.85rem 1.2rem;
  }

  .grid--2,
  .grid--3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal__dialog {
    margin: 8vh 0.8rem;
  }
}

@media (max-width: 480px) {
  .topbar__meta {
    display: none;
  }

  .card__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card__actions {
    width: 100%;
  }

  .card__actions .input--sm {
    width: 100%;
  }
}
