:root {
  --bg: #f4f9fd;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --soft: #eaf4fb;
  --line: #dbe8f2;
  --brand: #1ea4de;
  --brand-dark: #177fbf;
  --ok: #16a34a;
  --warn: #b45309;
  --danger: #dc2626;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 280px 1fr auto;
  align-items: center;
  gap: 20px;
  min-height: 96px;
  padding: 10px clamp(16px, 4vw, 54px);
  background: rgba(244, 249, 253, 0.93);
  border-bottom: 1px solid rgba(219, 232, 242, 0.9);
  backdrop-filter: blur(10px);
  transition: min-height 0.18s ease, box-shadow 0.18s ease;
}

.topbar.shrink {
  min-height: 72px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.brand {
  display: inline-flex;
  min-width: 0;
}

.brand img {
  width: min(250px, 100%);
  display: block;
}

.nav {
  display: flex;
  justify-content: center;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.nav a:hover {
  color: var(--brand-dark);
}

.top-action,
.btn,
.search button,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}

.top-action {
  padding: 0 16px;
  background: #0f172a;
  color: #fff;
}

main {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: clamp(20px, 4vw, 46px);
  align-items: end;
  min-height: calc(100svh - 116px);
  padding: clamp(34px, 6vh, 72px) 0 24px;
}

.hero-copy {
  padding: clamp(28px, 5vw, 46px);
  border-radius: 24px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  box-shadow: 0 20px 52px rgba(23, 127, 191, 0.24);
}

.eyebrow {
  margin: 0 0 10px;
  color: #075985;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow,
.admin-hero .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 0.96;
  letter-spacing: 0;
}

.lead {
  max-width: 650px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 18px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.btn {
  border: 0;
  padding: 0 16px;
}

.btn.primary {
  background: #0f172a;
  color: #fff;
}

.btn.secondary {
  background: #fff;
  color: #075985;
  border: 1px solid var(--line);
}

.search,
.request-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

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

.search label:first-child,
.search button {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 112px;
  padding-top: 12px;
  resize: vertical;
}

.search button {
  border: 0;
  background: var(--text);
  color: #fff;
}

.quick-cats {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 0 22px;
}

.cat-chip,
.ghost-btn {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0 14px;
}

.cat-chip {
  min-height: 42px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}

.cat-chip.active,
.ghost-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.section {
  padding: 42px 0;
}

.band {
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}

.section-head h2,
.split h2,
.portal h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.06;
}

.tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.worker-card,
.portal-grid article,
.ops-card,
.metric-card,
.request-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}

.worker-card {
  overflow: hidden;
}

.thumb-wrap {
  position: relative;
  height: 154px;
  background: var(--soft);
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.93);
  color: #94a3b8;
  cursor: pointer;
}

.fav-btn.active {
  color: var(--danger);
}

.thumb-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #334155;
  font-size: 11px;
  font-weight: 800;
}

.worker-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.worker-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.worker-title h3,
.portal-grid h3,
.ops-card h3 {
  margin: 0;
  font-size: 18px;
}

.status {
  flex: 0 0 auto;
  align-self: start;
  padding: 5px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 12px;
  font-weight: 900;
}

.worker-body p,
.split p,
.portal p,
.admin-hero p,
.portal-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.worker-body p {
  min-height: 66px;
  font-size: 14px;
}

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

.facts span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-actions a,
.card-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.wa-link {
  background: #dff8e9;
  color: #075e2d;
}

.call-link {
  background: #edf3f8;
  color: #203040;
}

.split {
  display: grid;
  grid-template-columns: 1fr minmax(340px, 440px);
  gap: 28px;
  align-items: start;
}

.flow-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.flow-list div,
.queue-item,
.alert-item {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.flow-list span,
.queue-item small {
  color: var(--muted);
}

.portal {
  display: grid;
  gap: 18px;
  padding: 32px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--line);
}

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

.portal-grid article {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.portal-grid span {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-hero {
  padding: 22px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  box-shadow: 0 18px 40px rgba(23, 127, 191, 0.2);
}

.admin-hero h3 {
  margin: 0 0 8px;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.08;
}

.admin-hero p {
  color: rgba(255, 255, 255, 0.9);
}

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

.metric-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 34px;
  line-height: 1;
}

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

.ops-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.queue-item em {
  justify-self: start;
  padding: 5px 8px;
  border-radius: 999px;
  background: #fff7ed;
  color: var(--warn);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

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

.module-list span {
  padding: 8px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 900;
}

.empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 22px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #fff;
  color: #64748b;
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, background 0.18s ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
  background: rgba(2, 6, 23, 0.58);
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(2, 6, 23, 0.35);
}

.modal-card img {
  width: 100%;
  height: 260px;
  display: block;
  object-fit: cover;
  background: var(--soft);
}

.modal-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.94);
  font-weight: 900;
  cursor: pointer;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 13px;
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 220px 1fr auto;
  }

  .hero,
  .split {
    grid-template-columns: 1fr;
    min-height: auto;
  }

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

  .ops-grid,
  .portal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
    min-height: 0;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .top-action {
    width: 100%;
  }

  main,
  footer {
    width: min(100% - 24px, 1160px);
  }

  .hero-copy {
    padding: 22px;
  }

  .hero h1 {
    font-size: 42px;
  }

  .search,
  .worker-grid,
  .metrics,
  .card-actions {
    grid-template-columns: 1fr;
  }

  .search label:first-child,
  .search button {
    grid-column: auto;
  }

  .section-head,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal {
    padding: 20px;
  }
}
