/* ─── 0. DIVISION SELECTOR ───────────────────────────────────── */
#screen-division {
  background: linear-gradient(160deg, #1E2470 0%, #171B50 45%, #0D1130 100%);
  height: 100svh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Header — logo + tagline */
.div-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 20px;
  flex-shrink: 0;
}
.div-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  margin-bottom: 10px;
  filter: brightness(0) invert(1);
}
.div-tagline {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  text-align: center;
}

/* Division grid — stretches to fill all space below the header */
.div-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 12px 16px;
  width: 100%;
  box-sizing: border-box;
}

/* Card — image-backed */
.div-card {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
  text-align: left;
  background: #e2e4eb;
}
.div-card:not([disabled]):hover {
  box-shadow: 0 6px 20px rgba(15,17,30,0.18);
  transform: translateY(-2px);
}
.div-card:not([disabled]):active {
  transform: translateY(0);
}

/* Background image layer */
.div-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #c8cad6;
  transition: transform 280ms ease;
}
.div-card:not([disabled]):hover .div-card-bg {
  transform: scale(1.04);
}

/* Gradient overlay so text is always readable */
.div-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10,12,32,0.82) 0%,
    rgba(10,12,32,0.35) 50%,
    rgba(10,12,32,0.10) 100%
  );
}
.div-card--unavailable .div-card-overlay {
  background: rgba(220,222,232,0.65);
}

/* Text content sits over the overlay */
.div-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px 12px;
}
.div-card-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
  line-height: 1.2;
}
.div-card-sub {
  display: block;
  font-size: 10px;
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
  line-height: 1.3;
}

/* Unavailable — desaturated photo, deeper overlay */
.div-card--unavailable {
  cursor: not-allowed;
}
.div-card--unavailable .div-card-bg {
  filter: grayscale(0.75) brightness(0.7);
}
.div-card--unavailable .div-card-overlay {
  background: linear-gradient(
    to top,
    rgba(10,12,32,0.88) 0%,
    rgba(10,12,32,0.55) 55%,
    rgba(10,12,32,0.25) 100%
  );
}

/* Coming Soon pill — top-right corner, no emoji */
.div-card-soon {
  position: absolute;
  top: 9px;
  right: 9px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.28);
  color: rgba(255,255,255,0.85);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Selected — navy ring */
.div-card--selected {
  border-color: var(--navy);
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--navy), 0 8px 24px rgba(15,17,30,0.2);
}

.div-grid { padding-bottom: 24px; }

@media (min-width: 600px) {
  .div-grid   { grid-template-columns: 1fr 1fr 1fr; gap: 14px; padding: 0 20px 24px; }
  .div-header { padding: 36px 32px 20px; }
  .div-logo   { height: 40px; }
}

/* ─── 1. LOGIN ───────────────────────────────────────────────── */
#screen-login {
  background: linear-gradient(160deg, #1E2470 0%, #171B50 45%, #0D1130 100%);
  justify-content: flex-end;
}
.login-brand-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 32px;
  color: white;
}
.login-logo {
  width: 180px;
  height: auto;
  margin: 0 auto 14px;
  display: block;
  filter: brightness(0) invert(1);
}
@media (min-width: 600px) {
  .login-logo { width: 210px; }
}
@media (min-width: 900px) {
  .login-logo { width: 230px; }
  .login-brand-area { padding: 60px 48px 40px; }
  .login-form-sheet { padding: 44px 56px 56px; }
}
.login-form-sheet {
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 32px 24px 40px;
  box-shadow: 0 -6px 40px rgba(10,12,32,0.25);
}
.login-version {
  text-align: center;
  font-size: 11px;
  color: var(--text-hint);
  margin-top: 20px;
}
.login-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 600;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  cursor: pointer;
  padding: 7px 14px 7px 10px;
  margin-bottom: 16px;
  font-family: var(--font);
  transition: background 130ms ease, border-color 130ms ease;
}
.login-back-btn:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.35);
}
.login-division-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 14px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-full);
  color: rgba(255,255,255,0.9);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.forgot-link {
  display: block;
  text-align: center;
  color: var(--navy);
  font-size: 14px;
  font-weight: 500;
  margin-top: 16px;
}
.forgot-link:hover { text-decoration: underline; }

/* ─── 2. HOME ────────────────────────────────────────────────── */
.home-header {
  background: var(--navy);
  color: white;
  padding: 20px 20px 24px;
  flex-shrink: 0;
}
.home-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.home-greeting { font-size: 20px; font-weight: 800; line-height: 1.2; letter-spacing: -0.3px; }
.home-date     { font-size: 13px; opacity: 0.6; margin-top: 3px; }
.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
}
.home-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: 90px;
  position: relative;
  isolation: isolate;
}
/* Emboss shadow layer — offset down-right, dark */
.home-body::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% + 3px), calc(-50% + 3px)) rotate(-12deg);
  width: 90%;
  height: 120px;
  background: url('../assets/servest-logo.png') center / contain no-repeat;
  filter: brightness(0) opacity(0.13);
  pointer-events: none;
  z-index: -1;
}
/* Emboss highlight layer — offset up-left, white */
.home-body::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% - 2px), calc(-50% - 2px)) rotate(-12deg);
  width: 90%;
  height: 120px;
  background: url('../assets/servest-logo.png') center / contain no-repeat;
  filter: brightness(0) invert(1) opacity(0.65);
  pointer-events: none;
  z-index: 0;
}
@media (min-width: 600px) {
  .home-header { padding: 24px 28px 28px; }
  .home-greeting { font-size: 22px; }
  .home-body { padding: 20px 28px; }
  .user-avatar { width: 48px; height: 48px; font-size: 16px; }
}
@media (min-width: 900px) {
  .home-header { padding: 28px 48px 32px; }
}

/* ─── 3. SITES ───────────────────────────────────────────────── */
#screen-sites .screen-body { padding: 0; }

/* ─── 4. AUDIT START ─────────────────────────────────────────── */
.audit-start-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

/* ─── 5. CATEGORIES ──────────────────────────────────────────── */
#screen-categories .screen-body { padding: 0; padding-bottom: 80px; }
.categories-footer {
  padding: 16px;
  background: var(--surface);
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--border);
}

/* ─── 6. QUESTIONS ───────────────────────────────────────────── */
#screen-questions { overflow: hidden; }
.question-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 24px;
}
.question-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.question-meta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.question-text {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-primary);
}
.comment-section {
  background: white;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.comment-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.comment-label .req { color: var(--red); font-size: 11px; }
.comment-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  font-family: var(--font);
  resize: none;
  min-height: 80px;
  outline: none;
  color: var(--text-primary);
  line-height: 1.5;
}
.comment-input:focus { border-color: var(--navy); }
.comment-input::placeholder { color: var(--text-hint); }
.photo-section {
  background: white;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.photo-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* ─── 7. REVIEW ──────────────────────────────────────────────── */
.review-body { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 24px; }
.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.score-row:last-child { border-bottom: none; }
.score-row-name { font-size: 14px; font-weight: 500; }
.score-row-val  { font-size: 14px; font-weight: 700; }
.failed-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--red);
  margin: 16px 0 8px;
}
.review-footer {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: white;
  flex-shrink: 0;
}

/* ─── 8. SIGN-OFF ────────────────────────────────────────────── */
.signoff-body { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 24px; }
.sig-clear-btn {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 0;
  background: none;
  border: none;
  cursor: pointer;
}
.sig-clear-btn:hover { color: var(--red); }
.signoff-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: white;
  flex-shrink: 0;
}

/* ─── 9. CONFIRMATION ────────────────────────────────────────── */
.confirm-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.confirm-title {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
}
.confirm-site {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 6px;
}
.confirm-score-line {
  font-size: 14px;
  text-align: center;
  margin-bottom: 12px;
}
.emailed-badge {
  background: var(--green-bg);
  color: var(--green-text);
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.confirm-recipients {
  width: 100%;
  margin-bottom: 28px;
}
.confirm-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

/* ─── 10. PROFILE ────────────────────────────────────────────── */
.profile-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 24px;
}
.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 24px;
  text-align: center;
}
.profile-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}
.profile-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}
.profile-role-badge {
  background: var(--navy);
  color: white;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}
.profile-detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.profile-detail-row.last { border-bottom: none; }
.profile-detail-icon {
  color: var(--text-secondary);
  flex-shrink: 0;
  display: flex;
}
.profile-detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.profile-detail-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ─── DIVISION SCREEN — Customer Feedback button ─────────────── */
.div-footer {
  padding: 12px 16px 24px;
  padding-bottom: max(24px, calc(16px + env(safe-area-inset-bottom)));
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}
.div-feedback-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.10);
  border: 1.5px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.85);
  border-radius: 24px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
  max-width: 340px;
  justify-content: center;
}
.div-feedback-btn:hover { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.4); }
.div-feedback-icon { font-size: 18px; }

/* ─── SITE FEEDBACK SCREEN ────────────────────────────────────── */
#screen-feedback {
  background: var(--bg-screen, #f4f5f9);
}
.fb-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  background: #fff;
  border-bottom: 1px solid #e8e9ee;
  flex-shrink: 0;
}
.fb-back {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--navy, #003366);
  cursor: pointer;
  padding: 4px 8px 4px 0;
  line-height: 1;
}
.fb-header-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
}
.fb-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  gap: 0;
  background: #fff;
  border-bottom: 1px solid #e8e9ee;
  flex-shrink: 0;
}
.fb-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8e9ee;
  color: #999;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}
.fb-step-dot.active { background: var(--navy, #003366); color: #fff; }
.fb-step-dot.done   { background: #27ae60; color: #fff; }
.fb-step-line {
  flex: 1;
  height: 2px;
  background: #e8e9ee;
  max-width: 40px;
}
.fb-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.fb-step-label {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 12px;
}
.fb-breadcrumb {
  font-size: 12px;
  color: var(--navy, #003366);
  background: rgba(0,51,102,0.08);
  border-radius: 8px;
  padding: 6px 12px;
  margin-bottom: 14px;
  font-weight: 500;
}
.fb-site-chip {
  display: inline-block;
  background: rgba(0,51,102,0.08);
  color: var(--navy, #003366);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.fb-search {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border: 1.5px solid #dde0e8;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
}
.fb-search:focus { border-color: var(--navy, #003366); }
.fb-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.fb-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f4;
  transition: background 0.12s;
}
.fb-list-item:last-child { border-bottom: none; }
.fb-list-item:active { background: #f4f5f9; }
.fb-list-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #003366, #1a5276);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fb-list-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f0f3f8;
  color: var(--navy, #003366);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fb-list-text { flex: 1; min-width: 0; }
.fb-list-name { font-size: 14px; font-weight: 600; color: #1a1a2e; }
.fb-list-sub  { font-size: 12px; color: #888; margin-top: 2px; }
.fb-list-arrow { font-size: 20px; color: #bbb; flex-shrink: 0; }
.fb-loading { padding: 20px; text-align: center; color: #888; font-size: 13px; }
.fb-empty   { padding: 20px; text-align: center; color: #aaa; font-size: 13px; }
.fb-error   { padding: 20px; text-align: center; color: #e74c3c; font-size: 13px; }

/* Service tile grid — step 1 of feedback */
.fb-div-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.fb-div-btn {
  position: relative;
  height: 110px;
  border: none;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  background-color: #c8cad6;
  padding: 0;
  text-align: left;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.fb-div-btn:hover  { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15,17,30,0.18); }
.fb-div-btn:active { transform: translateY(0); }
.fb-div-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,12,32,0.78) 0%, rgba(10,12,32,0.2) 60%, transparent 100%);
}
.fb-div-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px 10px;
}
.fb-div-label { display: block; font-size: 13px; font-weight: 700; color: #fff; line-height: 1.2; }
.fb-div-sub   { display: block; font-size: 10px; color: rgba(255,255,255,0.65); margin-top: 2px; }
.fb-div-btn--unavail { cursor: not-allowed; }
.fb-div-btn--unavail .fb-div-overlay { background: rgba(20,20,40,0.55); }
.fb-div-soon {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 9px; font-weight: 700;
  background: rgba(255,255,255,0.18);
  color: #fff;
  padding: 2px 6px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Details step */
.fb-section-label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin: 14px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.fb-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1.5px solid #dde0e8;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 90px;
}
.fb-textarea:focus { border-color: var(--navy, #003366); }
.fb-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border: 1.5px solid #dde0e8;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  margin-bottom: 8px;
  display: block;
}
.fb-input:focus { border-color: var(--navy, #003366); }
.fb-photo-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.fb-photo-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 1.5px dashed #bbb;
  font-size: 22px;
  color: #888;
  cursor: pointer;
}
.fb-photo-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.fb-thumb-wrap { position: relative; }
.fb-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; display: block; }
.fb-thumb-del {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e74c3c;
  color: #fff;
  border: none;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.fb-submit-btn { width: 100%; margin-top: 16px; }

/* Done screen */
.fb-done-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 24px 24px;
}
.fb-done-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #27ae60;
  color: #fff;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(39,174,96,0.35);
}
.fb-done-title { font-size: 22px; font-weight: 800; color: #1a1a2e; margin-bottom: 10px; }
.fb-done-msg   { font-size: 14px; color: #555; line-height: 1.5; margin-bottom: 20px; }
.fb-done-ref   { font-size: 13px; color: #777; margin-bottom: 4px; }
.fb-done-new  { width: 100%; margin-top: 24px; }
.fb-done-home { width: 100%; margin-top: 10px; }

/* ─── HOME — Feedback banner + complaints action ─────────────── */
.home-feedback-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fdf2f2;
  border: 1.5px solid #f5c6c6;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  cursor: pointer;
}
.home-fb-icon  { font-size: 20px; flex-shrink: 0; }
.home-fb-text  { flex: 1; font-size: 13px; color: #c0392b; font-weight: 500; }
.home-fb-count { font-weight: 800; font-size: 15px; }
.home-fb-arrow { font-size: 20px; color: #c0392b; }
.fb-badge-inline {
  display: inline-block;
  background: #e74c3c;
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 2px;
}
.action-icon.red {
  background: rgba(231,76,60,0.12);
  color: #e74c3c;
}

/* ─── COMPLAINTS SCREEN ───────────────────────────────────────── */
#screen-complaints {
  background: var(--bg-screen, #f4f5f9);
}
.comp-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  background: #fff;
  border-bottom: 1px solid #e8e9ee;
  flex-shrink: 0;
}
.comp-back {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--navy, #003366);
  cursor: pointer;
  padding: 4px 8px 4px 0;
}
.comp-header-title { font-size: 16px; font-weight: 700; color: #1a1a2e; }
.comp-tabs {
  display: flex;
  gap: 0;
  background: #fff;
  border-bottom: 1px solid #e8e9ee;
  flex-shrink: 0;
  overflow-x: auto;
}
.comp-tab {
  flex: 1;
  min-width: 70px;
  padding: 10px 6px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.comp-tab.active { color: var(--navy, #003366); border-bottom-color: var(--navy, #003366); }
.comp-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.comp-loading, .comp-empty { padding: 40px; text-align: center; color: #aaa; font-size: 13px; }
.comp-item {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  cursor: pointer;
  transition: box-shadow 0.12s;
}
.comp-item:active { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.comp-item-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.comp-item-site { font-size: 13px; font-weight: 700; color: #1a1a2e; }
.comp-item-issue { font-size: 14px; font-weight: 600; color: #003366; margin-bottom: 4px; }
.comp-item-desc { font-size: 13px; color: #555; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comp-item-meta { font-size: 11px; color: #aaa; }
.badge-red    { background: #fdf2f2; color: #c0392b; border: 1px solid #f5c6c6; }
.badge-amber  { background: #fef9e7; color: #d35400; border: 1px solid #fad7a0; }
.badge-grey   { background: #f4f5f9; color: #888;    border: 1px solid #dde0e8; }
.badge-navy   { background: rgba(0,51,102,0.08); color: #003366; border: 1px solid rgba(0,51,102,0.2); }

/* Complaint detail overlay */
.comp-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.comp-detail-overlay.open { opacity: 1; pointer-events: all; }
.comp-detail-panel {
  width: 100%;
  max-height: 85vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32,0,0.1,1);
  overflow: hidden;
}
.comp-detail-overlay.open .comp-detail-panel { transform: translateY(0); }
.comp-detail-header {
  display: flex;
  align-items: center;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #eee;
  gap: 10px;
}
.comp-detail-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #888;
  cursor: pointer;
  padding: 0 8px 0 0;
  line-height: 1;
}
.comp-detail-title { font-size: 15px; font-weight: 700; color: #1a1a2e; }
.comp-detail-body { flex: 1; overflow-y: auto; padding: 16px; }
.comp-detail-site { font-size: 13px; font-weight: 700; color: #555; margin-bottom: 6px; }
.comp-detail-category { font-size: 18px; font-weight: 800; color: #1a1a2e; margin-bottom: 8px; }
.comp-detail-division { display: inline-block; margin-bottom: 12px; text-transform: capitalize; }
.comp-detail-desc { font-size: 14px; color: #333; line-height: 1.5; margin-bottom: 14px; padding: 12px; background: #f9f9fc; border-radius: 10px; }
.comp-detail-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.comp-detail-photo { width: 80px; height: 80px; object-fit: cover; border-radius: 10px; }
.comp-detail-contact { font-size: 13px; color: #555; margin-bottom: 6px; }
.comp-resolve-section { margin-top: 16px; border-top: 1px solid #eee; padding-top: 14px; }
.comp-resolve-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1.5px solid #dde0e8;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  margin-bottom: 10px;
  outline: none;
}
.comp-resolve-input:focus { border-color: var(--navy, #003366); }
.comp-resolve-btn { width: 100%; }
.comp-resolved-note { margin-top: 16px; border-top: 1px solid #eee; padding-top: 14px; }
.comp-resolved-comment { font-size: 13px; color: #555; margin-top: 8px; font-style: italic; }

/* ─── AI CHAT WIDGET ──────────────────────────────────────────── */
.ai-fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1e3a6e, #0a1f45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 200;
  border: none;
  padding: 4px;
  /* layered shadow: ambient + key light + deep drop */
  box-shadow:
    0 1px 2px rgba(0,0,0,0.6),
    0 6px 16px rgba(0,0,0,0.55),
    0 12px 32px rgba(0,20,80,0.45),
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -2px 4px rgba(0,0,0,0.4);
  transition: transform 0.12s cubic-bezier(0.34,1.56,0.64,1),
              box-shadow 0.12s ease;
  /* subtle pulsing ring to draw the eye */
  animation: ai-fab-pulse 3s ease-in-out infinite;
}
.ai-fab::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 200deg, #4fc3f7, #1565c0, #0d47a1, #4fc3f7);
  z-index: -1;
  opacity: 0.7;
  animation: ai-fab-spin 6s linear infinite;
  filter: blur(1px);
}
.ai-fab::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, rgba(255,255,255,0.22) 0%, transparent 60%);
  pointer-events: none;
}
.ai-fab img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
  /* remove any lingering white fringe */
  mix-blend-mode: normal;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.ai-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow:
    0 2px 4px rgba(0,0,0,0.6),
    0 10px 28px rgba(0,0,0,0.6),
    0 20px 48px rgba(0,20,80,0.5),
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -2px 4px rgba(0,0,0,0.4);
}
.ai-fab:active {
  transform: scale(0.93) translateY(1px);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.7),
    0 3px 8px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.1),
    inset 0 2px 6px rgba(0,0,0,0.5);
}
@keyframes ai-fab-pulse {
  0%, 100% { box-shadow: 0 1px 2px rgba(0,0,0,0.6), 0 6px 16px rgba(0,0,0,0.55), 0 12px 32px rgba(0,20,80,0.45), inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -2px 4px rgba(0,0,0,0.4), 0 0 0 0 rgba(79,195,247,0); }
  50%       { box-shadow: 0 1px 2px rgba(0,0,0,0.6), 0 6px 16px rgba(0,0,0,0.55), 0 12px 32px rgba(0,20,80,0.45), inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -2px 4px rgba(0,0,0,0.4), 0 0 0 8px rgba(79,195,247,0.15); }
}
@keyframes ai-fab-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.ai-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.ai-panel-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.ai-panel {
  width: 100%;
  max-height: 78vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32,0,0.1,1);
  overflow: hidden;
}
.ai-panel-overlay.open .ai-panel {
  transform: translateY(0);
}
.ai-panel-header {
  display: flex;
  align-items: center;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #eee;
  gap: 10px;
}
.ai-panel-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg,#1a5276,#003366);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-panel-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  flex: 1;
}
.ai-panel-close {
  font-size: 22px;
  color: #888;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
}
.ai-msg.assistant {
  background: #f0f4f8;
  color: #1a1a2e;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ai-msg.user {
  background: #003366;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ai-msg.thinking {
  background: #f0f4f8;
  color: #888;
  align-self: flex-start;
  font-style: italic;
}
.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px 14px 4px;
}
.ai-chip {
  background: #eef3f8;
  border: 1px solid #d0dceb;
  border-radius: 20px;
  padding: 6px 13px;
  font-size: 12.5px;
  color: #1a5276;
  cursor: pointer;
  white-space: nowrap;
}
.ai-chip:active { background: #d0dceb; }
.ai-input-row {
  display: flex;
  align-items: center;
  padding: 10px 12px 14px;
  gap: 8px;
  border-top: 1px solid #eee;
}
.ai-input {
  flex: 1;
  border: 1.5px solid #d0dceb;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  background: #f8fafc;
}
.ai-input:focus { border-color: #1a5276; }
.ai-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #003366;
  color: #fff;
  border: none;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.ai-send:disabled { background: #b0bec5; }
