:root {
  --app-bg: #f4f7fb;
  --sidebar-bg: #111827;
  --sidebar-muted: #9ca3af;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --primary-soft: #e6fffb;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #15803d;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --radius: 8px;
}

html {
  font-size: 14px;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--app-bg);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

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

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

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

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  width: 280px;
  padding: 18px 16px;
  overflow-y: auto;
  background: var(--sidebar-bg);
  color: #fff;
  transition: transform 0.2s ease;
}

.sidebar-brand {
  padding: 4px 4px 22px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.brand-link:hover {
  color: #fff;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-link strong,
.brand-link small {
  display: block;
  line-height: 1.25;
}

.brand-link small {
  margin-top: 3px;
  color: var(--sidebar-muted);
  font-size: 0.78rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 18px;
}

.sidebar-section {
  margin: 18px 10px 8px;
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: #d1d5db;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: #fff;
  background: rgba(20, 184, 166, 0.14);
}

.sidebar-link.active {
  box-shadow: inset 3px 0 0 #14b8a6;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #a7f3d0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
}

.app-main {
  display: flex;
  flex-direction: column;
  width: calc(100% - 280px);
  min-height: 100vh;
  margin-left: 280px;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 14px 28px;
  background: rgba(244, 247, 251, 0.88);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  backdrop-filter: blur(14px);
}

.page-heading {
  min-width: 0;
}

.page-heading span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 2px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.topbar-actions {
  margin-left: auto;
}

.topbar-actions .navbar-nav {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.topbar-actions .nav-link,
.topbar-actions .btn-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text) !important;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 700;
  text-decoration: none;
}

.topbar-actions .btn-link:hover,
.topbar-actions .nav-link:hover {
  color: var(--primary) !important;
}

.sidebar-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--text);
}

.content-wrapper {
  flex: 1;
  padding: 28px;
}

.content-panel {
  min-height: 420px;
}

.content-panel > h1:first-child {
  display: none;
}

.content-panel > h4 {
  margin: 0 0 18px;
  font-size: 1.1rem;
  font-weight: 800;
}

.content-panel > p:first-of-type {
  margin-bottom: 16px;
}

.content-panel > p > a[asp-action],
.content-panel > p > a,
a[asp-action="Create"],
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

.btn-primary:hover,
.content-panel > p > a:hover,
a[asp-action="Create"]:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

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

.btn-info {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

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

.row:has(form) {
  margin: 0;
}

.row:has(form) > [class*="col-"] {
  width: 100%;
  max-width: 920px;
  padding: 0;
}

.content-panel form,
.modal form {
  max-width: 920px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 16px;
}

.control-label,
.content-panel form label,
.modal form label {
  margin-bottom: 7px;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 800;
}

.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  color: var(--text);
  background-color: #fff;
  box-shadow: none;
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14);
}

.form-check {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px 10px 34px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.text-danger,
.field-validation-error {
  display: block;
  margin-top: 6px;
  color: var(--danger) !important;
  font-size: 0.82rem;
  font-weight: 700;
}

hr {
  border-color: var(--border);
  opacity: 1;
}

.table,
.CustomColorTable {
  width: 100% !important;
  margin: 0 !important;
  border: 0 !important;
  color: var(--text);
}

.table-responsive,
.dataTables_wrapper {
  width: 100%;
}

.dataTables_wrapper,
.panel-hash,
.content-panel > table,
.content-panel > .table {
  padding: 18px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

table.dataTable thead th,
.table thead th,
.CustomColorTable thead th {
  position: relative;
  padding: 13px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: #334155;
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

table.dataTable tbody td,
.table tbody td,
.CustomColorTable tbody td {
  padding: 13px 12px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
  color: #334155;
}

table.dataTable tbody tr:hover,
.table tbody tr:hover {
  background: #f8fafc;
}

.table a:not(.btn),
table.dataTable a:not(.btn) {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 2px;
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
}

.table a:not(.btn):hover,
table.dataTable a:not(.btn):hover {
  background: var(--primary-soft);
  border-color: #99f6e4;
  color: var(--primary-dark);
}

.dataTables_length,
.dataTables_filter,
.dataTables_info,
.dataTables_paginate {
  color: var(--muted) !important;
  font-size: 0.86rem;
  font-weight: 700;
}

.dataTables_length select,
.dataTables_filter input,
.column-filter {
  min-height: 36px;
  margin: 0 6px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
}

.column-filter {
  width: 100%;
  min-width: 110px;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  min-width: 34px;
  margin: 0 2px;
  padding: 6px 10px !important;
  border: 1px solid var(--border) !important;
  border-radius: 7px !important;
  background: #fff !important;
  color: var(--text) !important;
  font-weight: 800;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

.panel-heading,
.panel-body {
  padding: 0 !important;
}

.panel-heading .row {
  align-items: center;
  margin-bottom: 16px;
}

.app-footer {
  padding: 16px 28px 24px;
  color: var(--muted);
  font-size: 0.84rem;
}

.border-top,
.border-bottom {
  border-color: var(--border) !important;
}

.box-shadow {
  box-shadow: var(--shadow);
}

.sidebar-backdrop {
  display: none;
}

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

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

  body.sidebar-open .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1030;
    display: block;
    background: rgba(15, 23, 42, 0.42);
  }

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

  .sidebar-toggle {
    display: inline-block;
  }

  .content-wrapper,
  .app-topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 575.98px) {
  .app-topbar {
    flex-wrap: wrap;
  }

  .topbar-actions {
    width: 100%;
    margin-left: 0;
  }

  .topbar-actions .navbar-nav {
    justify-content: space-between;
    width: 100%;
  }

  .content-wrapper {
    padding: 16px;
  }

  form,
  .dataTables_wrapper,
  .panel-hash,
  .content-panel > table,
  .content-panel > .table {
    padding: 14px;
  }
}
