* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f3f4f6;
  color: #1e293b;
  font-size: 16px;
  line-height: 1.5;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-header {
  flex: 0 0 auto;
  background: linear-gradient(90deg, #1e40af, #2563eb);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
}

.app-header-inner {
  width: 100%;
  max-width: 1300px;
  padding: 12px 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.app-brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.app-logo {
  height: 44px;
  width: auto;
  display: block;
}

.app-title {
  justify-self: center;
  text-align: center;
  min-width: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: #fff;
}

.app-header h1 .tm {
  font-size: 11px;
  vertical-align: super;
  font-weight: 500;
  margin-left: 1px;
}

.app-header .tagline {
  font-size: 14px;
  opacity: 0.92;
  margin-top: 2px;
}

.app-nav {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.app-nav-link:hover { background: rgba(255, 255, 255, 0.12); }

.app-nav-login {
  background: rgba(255, 255, 255, 0.15);
}

.app-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #fff;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.app-nav-icon:hover { background: rgba(255, 255, 255, 0.12); }

.app-profile-popover {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 220px;
  background: #fff;
  color: #1e293b;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  padding: 12px 14px;
  z-index: 200;
}

.app-profile-popover .pp-email {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  word-break: break-all;
  margin-bottom: 10px;
}

.app-profile-popover .pp-logout {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 14px;
  cursor: pointer;
}

.app-profile-popover .pp-logout:hover { background: #f9fafb; }

.app-nav-icon-wrap { position: relative; }

.app-body {
  flex: 1;
  min-height: 0;
  padding: 16px;
  display: flex;
  justify-content: center;
}

.app-body-inner {
  width: 100%;
  max-width: 1300px;
  height: 100%;
}

.gov-interface {
  display: flex;
  height: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.gov-left-panel {
  width: 420px;
  flex: 0 0 420px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e5e7eb;
  background: #fafafa;
}

.gov-left-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.gov-left-header h6 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #1e293b;
}

.gov-committees-list {
  flex: 1;
  overflow-y: auto;
}

.gc-card {
  transition: background 0.12s ease;
}

.gc-card:hover {
  background: #eef2ff;
}

.gc-card-active {
  background: #dbeafe !important;
  border-left: 3px solid #2563eb;
}

.gov-right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.loading-spinner {
  padding: 24px;
  text-align: center;
  color: #6b7280;
  font-size: 15px;
}

.spinner-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #c7d2fe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: pft-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

.spinner-icon-lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

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

button.btn-primary {
  padding: 10px 22px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

button.btn-primary:hover { background: #1d4ed8; }

button.btn-secondary {
  padding: 10px 18px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 15px;
  cursor: pointer;
}

button.btn-secondary:hover { background: #f9fafb; }

.framework-tag {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 3px;
  background: #dbeafe;
  color: #1e40af;
  white-space: nowrap;
  font-weight: 600;
}

#pgen-detail-form { overflow-y: auto; flex: 1; padding-right: 4px; }

.docx-preview { padding: 16px; }
.docx-preview section.docx { box-shadow: 0 0 4px rgba(0,0,0,0.1); margin-bottom: 12px; }

.pgen-tabs {
  display: flex;
  flex: 0 0 auto;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  padding: 0 16px;
  gap: 4px;
}

.pgen-tab {
  padding: 12px 18px;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.pgen-tab:hover { color: #1e293b; }

.pgen-tab.pgen-tab-active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.pgen-tab-panel {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

.pgen-tab-panel.pgen-tab-active {
  display: flex;
}

.pgen-document-display {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f3f4f6;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.pgen-document-display .docx-wrapper {
  background: transparent !important;
  padding: 0 !important;
}

.pgen-document-display section.docx {
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.12);
  margin: 0 auto 14px;
  background: #fff;
}

.pgen-document-display .pgen-doc-loading,
.pgen-document-display .pgen-doc-error {
  padding: 24px;
  text-align: center;
}

.pgen-document-display .pgen-doc-error { color: #ef4444; }
.pgen-document-display .pgen-doc-loading { color: #6b7280; }

.pft-login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.pft-login-card {
  width: 100%;
  max-width: 380px;
  margin: 0 20px;
  background: #fff;
  border-radius: 10px;
  padding: 28px 28px 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.pft-login-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #1e293b;
}

.pft-login-card p {
  margin: 0 0 18px;
  font-size: 14px;
  color: #6b7280;
}

.pft-login-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.pft-login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 15px;
  margin-bottom: 14px;
}

.pft-login-card input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.pft-login-error {
  font-size: 13px;
  color: #dc2626;
  margin: -8px 0 12px;
  min-height: 16px;
}

.pft-login-card button {
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.pft-login-card button:hover { background: #1d4ed8; }

/* ---------- Auth modal (signup / login) ---------- */
.pft-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.pft-modal-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 12px;
  padding: 26px 26px 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  position: relative;
}

.pft-modal-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #1e293b;
}

.pft-modal-card p.pft-modal-sub {
  margin: 0 0 18px;
  font-size: 14px;
  color: #6b7280;
}

.pft-modal-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin: 10px 0 6px;
}

.pft-modal-card input[type="email"],
.pft-modal-card input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 15px;
}

.pft-modal-card input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.pft-modal-error {
  font-size: 13px;
  color: #dc2626;
  margin-top: 8px;
  min-height: 16px;
}

.pft-modal-card button.pft-modal-submit {
  width: 100%;
  margin-top: 14px;
  padding: 11px 14px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.pft-modal-card button.pft-modal-submit:hover { background: #1d4ed8; }
.pft-modal-card button.pft-modal-submit:disabled { opacity: 0.6; cursor: default; }

.pft-modal-toggle {
  margin-top: 14px;
  font-size: 13px;
  color: #6b7280;
  text-align: center;
}

.pft-modal-toggle button {
  background: none;
  border: none;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  padding: 0 2px;
}

.pft-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
}

.pft-modal-close:hover { color: #1e293b; }

/* ---------- Plan selector ---------- */
.pft-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 4px;
}

@media (max-width: 520px) {
  .pft-plans { grid-template-columns: 1fr; }
}

.pft-plan {
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 14px 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.pft-plan:hover { border-color: #93c5fd; background: #f8faff; }

.pft-plan.pft-plan-selected {
  border-color: #2563eb;
  background: #eff6ff;
}

.pft-plan-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 6px;
}

.pft-plan-price {
  font-size: 20px;
  font-weight: 700;
  color: #2563eb;
  margin: 0 0 6px;
}

.pft-plan-desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.4;
}

.pft-modal-note {
  font-size: 12px;
  color: #6b7280;
  margin-top: 12px;
  line-height: 1.4;
}

/* ---------- FAQ page (faq.php) ---------- */
.faq-page {
  max-width: 820px;
  margin: 24px auto;
  padding: 24px 28px 32px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.faq-page h2 {
  margin: 0 0 18px;
  color: #1e293b;
}

.faq-item {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.faq-item:last-child { border-bottom: none; }

.faq-item h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #1e293b;
}

.faq-item p {
  margin: 0;
  color: #475569;
  line-height: 1.55;
}
