/* ==========================================================================
   DOANTM PLATFORM - CT01 & CITIZEN SERVICE PORTAL STYLESHEET
   Exact Layout & A4 Specification of capan.vn/client/ct01
   Elevated with DOANTM Bright Luminous Light Mode Palette
   ========================================================================== */

/* Google Fonts are loaded via direct <link> in HTML <head> for zero-waterfall parallel loading */

:root {
  --bg-main: #ffffff;
  --bg-surface: #f8fafc;
  --primary: #dc2626;
  --primary-hover: #b91c1c;
  --accent: #f59e0b;
  --cyan-accent: #0284c7;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-color: #e2e8f0;
  --card-shadow: 0 12px 35px -5px rgba(16, 185, 129, 0.09), 0 4px 16px -2px rgba(6, 182, 212, 0.07);
  --capan-primary: var(--primary);
  --capan-primary-hover: var(--primary-hover);
  --capan-primary-light: #fef2f2;
  --capan-primary-border: #fecaca;
  --capan-peach: var(--accent);
  --capan-peach-bg: #fffbeb;
  --capan-sky-bg: #f0f9ff;
  --capan-mint-bg: #f0fdf4;
  --capan-text-heading: #0f172a;
  --capan-text-body: #334155;
  --capan-text-muted: #64748b;
  --capan-border: #e2e8f0;
  --capan-border-light: rgba(226, 232, 240, 0.85);
  --capan-radius-lg: 20px;
  --capan-radius-md: 14px;
  --capan-radius-sm: 8px;
  --capan-shadow-soft: var(--card-shadow);
  --capan-shadow-hover: 0 20px 30px -10px rgba(16, 185, 129, 0.16), 0 10px 15px -5px rgba(6, 182, 212, 0.1);

  /* Emil Kowalski Motion & Tactile Tokens */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-press: 140ms;
  --dur-fast: 160ms;
}

/* Universal Tactile Response for E-Form Tool (Emil Kowalski) */
button,
.btn,
.capan-btn,
.tab-item,
.step-item,
.preset-chip,
.action-btn,
.capan-tab-btn {
  transition: transform var(--dur-press) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

button:active,
.btn:active,
.capan-btn:active,
.capan-btn-coral-large:active,
.capan-btn-scan-amber:active,
.capan-btn-scan-primary:active,
.capan-btn-outline:active,
.capan-form-tab-card:active,
.capan-modal-close:active,
.capan-auth-btn:active,
.btn:active,
.capan-btn:active,
.tab-item:active,
.preset-chip:active,
.action-btn:active,
.capan-tab-btn:active {
  transform: scale(0.97) !important;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: hidden !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
  color: var(--text-primary);
  background-color: #ffffff;
  background-image:
    radial-gradient(ellipse 35% 420px at 0% 180px, rgba(220, 38, 38, 0.04) 0%, transparent 100%),
    radial-gradient(ellipse 35% 420px at 100% 180px, rgba(2, 132, 199, 0.04) 0%, transparent 100%),
    linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
  background-repeat: no-repeat;
}

button, input, select, textarea {
  font-family: inherit;
}

.capan-app-root {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden !important;
  z-index: 1;
}

/* Left Side: Orange-Yellow Gradient Glow Effect, fading down into white */
.capan-app-root::before {
  content: "";
  position: absolute;
  top: 40px;
  left: -80px;
  width: min(560px, 45vw);
  height: 680px;
  background: linear-gradient(165deg, rgba(249, 115, 22, 0.28) 0%, rgba(245, 158, 11, 0.22) 38%, rgba(253, 224, 71, 0.16) 68%, rgba(255, 255, 255, 0) 100%);
  border-radius: 9999px;
  filter: blur(72px);
  pointer-events: none;
  z-index: -1;
}

/* Right Side: Blue-Green Gradient Glow Effect, fading down into white */
.capan-app-root::after {
  content: "";
  position: absolute;
  top: 40px;
  right: -80px;
  left: auto;
  transform: none;
  width: min(580px, 46vw);
  height: 680px;
  background: linear-gradient(195deg, rgba(14, 165, 233, 0.28) 0%, rgba(6, 182, 212, 0.22) 40%, rgba(16, 185, 129, 0.20) 70%, rgba(255, 255, 255, 0) 100%);
  border-radius: 9999px;
  filter: blur(72px);
  pointer-events: none;
  z-index: -1;
}

[hidden] {
  display: none !important;
}

.text-mobile, .preview-title-mobile, .tab-label-mobile {
  display: none;
}

/* ==========================================================================
   1. HEADER & NAVIGATION (DOANTM LIGHT MODE)
   ========================================================================== */
.capan-header {
  z-index: 100;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
}

.capan-header-top-bar {
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #f97316 0%, #f59e0b 32%, #10b981 68%, #0284c7 100%);
}

.capan-header-container {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1200px;
  min-height: 68px;
  margin: 0 auto;
  padding: 10px 20px;
}

.capan-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
}

.capan-emblem-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.capan-brand:hover .capan-emblem-wrap {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.35);
}

.capan-emblem-inner {
  width: 100%;
  height: 100%;
  background: #0f172a;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
}

.capan-brand-text {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
}

.capan-brand-sub {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.45px;
  color: #dc2626;
  text-transform: uppercase;
  margin-bottom: 1px;
}

.capan-brand-title {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.capan-brand-title .brand-tm {
  color: #dc2626;
}

.capan-brand-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0284c7;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  padding: 2px 7px;
  border-radius: 999px;
}

.capan-nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.capan-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.capan-nav-item:hover {
  color: #dc2626;
  background: #fef2f2;
}

.capan-nav-item.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #dc2626 0%, #e11d48 100%) !important;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

.capan-nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.capan-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.capan-auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border-radius: 9999px;
  background: #0f172a;
  color: #ffffff !important;
  border: 1px solid #1e293b;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.capan-auth-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.28);
}

/* Mobile Hamburger & Drawer */
.capan-hamburger-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #ffffff;
  border: 1.5px solid #fecaca;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.capan-hamburger-btn:hover {
  background: #fef2f2;
  border-color: #dc2626;
}

.capan-mobile-drawer {
  display: none;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  transition: max-height 0.3s ease, opacity 0.25s ease;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.capan-mobile-drawer.open {
  max-height: 420px;
  opacity: 1;
}

.capan-mobile-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px 16px;
}

.capan-drawer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #1e293b;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.capan-drawer-item:hover {
  background: #fef2f2;
  color: #dc2626;
}

.capan-drawer-item.active {
  background: #dc2626;
  color: #ffffff;
}

/* ==========================================================================
   2. MAIN CONTENT CONTAINER & UTILITY TABS
   ========================================================================== */
.capan-main-content {
  flex: 1;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}

.capan-utilities-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.capan-utility-nav-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 4px;
}

.capan-utility-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 10px 28px -6px rgba(15, 23, 42, 0.06);
}

.capan-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.capan-tab-btn:hover {
  color: #059669;
  background: #ecfdf5;
}

.capan-tab-btn.active {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

.capan-btn-guide-gradient {
  background: linear-gradient(135deg, #0d9488 0%, #059669 50%, #047857 100%);
  background-size: 200% auto;
  color: #ffffff !important;
  font-weight: 700 !important;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
  transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
  animation: guideGradShift 6s ease infinite;
}

@keyframes guideGradShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.capan-btn-guide-gradient:hover {
  background-position: right center;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.42);
}

.capan-btn-guide-gradient:active {
  transform: scale(0.97) !important;
}

/* ==========================================================================
   3. FORMS SELECTOR NAVIGATION CARD (5 BIỂU MẪU)
   ========================================================================== */
.capan-forms-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.capan-forms-nav-card {
  background:
    radial-gradient(circle at 4% 20%, rgba(251, 146, 60, 0.09) 0%, rgba(253, 224, 71, 0.05) 28%, transparent 55%),
    radial-gradient(circle at 96% 20%, rgba(14, 165, 233, 0.09) 0%, rgba(16, 185, 129, 0.07) 30%, transparent 58%),
    #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 20px 24px;
  box-shadow: 0 12px 32px -6px rgba(15, 23, 42, 0.05), 0 4px 14px -2px rgba(15, 23, 42, 0.03);
  position: relative;
  overflow: hidden;
}

.capan-forms-nav-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: linear-gradient(90deg, #f97316 0%, #f59e0b 32%, #10b981 68%, #0284c7 100%);
}

.capan-forms-nav-header {
  margin-bottom: 16px;
}

.capan-forms-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #d97706;
  background: linear-gradient(90deg, #fff7ed 0%, #fefce8 100%);
  border: 1px solid #fde68a;
  border-radius: 999px;
  margin-bottom: 6px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 800;
}

.capan-forms-nav-header h3 {
  color: #0f172a;
  margin: 4px 0;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.capan-forms-nav-header p {
  color: #64748b;
  margin: 0;
  font-size: 0.875rem;
}

.capan-forms-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

@media (min-width: 1024px) {
  .capan-forms-selector-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.capan-form-tab-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 58px;
  gap: 0;
  padding: 12px 14px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.capan-form-tab-card:hover {
  border-color: #38bdf8;
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -4px rgba(14, 165, 233, 0.12), 0 4px 10px -2px rgba(16, 185, 129, 0.08);
}

.capan-form-tab-card.active {
  border-color: #dc2626;
  background: linear-gradient(180deg, #fffafa 0%, #ffffff 100%);
  box-shadow: 0 0 0 2.5px rgba(220, 38, 38, 0.14);
}

.capan-form-tab-card.is-developing:hover {
  border-color: #f59e0b;
}

.form-tab-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.form-code-badge {
  color: #1e293b;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
  flex: 1;
}

.capan-form-tab-card.active .form-code-badge {
  color: #dc2626;
  font-weight: 800;
}

.form-status-ready {
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.form-status-dev {
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.form-status-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 9999px;
  padding: 3px 6px;
  line-height: 1;
  flex-shrink: 0;
}

.capan-step-item.done .step-badge {
  background: #fff7ed;
  color: #ea580c;
  border: 1.5px solid #f97316;
}

.capan-step-item.active {
  color: #0f172a;
  font-weight: 700;
}

.capan-step-item.active .step-badge {
  background: linear-gradient(135deg, #0284c7 0%, #10b981 100%);
  color: #ffffff;
  border: 1.5px solid #0284c7;
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.28);
}

.step-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-divider {
  flex: 1;
  height: 1.5px;
  background: #e2e8f0;
  min-width: 14px;
}

/* Dual QR Cards Panel */
.capan-qr-action-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.capan-qr-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 10px 28px -6px rgba(15, 23, 42, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.capan-qr-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -5px rgba(15, 23, 42, 0.08);
}

.capan-qr-card.landlord-card {
  border-top: 4px solid #f59e0b;
  background:
    radial-gradient(circle at 0% 0%, rgba(251, 146, 60, 0.08) 0%, rgba(253, 224, 71, 0.05) 35%, transparent 65%),
    #ffffff;
}

.capan-qr-card.tenant-card {
  border-top: 4px solid #06b6d4;
  background:
    radial-gradient(circle at 100% 0%, rgba(14, 165, 233, 0.08) 0%, rgba(16, 185, 129, 0.06) 35%, transparent 65%),
    #ffffff;
}

.qr-card-header {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.qr-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.qr-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qr-icon.text-amber {
  color: #ea580c;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.qr-icon.text-teal {
  color: #0284c7;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
}

.qr-header-title h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-sub-text {
  display: block;
  font-size: 11.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.capan-btn-scan-amber,
.capan-btn-scan-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.capan-btn-scan-amber {
  background: linear-gradient(135deg, #f97316 0%, #f59e0b 100%);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.capan-btn-scan-amber:hover {
  background: linear-gradient(135deg, #ea580c 0%, #d97706 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.32);
}

.capan-btn-scan-primary {
  background: linear-gradient(135deg, #0284c7 0%, #10b981 100%);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.capan-btn-scan-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #059669 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.32);
}

.capan-btn-manual-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 38px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.capan-btn-manual-edit:hover {
  color: #0f172a;
  background: #f1f5f9;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.qr-card-body {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 78px;
  padding: 12px 14px;
}

.qr-scanned-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  font-size: 13px;
  line-height: 1.45;
}

.info-label {
  color: #64748b;
  margin-right: 6px;
  font-size: 12px;
}

.info-value {
  color: #0f172a;
  font-weight: 500;
}

.info-value.text-bold {
  color: #0284c7;
  font-size: 13.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.landlord-card .info-value.text-bold {
  color: #ea580c;
}

.info-value.text-code {
  letter-spacing: 0.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
}

.qr-empty-hint {
  color: #64748b;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 0;
}

/* Inline Manual Input Drawer inside QR Card */
.qr-manual-drawer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.qr-manual-drawer .full-col {
  grid-column: 1 / -1;
}

.qr-manual-drawer label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 3px;
}

.qr-manual-drawer input,
.qr-manual-drawer select {
  width: 100%;
  padding: 6px 10px;
  font-size: 12.5px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #0f172a;
}

.qr-manual-drawer input:focus,
.qr-manual-drawer select:focus {
  outline: none;
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.14);
}

@media (max-width: 560px) {
  .qr-manual-drawer {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   5. PREVIEW CARD & FORM INPUTS (MỤC 10 & MỤC 11) - DOMINANT WHITE
   ========================================================================== */
.capan-preview-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 12px 32px -6px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.capan-preview-card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

.capan-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.panel-icon {
  color: #dc2626;
  width: 20px;
  height: 20px;
}

.capan-preview-card-body {
  padding: 22px 24px;
  background: #ffffff;
}

.ct01-fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 18px;
  min-width: 0;
}

.ct01-fieldset legend {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 10px;
  padding: 0;
}

.ct01-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.ct01-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #1e293b;
  cursor: pointer;
}

.ct01-radio-label input[type="radio"] {
  accent-color: #dc2626;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.ct01-address-inputs-grid {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(220px, 2fr);
  gap: 12px;
  max-width: 820px;
  margin-top: 10px;
}

.ct01-extra-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px;
  max-width: 820px;
  margin-top: 12px;
}

.ct01-address-input-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ct01-address-input-field label {
  color: #1e293b;
  font-size: 13px;
  font-weight: 600;
}

.capan-input {
  box-sizing: border-box;
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 8px 12px;
  font-size: 13.5px;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select.capan-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
  padding-right: 36px;
  cursor: pointer;
}

input[type="date"].capan-input {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  line-height: 24px;
}

.capan-input:hover {
  border-color: #94a3b8;
}

.capan-input:focus {
  outline: none;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

/* Row containing Date of birth & Gender in Member Modal */
.member-dob-gender-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.member-dob-gender-row .ct01-address-input-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Hero Scan Button in Member Modal */
.member-scan-action-wrap {
  margin-bottom: 4px;
}

.btn-scan-member-hero {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
  border: 1.5px solid #7dd3fc;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.12);
  box-sizing: border-box;
}

.btn-scan-member-hero:hover {
  background: linear-gradient(135deg, #e0f2fe 0%, #ccfbf1 100%);
  border-color: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.22);
}

.btn-scan-member-hero:active {
  transform: scale(0.99);
}

.btn-scan-member-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7 0%, #10b981 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.32);
}

.btn-scan-member-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.btn-scan-member-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0369a1;
  line-height: 1.3;
}

.btn-scan-member-desc {
  font-size: 11.5px;
  color: #475569;
  line-height: 1.3;
}

.btn-scan-member-badge {
  padding: 6px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0284c7 0%, #10b981 100%);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.28);
}

.ct01-contract-datetime-field {
  width: min(360px, 100%);
  margin-top: 12px;
}

/* Mục 11: Members Editor */
.ct01-members-editor {
  border: 0;
  min-width: 0;
  margin: 0 0 20px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.ct01-members-editor legend {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
  padding: 0 6px;
}

.ct01-members-editor p {
  margin: 0 0 12px;
  font-size: 13px;
  color: #64748b;
}

.capan-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.capan-btn-outline:hover:not(:disabled) {
  color: #0284c7;
  border-color: #0284c7;
  background: #f0f9ff;
}

.capan-btn-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ct01-member-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.member-actions {
  display: flex;
  gap: 8px;
}

.btn-link {
  background: none;
  border: none;
  font-size: 12.5px;
  font-weight: 600;
  color: #0284c7;
  cursor: pointer;
  padding: 2px 6px;
}

.btn-link.danger {
  color: #dc2626;
}

.btn-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   6. A4 DOCUMENT PREVIEW & EXACT PRINT SPECIFICATION
   ========================================================================== */
.doc-preview-wrapper {
  background: #f8fafc;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
}

.a4-page-scaler {
  transform-origin: top center;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.doc-mobile-toolbar {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  margin-bottom: 14px;
  padding: 8px 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.doc-mobile-badge {
  color: #0369a1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}

.doc-mobile-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.doc-toolbar-btn {
  color: #475569;
  cursor: pointer;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.doc-toolbar-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Exact A4 Paper Styles from capan.vn/client/ct01 */
.a4-page, .a4-page * {
  font-family: 'Times New Roman', Times, serif !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
  max-height: 999999px;
}

.a4-page {
  box-sizing: border-box;
  color: #000000;
  background: #ffffff;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 30px;
  padding: 16mm 15mm 16mm 22mm;
  font-size: 11.5pt;
  line-height: 1.35;
  position: relative;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.doc-preview-wrapper .ct01-doc-page *,
.doc-preview-wrapper .contract-doc-page * {
  font-weight: 400;
}

.ct01-doc-page .text-uppercase,
.ct01-doc-page .ct01-table-members tbody td:nth-child(2) > span,
.doc-preview-wrapper .contract-doc-page .contract-main-title,
.doc-preview-wrapper .contract-doc-page .party-role-head,
.doc-preview-wrapper .contract-doc-page .sig-head-title,
.doc-preview-wrapper .ct01-doc-page .ct01-main-title,
.doc-preview-wrapper .ct01-doc-page .ct01-recipient-value,
.doc-preview-wrapper .a4-page .national-country,
.doc-preview-wrapper .a4-page .national-motto,
.doc-preview-wrapper .a4-page strong {
  font-weight: 700 !important;
}

.contract-doc-page .text-uppercase,
.contract-doc-page .party-flex-row span,
.contract-doc-page .party-info-row span {
  font-weight: 400 !important;
}

.ct01-sub-header {
  text-align: center;
  color: #000000;
  margin-bottom: 6px;
  font-size: 11pt;
  line-height: 1.25;
}

.ct01-sub-header p {
  margin: 0;
}

.ct01-national-header,
.contract-national-header {
  text-align: center;
  margin-bottom: 10px;
}

.national-country {
  text-transform: uppercase;
  color: #000000;
  margin: 0 0 2px;
  font-size: 12pt;
  font-weight: 700 !important;
}

.national-motto {
  color: #000000;
  margin: 0;
  font-size: 12pt;
  font-weight: 700 !important;
}

.national-underline {
  background: #000000;
  width: 140px;
  height: 1px;
  margin: 5px auto 0;
  display: block;
}

.ct01-main-title {
  text-align: center;
  text-transform: uppercase;
  color: #000000;
  margin: 12px 0 6px;
  font-size: 14pt;
  font-weight: 700 !important;
}

.ct01-recipient {
  text-align: center;
  color: #000000;
  margin: 0 0 12px;
  font-size: 11.5pt;
}

.ct01-recipient-value {
  font-size: inherit;
  font-weight: 700 !important;
}

.ct01-line {
  overflow-wrap: anywhere;
  margin-bottom: 8px;
  font-size: 11.5pt;
  line-height: 1.35;
}

.ct01-request-label,
.ct01-request-content,
.ct01-request-prefix,
.ct01-request-address {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ct01-address-row {
  min-height: 1.6em;
  font-weight: 400 !important;
  display: block;
}

#a4-ct01-relationship,
.ct01-request-content,
.ct01-request-address {
  font-weight: 400 !important;
}

.ct01-flex-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 11.5pt;
}

.ct01-flex-line .flex-item {
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 0;
}

.ct01-flex-line .flex-item:nth-child(2) {
  padding-left: 24px;
}

.ct01-gender-value {
  margin-left: 6px;
}

.ct01-household-line {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: baseline !important;
  gap: 32px !important;
  font-size: 11.5pt;
  margin-bottom: 8px;
}

.ct01-household-line .flex-item {
  flex: 0 0 auto !important;
  min-width: auto !important;
  white-space: nowrap;
}

.ct01-household-line .flex-item:first-child {
  white-space: nowrap;
}

.ct01-household-line .flex-item:nth-child(2) {
  padding-left: 0 !important;
  white-space: nowrap;
}

.ct01-household-line .text-uppercase {
  white-space: nowrap;
}

.ct01-id-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  font-size: 11.5pt;
  line-height: 1.35;
}

.ct01-id-line .id-label {
  white-space: nowrap;
}

.ct01-boxes-group {
  white-space: nowrap;
  border: 1px solid #000000;
  border-right: none;
  flex: none;
  display: inline-flex;
  flex-direction: row;
  align-items: stretch;
  height: 25.5px;
  margin: 0;
  padding: 0;
  box-sizing: content-box;
}

.ct01-box-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-right: 1px solid #000000;
  width: 25px;
  height: 25.5px;
  font-size: 12pt;
  font-weight: 400 !important;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.ct01-box-digit {
  display: block;
  font-family: 'Times New Roman', Times, serif !important;
  font-size: 12pt;
  font-weight: 400 !important;
  line-height: 25.5px;
  text-align: center;
  width: 100%;
  padding-top: 1px;
}

.ct01-box-cell:last-child {
  border-right: 1px solid #000000;
}

/* Item 11 Table */
.ct01-members-section {
  margin-top: 6px;
}

.ct01-members-section .members-title {
  margin: 0 0 10px;
  font-size: 11.5pt;
}

.ct01-table-members {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  border: 1px solid #000000;
  border-right-width: 0;
  width: 100%;
  font-size: 10.5pt;
}

.ct01-table-members th {
  text-align: center;
  border: 1px solid #000000;
  border-width: 0 1px 1px 0;
  padding: 4px 2px;
  font-weight: 700 !important;
  line-height: 1.2;
  vertical-align: middle;
}

.ct01-table-members th > span {
  font-weight: 700 !important;
  display: inline-block;
  vertical-align: middle;
}

.ct01-table-members td {
  overflow-wrap: anywhere;
  border-top: 0 solid #000000;
  border-bottom: 0.5px dotted #969696;
  border-left: 0 solid #000000;
  border-right: 1px solid #000000;
  height: 21px;
  padding: 0 4px;
  vertical-align: middle;
  line-height: 21px;
}

.ct01-table-members tbody td.text-center {
  text-align: center;
}

.ct01-table-members tbody td:last-child {
  text-align: center;
}

.ct01-table-members tbody td > span {
  display: inline-block;
  vertical-align: middle;
  line-height: 1.2;
}

.a4-export-page .ct01-table-members thead th > span,
.a4-export-page .ct01-table-members tbody td > span {
  position: relative;
  top: 0;
}

/* 4-Column Signatures on CT01 */
.ct01-signatures-container {
  box-sizing: border-box;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  min-height: 185px;
  width: 100% !important;
  margin-top: 10px;
  border: 1px dashed #555555 !important;
}

.ct01-sig-col {
  text-align: center;
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  min-width: 0 !important;
  padding: 5px 3px 6px;
  border: none !important;
  border-right: 1px dashed #555555 !important;
}

.ct01-sig-col:first-child { flex: 0 0 26.8% !important; width: 26.8% !important; max-width: 26.8% !important; }
.ct01-sig-col:nth-child(2) { flex: 0 0 25.2% !important; width: 25.2% !important; max-width: 25.2% !important; }
.ct01-sig-col:nth-child(3) { flex: 0 0 24.8% !important; width: 24.8% !important; max-width: 24.8% !important; }
.ct01-sig-col:nth-child(4) { flex: 0 0 23.2% !important; width: 23.2% !important; max-width: 23.2% !important; border-right: none !important; }

.sig-date-placeholder {
  white-space: nowrap;
  letter-spacing: -0.2px;
  margin: 0 0 2px;
  font-size: 8.2pt;
  font-style: italic;
  line-height: 1.15;
}

.sig-heading {
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 2px;
  font-size: 8.6pt;
  font-weight: 700 !important;
  line-height: 1.15;
}

.sig-heading sup {
  font-size: 8pt;
  font-weight: 700 !important;
}

.sig-header-zone {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  height: 50px;
  min-height: 50px;
}

.sig-space {
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  margin: 2px 0 0;
}

.sig-canvas-img {
  object-fit: contain;
  max-width: 85%;
  max-height: 44px;
}

.sig-name-zone {
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 20px;
  min-height: 20px;
  margin: 0;
}

.sig-signer-name {
  text-align: center;
  margin: 0;
  font-size: 8pt;
  font-weight: 700 !important;
  line-height: 1.2;
}

.sig-notes-zone {
  text-align: left;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  width: 100%;
  height: 32px;
  min-height: 32px;
  padding-left: 2px;
}

.sig-sub-note {
  white-space: nowrap;
  color: #000000;
  text-align: left;
  margin: 1px 0;
  font-size: 7.8pt;
  font-style: italic;
  line-height: 1.2;
}

/* Page 2: Contract Document Page */
.contract-doc-page {
  font-size: 11.5pt;
  line-height: 1.35;
}

.contract-main-title {
  text-align: center;
  text-transform: uppercase;
  color: #000000;
  margin: 14px 0 10px;
  font-size: 14pt;
  font-weight: 700 !important;
}

.contract-intro-line {
  margin: 0 0 6px;
  font-size: 11.5pt;
}

.contract-party-block {
  margin-bottom: 8px;
}

.party-role-head {
  margin: 0 0 3px;
  font-size: 11.5pt;
  font-weight: 700 !important;
}

.party-flex-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}

.party-info-row {
  overflow-wrap: anywhere;
  margin: 2px 0;
}

.contract-long-value {
  overflow-wrap: anywhere;
  word-break: break-word;
  font-weight: 400 !important;
}

.contract-clause-intro {
  margin: 8px 0 4px;
  font-size: 11.5pt;
}

.contract-clauses-list p {
  text-align: justify;
  margin: 3px 0;
  font-size: 11.5pt;
}

.contract-signature-table {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-top: 24px;
  padding: 0 35px;
}

.contract-sig-cell {
  text-align: center;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  flex: 0 0 220px !important;
  width: 220px !important;
  box-sizing: border-box !important;
}

.sig-head-title {
  text-transform: uppercase;
  font-size: 11.5pt;
  font-weight: 700 !important;
}

.sig-space-contract {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 70px;
  max-height: 80px;
  margin: 4px 0 0;
}

.text-uppercase {
  text-transform: uppercase;
}

/* ==========================================================================
   7. INTERACTIVE DUAL SIGNATURE PADS PANEL
   ========================================================================== */
.interactive-signatures-panel {
  width: 100%;
  max-width: 900px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  margin: 10px auto 0;
  padding: 22px 24px;
  box-shadow: var(--card-shadow);
}

.interactive-signatures-panel h3 {
  color: #0f172a;
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 800;
}

.sig-pads-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.sig-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.sig-label {
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  font-size: 14.5px;
  font-weight: 700;
}

.sig-subtext {
  color: #64748b;
  margin-bottom: 10px;
  font-size: 12px;
}

.sig-canvas-wrapper {
  cursor: crosshair;
  touch-action: none;
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 130px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sig-canvas-wrapper:hover {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sig-canvas-wrapper canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.sig-placeholder {
  color: #94a3b8;
  pointer-events: none;
  user-select: none;
  font-size: 13px;
  text-align: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
}

.sig-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.sig-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.sig-btn:hover:not(:disabled) {
  border-color: #64748b;
  color: #0f172a;
  background: #f1f5f9;
}

.sig-btn.danger {
  color: #dc2626;
  border-color: #fecaca;
  background: #fff5f5;
}

.sig-btn.danger:hover:not(:disabled) {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

.sig-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Batch Residence Electronic Signature Styles */
.batch-landlord-sig-panel {
  margin-top: 14px;
}

.batch-landlord-sig-panel .sig-canvas-wrapper {
  background: #ffffff;
  border: 1.5px dashed #ea580c;
  height: 125px;
}

.batch-landlord-sig-panel .sig-canvas-wrapper:hover {
  border-color: #c2410c;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}

.batch-tenant-sig-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1.5px dashed #e2e8f0;
}

.batch-tenant-sig-box .sig-canvas-wrapper {
  background: #ffffff;
  border: 1.5px dashed #0284c7;
  height: 115px;
}

.batch-tenant-sig-box .sig-canvas-wrapper:hover {
  border-color: #0369a1;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

/* ==========================================================================
   8. BOTTOM EXPORT ACTIONS BAR
   ========================================================================== */
.capan-preview-bottom-actions {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding: 16px 20px;
}

.capan-output-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.capan-output-copy strong {
  color: #0f172a;
  font-size: 14.5px;
  font-weight: 800;
}

.capan-output-copy span {
  color: #64748b;
  font-size: 12.5px;
}

.capan-output-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.capan-btn-coral-large {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border-radius: 10px;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.28);
  transition: all 0.2s ease;
}

.capan-btn-coral-large:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.35);
}

.capan-btn-coral-large-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  background: #ffffff;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.capan-btn-coral-large-outline:hover {
  border-color: #dc2626;
  color: #dc2626;
  background: #fef2f2;
  transform: translateY(-1px);
}

/* ==========================================================================
   9. CITIZEN APPLICATION (CT02 ĐƠN CỚ MẤT & CT03 XÁC NHẬN HẠNH KIỂM)
   ========================================================================== */
.citizen-application-workspace {
  display: grid;
  gap: 20px;
}

.citizen-application-toolbar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: var(--card-shadow);
}

.citizen-application-toolbar-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.citizen-application-toolbar-content > div:first-child {
  display: grid;
  gap: 3px;
}

.citizen-application-toolbar-content > div:first-child > strong {
  font-size: 16px;
  color: #0f172a;
}

.citizen-application-toolbar-content > div:first-child > span {
  color: #64748b;
  font-size: 12.5px;
}

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

.citizen-application-page p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 12px 0;
}

.citizen-application-recipient {
  text-align: center;
  margin: 24px 0 !important;
}

.citizen-application-signatures {
  text-align: center;
  break-inside: avoid;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: baseline;
  gap: 4px 24px;
  margin-top: 24px;
}

.citizen-application-signatures > p {
  margin: 0;
}

.citizen-application-signatures strong {
  font-size: 10pt;
}

.citizen-application-signatures > div {
  grid-column: 2;
}

.citizen-application-signature-space {
  min-height: 90px;
}

/* Developing Form Card (CT04 / CT07) */
.developing-inner-card {
  border: 1.5px dashed #cbd5e1;
  text-align: center;
  background: #ffffff;
  border-radius: 16px;
  padding: 40px 24px;
  box-shadow: var(--card-shadow);
}

.developing-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 580px;
  margin: 0 auto;
}

.developing-icon-wrap {
  background: #fef2f2;
  color: #dc2626;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
}

.developing-badge {
  color: #d97706;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 999px;
  margin-bottom: 10px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 700;
}

.developing-hints {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  text-align: left;
  color: #475569;
  border-radius: 10px;
  width: 100%;
  margin: 18px 0 24px;
  padding: 14px 18px;
  font-size: 13.5px;
  line-height: 1.6;
}

/* ==========================================================================
   10. MODALS (QR SCANNER MODAL, MEMBER MODAL, APPLICATION MODAL)
   ========================================================================== */
.capan-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.capan-modal-backdrop[hidden] {
  display: none !important;
}

#qr-scanner-modal {
  z-index: 99999 !important;
}

#member-modal {
  z-index: 500 !important;
}

#batch-export-modal {
  z-index: 450 !important;
}

#export-images-modal {
  z-index: 400 !important;
}

#citizen-app-modal {
  z-index: 350 !important;
}

/* Batch Export Results Modal & Cards */
#batch-export-modal .capan-modal-box {
  max-width: 840px;
}

.batch-result-tenant-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.batch-result-tenant-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.batch-result-file-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.batch-result-file-item:hover {
  background: #f1f5f9;
}

.capan-modal-box {
  background: #ffffff;
  border: 1px solid #fecaca;
  border-radius: 18px;
  width: 100%;
  max-width: 720px;
  max-height: calc(100dvh - 24px);
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  animation: capanModalIn var(--dur-modal, 0.22s) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}

@keyframes capanModalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.capan-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 22px;
  background: #fffafa;
  border-bottom: 1px solid #fee2e2;
}

.capan-modal-close {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
}

.capan-modal-close:hover {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

.capan-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.capan-modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* Camera Viewport & Laser Overlay */
.qr-scanner-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qr-scanner-title-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.qr-scanner-title {
  color: #0f172a;
  font-size: 17px;
  font-weight: 800;
}

.qr-scanner-heading p {
  margin: 2px 0 0;
  font-size: 13px;
  color: #64748b;
}

.camera-viewport-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.camera-viewport {
  aspect-ratio: 16 / 9;
  cursor: crosshair;
  background: #090d16;
  border: 0;
  border-radius: 14px;
  width: 100%;
  min-height: 220px;
  max-height: 310px;
  padding: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.camera-video {
  object-fit: cover;
  width: 100%;
  height: 100%;
  display: block;
}

.scanner-laser-overlay {
  pointer-events: none;
  background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.55) 80%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: absolute;
  inset: 0;
}

.scanner-frame {
  aspect-ratio: 1;
  border: 1px dashed rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  width: min(55%, 200px);
  position: relative;
}

.scanner-frame .corner {
  border-style: solid;
  border-color: #ef4444;
  width: 22px;
  height: 22px;
  position: absolute;
}

.scanner-frame .corner-tl { border-width: 4px 0 0 4px; border-top-left-radius: 8px; top: -2px; left: -2px; }
.scanner-frame .corner-tr { border-width: 4px 4px 0 0; border-top-right-radius: 8px; top: -2px; right: -2px; }
.scanner-frame .corner-bl { border-width: 0 0 4px 4px; border-bottom-left-radius: 8px; bottom: -2px; left: -2px; }
.scanner-frame .corner-br { border-width: 0 4px 4px 0; border-bottom-right-radius: 8px; bottom: -2px; right: -2px; }

.scanner-laser-line {
  background: linear-gradient(90deg, transparent, #ef4444 20%, #22c55e 50%, #ef4444 80%, transparent);
  height: 2.5px;
  animation: 2.2s ease-in-out infinite alternate laser-sweep;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  box-shadow: 0 0 8px #ef4444;
}

@keyframes laser-sweep {
  0% { opacity: 0.8; top: 6%; }
  100% { opacity: 0.95; top: 94%; }
}

.qr-upload-option {
  background: linear-gradient(120deg, #fffafa, #fff1f2);
  border: 1px dashed #fca5a5;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
}

.qr-upload-crop-panel {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.qr-upload-cropper {
  cursor: crosshair;
  touch-action: none;
  background: #0f172a;
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  width: 100%;
  padding: 0;
  display: block;
  position: relative;
  overflow: hidden;
}

.qr-upload-cropper img {
  user-select: none;
  pointer-events: none;
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
}

.qr-upload-crop-selection {
  pointer-events: none;
  background: rgba(34, 197, 94, 0.18);
  border: 2px solid #22c55e;
  position: absolute;
  box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.45);
}

.scanned-card {
  background: linear-gradient(135deg, #f0fdf4, #fafffc);
  border: 1px solid #bbf7d0;
  border-radius: 14px;
  padding: 16px;
}

.scanned-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 0;
}

.scanned-grid > div {
  background: #ffffff;
  border: 1px solid #dcfce7;
  border-radius: 10px;
  padding: 10px 12px;
}

.scanned-grid > div.full-width {
  grid-column: span 2;
}

.scanned-grid dt {
  color: #64748b;
  font-size: 11.5px;
}

.scanned-grid dd {
  color: #0f172a;
  margin: 3px 0 0;
  font-size: 14px;
  font-weight: 700;
}

/* ==========================================================================
   11. OTHER VIEWS: TRA CỨU HỒ SƠ, LIÊN HỆ CSKV, KHAI BÁO CƯ TRÚ, HƯỚNG DẪN
   ========================================================================== */
.capan-lookup-workspace {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

.capan-lookup-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}

.capan-lookup-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.capan-lookup-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #fef2f2;
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.capan-lookup-search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.capan-lookup-result-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
}

.capan-result-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.capan-status-tag {
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.capan-result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px dashed #cbd5e1;
}

.capan-result-grid strong {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 2px;
}

.capan-result-grid p {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

/* CSKV Directory */
.capan-officer-header-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  margin-bottom: 20px;
  padding: 20px 24px;
  box-shadow: var(--card-shadow);
}

.capan-officer-search-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.capan-officer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 14px;
}

.capan-officer-card {
  cursor: pointer;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.capan-officer-card:hover {
  border-color: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.1);
}

.capan-officer-card.is-revealed {
  border-color: #dc2626;
  background: #fffafa;
}

.capan-officer-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.capan-officer-avatar-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.capan-officer-card.is-revealed .capan-officer-avatar-icon {
  background: #dc2626;
  color: #ffffff;
}

.capan-officer-name {
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
}

.capan-officer-kv-badge {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 5px;
}

.capan-officer-revealed-box {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.capan-officer-phone-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 7px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 15px;
  font-weight: 800;
}

.capan-officer-card-buttons {
  display: flex;
  gap: 6px;
}

.capan-card-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
}

.capan-card-btn-call {
  background: #dc2626;
  color: #ffffff;
}

.capan-card-btn-copy {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

/* Guide View */
.capan-guide {
  max-width: 1120px;
  margin: 0 auto;
}

.capan-guide-intro {
  background: linear-gradient(120deg, #fef2f2, #ffffff 72%);
  border: 1px solid #fecaca;
  border-radius: 18px;
  padding: 28px 32px;
}

.capan-guide-intro span {
  color: #dc2626;
  letter-spacing: 0.08em;
  font-size: 12.5px;
  font-weight: 800;
}

.capan-guide-intro h2 {
  margin: 6px 0 8px;
  font-size: 28px;
  color: #0f172a;
}

.capan-guide-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  margin-top: 20px;
}

.capan-guide-toc,
.capan-guide-content {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--card-shadow);
}

.capan-guide-toc {
  position: sticky;
  top: 88px;
}

.capan-guide-toc a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: #475569;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
}

.capan-guide-toc a:hover {
  color: #dc2626;
  background: #fef2f2;
}

.capan-guide-content section {
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 24px;
  padding-bottom: 24px;
}

.capan-guide-content section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Footer */
.capan-footer-wrap {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  margin-top: auto;
  padding: 20px 24px;
  text-align: center;
  font-size: 13px;
  color: #64748b;
}

/* Toast Notification */
#capan-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.capan-toast {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 4px solid #10b981;
  animation: capanModalIn 0.2s ease-out;
}

.capan-toast.warn {
  border-left-color: #f59e0b;
}

.capan-toast.error {
  border-left-color: #ef4444;
}

/* ==========================================================================
   12. RESPONSIVE & PRINT MEDIA QUERIES
   ========================================================================== */
@media (max-width: 900px) {
  .capan-steps-card,
  .capan-qr-action-panel,
  .capan-officer-search-inputs,
  .capan-guide-layout {
    grid-template-columns: 1fr;
  }

  .capan-nav,
  .capan-header-actions {
    display: none;
  }

  .capan-hamburger-btn,
  .capan-mobile-drawer {
    display: flex;
  }

  .capan-mobile-drawer {
    display: block;
  }
}

@media (max-width: 768px) {
  .text-desktop, .preview-title-desktop, .tab-label-desktop {
    display: none !important;
  }
  .text-mobile, .preview-title-mobile, .tab-label-mobile {
    display: inline !important;
  }
  .capan-qr-cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .qr-card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .qr-header-title {
    width: 100%;
  }
  .qr-card-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }
  .qr-card-actions .capan-btn-manual-edit {
    flex: 1;
    justify-content: center;
  }
  .qr-card-actions .capan-btn-scan-amber,
  .qr-card-actions .capan-btn-scan-primary {
    flex: 1.35;
    justify-content: center;
  }
  .sig-pads-grid,
  .ct01-address-inputs-grid,
  .scanned-grid,
  .capan-result-grid {
    grid-template-columns: 1fr;
  }
  .scanned-grid > div.full-width {
    grid-column: auto;
  }
  .capan-preview-bottom-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }
  .capan-output-buttons {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .capan-output-buttons #btn-download-pdf {
    grid-column: 1 / -1;
    height: 46px;
    font-size: 14.5px;
  }
  .capan-output-buttons button:not(#btn-download-pdf) {
    height: 40px;
    font-size: 13px;
  }
  .batch-head-actions {
    margin-left: 0;
    width: 100%;
  }
  .batch-head-actions button {
    flex: 1;
    justify-content: center;
  }
  .batch-tenants-grid {
    grid-template-columns: 1fr;
  }
  .batch-big-btn {
    width: 100%;
    justify-content: center;
    height: 48px;
    font-size: 15px;
    padding: 0 16px;
  }
  .citizen-application-toolbar-actions {
    flex-direction: column;
    width: 100%;
  }
  .citizen-application-toolbar-actions button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .capan-utility-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 480px;
    gap: 6px;
    padding: 4px;
  }
  .capan-tab-btn {
    width: 100%;
    padding: 0 6px;
    font-size: 13px;
    height: 40px;
    justify-content: center;
  }
  .capan-forms-selector-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .capan-form-tab-card[data-form-key="ct07"] {
    grid-column: 1 / -1;
  }
  .capan-form-tab-card {
    padding: 10px 12px;
    min-height: 52px;
  }
  .form-code-badge {
    font-size: 0.8rem;
  }
  .form-status-ready,
  .form-status-star {
    font-size: 10.5px;
    padding: 2px 6px;
  }
  .batch-qty-control-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .batch-qty-input-group {
    display: flex;
    justify-content: center;
    width: 100%;
  }
  .batch-qty-chips {
    justify-content: center;
  }
  .batch-tenant-card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .batch-tenant-actions {
    margin-left: 0;
    width: 100%;
    display: flex;
  }
  .batch-tenant-scan-btn {
    flex: 1;
    justify-content: center;
  }
  .batch-form-grid {
    grid-template-columns: 1fr;
  }
  .capan-modal-box {
    border-radius: 14px;
    max-height: calc(100dvh - 16px);
  }
  .capan-modal-header {
    padding: 14px 16px;
  }
  .capan-modal-body {
    padding: 14px 16px;
  }
  .capan-modal-footer {
    padding: 12px 16px;
    flex-direction: column-reverse;
    gap: 8px;
    width: 100%;
  }
  .capan-modal-footer button {
    width: 100%;
    justify-content: center;
    height: 40px;
  }
}

/* ==========================================================================
   14. BATCH REGISTRATION WORKSPACE (HỒ SƠ TẠM TRÚ THEO SỐ LƯỢNG)
   ========================================================================== */
.capan-batch-workspace {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.capan-batch-hero-card {
  background:
    radial-gradient(circle at 4% 20%, rgba(245, 158, 11, 0.12) 0%, rgba(254, 243, 199, 0.06) 28%, transparent 55%),
    radial-gradient(circle at 96% 20%, rgba(16, 185, 129, 0.10) 0%, rgba(2, 132, 199, 0.06) 30%, transparent 58%),
    #ffffff;
  border: 1.5px solid #fde68a;
  border-radius: 18px;
  padding: 22px 26px;
  box-shadow: 0 12px 32px -6px rgba(245, 158, 11, 0.08), 0 4px 14px -2px rgba(15, 23, 42, 0.03);
  position: relative;
  overflow: hidden;
}

.capan-batch-hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f59e0b 0%, #ef4444 40%, #10b981 100%);
}

.batch-hero-badge-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.batch-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 9999px;
  padding: 3px 10px;
  letter-spacing: 0.04em;
}

.batch-hero-counter {
  font-size: 12px;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 9999px;
  padding: 3px 12px;
}

.batch-hero-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px;
}

.batch-hero-header p {
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0;
}

.capan-batch-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.batch-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.batch-step-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.batch-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.batch-card-sub {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: #64748b;
}

.batch-head-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.batch-card-body {
  padding-top: 18px;
}

.batch-qty-control-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.batch-qty-input-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 4px 8px;
}

.batch-qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.batch-qty-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.batch-qty-input {
  width: 60px;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  text-align: center;
  outline: none;
}

.batch-qty-unit {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  margin-right: 4px;
}

.batch-qty-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.batch-chip-btn {
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.batch-chip-btn:hover {
  border-color: #f59e0b;
  color: #b45309;
}

.batch-chip-btn.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-color: #d97706;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.batch-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.batch-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 18px 0;
}

.batch-subhead {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.batch-tenants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.batch-tenant-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: all 0.2s ease;
}

.batch-tenant-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.batch-tenant-card.ready {
  border-color: #a7f3d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 60%);
}

.batch-tenant-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.batch-tenant-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.batch-tenant-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 2px 7px;
  letter-spacing: 0.02em;
}

.batch-tenant-name {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
}

.batch-tenant-id-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 2px 8px;
  letter-spacing: 0.5px;
}

.batch-tenant-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.batch-tenant-scan-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: #b91c1c;
  background: #fff5f5;
  border: 1.5px solid #fecaca;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.batch-tenant-scan-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.batch-tenant-delete-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.batch-tenant-delete-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  transform: translateY(-1px);
}

.batch-tenant-delete-btn:active {
  transform: scale(0.96);
}

.batch-grid-col-full {
  grid-column: 1 / -1;
}

.batch-progress-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.batch-progress-bar-bg {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.batch-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #10b981 100%);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.batch-progress-status {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  text-align: center;
}

.batch-export-action-row {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
}

.batch-big-btn {
  height: 52px;
  padding: 0 32px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 14px;
  background: linear-gradient(135deg, #dc2626 0%, #ea580c 50%, #f59e0b 100%);
  background-size: 200% auto;
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.batch-big-btn:hover {
  background-position: right center;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(234, 88, 12, 0.45);
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }
  html, body {
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    background: #ffffff !important;
    width: 210mm !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  .capan-header,
  .capan-header-top-bar,
  .capan-steps-card,
  .capan-qr-action-panel,
  .capan-forms-nav-card,
  .capan-preview-card-head,
  .capan-preview-bottom-actions,
  .interactive-signatures-panel,
  .capan-utility-nav-bar,
  .capan-footer-wrap,
  .doc-mobile-toolbar,
  .capan-hamburger-btn,
  .capan-mobile-drawer,
  .capan-app-root::before,
  .capan-app-root::after,
  .no-print {
    display: none !important;
  }
  .capan-app-root:not([hidden]),
  .capan-main-content:not([hidden]),
  .capan-forms-container:not([hidden]),
  .capan-ct01-workspace:not([hidden]),
  .citizen-application-workspace:not([hidden]),
  .capan-preview-card:not([hidden]),
  .capan-preview-card-body:not([hidden]),
  .doc-preview-wrapper:not([hidden]) {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    position: static !important;
    overflow: visible !important;
  }
  [hidden] {
    display: none !important;
  }
  .a4-page-scaler {
    zoom: 1 !important;
    width: 210mm !important;
    max-width: 210mm !important;
    margin: 0 auto !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    display: block !important;
    overflow: visible !important;
    transform: none !important;
  }
  .a4-page {
    box-shadow: none !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    background: #ffffff !important;
    border: none !important;
    width: 210mm !important;
    height: auto !important;
    min-height: 296mm !important;
    max-height: none !important;
    margin: 0 auto !important;
    padding: 16mm 15mm 16mm 22mm !important;
    display: block !important;
    position: relative !important;
    overflow: visible !important;
  }
  .ct01-doc-page {
    page-break-after: always !important;
    break-after: page !important;
  }
  .contract-doc-page {
    page-break-before: always !important;
    break-before: page !important;
    page-break-after: auto !important;
    break-after: auto !important;
  }
  .ct01-signatures-container,
  .ct01-sig-col {
    border: none !important;
  }
}

/* ============================================================================
   A4 EXPORT PAGE STYLES (Strict Desktop Dimensions for html2canvas on Mobile/iOS)
   ============================================================================ */
.a4-export-page {
  box-sizing: border-box !important;
  color: #000000 !important;
  background: #ffffff !important;
  width: 794px !important;
  min-width: 794px !important;
  max-width: 794px !important;
  height: 1123px !important;
  min-height: 1123px !important;
  max-height: 1123px !important;
  margin: 0 !important;
  padding: 16mm 15mm 16mm 22mm !important;
  font-size: 11.5pt !important;
  line-height: 1.35 !important;
  position: relative !important;
  box-shadow: none !important;
  transform: none !important;
  -webkit-transform: none !important;
  zoom: 1 !important;
  overflow: hidden !important;
}

.a4-export-page .ct01-signatures-container {
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  width: 100% !important;
  min-height: 185px !important;
  margin-top: 10px !important;
  border: none !important;
}

.a4-export-page .ct01-sig-col {
  text-align: center !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  min-width: 0 !important;
  padding: 5px 3px 6px !important;
  border: none !important;
}

.a4-export-page .ct01-sig-col:first-child { flex: 0 0 26.8% !important; width: 26.8% !important; max-width: 26.8% !important; }
.a4-export-page .ct01-sig-col:nth-child(2) { flex: 0 0 25.2% !important; width: 25.2% !important; max-width: 25.2% !important; }
.a4-export-page .ct01-sig-col:nth-child(3) { flex: 0 0 24.8% !important; width: 24.8% !important; max-width: 24.8% !important; }
.a4-export-page .ct01-sig-col:nth-child(4) { flex: 0 0 23.2% !important; width: 23.2% !important; max-width: 23.2% !important; border-right: none !important; }

.a4-export-page .contract-signature-table {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-top: 24px !important;
  padding: 0 35px !important;
}

.a4-export-page .contract-sig-cell {
  text-align: center !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  flex: 0 0 220px !important;
  width: 220px !important;
  box-sizing: border-box !important;
}


/* Disabled state for capan-btn-coral-large */
.capan-btn-coral-large:disabled,
.capan-btn-coral-large[disabled] {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  transform: none !important;
  filter: grayscale(0.4) !important;
  pointer-events: none !important;
}

/* Card 5 status badge alignment */
.form-tab-status-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Dedicated Camera Roll banner */
.capan-camera-roll-banner {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1.5px solid #7dd3fc;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.camera-roll-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #bae6fd;
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.15);
}

/* iOS Safari font zoom fix & mobile touch responsiveness */
@media (max-width: 768px) {
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="tel"],
  input[type="email"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

@media (max-width: 640px) {
  .capan-camera-roll-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .capan-camera-roll-banner button {
    width: 100%;
    justify-content: center;
    height: 42px;
  }
  .capan-footer-export-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .capan-footer-export-actions button,
  .capan-footer-export-actions a {
    width: 100%;
    justify-content: center;
    height: 42px;
  }
}

/* ==========================================================================
   COLLAPSIBLE SECTIONS (HOUSE INFO & BATCH TENANTS)
   ========================================================================== */
.capan-house-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1.5px solid #cbd5e1;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  text-align: left;
}

.capan-house-toggle-btn:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-color: #94a3b8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.capan-house-toggle-btn:active {
  transform: scale(0.99);
}

.house-toggle-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.28);
  flex-shrink: 0;
}

.house-badge-status {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #475569;
  white-space: nowrap;
}

.house-badge-status.filled {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.batch-tenant-collapse-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}

.batch-tenant-collapse-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.batch-tenant-collapse-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0d9488 0%, #059669 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.25);
  flex-shrink: 0;
}
