:root {
  --navy: #0b1a33;
  --navy2: #12243f;
  --navy3: #1a2f4d;
  --aqua: #4fc3a1;
  --blue: #3ba9e0;
  --green: #34a853;
  --orange: #f9a825;
  --bg: #f6f8fb;
  --card: #fff;
  --text: #14213d;
  --muted: #758196;
  --line: #e6eaf0;
  --danger: #e53935;
  --sidebar-w: 260px;
  --radius: 18px;
  --shadow: 0 10px 32px rgba(22, 34, 61, 0.08);
}

[data-bs-theme="dark"] {
  --bg: #08162b;
  --card: #10213b;
  --text: #f2f4f7;
  --muted: #9ba8bb;
  --line: #213654;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  margin: 0;
  overflow-x: hidden;
}

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.btn {
  border-radius: 12px;
  font-weight: 700;
  padding: 0.72rem 1rem;
}

.btn-primary {
  --bs-btn-bg: #007b8a;
  --bs-btn-border-color: #007b8a;
  --bs-btn-hover-bg: #006b78;
  --bs-btn-hover-border-color: #006b78;
}

.form-control,
.form-select {
  border-radius: 12px;
  border-color: var(--line);
  padding: 0.78rem 0.9rem;
  background-color: var(--card);
  color: var(--text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--aqua);
  box-shadow: 0 0 0 0.2rem rgba(79, 195, 161, 0.15);
}

.form-label {
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(79, 195, 161, 0.12);
  color: var(--text);
}

.link-btn {
  border: 0;
  background: none;
  color: #007b8a;
  font-weight: 700;
  padding: 0;
}

.loading-btn .btn-spinner {
  display: none;
}

.loading-btn.is-loading .btn-label {
  display: none;
}

.loading-btn.is-loading .btn-spinner {
  display: inline-block;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}

.avatar-green {
  background: linear-gradient(135deg, var(--aqua), #1ca77e);
  color: #05251c;
}

.avatar-blue {
  background: rgba(59, 169, 224, 0.16);
  color: #198cc6;
}

.avatar-orange {
  background: rgba(249, 168, 37, 0.16);
  color: #cf7e00;
}

.avatar-red {
  background: rgba(229, 57, 53, 0.13);
  color: #d4312d;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status.success {
  background: rgba(52, 168, 83, 0.12);
  color: #2f934a;
}

.status.warning {
  background: rgba(249, 168, 37, 0.13);
  color: #c77a00;
}

.status.danger {
  background: rgba(229, 57, 53, 0.11);
  color: #d5332f;
}

.status.info {
  background: rgba(59, 169, 224, 0.12);
  color: #278ec2;
}

.status.neutral {
  background: rgba(117, 129, 150, 0.12);
  color: var(--muted);
}

/* ========== AUTH ========== */
.auth-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  background: var(--card);
}

.auth-art {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #07162d, #0b2746 68%, #0c3553);
  color: #fff;
  padding: clamp(2rem, 5vw, 7vw);
  display: flex;
  align-items: center;
}

.auth-art:before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, #000, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
}

.auth-art-content {
  position: relative;
  z-index: 2;
  max-width: 610px;
  width: 100%;
}

.auth-logo {
  display: block;
  width: min(165px, 40vw);
  height: auto;
  margin: 0 0 clamp(1.5rem, 4vw, 3.5rem);
  object-fit: contain;
}

.auth-art .eyebrow {
  background: rgba(79, 195, 161, 0.12);
  border: 1px solid rgba(79, 195, 161, 0.25);
  color: var(--aqua);
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
}

.auth-art h1 {
  font-size: clamp(1.75rem, 3.5vw, 3.5rem);
  line-height: 1.1;
  font-weight: 800;
  margin: 1rem 0;
}

.auth-art p {
  font-size: clamp(0.9rem, 1.2vw, 1.05rem);
  color: #b8c8d9;
  max-width: 560px;
  line-height: 1.7;
  margin: 0;
}

.auth-points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

.auth-points > div {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px;
  border-radius: 16px;
  min-width: 0;
}

.auth-points i {
  color: var(--aqua);
  font-size: 1.2rem;
}

.auth-points span {
  display: block;
  margin-top: 10px;
}

.auth-points b,
.auth-points small {
  display: block;
}

.auth-points small {
  color: #91a5ba;
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.45;
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.2;
  pointer-events: none;
}

.orb-1 {
  width: min(360px, 50vw);
  height: min(360px, 50vw);
  background: var(--aqua);
  right: -20%;
  top: -10%;
}

.orb-2 {
  width: min(260px, 40vw);
  height: min(260px, 40vw);
  background: var(--blue);
  left: 35%;
  bottom: -20%;
}

.auth-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--card);
  min-height: 0;
}

.auth-card {
  width: min(440px, 100%);
}

.auth-card h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  margin: 8px 0;
}

.auth-step {
  display: none;
}

.auth-step.active {
  display: block;
  animation: fadeUp 0.25s ease;
}

.input-icon {
  position: relative;
}

.input-icon > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.input-icon .form-control {
  padding-left: 42px;
}

.input-icon .password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

.security-note,
.demo-note {
  margin-top: 18px;
  border-radius: 12px;
  padding: 11px 13px;
  background: rgba(79, 195, 161, 0.09);
  color: #248568;
  font-size: 11px;
  display: flex;
  gap: 8px;
}

.demo-note {
  display: block;
  text-align: center;
}

.auth-footer {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  margin: 0;
  padding: 0 1rem;
}

.mobile-auth-logo {
  display: inline-block;
  max-width: 140px;
  width: 100%;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.back-btn {
  border: 0;
  background: var(--bg);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  margin-bottom: 22px;
}

.otp-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.otp-row input {
  text-align: center;
  font-weight: 800;
  font-size: clamp(1rem, 3vw, 1.25rem);
  padding: 0.72rem 0.15rem;
  min-width: 0;
}

.password-rules {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}

.password-rules i {
  color: var(--green);
}

/* ========== ADMIN SHELL ========== */
.admin-app {
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  z-index: 1040;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy);
  color: #dfe8f1;
  display: flex;
  flex-direction: column;
}

.sidebar-head {
  height: 72px;
  min-height: 72px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-logo {
  width: min(130px, 100%);
  height: auto;
  max-height: 40px;
  object-fit: contain;
  object-position: left center;
}

.admin-chip {
  margin: 6px 12px 10px;
  padding: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 15px;
}

.admin-chip > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.admin-chip b,
.admin-chip span {
  display: block;
}

.admin-chip b {
  font-size: 11px;
}

.admin-chip span {
  font-size: 9px;
  color: #8095ab;
  margin-top: 2px;
}

.admin-chip > i {
  color: var(--aqua);
  flex-shrink: 0;
}

.side-nav {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 10px 20px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.side-nav::-webkit-scrollbar {
  width: 4px;
}

.side-nav::-webkit-scrollbar-thumb {
  background: #29405c;
  border-radius: 10px;
}

.nav-section {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #5d7590;
  padding: 18px 12px 7px;
}

.side-nav .nav-link,
.sidebar-foot .nav-link {
  position: relative;
  border: 0;
  background: transparent;
  width: 100%;
  color: #9eb0c3;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 11px;
  text-decoration: none;
  margin: 2px 0;
  cursor: pointer;
}

.side-nav .nav-link i,
.sidebar-foot .nav-link i {
  font-size: 15px;
  flex-shrink: 0;
}

.side-nav .nav-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-nav .nav-link:hover,
.side-nav .nav-link.active {
  color: #fff;
  background: rgba(79, 195, 161, 0.11);
}

.side-nav .nav-link.active:before {
  content: "";
  position: absolute;
  left: -10px;
  width: 3px;
  height: 22px;
  border-radius: 0 4px 4px 0;
  background: var(--aqua);
}

.nav-badge {
  font-style: normal;
  margin-left: auto;
  background: rgba(79, 195, 161, 0.18);
  color: var(--aqua);
  padding: 2px 6px;
  border-radius: 99px;
  font-size: 8px;
  flex-shrink: 0;
}

.nav-badge.warning {
  background: rgba(249, 168, 37, 0.17);
  color: #ffc461;
}

.nav-badge.danger {
  background: rgba(229, 57, 53, 0.18);
  color: #ff7975;
}

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.main-area {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 72px;
  min-height: 72px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(12px, 2vw, 26px);
  position: sticky;
  top: 0;
  z-index: 1020;
  gap: 8px;
}

.topbar h5 {
  font-size: clamp(13px, 1.5vw, 14px);
  font-weight: 800;
  margin: 0;
  line-height: 1.3;
}

.topbar small {
  color: var(--muted);
  font-size: 9px;
  display: block;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.global-search {
  height: 38px;
  width: min(290px, 28vw);
  border: 1px solid var(--line);
  border-radius: 11px;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  background: var(--bg);
}

.global-search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 11px;
  color: var(--text);
  min-width: 0;
}

.global-search kbd {
  font-size: 8px;
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
  flex-shrink: 0;
}

.notification-btn {
  position: relative;
}

.notification-btn span {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  right: 7px;
  top: 6px;
  border: 1px solid var(--card);
}

.top-profile > button {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  padding: 0;
}

.top-profile b,
.top-profile span {
  display: block;
  text-align: left;
}

.top-profile b {
  font-size: 10px;
}

.top-profile span {
  font-size: 8px;
  color: var(--muted);
}

.top-profile .dropdown-toggle:after {
  display: none;
}

.content-area {
  padding: clamp(14px, 2vw, 24px);
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

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

.section-head h4 {
  font-size: clamp(16px, 2vw, 18px);
  font-weight: 800;
  margin: 0 0 4px;
}

.section-head p {
  font-size: 10px;
  color: var(--muted);
  margin: 0;
}

.card-x {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.01);
  overflow: hidden;
}

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

.metric-card {
  padding: 18px;
}

.metric-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}

.metric-icon.green {
  color: #258865;
  background: rgba(79, 195, 161, 0.12);
}

.metric-icon.blue {
  color: #238cc1;
  background: rgba(59, 169, 224, 0.12);
}

.metric-icon.orange {
  color: #c87b02;
  background: rgba(249, 168, 37, 0.13);
}

.metric-icon.red {
  color: #d43632;
  background: rgba(229, 57, 53, 0.1);
}

.metric-card h3 {
  font-size: clamp(20px, 2.5vw, 25px);
  font-weight: 800;
  margin: 16px 0 3px;
  word-break: break-word;
}

.metric-card p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.metric-trend {
  font-size: 9px;
  font-weight: 700;
}

.metric-trend.up {
  color: var(--green);
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.65fr 0.9fr;
  gap: 14px;
  margin-top: 14px;
}

.card-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-head h6 {
  font-size: 12px;
  font-weight: 800;
  margin: 0;
}

.card-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.card-body-x {
  padding: 18px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  font-size: 10px;
  margin-bottom: 0;
  vertical-align: middle;
  width: 100%;
  min-width: 600px;
}

.table thead th {
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  border-color: var(--line);
  padding: 0.72rem 0.7rem;
  white-space: nowrap;
}

.table tbody td {
  border-color: var(--line);
  padding: 0.75rem 0.7rem;
  white-space: nowrap;
}

.table-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.table-user b,
.table-user span {
  display: block;
}

.table-user b {
  font-size: 10px;
}

.table-user span {
  font-size: 8px;
  color: var(--muted);
  margin-top: 2px;
}

.tiny-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.tiny-btn:hover {
  border-color: var(--aqua);
}

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

.kpi-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.kpi-row > div:first-child {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.kpi-row b,
.kpi-row span {
  display: block;
}

.kpi-row b {
  font-size: 10px;
}

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

.kpi-row > strong {
  font-size: 11px;
  flex-shrink: 0;
}

.activity-list {
  display: grid;
  gap: 14px;
}

.activity {
  display: flex;
  gap: 10px;
}

.activity .activity-line {
  width: 2px;
  background: var(--line);
  margin: 24px 0 -18px -29px;
}

.activity b,
.activity p,
.activity small {
  display: block;
}

.activity b {
  font-size: 9px;
}

.activity p {
  font-size: 9px;
  color: var(--muted);
  margin: 3px 0;
}

.activity small {
  font-size: 8px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.filter-input {
  height: 36px;
  min-width: min(190px, 100%);
  font-size: 10px;
  padding: 0.5rem 0.7rem;
}

.filter-select {
  height: 36px;
  min-width: min(125px, 100%);
  font-size: 10px;
  padding: 0.5rem 2rem 0.5rem 0.7rem;
}

.live-layout {
  display: grid;
  grid-template-columns: 1.7fr 0.85fr;
  gap: 14px;
}

.live-map {
  height: calc(100vh - 175px);
  height: calc(100dvh - 175px);
  min-height: 400px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}

.leaflet-container {
  font-family: Inter, sans-serif;
  height: 100% !important;
  width: 100% !important;
}

.operation-feed {
  height: calc(100vh - 175px);
  height: calc(100dvh - 175px);
  min-height: 400px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.operation-card {
  padding: 13px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.operation-card:hover {
  background: rgba(79, 195, 161, 0.05);
}

.operation-card .op-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.operation-card b {
  font-size: 10px;
}

.operation-card p {
  font-size: 9px;
  color: var(--muted);
  margin: 5px 0;
}

.operation-card .route {
  font-size: 9px;
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 6px;
  line-height: 1.7;
}

.route-dot {
  position: relative;
}

.route-dot:before,
.route-dot:after {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin: 4px auto;
  background: var(--green);
}

.route-dot:after {
  background: var(--danger);
  margin-top: 14px;
}

.route-dot i {
  position: absolute;
  width: 1px;
  height: 18px;
  background: var(--line);
  left: 4.5px;
  top: 9px;
}

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

.detail-item {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 12px;
  min-width: 0;
}

.detail-item span,
.detail-item b {
  display: block;
}

.detail-item span {
  font-size: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-item b {
  font-size: 10px;
  margin-top: 4px;
  word-break: break-word;
}

.timeline {
  position: relative;
  display: grid;
  gap: 16px;
  padding-left: 20px;
}

.timeline:before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}

.timeline-item {
  position: relative;
}

.timeline-item:before {
  content: "";
  position: absolute;
  left: -19px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--aqua);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--aqua);
}

.timeline-item b {
  display: block;
  font-size: 9px;
}

.timeline-item span {
  font-size: 8px;
  color: var(--muted);
}

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

.doc-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.doc-card i {
  font-size: 22px;
  color: #d63e3a;
  flex-shrink: 0;
}

.doc-card b,
.doc-card span {
  display: block;
}

.doc-card b {
  font-size: 9px;
}

.doc-card span {
  font-size: 8px;
  color: var(--muted);
  margin-top: 3px;
}

.chat-layout {
  display: grid;
  grid-template-columns: 300px 1fr 275px;
  height: calc(100vh - 132px);
  height: calc(100dvh - 132px);
  min-height: 480px;
  overflow: hidden;
}

.chat-list {
  border-right: 1px solid var(--line);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

.chat-list-head {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 2;
}

.chat-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.chat-item.active,
.chat-item:hover {
  background: rgba(79, 195, 161, 0.07);
}

.chat-item .grow {
  min-width: 0;
  flex: 1;
}

.chat-item b,
.chat-item span {
  display: block;
}

.chat-item b {
  font-size: 9px;
}

.chat-item span {
  font-size: 8px;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  margin-top: 4px;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-head {
  height: 60px;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 16px;
  justify-content: space-between;
  gap: 8px;
}

.chat-messages {
  padding: 18px;
  overflow: auto;
  flex: 1;
  background: linear-gradient(rgba(79, 195, 161, 0.018), rgba(59, 169, 224, 0.018));
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.bubble {
  max-width: min(68%, 360px);
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 9px;
  line-height: 1.6;
  background: var(--bg);
  border: 1px solid var(--line);
  align-self: flex-start;
  word-break: break-word;
}

.bubble.mine {
  align-self: flex-end;
  background: #007b8a;
  color: white;
  border-color: #007b8a;
}

.bubble small {
  display: block;
  margin-top: 4px;
  opacity: 0.68;
  font-size: 7px;
}

.chat-composer {
  padding: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-composer .form-control {
  flex: 1;
  min-width: 120px;
}

.chat-context {
  border-left: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

.context-user {
  text-align: center;
}

.context-user .avatar {
  margin: 0 auto 8px;
}

.context-user b,
.context-user span {
  display: block;
}

.context-user b {
  font-size: 11px;
}

.context-user span {
  font-size: 8px;
  color: var(--muted);
}

.context-section {
  margin-top: 20px;
}

.context-section h6 {
  font-size: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.setting-list {
  display: grid;
  gap: 12px;
}

.setting-row {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.setting-row b,
.setting-row span {
  display: block;
}

.setting-row b {
  font-size: 10px;
}

.setting-row span {
  font-size: 8px;
  color: var(--muted);
  margin-top: 3px;
}

.empty-state {
  padding: 50px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state i {
  font-size: 34px;
}

.empty-state h5 {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  margin: 10px 0 6px;
}

.chart-box {
  height: 260px;
  position: relative;
  width: 100%;
}

.chart-box canvas {
  max-width: 100% !important;
}

.mini-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mini-stat {
  padding: 12px;
  background: var(--bg);
  border-radius: 12px;
  min-width: 0;
}

.mini-stat span,
.mini-stat b {
  display: block;
}

.mini-stat span {
  font-size: 8px;
  color: var(--muted);
}

.mini-stat b {
  font-size: 14px;
  margin-top: 5px;
  word-break: break-word;
}

.progress-thin {
  height: 6px;
  border-radius: 99px;
  background: var(--bg);
  overflow: hidden;
}

.progress-thin span {
  display: block;
  height: 100%;
  background: var(--aqua);
  border-radius: inherit;
}

.sidebar-backdrop {
  display: none;
}

.modal-content {
  background: var(--card);
  color: var(--text);
  border-color: var(--line);
  border-radius: 18px;
}

.modal-header,
.modal-footer {
  border-color: var(--line);
}

.modal-title {
  font-size: 15px;
  font-weight: 800;
}

.btn-close {
  filter: var(--bs-btn-close-white-filter);
}

.dropdown-menu {
  background: var(--card);
  border-color: var(--line);
  font-size: 10px;
}

.dropdown-item {
  color: var(--text);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ========== RESPONSIVE ========== */

/* Large tablets / small desktops */
@media (max-width: 1199px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid,
  .live-layout {
    grid-template-columns: 1fr;
  }

  .live-map,
  .operation-feed {
    height: 480px;
    min-height: 360px;
  }

  .chat-layout {
    grid-template-columns: minmax(220px, 260px) 1fr;
  }

  .chat-context {
    display: none;
  }

  .auth-points {
    grid-template-columns: 1fr;
  }

  .auth-art h1 {
    font-size: clamp(1.6rem, 3vw, 2.8rem);
  }
}

/* Tablets and below – collapse sidebar */
@media (max-width: 991px) {
  .auth-view {
    grid-template-columns: 1fr;
  }

  .auth-art {
    display: none !important;
  }

  .auth-panel {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 20px 48px;
  }

  .auth-footer {
    position: relative;
    bottom: auto;
    margin-top: 24px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: min(var(--sidebar-w), 85vw);
  }

  .sidebar.open {
    transform: none;
  }

  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1030;
  }

  .main-area {
    margin-left: 0;
  }

  .content-area {
    padding: 16px;
  }

  .topbar {
    padding: 0 14px;
  }

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

  .chat-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .chat-list {
    height: 280px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .chat-thread {
    height: min(560px, 70vh);
  }
}

/* Mobile phones */
@media (max-width: 767px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .section-head > div:last-child,
  .toolbar > div:last-child {
    width: 100%;
  }

  .filters {
    width: 100%;
  }

  .filters > * {
    flex: 1 1 100%;
    min-width: 0 !important;
    width: 100%;
  }

  .filter-input,
  .filter-select {
    width: 100%;
    min-width: 0;
  }

  .auth-panel {
    padding: 20px 16px 40px;
  }

  .auth-card h2 {
    font-size: 1.45rem;
  }

  .otp-row {
    gap: 4px;
  }

  .otp-row input {
    padding: 0.6rem 0.1rem;
    font-size: 1rem;
  }

  .detail-grid,
  .doc-grid {
    grid-template-columns: 1fr;
  }

  .mini-stat-row {
    grid-template-columns: 1fr;
  }

  .top-actions {
    gap: 2px;
  }

  .topbar h5 {
    font-size: 13px;
  }

  .topbar small {
    display: none;
  }

  .content-area {
    padding: 12px;
  }

  .metric-card {
    padding: 14px;
  }

  .card-head,
  .card-body-x {
    padding: 14px;
  }

  .chart-box {
    height: 220px;
  }

  .live-map,
  .operation-feed {
    height: 360px;
    min-height: 300px;
  }

  .table {
    min-width: 520px;
    font-size: 9px;
  }

  .setting-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-composer {
    flex-direction: column;
  }

  .chat-composer .btn {
    width: 100%;
  }

  .bubble {
    max-width: 85%;
  }

  .modal-dialog {
    margin: 0.5rem;
  }
}

/* Very small phones */
@media (max-width: 480px) {
  .sidebar-logo {
    width: 110px;
  }

  .mobile-auth-logo {
    max-width: 120px;
  }

  .topbar {
    height: 60px;
    min-height: 60px;
    padding: 0 10px;
  }

  .content-area {
    padding: 10px;
  }

  .metric-card h3 {
    font-size: 18px;
  }

  .otp-row {
    gap: 3px;
  }

  .password-rules {
    flex-direction: column;
    gap: 4px;
  }

  .global-search {
    display: none !important;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .auth-step.active {
    animation: none;
  }

  .sidebar {
    transition: none;
  }
}
