/* Society NOC — shared styles */

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: linear-gradient(135deg, #f6f9fc 0%, #eef3f8 100%);
  color: #1b2a44;
  min-height: 100vh;
}

header.topbar {
  background: linear-gradient(90deg, #0b3d91, #1e5fbf);
  color: white;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
header.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; }
header.topbar nav a {
  color: white;
  text-decoration: none;
  margin-left: 20px;
  font-size: 14px;
  opacity: 0.85;
}
header.topbar nav a:hover { opacity: 1; text-decoration: underline; }
header.topbar nav a.active { font-weight: 700; opacity: 1; }

main { max-width: 1100px; margin: 32px auto; padding: 0 24px; }

.card {
  background: white;
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(11,61,145,0.06);
}
.card h2 {
  margin: 0 0 8px;
  color: #0b3d91;
  font-size: 20px;
  border-bottom: 2px solid #eef3f8;
  padding-bottom: 8px;
}
.card .subtitle {
  font-size: 13px;
  color: #5a6b85;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: 1 / -1; }
label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #344563;
}
label .req { color: #d04848; }
input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid #d4dcea;
  border-radius: 8px;
  background: #fafbfd;
  transition: border 0.15s, background 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: #1e5fbf;
  background: white;
  outline: none;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.doc-card {
  background: #fafbfd;
  border: 1.5px dashed #c6d0e2;
  border-radius: 10px;
  padding: 14px;
  position: relative;
}
.doc-card.has-file { border-style: solid; border-color: #2e9c5f; background: #effaf3; }
.doc-card label { font-size: 13px; margin-bottom: 8px; display: block; }
.doc-card input[type=file] { font-size: 12px; width: 100%; }
.doc-card .filename { font-size: 11px; color: #2e7a4a; margin-top: 6px; word-break: break-all; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: #0b3d91; color: white; }
.btn-primary:hover { background: #1e5fbf; box-shadow: 0 4px 12px rgba(11,61,145,0.3); }
.btn-success { background: #2e9c5f; color: white; }
.btn-success:hover { background: #3bb574; }
.btn-danger { background: #d04848; color: white; }
.btn-danger:hover { background: #e26060; }
.btn-warning { background: #c9a227; color: white; }
.btn-warning:hover { background: #dcb53c; }
.btn-secondary { background: #e9eef7; color: #1b2a44; }
.btn-secondary:hover { background: #d4dcea; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge.submitted { background: #eef3f8; color: #1b2a44; }
.badge.ai_verifying { background: #fff3d0; color: #876200; }
.badge.ai_rejected, .badge.secretary_rejected { background: #fde0e0; color: #b62828; }
.badge.ai_verified, .badge.secretary_review { background: #d8e9ff; color: #1e5fbf; }
.badge.approved, .badge.noc_generated { background: #d4f5e0; color: #1f7a44; }
.badge.conditional, .badge.conditionally_approved { background: #fef3c7; color: #92400e; }

.conditional-banner {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fef3c7;
  border-left: 4px solid #c9a227;
  border-radius: 6px;
  font-size: 13px;
  color: #78350f;
}

.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 10px;
  background: #1b2a44;
  color: white;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 1000;
  font-size: 14px;
  max-width: 380px;
  animation: slideIn 0.2s ease-out;
}
.toast.success { background: #2e9c5f; }
.toast.error { background: #d04848; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid #eef3f8; }
th { background: #fafbfd; color: #5a6b85; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
tr:hover td { background: #fafbfd; cursor: pointer; }

.timeline-item {
  padding: 10px 0 10px 22px;
  border-left: 2px solid #d4dcea;
  position: relative;
  margin-left: 8px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1e5fbf;
}
.timeline-item .when { font-size: 11px; color: #8595af; }
.timeline-item .what { font-weight: 600; }
.timeline-item .who { font-size: 12px; color: #5a6b85; margin-top: 2px; }

.issue-list { list-style: none; padding: 0; margin: 0; }
.issue-list li {
  padding: 10px 14px;
  border-left: 4px solid #d04848;
  background: #fde0e0;
  margin-bottom: 8px;
  border-radius: 6px;
  font-size: 13px;
  color: #621e1e;
}
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li {
  padding: 8px 14px;
  border-left: 4px solid #2e9c5f;
  background: #effaf3;
  margin-bottom: 6px;
  border-radius: 6px;
  font-size: 13px;
  color: #1f5e3a;
}

.purpose-toggle { display: flex; gap: 0; border-radius: 10px; overflow: hidden; border: 1px solid #d4dcea; width: fit-content; margin-bottom: 18px; }
.purpose-toggle button {
  border: none;
  background: white;
  padding: 10px 22px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  color: #5a6b85;
}
.purpose-toggle button.active { background: #0b3d91; color: white; }

.hidden { display: none !important; }

/* Inline field-level error (e.g. duplicate flat check) */
.inline-error {
  background: #fde0e0;
  border-left: 4px solid #d04848;
  color: #b62828;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.muted { color: #8595af; font-size: 12px; }

/* Purpose selection card (top of page) */
.purpose-card { border-left: 5px solid #0b3d91; }
.purpose-card h2 { color: #0b3d91; }
.purpose-card .purpose-toggle { margin-top: 4px; }

/* Bank details card */
.bank-details-card { border-left: 5px solid #2e9c5f; }
.bank-details-card h2 { color: #1f7a44; }
.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.bank-label { display: block; font-size: 11px; color: #5a6b85; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px; }
.bank-value { display: block; font-size: 14px; font-weight: 600; color: #1b2a44; }
.bank-value.mono { font-family: 'Courier New', monospace; letter-spacing: 0.5px; }
.bank-value.amount-due { font-size: 20px; color: #0b3d91; }

/* Per-document review card (secretary dashboard) */
.doc-review-card {
  border: 1.5px solid #d4dcea;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.doc-review-card:last-of-type { margin-bottom: 0; }
.doc-review-card.doc-status-approved {
  border-color: #2e9c5f;
  background: #f4fdf7;
}
.doc-review-card.doc-status-flagged {
  border-color: #d04848;
  background: #fff5f5;
}
.doc-review-card.doc-status-pending {
  border-color: #d4dcea;
  background: #fafbfd;
}

/* Top row: badge + info + View button */
.doc-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.doc-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.doc-card-info strong { font-size: 14px; }

/* Status badge */
.doc-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.doc-badge-pending  { background: #eef3f8; color: #5a6b85; }
.doc-badge-approved { background: #d4f5e0; color: #1f7a44; }
.doc-badge-flagged  { background: #fde0e0; color: #b62828; }

/* Action row: textarea + buttons */
.doc-card-actions { margin-top: 10px; }
.doc-flag-ta {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid #d4dcea;
  border-radius: 8px;
  resize: vertical;
  margin-bottom: 8px;
}
.doc-action-btns { display: flex; gap: 8px; }
.btn-sm { padding: 7px 14px; font-size: 12px; }

/* Read-only flagged note (non-review view) */
.doc-flag-note {
  margin-top: 8px;
  font-size: 12px;
  color: #b62828;
  padding: 6px 10px;
  background: #fde0e0;
  border-radius: 6px;
}

/* Decision section at bottom of docs card */
.decision-divider {
  border: none;
  border-top: 2px solid #eef3f8;
  margin: 18px 0 14px;
}
.doc-decision-section { padding-top: 4px; }
.doc-progress {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.prog-item {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
}
.prog-approved { background: #d4f5e0; color: #1f7a44; }
.prog-flagged  { background: #fde0e0; color: #b62828; }
.prog-pending  { background: #eef3f8; color: #5a6b85; }

/* Per-document notes on status page */
.doc-note-row {
  padding: 8px 14px;
  border-left: 4px solid #f0b429;
  background: #fffbef;
  margin-bottom: 8px;
  border-radius: 6px;
  font-size: 13px;
  color: #5a3800;
}

/* NOC upload card (secretary dashboard) */
.noc-upload-card { border-left: 5px solid #0b3d91; }
.noc-upload-card h2 { color: #0b3d91; }

/* Edit-mode banner (shown on index page when ?edit= is set) */
.edit-banner {
  background: #fff7e0;
  border: 1.5px solid #f0b429;
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 18px;
  font-size: 14px;
  color: #7a4f00;
  display: flex;
  align-items: center;
  gap: 10px;
}
.edit-banner strong { color: #5a3800; }
.banner-link {
  margin-left: auto;
  color: #0b3d91;
  font-size: 13px;
  text-decoration: underline;
}

/* Secretary rejection comment (status page) */
.secretary-rejected-comment {
  border-left: 5px solid #d04848;
}
.secretary-rejected-comment h2 { color: #b62828; }
.secretary-rejected-comment .comment-body {
  font-size: 14px;
  color: #621e1e;
  background: #fde0e0;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 8px 0;
}

/* Secretary approval comment (status page) */
.secretary-approved-comment {
  border-left: 5px solid #2e9c5f;
}
.secretary-approved-comment h2 { color: #1f7a44; }
.secretary-approved-comment .comment-body {
  font-size: 14px;
  color: #1f5e3a;
  background: #effaf3;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 8px 0;
}

/* Edit & Resubmit CTA card (status page) */
.resubmit-cta {
  border-left: 5px solid #f0b429;
}
.resubmit-cta h2 { color: #7a4f00; }
.resubmit-cta p { font-size: 14px; color: #5a4500; margin-bottom: 16px; }

/* Doc card — already accepted, no action needed (edit mode) */
.doc-card.on-file {
  border-style: solid;
  border-color: #2e9c5f;
  background: #effaf3;
  opacity: 0.75;
}
.doc-card.on-file .filename {
  color: #1f7a44;
  font-size: 11px;
  margin-top: 6px;
}

/* Doc card — pending (not reviewed) in edit mode — re-upload recommended */
.doc-card.pending-doc {
  border-style: solid;
  border-width: 2px;
  border-color: #d97706;
  background: #fffbeb;
  box-shadow: 0 0 0 3px rgba(217,119,6,.12);
}
.pending-note {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #92400e;
  font-weight: 700;
  background: #fef3c7;
  padding: 5px 8px;
  border-radius: 4px;
}

/* Doc card — flagged by secretary, must re-upload */
.doc-card.flagged-doc {
  border-style: solid;
  border-width: 2px;
  border-color: #b91c1c;
  background: #fee2e2;
  box-shadow: 0 0 0 3px rgba(185,28,28,.15);
}
.flag-note {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #991b1b;
  font-weight: 700;
  background: #fecaca;
  padding: 5px 8px;
  border-radius: 4px;
}
