/**
 * ═══════════════════════════════════════════════════════════════════
 * TRỢ LÝ Y KHOA — CSS MODULE (RESPONSIVE AUTO-ADAPT)
 * ═══════════════════════════════════════════════════════════════════
 * Path: assets/css/trolyykhoa-tlyk.css
 *
 * Triết lý:
 *   - Desktop: layout đẹp tự nhiên (rộng, 2 cột, action ngang...)
 *   - Mobile: AUTO chuyển sang touch-friendly (1 cột, button to, font 16px+)
 *   - Tablet: ở giữa
 *
 * Tối ưu mobile (không phải force):
 *   - Touch targets ≥ 48px (mobile)
 *   - Font 16px+ (chống iOS auto-zoom)
 *   - Camera capture support
 *   - Numeric keyboard cho PIN/SDT
 *   - Loading overlay cho pipeline lâu
 *
 * Namespace: .tlyk-*
 * Created: 26/04/2026
 * ═══════════════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════════════ */
/* RESET + BASE                                                          */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-app * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.tlyk-app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 12px;
  font-family: 'Be Vietnam Pro', 'Inter', -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #0F172A;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* HEADER (compact + tagline inline)                                     */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-header {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #E2E8F0;
}

.tlyk-header-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tlyk-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.tlyk-tagline {
  color: #64748B;
  font-size: 13px;
  font-weight: 400;
}

.tlyk-nav {
  display: flex;
  gap: 8px;
}

/* Nav buttons giờ dùng class hệ thống tm-btn (xem tm-buttons-v4.css) */

.tlyk-badge {
  background: #EAB308;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* TABS                                                                  */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-tab { display: none; }
.tlyk-tab.active { display: block; }

/* ═══════════════════════════════════════════════════════════════════ */
/* STEPS PROGRESS — ĐÃ ẨN (theo yêu cầu Bác)                             */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-steps { display: none; }

/* ═══════════════════════════════════════════════════════════════════ */
/* STEP PANELS (compact)                                                 */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-step-panel {
  display: none;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 16px 18px;
}

.tlyk-step-panel.active { display: block; }

.tlyk-step-panel h2 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 700;
}

.tlyk-hint {
  margin: 0 0 12px 0;
  color: #64748B;
  font-size: 13px;
  line-height: 1.5;
}

.tlyk-hint-small { font-size: 12px; color: #94A3B8; }

/* ═══════════════════════════════════════════════════════════════════ */
/* UPLOAD ZONE (compact cho laptop nhỏ)                                  */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-upload-zone {
  border: 2px dashed #CBD5E1;
  border-radius: 10px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  background: #F8FAFC;
  transition: all 0.15s;
}

.tlyk-upload-zone:hover { background: #F1F5F9; border-color: #94A3B8; }

.tlyk-upload-zone.dragover {
  border-color: #16A34A;
  background: #F0FDF4;
}

.tlyk-upload-prompt .ic {
  font-size: 32px;
  display: block;
  margin-bottom: 6px;
}

.tlyk-upload-prompt p {
  margin: 4px 0;
  color: #475569;
}

/* .tlyk-btn-camera: giờ dùng class tm-btn tm-btn-tinh tm-btn-s */
#tlyk-btn-camera {
  margin-top: 12px;
  display: none;        /* Hide by default — chỉ show trên mobile */
}

/* ═══════════════════════════════════════════════════════════════════ */
/* FILE LIST                                                             */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-file-list {
  margin-top: 16px;
}

.tlyk-file-list-header {
  margin-bottom: 8px;
  font-size: 14px;
}

.tlyk-file-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.tlyk-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
}

.tlyk-file-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.tlyk-file-name {
  font-weight: 500;
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tlyk-file-size {
  color: #64748B;
  font-size: 12px;
  flex-shrink: 0;
}

.tlyk-file-pages {
  color: #16A34A;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
  padding: 2px 8px;
  background: #F0FDF4;
  border-radius: 4px;
}

.tlyk-file-status {
  color: #94A3B8;
  font-size: 12px;
  flex-shrink: 0;
  font-style: italic;
}

.tlyk-file-status.tlyk-file-err {
  color: #DC2626;
  background: #FEE2E2;
  padding: 2px 8px;
  border-radius: 4px;
  font-style: normal;
}

.tlyk-file-pending {
  opacity: 0.7;
}

.tlyk-file-error {
  background: #FEF2F2 !important;
  border-color: #FECACA !important;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* SESSION TYPE RADIO                                                    */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-session-type {
  margin-top: 24px;
  padding: 16px;
  background: #F8FAFC;
  border-radius: 8px;
}

.tlyk-session-type h3 { margin: 0 0 12px 0; font-size: 15px; }

.tlyk-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
}

.tlyk-radio input { width: 18px; height: 18px; margin: 0; }

.tlyk-radio em { color: #DC2626; font-style: normal; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════ */
/* FORM SECTIONS                                                         */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-form-section {
  margin-bottom: 24px;
  padding: 20px;
  background: #F8FAFC;
  border-radius: 8px;
}

.tlyk-form-section.tlyk-readonly {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
}

.tlyk-form-section h3 { margin: 0 0 16px 0; font-size: 15px; }

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

.tlyk-grid-full { grid-column: 1 / -1; }

.tlyk-grid label {
  display: block;
  font-size: 12px;
  color: #64748B;
  margin-bottom: 4px;
  font-weight: 500;
}

.tlyk-grid input,
.tlyk-grid select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  -webkit-appearance: none;
}

.tlyk-grid input:focus,
.tlyk-grid select:focus {
  outline: none;
  border-color: #0F172A;
  box-shadow: 0 0 0 3px rgba(15,23,42,0.1);
}

.tlyk-grid input[readonly] {
  background: #F1F5F9;
  color: #475569;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* CLASSIFICATION CLUSTERS                                               */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-classification {
  display: grid;
  gap: 8px;
}

.tlyk-cluster {
  padding: 12px;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
}

.tlyk-cluster-title {
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tlyk-cluster-files { font-size: 13px; color: #64748B; }

.tlyk-cluster.empty {
  background: #FEF3C7;
  border-color: #FCD34D;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* ACTIONS / BUTTONS                                                     */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #E2E8F0;
}

/* Buttons: dùng class hệ thống tm-btn (xem tm-buttons-v4.css) */

.tlyk-cost {
  margin-left: 6px;
  padding: 2px 8px;
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* SUMMARY (Step 3)                                                      */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-summary {
  padding: 20px;
  background: #F8FAFC;
  border-radius: 8px;
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* DISCLAIMER                                                            */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-disclaimer {
  padding: 16px;
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-radius: 8px;
  font-size: 13px;
  color: #92400E;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* IFRAME (manage tab)                                                   */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-iframe {
  width: 100%;
  height: 80vh;
  min-height: 500px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* LOADING OVERLAY (cho pipeline 3-5 phút)                               */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.95);
  color: white;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
  text-align: center;
}

.tlyk-loading-overlay.active { display: flex; }

.tlyk-loading-spinner {
  width: 64px;
  height: 64px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: tlyk-spin 1s linear infinite;
  margin-bottom: 16px;
}

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

.tlyk-loading-text { font-size: 16px; margin-bottom: 8px; }
.tlyk-loading-substep { font-size: 13px; color: rgba(255,255,255,0.7); }

/* ═══════════════════════════════════════════════════════════════════ */
/* PIN INPUT (cho bác sĩ — view-share.php)                               */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-pin-form {
  max-width: 360px;
  margin: 40px auto;
  padding: 24px;
  background: white;
  border-radius: 12px;
  text-align: center;
  border: 1px solid #E2E8F0;
}

.tlyk-pin-input {
  width: 100%;
  padding: 14px;
  font-size: 24px;
  text-align: center;
  letter-spacing: 10px;
  font-family: 'Courier New', monospace;
  border: 2px solid #CBD5E1;
  border-radius: 8px;
  margin: 16px 0;
}

.tlyk-pin-input:focus { outline: none; border-color: #0F172A; }

/* ═══════════════════════════════════════════════════════════════════ */
/* SHARE WATERMARK (SVG-based)                                           */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-watermark {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='200'><text x='50' y='100' fill='%23000' font-size='20' transform='rotate(-30 200 100)'>ythuat.vn — SHARED</text></svg>");
  background-repeat: repeat;
}


/* ═══════════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════ */
/* TABLET (≤ 1023px) — auto adapt                                        */
/* ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  .tlyk-app {
    padding: 16px;
  }

  .tlyk-step-panel {
    padding: 24px;
  }

  .tlyk-upload-zone {
    padding: 36px 20px;
  }
}


/* ═══════════════════════════════════════════════════════════════════ */
/* MOBILE (≤ 640px) — auto adapt với tối ưu touch                        */
/* ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .tlyk-app {
    padding: 12px;
    font-size: 16px;             /* iOS no auto-zoom */
  }

  /* Header */
  .tlyk-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
  }
  .tlyk-header h1 { font-size: 22px; }
  .tlyk-tagline { margin-bottom: 12px; font-size: 13px; }

  /* Nav: scroll ngang nếu nhiều tab */
  .tlyk-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
    scrollbar-width: none;
  }
  .tlyk-nav::-webkit-scrollbar { display: none; }
  .tlyk-nav-btn {
    min-height: 48px;             /* Touch target */
    flex-shrink: 0;
  }

  /* Steps: compact */
  .tlyk-steps {
    margin-bottom: 20px;
    padding: 0 8px;
  }
  .tlyk-steps::before {
    top: 14px;
    left: 30px;
    right: 30px;
  }
  .tlyk-step .num { width: 28px; height: 28px; font-size: 13px; }
  .tlyk-step .label { font-size: 11px; line-height: 1.2; }

  /* Step panels: padding nhỏ */
  .tlyk-step-panel { padding: 16px; }
  .tlyk-step-panel h2 { font-size: 18px; }
  .tlyk-hint { margin-bottom: 16px; font-size: 14px; }

  /* Upload zone: nhỏ hơn */
  .tlyk-upload-zone { padding: 24px 16px; }
  .tlyk-upload-prompt .ic { font-size: 36px; }
  .tlyk-upload-prompt p { font-size: 14px; }

  /* Hiện nút camera trên mobile */
  .tlyk-btn-camera { display: inline-flex; }

  /* File list: tap area to */
  .tlyk-file-item {
    min-height: 56px;
    padding: 12px;
  }
  .tlyk-file-item .remove {
    min-width: 44px;
    min-height: 44px;
  }

  /* Radio: tap area to */
  .tlyk-radio {
    padding: 12px;
    min-height: 48px;
    border-radius: 6px;
  }
  .tlyk-radio:active { background: #E2E8F0; }
  .tlyk-radio input { width: 20px; height: 20px; }

  /* Form: 1 cột */
  .tlyk-form-section { padding: 16px; margin-bottom: 16px; }
  .tlyk-form-section h3 { font-size: 14px; margin-bottom: 12px; }

  .tlyk-grid {
    display: flex;
    flex-direction: column;       /* 1 cột */
    gap: 12px;
  }

  .tlyk-grid input,
  .tlyk-grid select {
    padding: 12px;
    min-height: 48px;
    font-size: 16px;              /* iOS no auto-zoom */
    border-radius: 8px;
  }

  /* Classification clusters: dạng accordion */
  .tlyk-cluster {
    padding: 12px;
  }
  .tlyk-cluster-title { font-size: 14px; }
  .tlyk-cluster.collapsed .tlyk-cluster-files { display: none; }

  /* Actions: stack vertical, primary ở dưới (gần ngón cái) */
  .tlyk-actions {
    flex-direction: column-reverse;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
  }

  .tlyk-btn {
    width: 100%;
    min-height: 48px;             /* Touch target */
    padding: 14px 20px;
    font-size: 15px;
  }

  .tlyk-btn-large {
    min-height: 56px;
    padding: 16px 28px;
    font-size: 16px;
  }

  /* Summary nhỏ hơn */
  .tlyk-summary { padding: 16px; font-size: 14px; }

  /* Disclaimer compact */
  .tlyk-disclaimer { padding: 12px; font-size: 13px; }

  /* Iframe full height tính theo viewport */
  .tlyk-iframe {
    height: calc(100vh - 200px);
    min-height: 400px;
    border-radius: 8px;
  }

  /* PIN input mobile-optimized */
  .tlyk-pin-form {
    margin: 24px 12px;
    padding: 20px;
  }
  .tlyk-pin-input {
    padding: 16px;
    min-height: 56px;
    font-size: 28px;
    letter-spacing: 12px;
  }
}


/* ═══════════════════════════════════════════════════════════════════ */
/* ACCESSIBILITY                                                         */
/* ═══════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .tlyk-loading-spinner { animation: none; }
  * { transition: none !important; }
}


/* ═══════════════════════════════════════════════════════════════════ */
/* MANAGE PAGE — Toolbar, Stats, List                                    */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-manage-page { max-width: 1200px; margin: 0 auto; }

.tlyk-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.tlyk-search-wrap { flex: 1; }

.tlyk-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-size: 14px;
  background: white;
}

.tlyk-search-input:focus {
  outline: none;
  border-color: #0F172A;
  box-shadow: 0 0 0 3px rgba(15,23,42,0.1);
}

.tlyk-toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tlyk-select {
  padding: 9px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  background: white;
  font-size: 14px;
  cursor: pointer;
  -webkit-appearance: none;
}

/* Stats */
.tlyk-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.tlyk-stat-card {
  padding: 16px;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  text-align: center;
}

.tlyk-stat-num {
  font-size: 28px;
  font-weight: 700;
  color: #0F172A;
}

.tlyk-stat-label {
  font-size: 12px;
  color: #64748B;
  margin-top: 4px;
}

/* Records list */
.tlyk-records-list {
  display: grid;
  gap: 12px;
}

.tlyk-record-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  transition: all 0.15s;
}

.tlyk-record-card:hover {
  border-color: #94A3B8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.tlyk-record-icon {
  font-size: 32px;
  width: 48px;
  text-align: center;
  flex-shrink: 0;
}

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

.tlyk-record-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tlyk-record-meta {
  font-size: 13px;
  color: #64748B;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tlyk-record-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.tlyk-record-actions .tlyk-btn {
  width: auto;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
}

/* Empty state */
.tlyk-empty-state {
  padding: 60px 20px;
  text-align: center;
  background: white;
  border: 2px dashed #E2E8F0;
  border-radius: 12px;
}

.tlyk-empty-state .ic {
  font-size: 64px;
  margin-bottom: 16px;
}

.tlyk-empty-state h3 {
  margin: 0 0 8px 0;
  color: #475569;
}

.tlyk-empty-state p {
  margin: 0 0 20px 0;
  color: #94A3B8;
}

/* Loading inline */
.tlyk-loading-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 24px;
  justify-content: center;
  color: #64748B;
}

.tlyk-loading-spinner-sm {
  width: 20px;
  height: 20px;
  border: 2px solid #E2E8F0;
  border-top-color: #0F172A;
  border-radius: 50%;
  animation: tlyk-spin 0.8s linear infinite;
}


/* ═══════════════════════════════════════════════════════════════════ */
/* MODAL                                                                  */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.tlyk-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
}

.tlyk-modal-dialog {
  position: relative;
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.tlyk-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #E2E8F0;
}

.tlyk-modal-header h2 { margin: 0; font-size: 18px; }

.tlyk-modal-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  cursor: pointer;
  color: #64748B;
  width: 36px;
  height: 36px;
  border-radius: 6px;
}

.tlyk-modal-close:hover { background: #F1F5F9; }

.tlyk-modal-body {
  padding: 20px;
  overflow-y: auto;
}


/* ═══════════════════════════════════════════════════════════════════ */
/* SHARE MODAL — Stages                                                  */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-share-stage[hidden] { display: none; }

.tlyk-share-record-info {
  padding: 12px 16px;
  background: #F1F5F9;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.tlyk-info-box {
  padding: 12px 16px;
  background: #DBEAFE;
  border-left: 4px solid #2563EB;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #1E3A8A;
}

.tlyk-warning-box {
  padding: 12px 16px;
  background: #FEF3C7;
  border-left: 4px solid #D97706;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #92400E;
}

.tlyk-warning-box ul {
  margin: 6px 0 0 0;
  padding-left: 20px;
}

.tlyk-warning-box li { margin: 3px 0; }

/* Share success */
.tlyk-share-success {
  padding: 16px;
  background: #D1FAE5;
  border-left: 4px solid #16A34A;
  border-radius: 6px;
  margin-bottom: 16px;
  color: #065F46;
}

/* Credentials display */
.tlyk-share-credentials {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.tlyk-credential-row label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 13px;
}

.tlyk-credential-value {
  display: flex;
  gap: 6px;
}

.tlyk-credential-value input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  background: #F8FAFC;
}

.tlyk-pin-display {
  font-size: 22px !important;
  letter-spacing: 8px;
  text-align: center;
  font-weight: 700;
  color: #DC2626;
}

.tlyk-btn-icon {
  padding: 10px 14px;
  background: white;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

.tlyk-btn-icon:hover { background: #F1F5F9; }

.tlyk-share-quick-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}


/* ═══════════════════════════════════════════════════════════════════ */
/* SHARE PAGE (cho bác sĩ — view-share.php)                              */
/* ═══════════════════════════════════════════════════════════════════ */
.tlyk-pin-page {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tlyk-pin-form {
  max-width: 400px;
  width: 100%;
  padding: 32px 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  text-align: center;
}

.tlyk-pin-logo {
  font-size: 56px;
  margin-bottom: 12px;
}

.tlyk-pin-title {
  margin: 0 0 6px 0;
  font-size: 22px;
}

.tlyk-pin-subtitle {
  color: #64748B;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 24px 0;
}

.tlyk-pin-help {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #E2E8F0;
  text-align: left;
  font-size: 13px;
  color: #64748B;
}

.tlyk-pin-help ul { padding-left: 20px; margin: 6px 0 0 0; }
.tlyk-pin-help li { margin: 4px 0; }

.tlyk-btn-block { width: 100%; }

/* Share record view */
.tlyk-share-record {
  max-width: 900px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  padding: 24px;
  position: relative;
  z-index: 2;
}

.tlyk-share-header {
  padding-bottom: 16px;
  border-bottom: 2px solid #0F172A;
  margin-bottom: 20px;
}

.tlyk-share-header h1 {
  margin: 0 0 8px 0;
  font-size: 24px;
}

.tlyk-share-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: #475569;
}

.tlyk-share-section {
  margin-bottom: 24px;
}

.tlyk-share-section h2 {
  font-size: 16px;
  padding: 8px 12px;
  background: #F1F5F9;
  border-left: 4px solid #0F172A;
  margin: 0 0 12px 0;
}

.tlyk-readonly-value {
  padding: 8px 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  font-size: 14px;
  min-height: 36px;
}

/* MoH sections (10 mục) — accordion */
.tlyk-moh-sections {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tlyk-moh-item {
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.tlyk-moh-item[open] {
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.tlyk-moh-title {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  list-style: none;
}

.tlyk-moh-title::-webkit-details-marker { display: none; }

.tlyk-moh-title:hover { background: #F8FAFC; }

.tlyk-moh-num {
  width: 28px;
  height: 28px;
  background: #0F172A;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.tlyk-moh-body {
  padding: 12px 16px 16px;
  border-top: 1px solid #E2E8F0;
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
}

.tlyk-share-footer {
  display: flex;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid #E2E8F0;
  margin-top: 24px;
}

.tlyk-share-audit-notice {
  margin-top: 16px;
  padding: 10px 14px;
  background: #EFF6FF;
  border-radius: 6px;
  font-size: 12px;
  color: #1E40AF;
  line-height: 1.5;
}

/* Error state */
.tlyk-share-error {
  max-width: 480px;
  margin: 60px auto;
  padding: 32px 24px;
  background: white;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.tlyk-share-error .ic { font-size: 56px; margin-bottom: 12px; }
.tlyk-share-error h2 { margin: 0 0 8px 0; color: #DC2626; }
.tlyk-share-error p { color: #64748B; line-height: 1.6; }


/* ═══════════════════════════════════════════════════════════════════ */
/* MOBILE SHARE PAGE                                                     */
/* ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .tlyk-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .tlyk-toolbar-actions {
    flex-direction: column;
  }

  .tlyk-toolbar-actions .tlyk-select,
  .tlyk-toolbar-actions .tlyk-btn {
    width: 100%;
  }

  .tlyk-stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .tlyk-stat-card { padding: 12px; }
  .tlyk-stat-num { font-size: 24px; }

  .tlyk-record-card {
    flex-direction: column;
  }

  .tlyk-record-actions {
    flex-wrap: wrap;
  }

  .tlyk-record-actions .tlyk-btn {
    flex: 1;
    min-width: calc(50% - 3px);
  }

  /* Modal mobile */
  .tlyk-modal { padding: 0; align-items: flex-end; }

  .tlyk-modal-dialog {
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    width: 100%;
  }

  .tlyk-share-quick-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .tlyk-pin-form {
    margin: 12px;
    padding: 24px 20px;
  }

  .tlyk-share-record { padding: 16px; }

  .tlyk-share-meta {
    flex-direction: column;
    gap: 4px;
  }

  .tlyk-share-footer {
    flex-direction: column;
  }

  .tlyk-credential-value {
    flex-direction: column;
  }

  .tlyk-btn-icon { width: 100%; }
}

/* ═══════════════════════════════════════════════════════ */
/* v2 SCHEMA UI (verdict + markdown render)                */
/* ═══════════════════════════════════════════════════════ */
.tlyk-verdict {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-weight: 600;
  font-size: 16px;
}
.tlyk-verdict-pass    { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.tlyk-verdict-warn    { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.tlyk-verdict-review  { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }

.tlyk-markdown-body {
  font-size: 15px; line-height: 1.7;
}
.tlyk-markdown-body h2 { font-size: 18px; margin: 16px 0 8px; color: #0F172A; }
.tlyk-markdown-body h3 { font-size: 16px; margin: 12px 0 6px; color: #0F172A; }
.tlyk-markdown-body h4 { font-size: 15px; margin: 10px 0 4px; color: #475569; }
.tlyk-markdown-body ul { margin: 6px 0; padding-left: 24px; }
.tlyk-markdown-body li { margin: 4px 0; }
.tlyk-markdown-body strong { color: #0F172A; }

.tlyk-ai-transparency {
  background: #F8FAFC; border-left: 4px solid #64748B;
}
.tlyk-disclaimer-mini {
  margin-top: 12px; padding: 10px;
  background: #FEF3C7; border-left: 3px solid #F59E0B;
  font-size: 13px; color: #78350F;
}

/* ─────────────────────────────────────── */
/* PHASE 2 — COVERAGE UI                   */
/* ─────────────────────────────────────── */

.tlyk-classify-summary {
  padding: 12px 16px;
  background: #F8FAFC;
  border-radius: 8px;
  margin-bottom: 16px;
}

.tlyk-coverage {
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  border: 2px solid;
}
.tlyk-coverage-ok    { background: #F0FDF4; border-color: #16A34A; }
.tlyk-coverage-warn  { background: #FFFBEB; border-color: #F59E0B; }
.tlyk-coverage-err   { background: #FEF2F2; border-color: #DC2626; }

.tlyk-coverage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.tlyk-coverage-score {
  font-size: 24px;
  font-weight: 700;
}
.tlyk-coverage-ok    .tlyk-coverage-score { color: #16A34A; }
.tlyk-coverage-warn  .tlyk-coverage-score { color: #F59E0B; }
.tlyk-coverage-err   .tlyk-coverage-score { color: #DC2626; }

.tlyk-coverage-bar {
  height: 8px;
  background: #E5E7EB;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.tlyk-coverage-fill {
  height: 100%;
  background: linear-gradient(90deg, #16A34A 0%, #F59E0B 70%, #DC2626 100%);
  transition: width 0.5s;
}

.tlyk-coverage-msg {
  margin: 8px 0;
  font-style: italic;
}
.tlyk-coverage-req {
  padding: 8px 12px;
  background: rgba(255,255,255,0.6);
  border-radius: 6px;
  font-size: 14px;
}
.tlyk-coverage-missing {
  color: #DC2626;
  font-weight: 500;
}

.tlyk-warnings {
  margin-bottom: 16px;
}
.tlyk-warning {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 14px;
}
.tlyk-warn-critical {
  background: #FEE2E2;
  color: #991B1B;
  border-left: 4px solid #DC2626;
}
.tlyk-warn-warning {
  background: #FEF3C7;
  color: #92400E;
  border-left: 4px solid #F59E0B;
}

.tlyk-identity {
  padding: 14px 16px;
  background: #EFF6FF;
  border-radius: 8px;
  margin-bottom: 16px;
}
.tlyk-identity h4 { margin: 0 0 10px 0; }
.tlyk-identity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  font-size: 14px;
}
.tlyk-identity-grid span { color: #6B7280; }

.tlyk-classify-files {
  margin-bottom: 16px;
}
.tlyk-classify-files h4 { margin: 0 0 8px 0; }
.tlyk-classify-file {
  padding: 10px 12px;
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  margin-bottom: 6px;
}
.tlyk-classify-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tlyk-classify-file-row .tlyk-file-name {
  flex: 1;
  font-weight: 500;
  min-width: 140px;
}
.tlyk-file-badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.tlyk-badge-ok   { background: #DCFCE7; color: #15803D; }
.tlyk-badge-warn { background: #FEF3C7; color: #92400E; }
.tlyk-badge-err  { background: #FEE2E2; color: #991B1B; }

.tlyk-file-sections {
  margin-top: 6px;
  padding: 4px 8px 4px 28px;
  font-size: 13px;
  color: #6B7280;
}

.tlyk-classify-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #E5E7EB;
}

@media (max-width: 640px) {
  .tlyk-classify-actions {
    flex-direction: column-reverse;
  }
  .tlyk-classify-actions button {
    width: 100%;
  }
}

/* ─────────────────────────────────────── */
/* PHASE 2.5 — STEP 2 IDENTITY FORM        */
/* ─────────────────────────────────────── */

/* Field auto-fill (AI điền) — vàng nhạt dịu mắt */
.tlyk-auto-filled {
  background: #FEFBF0 !important;
  color: #92400E;
  cursor: not-allowed;
}

/* Wrapper cho field có eye icon */
.tlyk-pii-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.tlyk-pii-wrapper input {
  flex: 1;
  padding-right: 44px !important;
}

/* Eye button — SVG icon */
.tlyk-eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.tlyk-eye-btn:hover {
  background: #F1F5F9;
  color: #475569;
}
.tlyk-eye-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tlyk-eye-btn svg {
  display: block;
}
