:root {
  --ux-ring: rgba(18, 76, 47, 0.18);
  --ux-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  --ux-shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.06);
  --ux-border-soft: #e2e8f0;
  --ux-text-soft: #64748b;
  --ux-surface-soft: #f8fafc;
}

html { scroll-behavior: smooth; }
body.ux-enhanced {
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.ux-enhanced * { box-sizing: border-box; }
body.ux-enhanced img { max-width: 100%; }
body.ux-enhanced button,
body.ux-enhanced .btn,
body.ux-enhanced a.btn,
body.ux-enhanced input,
body.ux-enhanced select,
body.ux-enhanced textarea {
  font-family: inherit;
}
body.ux-enhanced button,
body.ux-enhanced .btn,
body.ux-enhanced a.btn {
  min-height: 44px;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease, background .18s ease;
}
body.ux-enhanced button:hover,
body.ux-enhanced .btn:hover,
body.ux-enhanced a.btn:hover {
  transform: translateY(-1px);
}
body.ux-enhanced button:disabled,
body.ux-enhanced .btn:disabled,
body.ux-enhanced input:disabled,
body.ux-enhanced select:disabled,
body.ux-enhanced textarea:disabled {
  cursor: not-allowed;
  opacity: .68;
}
body.ux-enhanced input,
body.ux-enhanced select,
body.ux-enhanced textarea {
  min-height: 46px;
}
body.ux-enhanced input:focus,
body.ux-enhanced select:focus,
body.ux-enhanced textarea:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--ux-ring);
}
body.ux-enhanced .header,
body.ux-enhanced .login-box,
body.ux-enhanced .card,
body.ux-enhanced .hero,
body.ux-enhanced .banner,
body.ux-enhanced .view-section {
  box-shadow: var(--ux-shadow-soft);
}
body.ux-enhanced .table-wrap,
body.ux-enhanced .gs-table-wrap,
body.ux-enhanced #result-wrapper {
  -webkit-overflow-scrolling: touch;
}
body.ux-enhanced .table-wrap::after,
body.ux-enhanced .gs-table-wrap::after {
  content: '';
  display: block;
  height: 1px;
}
body.ux-enhanced .ux-inline-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ux-text-soft);
}
body.ux-enhanced .ux-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(10px);
  border: 1px solid var(--ux-border-soft);
  border-radius: 14px;
  box-shadow: var(--ux-shadow-soft);
}
body.ux-enhanced .ux-filter-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1 1 320px;
}
body.ux-enhanced .ux-filter-title {
  font-weight: 800;
  color: #0f172a;
}
body.ux-enhanced .ux-filter-input {
  flex: 1 1 240px;
  min-width: 220px;
  border-radius: 12px;
  border: 1px solid var(--ux-border-soft);
  background: #fff;
  padding: 12px 14px;
}
body.ux-enhanced .ux-filter-count {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--ux-surface-soft);
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--ux-border-soft);
}
body.ux-enhanced .ux-empty-results {
  display: none;
  margin-top: 14px;
  padding: 18px;
  border-radius: 14px;
  border: 1px dashed var(--ux-border-soft);
  background: #fff;
  color: var(--ux-text-soft);
  text-align: center;
  font-weight: 700;
}
body.ux-enhanced .ux-jump-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 8px;
}
body.ux-enhanced .ux-jump-btn {
  border: 1px solid var(--ux-border-soft);
  background: #fff;
  color: #0f172a;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}
body.ux-enhanced .ux-jump-btn.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}
body.ux-enhanced .ux-scroll-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: none;
  background: #0f172a;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: var(--ux-shadow);
  z-index: 1200;
  display: none;
}
body.ux-enhanced .ux-scroll-top.show { display: inline-flex; align-items: center; justify-content: center; }
body.ux-enhanced .ux-table-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--ux-text-soft);
  font-weight: 700;
}
body.ux-enhanced .ux-page-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid var(--ux-border-soft);
}

@media (max-width: 900px) {
  body.ux-enhanced .header,
  body.ux-enhanced .card,
  body.ux-enhanced .login-box,
  body.ux-enhanced .view-section { border-radius: 14px; }
  body.ux-enhanced .controls {
    flex-wrap: wrap !important;
    justify-content: stretch !important;
  }
  body.ux-enhanced .controls button,
  body.ux-enhanced .controls .btn,
  body.ux-enhanced .controls a,
  body.ux-enhanced .actions button,
  body.ux-enhanced .actions .btn,
  body.ux-enhanced .actions a,
  body.ux-enhanced .footer-actions .btn,
  body.ux-enhanced .footer-actions a {
    flex: 1 1 180px;
    min-width: 0;
    text-align: center;
    justify-content: center;
  }
  body.ux-enhanced .header,
  body.ux-enhanced .topbar,
  body.ux-enhanced .footer-actions,
  body.ux-enhanced .actions,
  body.ux-enhanced .chips {
    gap: 10px !important;
  }
  body.ux-enhanced .grid,
  body.ux-enhanced .tiles,
  body.ux-enhanced .stats {
    gap: 12px !important;
  }
}

@media (max-width: 820px) {
  body.ux-enhanced table.ux-card-table {
    min-width: 0 !important;
    width: 100%;
    background: transparent;
  }
  body.ux-enhanced table.ux-card-table thead {
    display: none;
  }
  body.ux-enhanced table.ux-card-table tbody,
  body.ux-enhanced table.ux-card-table tr,
  body.ux-enhanced table.ux-card-table td {
    display: block;
    width: 100%;
  }
  body.ux-enhanced table.ux-card-table tr {
    background: #fff;
    border: 1px solid var(--ux-border-soft);
    border-radius: 14px;
    margin: 0 0 12px;
    box-shadow: var(--ux-shadow-soft);
    overflow: hidden;
  }
  body.ux-enhanced table.ux-card-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 12px;
    border-top: 1px solid #f1f5f9;
    text-align: right !important;
    min-height: 0 !important;
  }
  body.ux-enhanced table.ux-card-table td:first-child {
    border-top: none;
  }
  body.ux-enhanced table.ux-card-table td::before {
    content: attr(data-label);
    text-align: left;
    font-weight: 800;
    color: #475569;
    flex: 0 0 42%;
    padding-right: 10px;
  }
  body.ux-enhanced table.ux-card-table td[colspan] {
    display: block;
    text-align: center !important;
  }
  body.ux-enhanced table.ux-card-table td[colspan]::before {
    display: none;
  }
}

@media (max-width: 640px) {
  body.ux-enhanced { padding: 14px !important; }
  body.ux-enhanced .hero {
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    padding: 44px 16px 60px !important;
  }
  body.ux-enhanced .hero h1 { font-size: 1.5rem !important; }
  body.ux-enhanced .hero img { width: 84px; height: 84px; }
  body.ux-enhanced .login-box,
  body.ux-enhanced .header,
  body.ux-enhanced .card,
  body.ux-enhanced .banner,
  body.ux-enhanced .view-section {
    padding: 16px !important;
  }
  body.ux-enhanced .ux-filter-bar {
    padding: 12px;
  }
  body.ux-enhanced .ux-filter-group {
    flex-direction: column;
    align-items: stretch;
  }
  body.ux-enhanced .ux-filter-input {
    min-width: 0;
    width: 100%;
  }
  body.ux-enhanced .nav-tabs {
    flex-wrap: wrap;
  }
  body.ux-enhanced .nav-tab {
    flex: 1 1 140px;
    text-align: center;
  }
  body.ux-enhanced #result-wrapper .controls {
    position: sticky;
    top: 0;
    border-radius: 14px;
  }
}


.ux-busy-overlay,
.kdis-busy-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.18);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  backdrop-filter: blur(2px);
}
.ux-busy-overlay.show,
.kdis-busy-overlay.show { display: flex; }
.ux-busy-card,
.kdis-busy-card {
  min-width: 220px;
  max-width: calc(100vw - 32px);
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  color: #0f172a;
}
.ux-busy-spinner,
.kdis-busy-spinner {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 3px solid rgba(15, 23, 42, 0.14);
  border-top-color: #0f766e;
  animation: uxspin .8s linear infinite;
  flex: 0 0 auto;
}
@keyframes uxspin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
body.ux-enhanced .ux-btn-loading,
.kdis-btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.85;
}
body.ux-enhanced .ux-btn-loading::after,
.kdis-btn-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: currentColor;
  display: inline-block;
  margin-left: 8px;
  animation: uxspin .8s linear infinite;
  vertical-align: middle;
}

/* ===== Safe free-plan upgrades ===== */
body.ux-enhanced .kdis-network-banner {
  position: sticky;
  top: 0;
  z-index: 1400;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  font-weight: 800;
  display: none;
}
body.ux-enhanced .kdis-network-banner.show { display: block; }
body.ux-enhanced .kdis-network-banner.ok {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}
body.ux-enhanced .kdis-cache-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--ux-border-soft);
  font-size: 12px;
  font-weight: 800;
  color: #334155;
}
body.ux-enhanced .kdis-cache-badge .kdis-cache-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #16a34a;
  display: inline-block;
}
body.ux-enhanced .kdis-cache-badge.offline .kdis-cache-dot { background: #d97706; }
body.ux-enhanced .kdis-small-btn,
body.ux-enhanced .kdis-toggle,
body.ux-enhanced .kdis-pill-btn {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--ux-border-soft);
  background: #fff;
  color: #0f172a;
  font-weight: 800;
  cursor: pointer;
}
body.ux-enhanced .kdis-toggle.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}
body.ux-enhanced .kdis-top-tools,
body.ux-enhanced .kdis-draft-tools,
body.ux-enhanced .kdis-quick-actions,
body.ux-enhanced .kdis-notice-center {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
body.ux-enhanced .kdis-top-tools {
  margin: 10px 0 0;
}
body.ux-enhanced .kdis-note-card,
body.ux-enhanced .kdis-notice-panel {
  margin: 14px 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--ux-border-soft);
  background: #fff;
  box-shadow: var(--ux-shadow-soft);
}
body.ux-enhanced .kdis-note-card strong,
body.ux-enhanced .kdis-notice-panel strong {
  display: block;
  margin-bottom: 6px;
  color: #0f172a;
}
body.ux-enhanced .kdis-note-card .sub,
body.ux-enhanced .kdis-notice-panel .sub {
  font-size: 12px;
  color: var(--ux-text-soft);
  line-height: 1.5;
}
body.ux-enhanced .kdis-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--ux-border-soft);
  background: #fff;
  color: #0f172a;
  text-decoration: none;
  font-weight: 800;
  box-shadow: var(--ux-shadow-soft);
}
body.ux-enhanced .kdis-action-chip .meta {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--ux-text-soft);
}
body.ux-enhanced .kdis-quick-wrap {
  margin: 0 0 16px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f8fafc, #ffffff);
  border: 1px solid var(--ux-border-soft);
  box-shadow: var(--ux-shadow-soft);
}
body.ux-enhanced .kdis-quick-wrap h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #0f172a;
}
body.ux-enhanced .kdis-quick-wrap p {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--ux-text-soft);
}
body.ux-enhanced .kdis-ann-new {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
body.ux-enhanced .kdis-lock-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #9f1239;
  font-size: 12px;
  font-weight: 800;
}
body.ux-enhanced .kdis-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 18px;
}
body.ux-enhanced .kdis-modal-backdrop.show { display: flex; }
body.ux-enhanced .kdis-modal {
  width: min(100%, 520px);
  background: #fff;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.24);
}
body.ux-enhanced .kdis-modal h3 {
  margin: 0 0 8px;
  color: #0f172a;
}
body.ux-enhanced .kdis-modal p {
  margin: 0 0 10px;
  color: #475569;
  line-height: 1.5;
}
body.ux-enhanced .kdis-modal .kdis-modal-summary {
  margin: 10px 0;
  padding: 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--ux-border-soft);
  font-size: 13px;
  color: #0f172a;
}
body.ux-enhanced .kdis-modal .kdis-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
body.ux-enhanced .kdis-modal .kdis-modal-actions button {
  flex: 1 1 140px;
}
body.ux-enhanced .kdis-modal .danger { background: #b91c1c; color: #fff; }
body.ux-enhanced .kdis-modal .archive { background: #0f766e; color: #fff; }
body.ux-enhanced .kdis-modal .secondary { background: #e2e8f0; color: #0f172a; }
body.ux-enhanced .kdis-sticky-save {
  position: sticky;
  top: 8px;
  z-index: 1100;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--ux-border-soft);
  box-shadow: var(--ux-shadow-soft);
}
body.ux-enhanced .kdis-sticky-save .status {
  font-size: 12px;
  color: var(--ux-text-soft);
  font-weight: 800;
}
body.ux-enhanced .kdis-end-save {
  margin: 22px 0 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--ux-border-soft);
  background: #fff;
  box-shadow: var(--ux-shadow-soft);
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
body.ux-enhanced .kdis-end-save .sub {
  font-size: 12px;
  color: var(--ux-text-soft);
  line-height: 1.5;
  margin-top: 4px;
}
body.kdis-low-data * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}
body.kdis-low-data img,
body.kdis-low-data .card-img,
body.kdis-low-data #childAvatarImg,
body.kdis-low-data .photo-frame,
body.kdis-low-data .sig-img,
body.kdis-low-data .stamp-img {
  display: none !important;
}
body.kdis-low-data .hero,
body.kdis-low-data .hero-section {
  background-image: none !important;
}
body.kdis-low-data .kdis-cache-badge::after {
  content: '';
  margin-left: 4px;
  color: #0f766e;
}
body.ux-enhanced .kdis-hidden-lite { display: none !important; }
@media (max-width: 820px) {
  body.ux-enhanced .kdis-cache-badge,
  body.ux-enhanced .kdis-top-tools,
  body.ux-enhanced .kdis-draft-tools,
  body.ux-enhanced .kdis-session-inline { width: 100%; }
}


body.ux-enhanced .kdis-parent-switch-card {
  margin: 0 0 16px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid #dbe7f3;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
}
body.ux-enhanced .kdis-parent-switch-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
body.ux-enhanced .kdis-parent-switch-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 12px;
  font-weight: 900;
}
body.ux-enhanced .kdis-parent-switch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
body.ux-enhanced .kdis-parent-switch-field label {
  display: block;
  margin-bottom: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
body.ux-enhanced .kdis-parent-switch-field input,
body.ux-enhanced .kdis-parent-switch-field select {
  width: 100%;
}
body.ux-enhanced .kdis-parent-switch-tip {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}
body.ux-enhanced .kdis-parent-switch-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
@media (max-width: 720px) {
  body.ux-enhanced .kdis-parent-switch-grid {
    grid-template-columns: 1fr;
  }
  body.ux-enhanced .kdis-parent-switch-actions .btn {
    width: 100%;
  }
}
