@font-face {
  font-family: "Nikosh";
  src: local("Nikosh"), url("/Nikosh.ttf?v=2") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #18231f;
  --muted: #7b8588;
  --line: #e3eaeb;
  --surface: #ffffff;
  --band: #f2fffb;
  --soft: #effaf6;
  --accent: #0b9b72;
  --accent-strong: #087a5c;
  --warn: #8a3a12;
  --danger: #b42318;
  --danger-strong: #8f1d14;
  --bangla-font: "Kalpurush", "Nikosh", "Noto Sans Bengali", "Nirmala UI", "SolaimanLipi", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--bangla-font);
  color: var(--ink);
  background: var(--band);
  font-size: 18px;
}

body,
button,
input,
select,
textarea {
  font-family: var(--bangla-font) !important;
}

.shell {
  width: 100%;
  margin: 0 auto;
  padding: 0 0 64px;
}

.hero {
  min-height: 216px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 22px min(7vw, 72px) 96px;
  border-bottom-left-radius: 40px;
  border-bottom-right-radius: 40px;
  color: #fff;
  background: linear-gradient(180deg, #077a5e 0%, #0b805f 100%);
  box-shadow: 0 28px 70px rgba(5, 103, 78, 0.16);
  position: relative;
  text-align: center;
}

.eyebrow {
  margin: 0 0 4px;
  color: #fff;
  font-size: 32px;
  font-weight: 700;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: 0;
  font-weight: 400;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 22px;
  width: min(1024px, calc(100% - 32px));
  margin: -64px auto 0;
  padding: 34px 34px 92px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 44px rgba(38, 60, 54, 0.18);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 2;
}

label {
  display: grid;
  gap: 0;
  min-width: 0;
  position: relative;
}

label span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

select,
input {
  width: 100%;
  min-height: 50px;
  padding: 11px 18px;
  border: 1px solid #e7edf0;
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  font: inherit;
  box-shadow: 0 3px 8px rgba(16, 33, 29, 0.03);
}

select:focus,
input:focus {
  outline: none;
  border-color: rgba(11, 155, 114, 0.55);
  box-shadow: 0 0 0 4px rgba(11, 155, 114, 0.10);
}

select:disabled {
  color: #a8b4b8;
  background: rgba(255, 255, 255, 0.48);
}

.location-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(25, 50, 44, 0.2);
}

.location-menu[hidden] {
  display: none;
}

.location-option {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  text-align: left;
  color: var(--ink);
  background: transparent;
}

.location-option:hover,
.location-option:focus {
  background: var(--soft);
}

.location-option strong,
.location-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.wide {
  grid-column: span 3;
}

.actions,
.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(1024px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0;
}

.actions {
  justify-content: flex-end;
  margin-top: -82px;
  margin-bottom: 34px;
  padding-right: 34px;
  position: relative;
  z-index: 3;
}

.status-row {
  margin-bottom: 18px;
}

button {
  min-height: 50px;
  padding: 10px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  border-color: #9eb2ab;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
  min-width: 216px;
  box-shadow: 0 10px 22px rgba(11, 155, 114, 0.22);
}

.primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.danger {
  border-color: rgba(180, 35, 24, 0.28);
  color: #fff;
  background: var(--danger);
  min-width: 132px;
}

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

.icon-button {
  position: absolute;
  right: min(7vw, 72px);
  top: 70px;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 24px;
  color: var(--accent-strong);
  background: #fff;
}

#status {
  margin: 0;
  color: var(--muted);
}

.busy-indicator {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 3px solid rgba(11, 155, 114, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

#status.error {
  color: var(--warn);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Results section wrapper */
.results {
  width: min(1024px, calc(100% - 32px));
  margin: 14px auto 0;
}

/* 2-column card grid */
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.vcard {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}

.vcard:hover {
  border-color: var(--accent);
}

.vcard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px 10px;
  gap: 10px;
}

.vcard-info {
  flex: 1;
  min-width: 0;
}

.vcard-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 8px;
}

.vcard-name {
  flex: 1;
  min-width: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.copy-result-btn {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  flex: 0 0 auto;
  border-color: #cfe0dc;
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--soft);
  font-size: 20px;
  line-height: 1;
}

.copy-result-btn:hover {
  border-color: var(--accent);
  background: #fff;
}

.vcard-meta-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.vmeta-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 15px;
}

.vmeta-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.vmeta-lbl {
  color: var(--muted);
  flex-shrink: 0;
}

.vmeta-val {
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.sl-val {
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
}

.gender-badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 500;
  margin-top: 2px;
}

.badge-blue    { background: #e6f1fb; color: #185fa5; border: 1px solid #85b7eb; }
.badge-pink    { background: #fbeaf0; color: #993556; border: 1px solid #ed93b1; }
.badge-neutral { background: var(--soft); color: var(--accent-strong); border: 1px solid #b8d2ca; }
.badge-hijra   { background: #faeeda; color: #854f0b; border: 1px solid #ef9f27; }

.vcard-photo { flex-shrink: 0; }

.photo-box {
  width: 60px;
  height: 70px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--band);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.vcard-extra {
  border-top: 1px solid var(--line);
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.xrow {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 14px;
}

.xlbl {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
  min-width: 72px;
}

.xval {
  color: var(--ink);
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.vno {
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.vcard-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 12px;
  border-top: 1px solid var(--line);
  background: var(--band);
}

.loc-pill {
  font-size: 12px;
  padding: 3px 9px;
  border: 1px solid #c6ddd8;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--surface);
  white-space: nowrap;
}

.empty-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(1024px, calc(100% - 32px));
  margin: 16px auto 0;
  padding: 12px 0;
}

.pager span {
  color: var(--muted);
  font-size: 16px;
}

.pager button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.result-tools {
  display: grid;
  grid-template-columns: auto minmax(220px, 520px) auto;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(1024px, calc(100% - 32px));
  margin: 14px auto;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.strict-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}

.strict-toggle span {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.hero-strict {
  padding: 4px;
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.strict-toggle.hero-strict input {
  width: 15px;
  height: 15px;
}

.strict-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.result-tools[hidden] {
  display: none;
}

.result-tools input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
}

.search-input-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.search-input-wrap input[type="search"] {
  width: 100%;
  padding-right: 42px;
}

.search-input-wrap input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

.input-clear {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 30px;
  height: 30px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: #e6eeec;
  color: #344b47;
  font: 700 22px/30px system-ui, sans-serif;
  cursor: pointer;
}

.input-clear[hidden] {
  display: none;
}

.result-tools span {
  color: var(--muted);
  white-space: nowrap;
}

.empty-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .shell {
    padding-top: 0;
  }

  .hero {
    min-height: 180px;
    padding-bottom: 80px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: -54px;
    padding: 18px 12px 126px;
  }

  .wide {
    grid-column: span 1;
  }

  .toolbar select,
  .toolbar input {
    min-width: 0;
    min-height: 46px;
    padding: 9px 10px;
    border-radius: 9px;
    font-size: 15px;
  }

  .toolbar .search-input-wrap input[type="search"] {
    padding-right: 34px;
  }

  .toolbar .input-clear {
    right: 3px;
    width: 27px;
    height: 27px;
    font-size: 19px;
    line-height: 27px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: -112px;
    padding: 0 18px;
  }

  .primary {
    min-width: 0;
  }

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

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

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    background: #fff;
    font-size: 10pt;
  }

  .hero,
  .toolbar,
  .actions,
  .icon-button,
  .status-row,
  .result-tools,
  .pager,
  .copy-result-btn {
    display: none;
  }

  .shell {
    width: 100%;
    padding: 0;
  }

  .results {
    width: 100%;
    margin: 0;
  }

  .result-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 4mm;
    align-items: start;
  }

  .vcard {
    width: auto;
    min-width: 0;
    break-inside: avoid-page;
    page-break-inside: avoid;
    border: 0.35mm solid #a9c8c1;
    border-radius: 2.5mm;
    box-shadow: none;
  }

  .vcard-header {
    padding: 3mm 3.5mm 2mm;
    gap: 2mm;
  }

  .vcard-name {
    font-size: 13pt;
  }

  .vmeta-row,
  .xrow {
    font-size: 9pt;
    line-height: 1.25;
  }

  .vcard-extra {
    padding: 2mm 3.5mm;
  }

  .vcard-pills {
    gap: 1mm;
    padding: 2mm 3.5mm;
  }

  .loc-pill,
  .gender-badge {
    font-size: 8pt;
  }

  .vcard-photo {
    display: none;
  }
}
