﻿:root {
  --bg: #0f1324;
  --bg-soft: #17203a;
  --surface: #1e2a4a;
  --surface-2: #27365e;
  --text: #f3f6ff;
  --text-muted: #9fb0d8;
  --accent: #e94560;
  --gold: #f4a836;
  --teal: #00d4aa;
  --line: #32436e;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(233, 69, 96, 0.15), transparent 24%),
    radial-gradient(circle at 85% 8%, rgba(0, 212, 170, 0.12), transparent 22%),
    linear-gradient(160deg, #0c1222 0%, #141b31 45%, #0d1326 100%);
  color: var(--text);
  min-height: 100vh;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-card {
  width: min(440px, 100%);
  background: rgba(23, 32, 58, 0.86);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

.brand {
  font-size: 30px;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--gold);
}

.subtitle {
  margin: 0 0 24px;
  color: var(--text-muted);
}

.error {
  background: rgba(255, 107, 107, 0.16);
  border: 1px solid rgba(255, 107, 107, 0.55);
  color: #ffd6d6;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  background: #121a31;
  color: var(--text);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  outline: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.18);
}

.btn {
  background: linear-gradient(110deg, #d93557, #f05771);
  color: white;
  border: none;
  padding: 11px 15px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.07);
}

.btn.btn-muted {
  background: linear-gradient(110deg, #3e4f82, #566ba6);
}

.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(185deg, rgba(20, 31, 57, 0.98), rgba(14, 21, 42, 0.98));
  border-right: 1px solid var(--line);
  padding: 24px 16px;
}

.sidebar h2 {
  margin: 0 0 2px;
  font-size: 22px;
  color: var(--gold);
}

.sidebar p {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.nav-link {
  display: block;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(233, 69, 96, 0.15);
  border-color: rgba(233, 69, 96, 0.4);
}

.main {
  padding: 26px;
}

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

.topbar .meta {
  color: var(--text-muted);
  font-size: 13px;
}

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

.card {
  background: linear-gradient(180deg, rgba(35, 49, 86, 0.95), rgba(25, 35, 64, 0.95));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.card h4 {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.metric {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
}

.table-wrap {
  background: rgba(26, 37, 67, 0.95);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.table-title {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(50, 67, 110, 0.5);
  font-size: 14px;
}

th {
  color: var(--text-muted);
  font-weight: 600;
}

.badge {
  padding: 4px 9px;
  border-radius: 100px;
  font-size: 12px;
  border: 1px solid transparent;
}

.badge.pending {
  color: #fff2ce;
  border-color: #f7d275;
  background: rgba(244, 168, 54, 0.16);
}

.badge.approved {
  color: #d8fff2;
  border-color: #48dbb4;
  background: rgba(0, 212, 170, 0.15);
}

.badge.rejected {
  color: #ffd8d8;
  border-color: #ff8b8b;
  background: rgba(255, 107, 107, 0.15);
}

.badge.sent {
  color: #d8fff2;
  border-color: #48dbb4;
  background: rgba(0, 212, 170, 0.15);
}

.badge.failed {
  color: #ffd8d8;
  border-color: #ff8b8b;
  background: rgba(255, 107, 107, 0.15);
}

.badge.queued {
  color: #fff2ce;
  border-color: #f7d275;
  background: rgba(244, 168, 54, 0.16);
}

.badge.active {
  color: #d8fff2;
  border-color: #48dbb4;
  background: rgba(0, 212, 170, 0.15);
}

.badge.inactive {
  color: #ffe4e4;
  border-color: #ff9191;
  background: rgba(255, 107, 107, 0.15);
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

textarea.input {
  min-height: 120px;
  resize: vertical;
}

.notice {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 212, 170, 0.4);
  background: rgba(0, 212, 170, 0.12);
  color: #c7fff1;
  margin-bottom: 12px;
}

.filter-card {
  padding-bottom: 12px;
}

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

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

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.meta-row {
  margin: 8px 0 10px;
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 13px;
}

.pagination {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.bulk-card .filter-actions {
  justify-content: flex-start;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.check-all,
.row-check {
  width: 16px;
  height: 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 24, 0.74);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1000;
}

.modal-backdrop.open {
  display: flex;
}

.modal-panel {
  width: min(680px, 100%);
  background: linear-gradient(180deg, rgba(35, 49, 86, 0.98), rgba(25, 35, 64, 0.98));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(50, 67, 110, 0.6);
}

.modal-head h3 {
  margin: 0;
}

.modal-body {
  margin: 0;
  white-space: pre-wrap;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
  color: #cdd9ff;
  padding: 14px 16px 16px;
  max-height: 55vh;
  overflow: auto;
}

div.dataTables_wrapper div.dataTables_filter input,
div.dataTables_wrapper div.dataTables_length select {
  background: #121a31;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table.dataTable {
  border-collapse: collapse !important;
}

table.dataTable thead th,
table.dataTable thead td {
  border-bottom: 1px solid rgba(50, 67, 110, 0.5) !important;
}

div.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text) !important;
}

div.dataTables_wrapper .dataTables_length,
div.dataTables_wrapper .dataTables_filter,
div.dataTables_wrapper .dataTables_info,
div.dataTables_wrapper .dataTables_paginate {
  color: var(--text-muted) !important;
}

table.dataTable tbody td:first-child,
table.dataTable thead th:first-child {
  width: 36px;
}

.matrix-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(20, 30, 54, 0.8);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.matrix-table th,
.matrix-table td {
  border-bottom: 1px solid rgba(50, 67, 110, 0.5);
  padding: 10px 12px;
  vertical-align: middle;
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  background: rgba(24, 35, 63, 0.98);
  z-index: 1;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

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

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

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

@media (max-width: 620px) {
  .main {
    padding: 14px;
  }

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