:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --navy: #081225;
  --navy-soft: #111d33;
  --body: #f4f7fb;
  --text: #172033;
  --muted: #7d889c;
  --border: #e7ebf1;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--body);
  color: var(--text);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(
      circle at top left,
      rgba(37, 99, 235, 0.25),
      transparent 35%
    ),
    linear-gradient(135deg, #081225, #0c1c39);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 18px;
}

.login-panel {
  width: 100%;
  max-width: 440px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  margin-bottom: 24px;
}

.brand-icon,
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border-radius: 15px;
}

.brand-icon {
  width: 54px;
  height: 54px;
  font-size: 23px;
}

.login-brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
}

.login-brand p {
  margin: 2px 0 0;
  color: #9fb0ce;
}

.login-card {
  background: #fff;
  border-radius: 24px;
  padding: 34px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.28);
}

.login-label {
  color: var(--primary);
  font-size: 11px;
  letter-spacing: 1.4px;
  font-weight: 800;
}

.login-card h2 {
  margin: 10px 0 4px;
  font-weight: 800;
}

.login-input {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.login-input .input-group-text,
.login-input .form-control,
.btn-password {
  border: 0;
  background: #f8fafc;
}

.login-input .form-control {
  min-height: 50px;
  box-shadow: none;
}

.btn-login {
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  background: var(--primary);
}

.login-footer {
  text-align: center;
  color: #8fa1bf;
  margin-top: 22px;
  font-size: 13px;
}

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

.app-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  padding: 24px 18px;
  background: var(--navy);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  padding: 0 8px 24px;
}

.sidebar-logo {
  width: 43px;
  height: 43px;
}

.sidebar-brand strong {
  display: block;
  font-size: 18px;
}

.sidebar-brand span {
  display: block;
  color: #8394b2;
  font-size: 12px;
}

.sidebar-menu {
  flex: 1;
}

.menu-heading {
  display: block;
  color: #52617c;
  font-size: 10px;
  letter-spacing: 1.4px;
  font-weight: 800;
  margin: 18px 12px 8px;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 13px;
  color: #93a4c1;
  padding: 12px 14px;
  border-radius: 11px;
  text-decoration: none;
  margin-bottom: 4px;
  transition: 0.2s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
  color: #fff;
  background: var(--primary);
}

.sidebar-menu i {
  width: 18px;
  text-align: center;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px;
  border-radius: 13px;
  background: var(--navy-soft);
  color: #fff;
}

.status-dot {
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.12);
}

.sidebar-status strong,
.sidebar-status span {
  display: block;
}

.sidebar-status strong {
  font-size: 13px;
}

.sidebar-status span {
  color: #7f91ae;
  font-size: 11px;
}

.app-main {
  width: calc(100% - 260px);
  margin-left: 260px;
}

.topbar {
  min-height: 86px;
  padding: 18px 30px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.topbar h1 {
  font-size: 21px;
  font-weight: 800;
  margin: 0;
}

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

.sidebar-toggle {
  display: none;
  border: 0;
  background: transparent;
  margin-right: 15px;
}

.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 11px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #e8efff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

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

.user-info strong {
  font-size: 13px;
}

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

.logout-button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #64748b;
  background: #f4f6fa;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.app-content {
  padding: 28px 30px;
}

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

.metric-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 17px;
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 17px;
}

.metric-icon {
  width: 53px;
  height: 53px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
}

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

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  font-size: 27px;
  margin-top: 3px;
}

.metric-blue .metric-icon {
  color: #2563eb;
  background: #e8efff;
}

.metric-orange .metric-icon {
  color: #ea580c;
  background: #fff1e7;
}

.metric-red .metric-icon {
  color: #dc2626;
  background: #feecec;
}

.metric-green .metric-icon {
  color: #16a34a;
  background: #eaf8ef;
}

.panel-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 17px;
  height: 100%;
  overflow: hidden;
}

.panel-header {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h3 {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}

.panel-header p {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 0;
}

.panel-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.app-table {
  margin: 0;
}

.app-table th {
  color: #8490a4;
  font-size: 11px;
  font-weight: 700;
  padding: 13px 20px;
  border-bottom-color: var(--border);
}

.app-table td {
  vertical-align: middle;
  padding: 14px 20px;
  border-bottom-color: var(--border);
  font-size: 13px;
}

.app-table td small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.message-cell {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
}

.status-success {
  color: #15803d;
  background: #dcfce7;
}

.status-warning {
  color: #b45309;
  background: #fef3c7;
}

.status-danger {
  color: #b91c1c;
  background: #fee2e2;
}

.status-secondary {
  color: #475569;
  background: #e2e8f0;
}

.incoming-list {
  padding: 8px 20px;
}

.incoming-item {
  display: flex;
  gap: 13px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.incoming-item:last-child {
  border-bottom: 0;
}

.incoming-avatar {
  flex: 0 0 39px;
  width: 39px;
  height: 39px;
  border-radius: 12px;
  color: var(--primary);
  background: #e8efff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.incoming-content {
  min-width: 0;
  flex: 1;
}

.incoming-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.incoming-top strong {
  font-size: 13px;
}

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

.incoming-content p {
  color: #69768a;
  font-size: 12px;
  margin: 5px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state,
.empty-table {
  color: var(--muted) !important;
  text-align: center;
  padding: 35px !important;
}

.empty-state i {
  font-size: 30px;
  margin-bottom: 10px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  padding: 18px 30px;
  color: var(--muted);
  font-size: 11px;
}

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

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-main {
    width: 100%;
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block;
  }

  .topbar {
    padding: 16px 18px;
  }

  .topbar p,
  .user-info {
    display: none;
  }

  .app-content {
    padding: 20px 15px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .app-footer {
    padding: 16px;
  }
}

.gateway-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding: 22px;
}

.gateway-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  background: #fff;
}

.gateway-card-top {
  display: flex;
  align-items: center;
  gap: 13px;
}

.gateway-device-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: #e8efff;
  font-size: 20px;
}

.gateway-title {
  flex: 1;
  min-width: 0;
}

.gateway-title h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.gateway-title span {
  color: var(--muted);
  font-size: 11px;
}

.gateway-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 800;
}

.gateway-state > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.gateway-state.online {
  color: #15803d;
  background: #dcfce7;
}

.gateway-state.online > span {
  background: #22c55e;
}

.gateway-state.offline {
  color: #b91c1c;
  background: #fee2e2;
}

.gateway-state.offline > span {
  background: #ef4444;
}

.gateway-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.gateway-stats > div {
  padding: 14px;
  border-right: 1px solid var(--border);
}

.gateway-stats > div:last-child {
  border-right: 0;
}

.gateway-stats span,
.gateway-stats strong {
  display: block;
}

.gateway-stats span {
  color: var(--muted);
  font-size: 10px;
}

.gateway-stats strong {
  margin-top: 4px;
  font-size: 14px;
}

.gateway-info-list {
  margin-top: 18px;
}

.gateway-info-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}

.gateway-info-list span {
  color: var(--muted);
  font-size: 11px;
}

.gateway-info-list strong {
  font-size: 11px;
  text-align: right;
}

.gateway-sims {
  display: flex;
  gap: 10px;
  margin-top: 17px;
}

.sim-chip {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border-radius: 12px;
  background: #f6f8fc;
}

.sim-chip i {
  color: var(--primary);
}

.sim-chip span,
.sim-chip strong {
  display: block;
}

.sim-chip span {
  color: var(--muted);
  font-size: 9px;
}

.sim-chip strong {
  font-size: 11px;
}

.gateway-card-footer {
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.gateway-card-footer span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-bottom: 4px;
}

.gateway-card-footer code {
  color: #475569;
  font-size: 10px;
}

@media (max-width: 1100px) {
  .gateway-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .gateway-grid {
    padding: 14px;
  }

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

  .gateway-stats > div {
    border-bottom: 1px solid var(--border);
  }

  .gateway-sims {
    flex-direction: column;
  }
}

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

.queue-stat {
  min-height: 115px;
  padding: 22px;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--border);
}

.queue-stat span,
.queue-stat strong {
  display: block;
}

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

.queue-stat strong {
  margin-top: 4px;
  font-size: 27px;
}

.queue-stat > i {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}

.queue-stat-success > i {
  color: #16a34a;
  background: #eaf8ef;
}

.queue-stat-warning > i {
  color: #d97706;
  background: #fff5dd;
}

.queue-stat-blue > i {
  color: #2563eb;
  background: #e8efff;
}

.queue-stat-danger > i {
  color: #dc2626;
  background: #feecec;
}

.outgoing-filter {
  display: grid;
  grid-template-columns:
    150px
    150px
    170px
    220px
    minmax(220px, 1fr)
    auto;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  align-items: end;
}

.outgoing-filter label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.filter-actions {
  display: flex;
  gap: 7px;
}

.outgoing-table {
  min-width: 1200px;
}

.outgoing-message {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.outgoing-table code {
  color: #475569;
  font-size: 10px;
}

.app-modal {
  border: 0;
  border-radius: 20px;
  overflow: hidden;
}

.app-modal .modal-header {
  padding: 20px 22px;
  border-bottom-color: var(--border);
}

.app-modal .modal-header h5 {
  margin: 0;
  font-weight: 800;
}

.app-modal .modal-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.app-modal .modal-body {
  padding: 22px;
}

.app-modal .modal-footer {
  padding: 16px 22px;
  border-top-color: var(--border);
}

.sms-counter {
  margin-top: 6px;
  text-align: right;
  color: var(--muted);
  font-size: 10px;
}

.sms-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sms-detail-grid > div,
.sms-detail-block {
  padding: 15px;
  border-radius: 12px;
  background: #f7f9fc;
}

.sms-detail-grid span,
.sms-detail-block > span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 5px;
}

.sms-detail-grid strong {
  font-size: 13px;
}

.sms-detail-block {
  margin-top: 13px;
}

.sms-detail-block pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 12px;
  color: #475569;
}

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

@media (max-width: 768px) {
  .outgoing-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .outgoing-filter {
    grid-template-columns: 1fr;
    padding: 15px;
  }

  .filter-actions {
    width: 100%;
  }

  .filter-actions .btn {
    flex: 1;
  }

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

@media (max-width: 480px) {
  .outgoing-summary {
    grid-template-columns: 1fr;
  }
}
