:root {
  --st-sidebar: #17212b;
  --st-sidebar-active: #223443;
  --st-sidebar-border: #2d4253;
  --st-accent: #1f6f8b;
  --st-accent-dark: #17536a;
  --st-teal: #177f75;
  --st-red: #b23b3b;
  --st-amber: #a96d00;
  --st-border: #d9e1e8;
  --st-page: #f4f6f8;
  --st-text: #17212b;
  --st-muted: #657282;
}

html, body {
  min-height: 100%;
}

body {
  background: var(--st-page);
  color: var(--st-text);
  font-size: .95rem;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  background: var(--st-sidebar);
  color: #fff;
  border-right: 1px solid var(--st-sidebar-border);
}

.sidebar .brand {
  font-weight: 700;
  letter-spacing: 0;
}

.brand-subtitle {
  color: #aebccb;
  font-size: .75rem;
  font-weight: 500;
  line-height: 1;
}

.sidebar .nav-link {
  color: #d6dee6;
  border-radius: 7px;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: .65rem;
  font-weight: 600;
  padding: .55rem .7rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  color: #fff;
  background: var(--st-sidebar-active);
}

.nav-svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  flex: 0 0 auto;
  opacity: .92;
}

.content-wrap {
  min-width: 0;
}

.topbar,
.panel,
.metric {
  background: #fff;
  border: 1px solid var(--st-border);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}

.panel,
.metric {
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(23, 33, 43, .04);
}

.eyebrow {
  color: var(--st-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.metric {
  padding: 1rem;
  min-height: 116px;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--metric-color, var(--st-accent));
}

.metric .label {
  color: var(--st-muted);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric .value {
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 800;
  margin-top: .4rem;
}

.metric .hint {
  color: var(--st-muted);
  font-size: .8rem;
  margin-top: .2rem;
}

.metric-attention {
  --metric-color: var(--st-red);
}

.metric-good {
  --metric-color: var(--st-teal);
}

.metric-neutral {
  --metric-color: var(--st-accent);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.table-responsive {
  border-radius: 8px;
  border: 1px solid var(--st-border);
  background: #fff;
}

.table {
  --bs-table-hover-bg: #f6f9fb;
  font-size: .9rem;
}

.table thead th {
  background: #f8fafc;
  color: #425160;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--st-border);
}

.table td,
.table th {
  padding: .72rem .85rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: .18rem .55rem;
  font-size: .76rem;
  font-weight: 700;
  text-transform: capitalize;
}

.status-success {
  color: #0f5f42;
  background: #e8f6ef;
  border-color: #bfe8d2;
}

.status-warning {
  color: #7a4d00;
  background: #fff4d7;
  border-color: #f1d797;
}

.status-danger {
  color: #8d2f2f;
  background: #fdeaea;
  border-color: #efbaba;
}

.status-secondary {
  color: #4c5967;
  background: #eef2f5;
  border-color: #d7e0e7;
}

.status-primary {
  color: #155166;
  background: #e6f3f7;
  border-color: #b9dce7;
}

.fiber-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--st-border);
  border-radius: 999px;
  padding: .15rem .5rem;
  font-size: .82rem;
  background: #fff;
}

.fiber-dot {
  width: .75rem;
  height: .75rem;
  border-radius: 50%;
  border: 1px solid #9aa7b2;
}

.warning-row {
  background: #fff8e6;
}

.map-canvas {
  min-height: 68vh;
  height: calc(100vh - 210px);
  border: 1px solid var(--st-border);
  border-radius: 8px;
}

.report-actions {
  white-space: nowrap;
}

.upload-preview {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--st-border);
}

.offline-pending {
  border-color: #c89000;
  background: #fff8e6;
}

#sync-status {
  min-width: 72px;
}

.gps-status {
  color: var(--st-muted);
  font-size: .8rem;
  margin-top: .35rem;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.record-card {
  background: #fff;
  border: 1px solid var(--st-border);
  border-radius: 8px;
  padding: 1rem;
}

.record-card .title {
  font-weight: 800;
  margin-bottom: .25rem;
}

.form-label {
  color: #384858;
  font-weight: 700;
  font-size: .84rem;
}

.form-control,
.form-select {
  border-color: #cdd7e0;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--st-accent);
  box-shadow: 0 0 0 .2rem rgba(31, 111, 139, .16);
}

.btn-primary {
  --bs-btn-bg: var(--st-accent);
  --bs-btn-border-color: var(--st-accent);
  --bs-btn-hover-bg: var(--st-accent-dark);
  --bs-btn-hover-border-color: var(--st-accent-dark);
}

@media (min-width: 992px) {
  .sidebar {
    width: 276px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}

@media (max-width: 767.98px) {
  .sidebar {
    position: static;
  }

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

  .topbar {
    position: static;
  }

  .topbar .d-flex.align-items-center.gap-3 {
    width: 100%;
    justify-content: space-between;
    gap: .5rem !important;
  }

  .table-responsive table {
    min-width: 760px;
  }
}
