.history-save-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 28px;
  align-items: center;
  margin: 28px 0 6px;
  padding: 22px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.96), rgba(240, 253, 250, 0.82));
}

.history-save-panel strong { color: #0f513f; font-size: 1.05rem; }
.history-save-panel p { margin: 6px 0 0; color: #607089; line-height: 1.55; }
.history-save-actions { display: flex; gap: 10px; align-items: center; }
.history-save-message { grid-column: 1 / -1; min-height: 1.4em; margin: -4px 0 0 !important; font-weight: 650; }
.history-save-message:empty { display: none; }
.history-save-message.is-success { color: #087a55; }
.history-save-message.is-error { color: #b42318; }

.history-page { background: #f3f7fb; color: #17233a; min-height: 100vh; }
.history-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 52px 0 96px; }
.history-hero { display: flex; justify-content: space-between; gap: 28px; align-items: end; margin-bottom: 30px; }
.history-eyebrow { margin: 0 0 10px; color: #0f766e; font-size: .82rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.history-hero h1 { margin: 0; font-size: clamp(2.1rem, 5vw, 4.2rem); line-height: 1.02; letter-spacing: -.045em; }
.history-hero p:not(.history-eyebrow) { max-width: 670px; margin: 14px 0 0; color: #64748b; font-size: 1.05rem; line-height: 1.65; }
.history-toolbar, .history-card, .history-detail-card, .history-empty, .history-error {
  border: 1px solid #d8e3ec; border-radius: 24px; background: #fff; box-shadow: 0 16px 42px rgba(23, 50, 45, .07);
}
.history-toolbar { display: grid; grid-template-columns: minmax(240px, 1.6fr) repeat(3, minmax(150px, .7fr)); gap: 12px; padding: 16px; margin-bottom: 22px; }
.history-control { width: 100%; min-width: 0; min-height: 48px; padding: 0 14px; border: 1px solid #cfdae4; border-radius: 14px; background: #fff; color: #17233a; font: inherit; box-sizing: border-box; }
.history-control:focus { outline: 3px solid rgba(15, 118, 110, .15); border-color: #0f766e; }
.history-select { position: relative; min-width: 0; }
.history-native-select { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.history-select-trigger {
  width: 100%; min-width: 0; min-height: 48px; padding: 0 14px 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid #cfdae4; border-radius: 14px; color: #26364d;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,250,.94));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 4px 12px rgba(23,50,45,.035);
  text-align: left; font: inherit; font-weight: 650; cursor: pointer;
  transition: border-color 220ms ease, box-shadow 220ms ease, background-color 220ms ease;
}
.history-select-trigger > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-select-trigger:hover { border-color: #9fcfc2; background: #f8fffc; }
.history-select-trigger:focus-visible { outline: 3px solid rgba(15,118,110,.16); outline-offset: 2px; border-color: #0f766e; }
.history-select-chevron { width: 9px; height: 9px; flex: 0 0 auto; border-right: 2px solid #397165; border-bottom: 2px solid #397165; transform: translateY(-2px) rotate(45deg); transition: transform 260ms cubic-bezier(.22,1,.36,1); }
.history-select.is-open .history-select-trigger { border-color: #70b8a5; box-shadow: 0 0 0 4px rgba(15,118,110,.1), 0 12px 28px rgba(23,50,45,.08); }
.history-select.is-open .history-select-chevron { transform: translateY(2px) rotate(225deg); }
.history-select-menu {
  position: absolute; z-index: 80; top: calc(100% + 8px); right: 0; left: 0;
  max-height: 280px; padding: 7px; overflow-y: auto;
  border: 1px solid rgba(190,215,207,.9); border-radius: 17px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 20px 48px rgba(20,56,47,.16), inset 0 1px 0 #fff;
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
}
.history-select-menu[hidden] { display: none; }
.history-select-option {
  width: 100%; min-height: 42px; padding: 8px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 0; border-radius: 11px; color: #334155; background: transparent;
  text-align: left; font: inherit; font-weight: 600; cursor: pointer;
}
.history-select-option:hover, .history-select-option:focus-visible { outline: 0; color: #075e4c; background: #edf9f5; }
.history-select-option[aria-selected="true"] { color: #075e4c; background: linear-gradient(135deg, #e6f7f2, #f1fbf8); font-weight: 800; }
.history-select-check { color: #0f8a70; opacity: 0; font-weight: 900; }
.history-select-option[aria-selected="true"] .history-select-check { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .history-select-trigger, .history-select-chevron { transition: none; }
}
.history-feedback { min-height: 1.4em; margin: -8px 0 16px; color: #087a55; font-weight: 700; }
.history-feedback:empty { display: none; }
.history-list { display: grid; gap: 14px; }
.history-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px; align-items: center; padding: 22px; }
.history-card-top { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.history-badge { display: inline-flex; align-items: center; min-height: 30px; padding: 0 11px; border-radius: 999px; background: #e6f7f2; color: #08705c; font-size: .78rem; font-weight: 800; }
.history-badge.is-document { background: #e8f0ff; color: #1858a8; }
.history-card h2 { margin: 0; font-size: 1.2rem; line-height: 1.35; }
.history-card-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 9px; color: #64748b; font-size: .92rem; }
.history-card-actions { display: flex; gap: 9px; }
.history-button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid #cddae4; border-radius: 13px; background: #fff; color: #0d6458; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
.history-button:hover { background: #eefbf7; border-color: #9dcfc1; }
.history-button.is-danger { color: #b42318; }
.history-button.is-primary { color: #fff; border-color: #0f766e; background: #0f766e; }
.history-load-more { display: flex; justify-content: center; margin-top: 22px; }
.history-empty, .history-error { padding: 52px 24px; text-align: center; }
.history-empty h2, .history-error h2 { margin: 0 0 8px; }
.history-empty p, .history-error p { margin: 0 0 22px; color: #64748b; }
.history-detail-card { padding: clamp(22px, 4vw, 44px); }
.history-detail-head { display: flex; justify-content: space-between; gap: 24px; align-items: start; padding-bottom: 26px; border-bottom: 1px solid #dde6ed; }
.history-detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.history-print-brand { display: none; }
.history-list-print-sheet { display: none; }
.history-detail-head h1 { margin: 8px 0; font-size: clamp(1.8rem, 4vw, 3.2rem); line-height: 1.08; }
.history-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 26px; }
.history-detail-section { min-width: 0; padding: 20px; border-radius: 18px; background: #f6faf9; }
.history-detail-section.is-wide { grid-column: 1 / -1; }
.history-detail-section h2 { margin: 0 0 14px; font-size: 1rem; color: #0f675b; }
.history-definition { display: grid; gap: 12px; margin: 0; }
.history-definition div { display: grid; grid-template-columns: minmax(120px, .45fr) minmax(0, 1fr); gap: 18px; }
.history-definition dt { color: #64748b; }
.history-definition dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.history-reasons { margin: 0; padding-left: 20px; line-height: 1.65; }
.history-modal[hidden] { display: none; }
.history-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(12, 24, 22, .55); }
.history-modal-card { width: min(480px, 100%); padding: 26px; border-radius: 24px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.22); }
.history-modal-card h2 { margin: 0 0 10px; }
.history-modal-card p { color: #64748b; line-height: 1.6; }
.history-modal-actions { display: flex; justify-content: end; gap: 10px; margin-top: 22px; }

@media (max-width: 820px) {
  .history-save-panel, .history-card { grid-template-columns: 1fr; }
  .history-save-actions, .history-card-actions { flex-wrap: wrap; }
  .history-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-toolbar input { grid-column: 1 / -1; }
  .history-detail-grid { grid-template-columns: 1fr; }
  .history-detail-section.is-wide { grid-column: auto; }
}

@media (max-width: 520px) {
  .history-shell { width: min(100% - 24px, 1180px); padding-top: 34px; }
  .history-hero { display: block; }
  .history-hero .history-button { margin-top: 18px; }
  .history-toolbar { grid-template-columns: 1fr; }
  .history-toolbar input { grid-column: auto; }
  .history-card-actions, .history-save-actions, .history-modal-actions { display: grid; grid-template-columns: 1fr; }
  .history-button, .history-save-actions .button { width: 100%; box-sizing: border-box; }
  .history-detail-head { display: block; }
  .history-detail-actions { display: grid; grid-template-columns: 1fr; margin-top: 18px; }
  .history-definition div { grid-template-columns: 1fr; gap: 4px; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  *, *::before, *::after { box-shadow: none !important; text-shadow: none !important; }
  html, body, .history-page { min-height: auto; background: #fff !important; color: #111827; }
  .no-print, .app-navigation-header, .app-mobile-navigation, .mobile-bottom-nav, .site-footer, footer, .history-save-panel { display: none !important; }
  .history-shell { width: 100%; margin: 0; padding: 0; }
  .history-detail-card { padding: 0; border: 0; border-radius: 0; background: #fff; }
  .history-print-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 2px solid #0f766e; }
  .history-print-brand img { width: 38px; height: 38px; }
  .history-print-brand strong, .history-print-brand span { display: block; }
  .history-print-brand strong { color: #0f513f; font-size: 1rem; }
  .history-print-brand span { margin-top: 2px; color: #64748b; font-size: .72rem; }
  .history-detail-head { padding-bottom: 16px; break-after: avoid; }
  .history-detail-head h1 { font-size: 24pt; }
  .history-detail-grid { gap: 10px; margin-top: 16px; }
  .history-detail-section { padding: 14px; border: 1px solid #dce7e3; border-radius: 10px; background: #f8fbfa !important; break-inside: avoid; }
  .history-definition { gap: 7px; }
  .history-definition div { gap: 12px; }
  .history-badge { min-height: 24px; padding-inline: 8px; border: 1px solid #b9ded3; background: #edf9f5 !important; color: #075e4c; }
  .history-badge.is-document { border-color: #c8d8f2; background: #eef4ff !important; color: #174f96; }
  .history-reasons { line-height: 1.5; }
  a[href]::after { content: none !important; }

  body.history-list-printing > * { display: none !important; }
  body.history-list-printing > .history-list-print-sheet {
    display: block !important;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  body.history-list-printing .history-print-brand { display: flex; }
}

.location-automatic-note {
  margin: 14px 0 0;
  padding: 11px 14px;
  border-radius: 12px;
  background: #e8f7f2;
  color: #0b6759;
  font-size: .88rem;
  font-weight: 650;
  line-height: 1.5;
}
/* Tabel overlay pada snapshot Tata Ruang mengikuti permukaan riwayat yang sama. */
.history-spatial-table{max-width:100%;margin:18px 0;overflow:auto;border:1px solid #dce7e5;border-radius:16px}.history-spatial-table table{width:100%;border-collapse:collapse}.history-spatial-table th,.history-spatial-table td{padding:12px 14px;border-bottom:1px solid #e5eceb;text-align:left}.history-spatial-table th{background:#edf7f4;color:#31534d;font-size:.78rem;text-transform:uppercase}
