.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 36px;
  padding: 0 var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;

  transition: filter var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              background-color var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease),
              color var(--dur-base) var(--ease);
}

.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.btn-primary {
  background: var(--accent-grad);
  color: var(--on-accent);
  border-color: transparent;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); filter: none; }

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

.btn-sm {
  height: 30px;
  padding: 0 var(--sp-3);
  font-size: var(--fs-xs);
}

.btn-blok {
  width: 100%;
}

.btn-icon-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease);
}
.btn-icon-sm:hover { color: var(--text); background: var(--surface-2); }

.card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
}

.card-klik {
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.card-klik:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.card-title {
  font-size: var(--fs-body);
  font-weight: var(--fw-bold);
  margin-bottom: 3px;
}

.card-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.card-metrik {
  background: var(--surface-1);
  border: none;
  border-radius: var(--r-md);
  padding: var(--sp-4);
}
.card-metrik .label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-1);
}
.card-metrik .nilai {
  font-size: var(--fs-title);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}

.grid-metrik {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3);
}

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  padding: var(--sp-2) var(--sp-3);
  text-align: left;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.data-table tbody td {
  padding: 11px var(--sp-3);
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tbody tr:hover td {
  background: var(--surface-2);
}

.data-table .kol-angka,
.data-table th.kol-angka {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.data-table .kol-penanda,
.data-table th.kol-penanda {
  text-align: center;
}

@media (max-width: 640px) {
  .tabel-kartu thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .tabel-kartu,
  .tabel-kartu tbody,
  .tabel-kartu tr,
  .tabel-kartu td {
    display: block;
    width: 100%;
  }

  .tabel-kartu tr {
    position: relative;
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-4);
    margin-bottom: var(--sp-3);
  }

  .tabel-kartu tbody tr:hover td { background: transparent; }

  .tabel-kartu td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-2) 0;
    border: none;
    border-top: 1px solid var(--line);
    text-align: left;
  }

  .tabel-kartu td::before {
    content: attr(data-label);
    flex: none;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
  }

  .tabel-kartu td.kol-judul {
    display: block;
    padding: 0 var(--sp-8) var(--sp-1) 0;
    border-top: none;
    font-size: var(--fs-body);
    font-weight: var(--fw-bold);
  }
  .tabel-kartu td.kol-judul::before { content: none; }

  .tabel-kartu td.kol-sub {
    display: block;
    padding: 0 0 var(--sp-2);
    border-top: none;
    font-size: var(--fs-xs);
    color: var(--text-muted);
  }
  .tabel-kartu td.kol-sub::before { content: none; }

  .tabel-kartu td.kol-penanda {
    position: absolute;
    top: var(--sp-4);
    right: var(--sp-4);
    display: block;
    width: auto;
    padding: 0;
    border-top: none;
    text-align: right;
  }
  .tabel-kartu td.kol-penanda::before { content: none; }

  .tabel-kartu td.kol-angka {
    text-align: right;
    font-weight: var(--fw-semibold);
    font-variant-numeric: tabular-nums;
  }

  .tabel-kartu td.kol-sembunyi-hp { display: none; }

  .tabel-kartu tr.grand-row,
  .tabel-kartu tr.pivot-subtotal-row {
    border-color: var(--line-strong);
  }

  .tabel-kartu tr.baris-kosong {
    background: none;
    border: none;
    padding: 0;
  }
  .tabel-kartu tr.baris-kosong td {
    display: block;
    border: none;
    text-align: center;
  }
  .tabel-kartu tr.baris-kosong td::before {
    content: none;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 3px 9px;
  border-radius: var(--r-xs);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-muted);
}

.badge-aman     { background: var(--success-soft); color: var(--success); }
.badge-perhatian{ background: var(--warning-soft); color: var(--warning); }
.badge-bahaya   { background: var(--danger-soft);  color: var(--danger); }
.badge-info     { background: var(--info-soft);    color: var(--info); }
.badge-netral   { background: var(--surface-2);    color: var(--text-muted); }

.titik-status {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  flex: none;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field-label,
.lbl {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
}

.inp,
.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  height: 36px;
  padding: 0 var(--sp-3);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-body);
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              background-color var(--dur-base) var(--ease),
              color var(--dur-base) var(--ease);
}

.field-group textarea {
  height: auto;
  min-height: 88px;
  padding: var(--sp-3);
  resize: vertical;
  line-height: 1.5;
}

.inp::placeholder,
.field-group input::placeholder,
.field-group textarea::placeholder {
  color: var(--text-muted);
}

.inp:focus,
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.inp:disabled,
.field-group input:disabled,
.field-group select:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.inp-uang {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
}

.select-wrap {
  position: relative;
  display: block;
}
.select-wrap select {
  width: 100%;
  height: 36px;
  padding: 0 var(--sp-8) 0 var(--sp-3);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-body);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
}
.select-wrap::after {
  content: '';
  position: absolute;
  top: 50%;
  right: var(--sp-3);
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.modal-latar {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: rgba(0,0,0,.45);
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - var(--sp-8));
  overflow-y: auto;
  padding: var(--sp-6);
  background: var(--surface-solid);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}

.modal-judul {
  font-size: var(--fs-title);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-3);
}

.modal-isi {
  font-size: var(--fs-body);
  color: var(--text-2);
}

.modal-aksi {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-6);
}

@media (max-width: 640px) {
  .modal { max-width: none; }
  .modal-aksi .btn { flex: 1; }
}

.v7-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: none;
  border-radius: var(--r-md);
  background: none;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}

.v7-nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.v7-nav-item[aria-current="page"],
.v7-nav-item.aktif,
.v7-nav-item.active {
  background: var(--accent-soft);
  color: var(--text);
}

.btn-kembali {
  display: none;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) 2px;
  border: 0;
  background: none;
  color: inherit;
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  opacity: .6;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.btn-kembali:hover,
.btn-kembali:active { opacity: 1; }

@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  .btn-kembali { display: inline-flex; }
}

.split-view {
  display: grid;
  grid-template-columns: minmax(300px, 340px) 1fr;
  gap: var(--sp-4);
  align-items: start;
}

@media (max-width: 1024px) {
  .split-view { grid-template-columns: minmax(260px, 300px) 1fr; }
}

@media (max-width: 640px) {
  .split-view { grid-template-columns: 1fr; }
}

.ti {
  font-size: 1.25em;
  line-height: 1;
  color: currentColor;
  flex: none;
}

.hidden { display: none !important; }

.num {
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
}

.teks-redup { color: var(--text-muted); }
.teks-bahaya { color: var(--danger); }

.kaca-buram {
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.teks-aman { color: var(--success); }

.tt { position: relative; cursor: default; }
.tt::after {
  content: attr(data-tt);
  position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translate(-50%, 4px);
  background: var(--surface-solid); color: var(--text);
  padding: 9px 12px; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: var(--fw-normal);
  line-height: 1.55; white-space: normal; width: max-content; max-width: 260px; text-align: left;
  box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; pointer-events: none; z-index: 80;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility var(--dur-fast);
}
.tt::before {
  content: ''; position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, 4px);
  border: 5px solid transparent; border-top-color: var(--surface-solid); margin-bottom: -1px;
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 81;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility var(--dur-fast);
}
.tt:hover::after, .tt:hover::before, .tt:focus-visible::after, .tt:focus-visible::before { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.tt-bawah::after { bottom: auto; top: calc(100% + 9px); }
.tt-bawah::before { bottom: auto; top: 100%; margin-bottom: 0; margin-top: -1px; border-top-color: transparent; border-bottom-color: var(--surface-solid); }

@media (max-width: 640px) {
  .tabel-form-kartu-wrap { overflow-x: visible; }

  .tabel-form-kartu {
    min-width: 0 !important;
  }

  .tabel-form-kartu thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .tabel-form-kartu,
  .tabel-form-kartu tbody,
  .tabel-form-kartu tr,
  .tabel-form-kartu td {
    display: block !important;
    width: 100% !important;
  }

  .tabel-form-kartu tr {
    position: relative;
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-4);
    padding-right: var(--sp-10);
    margin-bottom: var(--sp-3);
  }

  .tabel-form-kartu td {
    padding: var(--sp-2) 0 !important;
    border: none !important;
    text-align: left !important;
  }

  .tabel-form-kartu td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: var(--sp-1);
  }

  .tabel-form-kartu select,
  .tabel-form-kartu input {
    width: 100%;
  }

  .tabel-form-kartu td.kol-aksi-kartu {
    position: absolute;
    top: var(--sp-4);
    right: var(--sp-4);
    width: auto !important;
    padding: 0 !important;
  }
}
