@font-face {
  font-family: 'Satoshi';
  src: url('/assets/fonts/Satoshi-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Satoshi';
  src: url('/assets/fonts/Satoshi-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Satoshi';
  src: url('/assets/fonts/Satoshi-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Satoshi';
  src: url('/assets/fonts/Satoshi-Black.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f4f0;
  --surface: #ffffff;
  --surface-soft: #faf8f5;
  --border: #e7e1d8;
  --border-strong: #d6cdc0;
  --ink: #1c1917;
  --ink-muted: #6b625a;
  --ink-subtle: #91867b;
  --crimson-dark: #6f0705;
  --crimson: #a8100d;
  --crimson-bright: #c81e1a;
  --amber: #e67e22;
  --gold: #fcd34d;
  --kelurahan-bg: #fef2f2;
  --kelurahan-ink: #b91c1c;
  --desa-bg: #f0fdf4;
  --desa-ink: #15803d;
  --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.06);
  --shadow-md: 0 8px 24px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 18px 42px rgba(28, 25, 23, 0.14);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* HERO */
.hero {
  position: relative;
  background: linear-gradient(125deg, #680604 0%, #a5110d 52%, #d96b17 100%);
  color: #ffffff;
  padding: 18px 0 34px;
  overflow: hidden;
  border-bottom: 3px solid rgba(252, 211, 77, 0.35);
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 96px 96px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  flex-shrink: 0;
}

.brand-badge svg {
  width: 24px;
  height: 24px;
}

.brand-sub {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255, 243, 209, 0.85);
}

.brand-title {
  margin: 1px 0 0;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 12.5px;
  color: #fff7e6;
}

.stats-pill .dot {
  opacity: 0.5;
}

.btn-outline-light {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.22);
}

.hero-copy {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 18px;
}

.hero-heading {
  margin: 0 0 6px;
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero-desc {
  margin: 0;
  font-size: 14.5px;
  color: rgba(255, 245, 232, 0.9);
}

/* SEARCH BOX */
.search-wrap {
  max-width: 780px;
  margin: 0 auto;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(56, 6, 4, 0.28);
  border: 2px solid transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--gold);
  box-shadow: 0 16px 40px rgba(56, 6, 4, 0.34), 0 0 0 4px rgba(252, 211, 77, 0.24);
}

.search-icon {
  position: absolute;
  left: 18px;
  color: var(--crimson);
  pointer-events: none;
}

.search-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 17px 78px 17px 52px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}

.search-input::placeholder {
  color: #9c9288;
  font-weight: 400;
}

.clear-btn {
  position: absolute;
  right: 46px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: #f1ece6;
  color: var(--ink-muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-btn:hover {
  background: #e5ddd3;
  color: var(--ink);
}

.kbd-hint {
  position: absolute;
  right: 14px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f3efe9;
  border: 1px solid #dfd7cd;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}

.quick-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.quick-label {
  font-size: 12px;
  color: rgba(255, 243, 209, 0.8);
  font-weight: 500;
}

.chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: translateY(-1px);
}

/* MAIN CONTENT */
.main-content {
  padding-top: 24px;
  padding-bottom: 48px;
}

/* KASI DIRECTORY STRIP */
.kasi-section {
  margin-bottom: 24px;
}

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

.section-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.section-hint {
  font-size: 12.5px;
  color: var(--ink-subtle);
}

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

.kasi-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.14s ease;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.kasi-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--seksi-color, var(--crimson));
}

.kasi-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kasi-card.active {
  border-color: var(--seksi-color, var(--crimson));
  background: #fffdfb;
  box-shadow: 0 0 0 3px rgba(168, 16, 13, 0.1), var(--shadow-md);
}

.avatar-wrap {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--seksi-color, var(--crimson));
  flex-shrink: 0;
  background: #8a0f0c;
  position: relative;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 24%;
  transform: scale(1.45);
  transform-origin: 50% 24%;
  display: block;
}

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

.kasi-seksi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}

.seksi-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: #ffffff;
  background: var(--seksi-color, var(--crimson));
}

.kasi-count {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-subtle);
}

.kasi-name {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.kasi-kec-list {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* TOOLBAR & FILTERS */
.toolbar-section {
  margin-bottom: 16px;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.seksi-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.tab-btn:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.tab-btn.active {
  background: var(--crimson);
  color: #ffffff;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-input {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: var(--crimson);
}

.view-toggle {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 2px;
}

.view-btn {
  padding: 5px 11px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.view-btn.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 0 2px;
}

.result-summary {
  font-size: 13.5px;
  color: var(--ink-muted);
}

.result-summary strong {
  color: var(--ink);
}

.btn-link {
  border: none;
  background: transparent;
  color: var(--crimson);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.duplicate-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 13.5px;
  font-weight: 500;
}

.duplicate-alert svg {
  flex-shrink: 0;
  color: #d97706;
}

/* RESULT CARDS */
.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.wilayah-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow 0.16s ease, border-color 0.16s ease, transform 0.14s ease;
}

.wilayah-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.wilayah-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wilayah-title-group {
  min-width: 0;
}

.wilayah-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.status-kelurahan {
  background: var(--kelurahan-bg);
  color: var(--kelurahan-ink);
}

.status-desa {
  background: var(--desa-bg);
  color: var(--desa-ink);
}

.dup-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
}

.wilayah-name {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.2;
}

.wilayah-kec {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--ink-muted);
  font-weight: 500;
}

.wilayah-no {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-subtle);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 8px;
  flex-shrink: 0;
}

.kasi-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--seksi-color, var(--crimson));
}

.kasi-strip-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar-btn {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.avatar-btn .avatar-wrap {
  width: 50px;
  height: 50px;
  transition: transform 0.15s ease;
}

.avatar-btn:hover .avatar-wrap {
  transform: scale(1.06);
}

.kasi-strip-text {
  min-width: 0;
}

.kasi-strip-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.kasi-strip-name {
  font-size: 15.5px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.25;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.copy-btn:hover {
  background: #f6f2ec;
  border-color: var(--crimson);
  color: var(--crimson);
}

/* HIGHLIGHT */
mark {
  background: #fef08a;
  color: #1c1917;
  padding: 0 2px;
  border-radius: 3px;
}

/* TABLE VIEW */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: #fdfbf8;
}

.table-kasi-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-kasi-cell .avatar-wrap {
  width: 34px;
  height: 34px;
  border-width: 1.5px;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.empty-state h4 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 900;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
}

/* FOOTER */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 0;
  color: var(--ink-muted);
  font-size: 12.5px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 13, 0.62);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
}

.modal-portrait {
  max-width: 440px;
}

.modal-editor {
  max-width: 560px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 900;
}

.modal-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.modal-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  background: var(--crimson);
  color: #ffffff;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}

.modal-close:hover {
  background: #efeae3;
  color: var(--ink);
}

.portrait-frame {
  padding: 16px 20px;
}

.portrait-frame img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

.modal-footer-note {
  padding: 0 20px 18px;
  font-size: 13px;
  color: var(--ink-muted);
  text-align: center;
}

.edit-kasi-form {
  padding: 16px 20px 20px;
}

.edit-kasi-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edit-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.edit-row label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-muted);
}

.edit-row input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.edit-row input:focus {
  outline: none;
  border-color: var(--crimson);
}

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

.btn-secondary {
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  padding: 9px 18px;
  border-radius: 10px;
  border: none;
  background: var(--crimson);
  color: #ffffff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--crimson-dark);
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1c1917;
  color: #ffffff;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

/* RESPONSIVE */
@media (max-width: 980px) {
  .kasi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
  .kasi-grid {
    grid-template-columns: 1fr;
  }
  .stats-pill {
    display: none;
  }
  .kasi-strip {
    flex-direction: column;
    align-items: stretch;
  }
  .copy-btn {
    justify-content: center;
  }
}
