:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #eef2f6;
  --text: #172033;
  --muted: #6b7280;
  --border: #d8dee7;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --sidebar: #111827;
  --sidebar-soft: #1f2937;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: var(--primary);
}

a:hover {
  color: var(--primary-dark);
  text-decoration: none;
}

.ctnav {
  min-height: 64px;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#pageMessages {
  left: 50%;
  top: 12px;
  width: min(560px, calc(100% - 32px));
  z-index: 1040;
  position: fixed;
  text-align: center;
  transform: translateX(-50%);
}

#sidebar-wrapper {
  color: #f8fafc;
  background: var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

#sidebar-wrapper .sidebar-heading {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
}

.sidebar-logo img {
  width: 148px;
  max-height: 72px;
  object-fit: contain;
}

#sidebar-wrapper .brand-link,
#sidebar-wrapper .list-group-item {
  color: #9aa4b2;
  background: transparent;
  border: 0;
}

#sidebar-wrapper .brand-link {
  display: block;
  padding: 0.85rem 1.25rem;
  font-weight: 700;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#sidebar-wrapper .list-group {
  padding: 0.5rem 0;
}

#sidebar-wrapper .list-group-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.15rem 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

#sidebar-wrapper .list-group-item:hover,
#sidebar-wrapper .list-group-item:focus {
  color: #ffffff;
  background: var(--sidebar-soft);
}

#sidebar-wrapper .list-group-item.active {
  color: #ffffff;
  font-weight: 600;
  background: rgba(37, 99, 235, 0.16);
  box-shadow: inset 3px 0 0 var(--primary);
}

#sidebar-wrapper .list-group-item .nav-ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 1.75;
  opacity: 0.85;
}

#sidebar-wrapper .list-group-item:hover .nav-ico,
#sidebar-wrapper .list-group-item:focus .nav-ico,
#sidebar-wrapper .list-group-item.active .nav-ico {
  opacity: 1;
}

.nav-ico {
  width: 18px;
  height: 18px;
  vertical-align: -0.18em;
}

#page-content-wrapper {
  background: var(--bg);
}

.container-fluid,
main[role="main"] {
  max-width: 1180px;
  margin-right: auto;
  margin-left: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text);
  letter-spacing: 0;
}

.card,
.ctcard {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.card-header,
.card-header-warning {
  color: var(--text);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.card-header h2,
.card-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.card-body {
  color: var(--text);
}

.ctinput label,
.form-label,
label {
  color: var(--muted);
  font-weight: 600;
}

.ctinput input,
.ctinput select,
.ctinput textarea,
.form-control {
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: none;
}

.ctinput input:focus,
.ctinput select:focus,
.ctinput textarea:focus,
.form-control:focus {
  color: var(--text);
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.14);
}

.btn {
  border-radius: 8px;
  font-weight: 700;
}

.btn-primary,
.btn-info {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover,
.btn-info:hover {
  color: #ffffff;
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-danger {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

.btn-success {
  color: #ffffff;
  background: var(--success);
  border-color: var(--success);
}

.table {
  color: var(--text);
  background: var(--surface);
}

.table thead th {
  color: var(--muted) !important;
  font-size: 0.78rem;
  text-transform: uppercase;
  border-top: 0;
  border-bottom: 1px solid var(--border);
}

.table td,
.table th {
  vertical-align: middle;
  border-top: 1px solid var(--border);
}

.table-striped tbody tr:nth-of-type(odd) {
  background: #f8fafc;
}

.table-sm th,
.table-sm td {
  padding: 0.7rem 0.9rem;
  white-space: nowrap;
}

.table-sm td:last-child {
  display: inline-flex;
  gap: 0.5rem;
}

.modal-content {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

.alert {
  border-radius: 8px;
  border-width: 1px;
}

.ctmain-table {
  margin-top: 1rem;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  padding: 1rem 0;
}

.grid-item {
  padding: 0.75rem;
  text-align: center;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.grid-item img {
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.image-text {
  margin-top: 0.5rem;
  color: var(--muted);
  font-weight: 700;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg);
}

.login-card {
  width: min(100%, 380px);
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.10);
}

.login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
  font-weight: 800;
}

.login-card p {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.login-card .form-control {
  height: 48px;
}

.login-footer {
  margin-top: 1.25rem;
  text-align: center;
}

.login-footer a {
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 767px) {
  .ctnav {
    padding: 0.65rem 0.85rem;
  }

  .container-fluid,
  main[role="main"] {
    padding-right: 1rem !important;
    padding-left: 1rem !important;
  }

  .card-body {
    padding: 1rem;
  }

  .table-responsive {
    border: 0;
  }
}
