/* Progressive-enhancement UI used by admin.js. All selectors are prefixed so
   the downloaded prototype keeps its original layout and visual language. */
.tp-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.tp-loading {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 35, 74, 0.14);
  backdrop-filter: blur(1px);
}

.tp-loading[hidden] {
  display: none;
}

.tp-loading__panel {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
  padding: 12px 16px;
  border: 1px solid #e4e9f2;
  border-radius: 12px;
  background: #fff;
  color: #1c2b4a;
  box-shadow: 0 12px 32px rgba(20, 40, 90, 0.16);
  font-size: 12px;
  font-weight: 700;
}

.tp-spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid #dce7fc;
  border-top-color: #2f6ae6;
  border-radius: 50%;
  animation: tp-spin 0.72s linear infinite;
}

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

.tp-toast-region {
  position: fixed;
  z-index: 110;
  top: 76px;
  right: 18px;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.tp-toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid #e4e9f2;
  border-left: 3px solid #2f6ae6;
  border-radius: 10px;
  background: #fff;
  color: #1c2b4a;
  box-shadow: 0 10px 28px rgba(20, 40, 90, 0.15);
  font-size: 12px;
  line-height: 1.55;
  pointer-events: auto;
  animation: tp-toast-in 0.2s ease-out;
}

.tp-toast--success { border-left-color: #22a558; }
.tp-toast--warning { border-left-color: #f5a623; }
.tp-toast--error { border-left-color: #e5484d; }
.tp-toast__body { flex: 1; min-width: 0; }
.tp-toast__title { display: block; margin-bottom: 1px; font-weight: 800; }
.tp-toast__close {
  border: 0;
  background: transparent;
  color: #64708c;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

@keyframes tp-toast-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.tp-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(18, 35, 74, 0.48);
}

.tp-modal-backdrop[hidden] {
  display: none;
}

.tp-modal {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid #e4e9f2;
  border-radius: 14px;
  background: #fff;
  color: #1c2b4a;
  box-shadow: 0 22px 64px rgba(18, 35, 74, 0.28);
}

.tp-modal__header,
.tp-modal__footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
}

.tp-modal__header {
  border-bottom: 1px solid #eef2f8;
}

.tp-modal__title {
  flex: 1;
  font-size: 15px;
  font-weight: 900;
}

.tp-modal__close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #f1f4fa;
  color: #64708c;
  cursor: pointer;
}

.tp-modal__body {
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  padding: 18px;
  font-size: 12px;
  line-height: 1.7;
}

.tp-modal__footer {
  justify-content: flex-end;
  border-top: 1px solid #eef2f8;
}

.tp-btn {
  min-height: 34px;
  padding: 7px 14px;
  border: 0;
  border-radius: 8px;
  background: #f1f4fa;
  color: #64708c;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.tp-btn--primary { background: #2f6ae6; color: #fff; }
.tp-btn--danger { background: #e5484d; color: #fff; }
.tp-btn:focus-visible,
.tp-modal__close:focus-visible,
.tp-toast__close:focus-visible,
.nav-item:focus-visible {
  outline: 2px solid #6fa0ff;
  outline-offset: 2px;
}

.tp-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.tp-detail-item {
  padding: 9px 11px;
  border: 1px solid #eef2f8;
  border-radius: 8px;
  background: #fafbfe;
}

.tp-detail-label {
  display: block;
  margin-bottom: 2px;
  color: #64708c;
  font-size: 10px;
}

.tp-detail-value {
  color: #1c2b4a;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.tp-field {
  width: 100%;
  min-height: 76px;
  margin-top: 8px;
  padding: 9px 11px;
  resize: vertical;
  border: 1px solid #e4e9f2;
  border-radius: 8px;
  color: #1c2b4a;
  font: inherit;
  font-size: 12px;
}

.tp-field:focus {
  border-color: #2f6ae6;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(47, 106, 230, 0.10);
}

.tp-notification-list {
  display: grid;
  gap: 8px;
}

.tp-notification {
  padding: 10px 12px;
  border: 1px solid #eef2f8;
  border-radius: 9px;
  background: #fafbfe;
}

.tp-api-state {
  transition: color 0.2s ease;
}

@media (max-width: 640px) {
  .tp-detail-grid { grid-template-columns: 1fr; }
  .tp-toast-region { top: 68px; right: 10px; width: calc(100vw - 20px); }
  .tp-modal-backdrop { padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .tp-spinner,
  .tp-toast { animation: none; }
}

@media print {
  @page { size: A4 landscape; margin: 12mm; }

  body.tp-printing {
    background: #fff !important;
    color: #1c2b4a !important;
  }

  body.tp-printing aside,
  body.tp-printing header,
  body.tp-printing button,
  body.tp-printing [role="button"],
  body.tp-printing #tp-loading,
  body.tp-printing #tp-toast-region,
  body.tp-printing #tp-modal-backdrop {
    display: none !important;
  }

  body.tp-printing .ml-60 {
    margin-left: 0 !important;
  }

  body.tp-printing main {
    padding: 0 !important;
  }

  body.tp-printing .page-section {
    display: none !important;
  }

  body.tp-printing .page-section.active {
    display: block !important;
    animation: none !important;
  }

  body.tp-printing .page-section.active::before {
    display: block;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #d9e0ec;
    content: attr(data-tp-print-title);
    font-size: 18px;
    font-weight: 900;
  }

  body.tp-printing .card,
  body.tp-printing table,
  body.tp-printing tr {
    break-inside: avoid;
    box-shadow: none !important;
  }
}
