:root,
body[data-brand="ocean"] {
  --bg: #f3f7fb;
  --bg-accent: #e8f2ff;
  --panel: #ffffff;
  --panel-soft: #f7fbff;
  --text: #17324d;
  --text-muted: #59728a;
  --border: #d8e7f5;
  --primary: #0e7490;
  --primary-2: #0284c7;
  --primary-soft: #e0f2fe;
  --success: #15803d;
  --danger: #b42318;
  --shadow: 0 12px 30px rgba(15, 40, 70, 0.09);
  --radius: 16px;
  --tech-grid: rgba(10, 88, 132, 0.08);
  --tech-line: rgba(6, 102, 151, 0.18);
  --tech-glow: rgba(2, 132, 199, 0.3);
}

/* Alternative brand palette: set data-brand="forest" on <body> to use */
body[data-brand="forest"] {
  --bg: #f4f9f4;
  --bg-accent: #e6f5e8;
  --panel: #ffffff;
  --panel-soft: #f4fcf6;
  --text: #1e3a2f;
  --text-muted: #5c7468;
  --border: #d6eadc;
  --primary: #0f766e;
  --primary-2: #16a34a;
  --primary-soft: #e1f8ea;
  --success: #166534;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Be Vietnam Pro", "Manrope", sans-serif;
  color: var(--text);
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 39px,
      var(--tech-grid) 40px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 39px,
      var(--tech-grid) 40px
    ),
    radial-gradient(circle at 2% 0%, #d6eaff 0%, transparent 42%),
    radial-gradient(circle at 95% 3%, #d4f5f7 0%, transparent 34%),
    linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 48%, #f8fbff 100%);
  position: relative;
  isolation: isolate;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  filter: blur(16px);
}

body::before {
  width: 320px;
  height: 320px;
  right: -90px;
  top: 18%;
  background: radial-gradient(circle, rgba(14, 116, 144, 0.18) 0%, rgba(14, 116, 144, 0) 68%);
}

body::after {
  width: 280px;
  height: 280px;
  left: -80px;
  bottom: 12%;
  background: radial-gradient(circle, rgba(2, 132, 199, 0.2) 0%, rgba(2, 132, 199, 0) 70%);
}

body.home-legacy-bg {
  background:
    linear-gradient(rgba(7, 23, 41, 0.38), rgba(7, 23, 41, 0.38)),
    url("../images/Searchs_002.jpg") center center / cover no-repeat fixed;
}

body.home-legacy-bg::before,
body.home-legacy-bg::after {
  display: none;
}

a {
  color: inherit;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: 28px 0 22px;
  position: relative;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero::before {
  background:
    linear-gradient(120deg, transparent 0 12%, var(--tech-line) 12% 12.2%, transparent 12.2% 25%, var(--tech-line) 25% 25.15%, transparent 25.15% 100%),
    linear-gradient(300deg, transparent 0 18%, var(--tech-line) 18% 18.2%, transparent 18.2% 100%);
  opacity: 0.35;
}

.hero::after {
  background:
    radial-gradient(circle at 18% 22%, var(--tech-glow) 0 3px, transparent 4px),
    radial-gradient(circle at 72% 35%, var(--tech-glow) 0 3px, transparent 4px),
    radial-gradient(circle at 84% 68%, var(--tech-glow) 0 2px, transparent 3px);
  opacity: 0.75;
}

.content-wrap {
  padding-bottom: 22px;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #0f2a44;
  background: linear-gradient(135deg, #0f2a44, #0a5c7d 65%, #0284c7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.meta,
.muted,
.stat-label {
  color: var(--text-muted);
}

.card {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(247, 252, 255, 0.96)),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  transform-origin: center;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(2, 132, 199, 0.08), transparent 34%),
    linear-gradient(0deg, rgba(2, 132, 199, 0.06), transparent 36%);
  opacity: 0.55;
}

.card::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border-top: 1px solid #9ed1f5;
  border-right: 1px solid #9ed1f5;
  opacity: 0.7;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-4px) scale(1.015) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  box-shadow: 0 24px 46px rgba(12, 42, 72, 0.16);
  border-color: #b9d8f3;
}

.row,
.filters,
.search-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 860px) {
  .search-grid,
  .filters {
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
  }

  .row.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.pill {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pill::placeholder {
  color: #86a1b9;
}

.pill:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.12);
}

select.pill {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg fill='%23546f86' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.23 7.21a.75.75 0 011.06.02L10 10.06l3.71-2.83a.75.75 0 111.06 1.06l-4.24 3.24a.75.75 0 01-.92 0L5.21 8.29a.75.75 0 01.02-1.08z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 15px;
  background-position: right 12px center;
}

.btn,
.link-primary,
button.btn,
button.link-primary {
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 700;
  padding: 11px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: transform 0.15s ease, filter 0.15s ease;
  box-shadow: 0 8px 18px rgba(2, 132, 199, 0.22);
}

.btn:hover,
.link-primary:hover,
button.btn:hover,
button.link-primary:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.btn:active,
.link-primary:active,
button.btn:active,
button.link-primary:active {
  transform: translateY(0);
}

.link,
.btn-outline,
.btn-small {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  text-decoration: none;
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  transition: border-color 0.16s ease, color 0.16s ease, background-color 0.16s ease;
}

.btn-small {
  padding: 8px 11px;
  border-radius: 10px;
  cursor: pointer;
}

.link:hover,
.btn-outline:hover,
.btn-small:hover {
  border-color: #c4d9ee;
  background: #f7fbff;
}

.btn-small:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-del {
  background: #fff1f1;
  border-color: #f6d0d0;
  color: var(--danger);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 0 10px;
}

.links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 10px 0 14px;
}

.stats .card {
  position: relative;
  overflow: hidden;
}

.stats .card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0e7490, #0284c7);
}

.stats .card:nth-child(2)::before {
  background: linear-gradient(90deg, #0f766e, #16a34a);
}

.stats .card:nth-child(3)::before {
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
}

@media (min-width: 860px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-num {
  font-size: 1.35rem;
  font-weight: 800;
  color: #083154;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  background: linear-gradient(180deg, #ebf5ff, #e2f1ff);
  color: #1d4464;
  text-align: left;
  padding: 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid #ecf2f8;
  vertical-align: top;
}

tbody tr:hover {
  background: #f8fcff;
}

.name {
  font-weight: 700;
}

.badge,
.badge-soft {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid #b4dcff;
  background: linear-gradient(145deg, #e6f5ff, #dbf0ff);
  color: #0a5a7b;
  font-size: 0.86rem;
  padding: 4px 10px;
  font-weight: 600;
}

.actions,
.actions-row,
.pagination {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination {
  margin-top: 14px;
}

.page-link {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  background: #fff;
  color: var(--text);
}

.page-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: #fff;
}

.page-link:hover {
  border-color: #bfd6eb;
  background: #f5faff;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 860px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sec-title {
  margin: 10px 0 12px;
  font-size: 1.2rem;
  color: #113656;
  position: relative;
  padding-left: 14px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-size: 1.02rem;
}

.sec-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(145deg, #0e7490, #0284c7);
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.16);
}

.suggest-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.suggest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

@media (min-width: 860px) {
  .suggest-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.suggest-card {
  background: linear-gradient(160deg, #f7fcff, #f2f9ff);
  border: 1px solid #cfe4f8;
  border-radius: 14px;
  padding: 14px;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  position: relative;
  overflow: hidden;
}

.suggest-card:nth-child(odd) {
  background: linear-gradient(160deg, #f3fbff, #eefdff);
}

.suggest-card:hover {
  transform: translateY(-5px) scale(1.02) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  box-shadow: 0 20px 36px rgba(4, 85, 126, 0.16);
  border-color: #a9d7f6;
  background: linear-gradient(160deg, #f8fdff, #ecf8ff);
}

.suggest-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #4aa9df, transparent);
  opacity: 0.8;
}

.suggest-card h4 {
  margin: 0 0 8px;
  color: #0f3f66;
  font-size: 1.02rem;
}

.suggest-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.56;
}

.suggest-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

pre.suggest {
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.62;
}

.skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, #ecf4fc 25%, #f7fbff 37%, #ecf4fc 63%);
  background-size: 400% 100%;
  animation: loading 1.4s ease infinite;
}

.s-line {
  height: 12px;
  margin: 10px 0;
}

@keyframes loading {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.footer,
.footer-note {
  color: var(--text-muted);
  text-align: center;
  padding: 24px 12px 28px;
}

.error,
.flash {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.error,
.flash.error {
  background: #fff1f1;
  border: 1px solid #f6d0d0;
  color: #8f1f1f;
}

.flash.success {
  background: #ecfdf3;
  border: 1px solid #b8efcc;
  color: #166534;
}

.flash.info {
  background: #eef6ff;
  border: 1px solid #d8e7f5;
  color: #204a73;
}

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

.login-form {
  width: min(460px, 100%);
}

.login-form h2 {
  margin-top: 0;
  margin-bottom: 18px;
  color: #123557;
}

.login-form .btn {
  width: 100%;
}

.input-group {
  margin-bottom: 12px;
}

.input-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-weight: 600;
}

.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 34px 0;
}

.landing-panel {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 85% -15%, rgba(2, 132, 199, 0.14), transparent 42%),
    radial-gradient(circle at -5% 105%, rgba(14, 116, 144, 0.12), transparent 36%),
    rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 56px rgba(16, 48, 80, 0.15);
  backdrop-filter: blur(6px);
  padding: clamp(20px, 4vw, 34px);
  position: relative;
}

.landing-panel::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(55, 120, 168, 0.25);
  border-radius: 16px;
  pointer-events: none;
}

.landing-title {
  margin: 0;
  color: #0d395f;
  font-weight: 800;
  font-size: clamp(1.3rem, 2.9vw, 2.2rem);
}

.landing-subtitle {
  margin: 10px 0 18px;
  color: var(--text-muted);
  line-height: 1.6;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(160deg, #ffffff, #eef8ff);
  border: 1px solid #cfe6fb;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  color: #0e4876;
  margin-bottom: 12px;
  box-shadow: 0 8px 18px rgba(2, 132, 199, 0.12);
  position: relative;
}

.brand-pill::after {
  content: "LAB";
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 999px;
  background: #dff2ff;
  color: #0b5f84;
}

.corner-note {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.search-grid.card,
.filters,
.stats .card {
  animation: fade-up 0.55s ease both;
}

.grid .card.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: reveal-card 0.45s ease forwards;
}

@keyframes reveal-card {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .table-wrap {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0;
  }

  .table-wrap table.admin-table {
    min-width: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .table-wrap table.admin-table thead {
    display: none;
  }

  .table-wrap table.admin-table tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
    padding: 6px 0;
  }

  .table-wrap table.admin-table tbody td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border: 0;
    border-bottom: 1px dashed #e5edf6;
    padding: 10px 12px;
    min-height: 44px;
  }

  .table-wrap table.admin-table tbody td:last-child {
    border-bottom: 0;
    padding-top: 12px;
  }

  .table-wrap table.admin-table tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.86rem;
    flex: 0 0 42%;
  }

  .table-wrap table.admin-table tbody td > * {
    margin-left: auto;
  }

  .table-wrap table.admin-table tbody td[colspan] {
    display: block;
    text-align: left;
  }

  .table-wrap table.admin-table tbody td[colspan]::before {
    content: none;
  }

  .table-wrap table.admin-table .actions-row,
  .table-wrap table.admin-table .actions {
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
