/* ============================================================
   AKRA – Construction Management & Supervision
   Mobile-First RTL Dashboard
   Palette: architectural blue · metallic gray · crisp white
   ============================================================ */

:root {
  /* Deep architectural blue */
  --blue-900: #0a1f3c;
  --blue-800: #0e2a4d;
  --blue-700: #13355f;
  --blue-600: #1b4a7a;
  --blue-500: #2a6299;
  --blue-accent: #3a7bbf;

  /* Metallic gray */
  --steel-900: #1f2733;
  --steel-700: #3a4453;
  --steel-500: #6b7280;
  --steel-400: #8d99ae;
  --steel-300: #b8c0cc;
  --steel-200: #d9dee6;
  --steel-100: #eef1f5;
  --steel-50:  #f6f8fb;

  /* Crisp white */
  --white: #ffffff;

  /* State */
  --success: #1f8a5b;
  --success-soft: #e6f4ec;
  --warn: #b7791f;

  --shadow-sm: 0 1px 2px rgba(15, 30, 55, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 30, 55, 0.10);
  --shadow-lg: 0 12px 40px rgba(10, 31, 60, 0.22);

  --radius: 14px;
  --radius-sm: 10px;

  --header-metal: linear-gradient(135deg, #12325a 0%, #0e2a4d 45%, #17324f 100%);
  --steel-sheen: linear-gradient(135deg, #f6f8fb 0%, #e7ecf2 100%);

  --ff: "Heebo", "Assistant", "Segoe UI", system-ui, -apple-system, "Rubik", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--steel-100);
  color: var(--steel-900);
  font-family: var(--ff);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--steel-50);
  box-shadow: var(--shadow-md);
}

/* ---------- Top bar (brand) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-metal);
  color: var(--white);
  padding: 14px 18px 12px;
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.topbar__brandrow { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 60px; height: 60px; flex: 0 0 auto;
  border-radius: 13px;
  background: linear-gradient(145deg, #ffffff 0%, #dbe3ed 100%);
  color: var(--blue-800);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; letter-spacing: 0.5px;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.9), 0 2px 8px rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.5);
  overflow: hidden;
}
.logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.brandtext { line-height: 1.15; }
.brandtext h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: 3px; }
.brandtext span { font-size: 12px; color: var(--steel-300); font-weight: 500; letter-spacing: 0.5px; }
.topbar__menu {
  margin-inline-start: auto; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.12); color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px; padding: 8px 12px; cursor: pointer;
  font-family: var(--ff); font-size: 13px; font-weight: 600;
  transition: background 0.18s;
}
.topbar__menu:active { background: rgba(255,255,255,0.22); }

.topbar__project {
  margin-top: 12px; padding: 9px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  font-size: 14px; color: #eaf1f9; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.topbar__project svg { color: var(--blue-accent); flex: 0 0 auto; }
.topbar__project span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__project.is-empty { color: var(--steel-300); font-weight: 500; }

/* ---------- Empty state ---------- */
.empty { padding: 46px 26px 40px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty__icon {
  width: 88px; height: 88px; border-radius: 24px; margin-bottom: 8px;
  background: var(--steel-sheen); border: 1px solid var(--steel-200);
  display: flex; align-items: center; justify-content: center; color: var(--blue-600);
  box-shadow: var(--shadow-sm);
}
.empty h2 { margin: 4px 0 2px; font-size: 20px; color: var(--steel-900); font-weight: 800; }
.empty p { margin: 0 0 18px; font-size: 14px; color: var(--steel-500); line-height: 1.6; max-width: 340px; }
.empty .btn { max-width: 300px; width: 100%; margin-bottom: 10px; }

/* ---------- Progress ---------- */
.progress {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--white);
  padding: 12px 18px 14px;
  border-bottom: 1px solid var(--steel-200);
  box-shadow: var(--shadow-sm);
}
.progress__head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
.progress__label { font-size: 13px; font-weight: 600; color: var(--steel-700); }
.progress__pct { font-size: 22px; font-weight: 800; color: var(--blue-700); }
.progress__pct small { font-size: 12px; font-weight: 600; color: var(--steel-400); }
.progress__track {
  height: 12px; border-radius: 10px; background: var(--steel-200);
  overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.10);
}
.progress__bar {
  height: 100%; width: 0%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--blue-600), var(--blue-accent));
  transition: width 0.45s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 0 8px rgba(58,123,191,0.5);
}
.progress__bar.is-complete { background: linear-gradient(90deg, #17784f, var(--success)); }
.progress__meta { margin-top: 6px; font-size: 11.5px; color: var(--steel-500); }

/* ---------- Header form ---------- */
.section-title {
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: var(--steel-500); text-transform: uppercase;
  padding: 18px 18px 8px;
}
.details {
  background: var(--white);
  margin: 0 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--steel-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.field { padding: 11px 14px; border-bottom: 1px solid var(--steel-100); }
.field:last-child { border-bottom: none; }
.field label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--steel-500); margin-bottom: 5px;
}
.field input {
  width: 100%; border: none; outline: none; background: transparent;
  font-family: var(--ff); font-size: 16px; color: var(--steel-900);
  font-weight: 600; padding: 2px 0;
}
.field input::placeholder { color: var(--steel-300); font-weight: 500; }
.field input[readonly] { color: var(--steel-500); }
.field select {
  width: 100%; border: none; outline: none; background: transparent;
  font-family: var(--ff); font-size: 16px; color: var(--steel-900);
  font-weight: 600; padding: 2px 0; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left center; padding-left: 20px;
}

/* ---------- Accordion chapters ---------- */
.chapters { padding: 0 12px 8px; }
.chapter {
  background: var(--white);
  border: 1px solid var(--steel-200);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.chapter__head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 15px;
  cursor: pointer;
  user-select: none;
  background: var(--white);
  transition: background 0.2s;
}
.chapter__head:active { background: var(--steel-50); }
.chapter__badge {
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 10px;
  background: var(--steel-sheen);
  border: 1px solid var(--steel-200);
  color: var(--blue-700);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
  box-shadow: var(--shadow-sm);
}
.chapter.is-complete .chapter__badge {
  background: var(--success);
  color: var(--white); border-color: var(--success);
}
.chapter__titles { flex: 1 1 auto; min-width: 0; }
.chapter__titles h3 {
  margin: 0; font-size: 15.5px; font-weight: 700; color: var(--steel-900);
  line-height: 1.25;
}
.chapter__titles .sub { font-size: 12px; color: var(--steel-400); font-weight: 500; }
.chapter__count {
  font-size: 12px; font-weight: 700; color: var(--blue-600);
  background: var(--steel-100); padding: 3px 9px; border-radius: 20px;
  flex: 0 0 auto;
}
.chapter.is-complete .chapter__count { color: var(--success); background: var(--success-soft); }
.chapter__chev {
  flex: 0 0 auto; color: var(--steel-400); transition: transform 0.3s;
  font-size: 14px;
}
.chapter.is-open .chapter__chev { transform: rotate(-180deg); }

.chapter__body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s ease;
}
.chapter.is-open .chapter__body { max-height: 6000px; }
.chapter__inner { padding: 4px 0 8px; border-top: 1px solid var(--steel-100); }

.group-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.4px;
  color: var(--blue-600); background: var(--steel-50);
  padding: 8px 15px; margin-top: 4px;
  border-top: 1px solid var(--steel-100);
  border-bottom: 1px solid var(--steel-100);
}

/* ---------- Inspection item ---------- */
.item { padding: 12px 15px; border-bottom: 1px solid var(--steel-100); }
.item:last-child { border-bottom: none; }
.item__row { display: flex; gap: 12px; align-items: flex-start; }

.checkbox {
  flex: 0 0 auto; width: 26px; height: 26px; margin-top: 1px;
  border-radius: 8px; border: 2px solid var(--steel-300);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.18s;
  position: relative;
}
.checkbox svg { width: 15px; height: 15px; opacity: 0; transform: scale(0.5); transition: all 0.18s; }
.checkbox.is-checked {
  background: linear-gradient(145deg, var(--blue-500), var(--blue-700));
  border-color: var(--blue-700);
  box-shadow: 0 2px 6px rgba(27,74,122,0.4);
}
.checkbox.is-checked svg { opacity: 1; transform: scale(1); stroke: #fff; }

.item__main { flex: 1 1 auto; min-width: 0; }
.item__label {
  font-size: 15px; font-weight: 700; color: var(--steel-900);
  line-height: 1.3; cursor: pointer;
}
.item.is-checked .item__label { color: var(--steel-500); }
.item__detail { font-size: 13px; color: var(--steel-500); line-height: 1.5; margin-top: 3px; }

.item__actions { margin-top: 9px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.note-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--blue-600);
  background: var(--steel-100); border: 1px solid var(--steel-200);
  padding: 6px 11px; border-radius: 20px; cursor: pointer;
  transition: all 0.18s;
}
.note-toggle:active { background: var(--steel-200); }
.note-toggle.has-note { color: var(--white); background: var(--blue-600); border-color: var(--blue-700); }

.photo-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--steel-700);
  background: var(--steel-100); border: 1px solid var(--steel-200);
  padding: 6px 11px; border-radius: 20px; cursor: pointer;
  transition: all 0.18s;
}
.photo-toggle:active { background: var(--steel-200); }
.photo-toggle.has-photo { color: var(--white); background: var(--steel-500); border-color: var(--steel-500); }
.photo-toggle .photo-count { font-size: 11px; min-width: 6px; }
.photo-toggle.has-photo .photo-count { background: rgba(255,255,255,0.25); border-radius: 10px; padding: 0 5px; }

.photos-box { margin-top: 10px; overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.photos-box.is-open { max-height: 420px; overflow: visible; }
.photos-grid { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px; }
.thumb { position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden; border: 1px solid var(--steel-200); box-shadow: var(--shadow-sm); }
.thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.thumb-del {
  position: absolute; top: 3px; inset-inline-start: 3px;
  width: 20px; height: 20px; border-radius: 50%; border: none;
  background: rgba(15,30,55,0.72); color: #fff; font-size: 14px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.thumb-add {
  width: 74px; height: 74px; border-radius: 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; transition: all 0.18s;
}
.thumb-add .ic { font-size: 24px; line-height: 1; }
.thumb-add small { font-size: 11px; font-weight: 700; }
/* Prominent camera button — opens the device camera directly */
.thumb-cam {
  border: none;
  background: linear-gradient(145deg, var(--blue-500), var(--blue-700));
  color: #fff; box-shadow: 0 3px 10px rgba(19,53,95,0.35);
}
.thumb-cam:active { transform: scale(0.96); }
/* Gallery button */
.thumb-gallery {
  border: 2px dashed var(--steel-300); background: var(--steel-50); color: var(--steel-500);
}
.thumb-gallery:active { background: var(--steel-100); border-color: var(--blue-accent); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(8,18,34,0.92); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.lightbox.is-open { display: flex; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lightbox__close {
  position: absolute; top: 16px; inset-inline-start: 16px;
  width: 42px; height: 42px; border-radius: 12px; border: none;
  background: rgba(255,255,255,0.14); color: #fff; font-size: 26px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.note-box { margin-top: 10px; overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.note-box.is-open { max-height: 240px; }
.note-box textarea {
  width: 100%; min-height: 70px; resize: vertical;
  border: 1px solid var(--steel-300); border-radius: var(--radius-sm);
  padding: 10px 12px; font-family: var(--ff); font-size: 14px; color: var(--steel-900);
  background: var(--steel-50); outline: none; line-height: 1.5;
}
.note-box textarea:focus { border-color: var(--blue-accent); background: var(--white); box-shadow: 0 0 0 3px rgba(58,123,191,0.12); }

/* ---------- Project documents (binder) ---------- */
.documents { padding: 0 12px 8px; }
.drive-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--navy, #0e2a4d); color: #fff; text-decoration: none;
  border-radius: var(--radius); padding: 12px 15px; margin-bottom: 12px;
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm);
}
.drive-bar:active { transform: scale(0.99); }

/* ---------- Punch list (defects) ---------- */
.defects { padding: 0 12px 8px; }
.dfl-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.dfl-chip {
  border: 1px solid var(--steel-200); background: var(--white); border-radius: 999px;
  padding: 6px 13px; font-family: var(--ff); font-size: 13px; font-weight: 600; color: var(--steel-500); cursor: pointer;
}
.dfl-chip b { font-weight: 800; color: var(--steel-900); }
.dfl-chip.is-on { background: #0e2a4d; color: #fff; border-color: transparent; }
.dfl-chip.is-on b { color: #fff; }
.dfl-add {
  margin-inline-start: auto; border: none; cursor: pointer; border-radius: 10px;
  background: linear-gradient(145deg, var(--blue-600), var(--blue-800)); color: #fff;
  font-family: var(--ff); font-size: 14px; font-weight: 700; padding: 9px 15px;
}
.dfl-list { display: flex; flex-direction: column; gap: 10px; }
.dfl-card { background: var(--white); border: 1px solid var(--steel-200); border-radius: 13px; padding: 13px 14px; box-shadow: var(--shadow-sm); }
.dfl-card__head { display: flex; align-items: flex-start; gap: 10px; }
.dfl-pill { flex: 0 0 auto; border: none; cursor: pointer; border-radius: 8px; padding: 5px 11px; font-family: var(--ff); font-size: 12.5px; font-weight: 800; color: #fff; }
.dfl-pill.open { background: #c0392b; }
.dfl-pill.fixed { background: #2f6fb0; }
.dfl-pill.verified { background: #1c8a5b; }
.dfl-desc { font-size: 15px; font-weight: 700; color: var(--steel-900); line-height: 1.45; padding-top: 2px; }
.dfl-meta { font-size: 13px; color: var(--steel-500); margin-top: 9px; font-weight: 500; }
.dfl-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.dfl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; border-top: 1px solid var(--steel-100); padding-top: 11px; }
.dfl-act {
  flex: 1; min-width: 88px; background: #f6f8fb; border: 1px solid var(--steel-200); border-radius: 9px;
  padding: 8px 6px; font-family: var(--ff); font-size: 13px; font-weight: 600; color: var(--steel-700, #52606d); cursor: pointer;
}
.dfl-act.danger { color: #c0392b; }
.dfl-empty {
  text-align: center; color: var(--steel-400); font-size: 14px; padding: 24px 12px;
  background: var(--white); border: 1px dashed var(--steel-200); border-radius: 13px;
}

.stat--link { cursor: pointer; border: 1px solid #f0c8c2 !important; background: #fdf3f2 !important; }
.stat--link .n, .stat--link .l { color: #c0392b !important; }
.stat--link:active { transform: scale(0.97); }

/* ---------- Voice dictation mic ---------- */
.note-box { position: relative; }
.def-desc-wrap { position: relative; }
.mic-btn {
  position: absolute; bottom: 9px; inset-inline-end: 9px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  background: #eef2f7; color: #47505f; display: grid; place-items: center;
  box-shadow: 0 1px 4px rgba(16,32,51,.16);
}
.note-box textarea, .def-desc-wrap textarea { padding-inline-end: 46px; }
.mic-btn.is-rec { background: #c0392b; color: #fff; animation: micpulse 1.1s infinite; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,.5); } 50% { box-shadow: 0 0 0 7px rgba(192,57,43,0); } }

/* ---------- AI features ---------- */
.ai-btn {
  position: absolute; top: 9px; inset-inline-end: 9px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(145deg, #8a5cff, #5b8bf0); color: #fff; font-size: 15px;
  display: grid; place-items: center; box-shadow: 0 1px 4px rgba(16,32,51,.2);
}
.ai-btn:active { transform: scale(0.93); }
.btn--ai {
  background: linear-gradient(145deg, #8a5cff, #5b8bf0);
  color: #fff; box-shadow: 0 4px 12px rgba(96,80,240,.3);
}
.report__ai {
  border: 1px solid #d8d2f5; background: linear-gradient(180deg, #f6f4ff, #fbfaff);
  border-radius: 12px; padding: 13px 15px; margin: 4px 0 14px;
}
.report__ai-t { font-weight: 800; color: #5b46c9; font-size: 14px; margin-bottom: 7px; }
.report__ai-b { font-size: 14px; line-height: 1.75; color: var(--steel-900, #1f2733); }

/* ---------- Report cover page (first page of the PDF) ---------- */
.report__cover {
  page-break-after: always; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 78vh; padding: 30px 24px 40px;
}
.report__cover .rc-logo { width: 140px; height: auto; margin-bottom: 14px; }
.rc-brandname { font-size: 30px; font-weight: 800; letter-spacing: 6px; color: #0e2a4d; }
.rc-brandsub { font-size: 13px; letter-spacing: 3px; color: #6b7280; font-weight: 600; margin-top: 2px; }
.rc-line { width: 60px; height: 3px; background: #c49a4a; border-radius: 2px; margin: 22px 0; }
.rc-doctype { font-size: 15px; letter-spacing: 4px; color: #8492a2; font-weight: 700; }
.rc-proj { font-size: 28px; font-weight: 800; color: #0e2a4d; margin: 8px 0 26px; text-wrap: balance; }
.rc-meta { display: inline-block; text-align: right; }
.rc-row { font-size: 15px; color: #1f2733; line-height: 2.1; }
.rc-row span { color: #8492a2; font-weight: 600; display: inline-block; min-width: 92px; }
.rc-row b { font-weight: 700; }
.rc-foot { margin-top: 34px; font-size: 12px; letter-spacing: 2px; color: #0e2a4d; font-weight: 700; }

/* ---------- Client share modal ---------- */
.btn--link { background: linear-gradient(145deg, #2f6fb0, #1f4f86); color: #fff; box-shadow: 0 4px 12px rgba(47,111,176,.3); }
.share-toggle { display: flex; align-items: center; justify-content: space-between; background: #e3f3ea; border: 1px solid #cfe9db; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.share-toggle__label { font-size: 14px; font-weight: 700; }
.share-toggle__label.on { color: #1c8a5b; }
.share-toggle__label.off { color: #8492a2; }
.switch { width: 46px; height: 27px; background: #c9d3df; border: none; border-radius: 99px; position: relative; cursor: pointer; transition: background .2s; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-end: 3px; width: 21px; height: 21px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: inset-inline-start .2s, inset-inline-end .2s; }
.switch.on { background: #1c8a5b; }
.switch.on::after { inset-inline-end: auto; inset-inline-start: 3px; }
.share-linkbox { display: flex; align-items: center; gap: 8px; background: #f6f8fb; border: 1px solid #e4eaf1; border-radius: 11px; padding: 11px 12px; margin-bottom: 14px; }
.share-linkbox__u { flex: 1; font-size: 13px; color: #4c5a6b; direction: ltr; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Menlo, Consolas, monospace; }
.share-copy { flex: 0 0 auto; background: #0e2a4d; color: #fff; border: none; font-size: 12.5px; font-weight: 700; padding: 8px 13px; border-radius: 8px; cursor: pointer; }
.share-row { display: flex; gap: 10px; }
.sbtn { flex: 1; text-align: center; border: none; border-radius: 11px; padding: 12px 8px; font-family: var(--ff); font-size: 13.5px; font-weight: 700; color: #fff; cursor: pointer; }
.sbtn.wa { background: #25d366; }
.sbtn.mail { background: linear-gradient(145deg, #6d7787, #47505f); }
.share-hint { font-size: 12.5px; color: #8492a2; text-align: center; margin-top: 14px; line-height: 1.6; }
.share-hint b { color: #4c5a6b; }

/* ---------- Milestones & payments ---------- */
.milestones { padding: 0 12px 8px; }
.ms-bar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.ms-add { border: none; cursor: pointer; border-radius: 10px; background: linear-gradient(145deg, var(--blue-600), var(--blue-800)); color: #fff; font-family: var(--ff); font-size: 14px; font-weight: 700; padding: 9px 15px; }
.ms-sum { background: var(--white); border: 1px solid var(--steel-200); border-radius: 13px; padding: 14px 15px; box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.ms-sum__bar { height: 10px; background: #eef2f7; border-radius: 99px; overflow: hidden; margin-bottom: 12px; }
.ms-sum__fill { height: 100%; background: linear-gradient(90deg, #2f6fb0, #1c8a5b); border-radius: 99px; }
.ms-sum__row { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; color: var(--steel-700, #52606d); }
.ms-sum__row b { font-weight: 800; color: var(--steel-900); }
.ms-sum__row b.paid { color: #1c8a5b; }
.ms-sum__row.total { border-top: 1px solid var(--steel-100); margin-top: 6px; padding-top: 9px; font-size: 15px; }
.ms-list { display: flex; flex-direction: column; gap: 10px; }
.ms-card { background: var(--white); border: 1px solid var(--steel-200); border-radius: 13px; padding: 13px 14px; box-shadow: var(--shadow-sm); }
.ms-card__main { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ms-card__name { font-size: 15px; font-weight: 700; color: var(--steel-900); }
.ms-card__amt { font-size: 16px; font-weight: 800; color: #0e2a4d; white-space: nowrap; }
.ms-pill { display: inline-block; margin-top: 9px; border: none; cursor: pointer; border-radius: 8px; padding: 5px 11px; font-family: var(--ff); font-size: 12.5px; font-weight: 800; color: #fff; }
.ms-pill.pending { background: #8492a2; }
.ms-pill.done { background: #b7791f; }
.ms-pill.paid { background: #1c8a5b; }
.ms-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; border-top: 1px solid var(--steel-100); padding-top: 11px; }
.ms-act { flex: 1; min-width: 80px; background: #f6f8fb; border: 1px solid var(--steel-200); border-radius: 9px; padding: 8px 6px; font-family: var(--ff); font-size: 13px; font-weight: 600; color: var(--steel-700, #52606d); cursor: pointer; }
.ms-act.danger { color: #c0392b; flex: 0 0 auto; }
.ms-empty { text-align: center; color: var(--steel-400); font-size: 14px; padding: 22px 12px; background: var(--white); border: 1px dashed var(--steel-200); border-radius: 13px; }
.rep-pay { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; margin-top: 10px; padding: 10px; background: #f6f8fb; border-radius: 8px; font-size: 13.5px; }
.rep-pay b { color: #0e2a4d; }

.modal--sm { max-width: 440px; }
.deffield { margin-bottom: 15px; }
.deffield label { display: block; font-size: 12.5px; font-weight: 700; color: var(--steel-500); margin-bottom: 6px; }
.deffield input, .deffield textarea {
  width: 100%; box-sizing: border-box; border: 1px solid var(--steel-200); border-radius: 10px;
  padding: 12px; font-family: var(--ff); font-size: 15px; color: var(--steel-900); background: var(--white);
}
.deffield textarea { resize: vertical; line-height: 1.5; }
.modal--sm .btn { width: 100%; }

.doc-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--white); border: 1px solid var(--steel-200); border-radius: var(--radius);
  padding: 13px 15px; margin-bottom: 10px; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: border-color 0.18s, transform 0.1s;
}
.doc-card:active { transform: scale(0.995); }
.doc-card__icon {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 11px;
  background: var(--steel-sheen); border: 1px solid var(--steel-200);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--blue-700);
}
.doc-card__main { flex: 1 1 auto; min-width: 0; }
.doc-card__title { font-size: 15px; font-weight: 700; color: var(--steel-900); }
.doc-card__sub { font-size: 12px; color: var(--steel-400); margin-top: 2px; }
.doc-card__badge { font-size: 11px; font-weight: 700; color: var(--steel-600, #52606d); background: var(--steel-100); border-radius: 20px; padding: 3px 9px; flex: 0 0 auto; }
.doc-card__badge.ok { color: var(--success); background: var(--success-soft); }
.doc-card__chev { color: var(--steel-300); font-size: 20px; font-weight: 700; flex: 0 0 auto; }
.doc-card--soon { cursor: default; opacity: 0.75; border-style: dashed; box-shadow: none; }
.doc-card--soon .doc-card__icon { color: var(--steel-400); font-size: 24px; }

/* ---------- Contract document ---------- */
.contract { background: #fff; padding-bottom: 6px; }
.contract__brandbar { background: var(--header-metal); color: #fff; padding: 14px 18px; display: flex; align-items: center; gap: 12px; }
.contract__brandbar .logo { width: 40px; height: 40px; }
.contract__brandbar h3 { margin: 0; font-size: 16px; letter-spacing: 2px; }
.contract__brandbar span { font-size: 11px; color: var(--steel-300); }
.contract__title { text-align: center; font-size: 17px; font-weight: 800; color: var(--blue-800); padding: 14px 18px 6px; border-bottom: 2px solid var(--blue-700); }

.contract__editbar { background: #eef4fb; border: 1px solid #d3e2f2; border-radius: 10px; margin: 12px; padding: 11px 12px; }
.ce-title { font-size: 12px; font-weight: 800; color: var(--blue-700); margin-bottom: 8px; }
.ce-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ce-grid label { font-size: 11px; font-weight: 600; color: var(--steel-500); display: flex; flex-direction: column; gap: 4px; }
.ce-grid input { border: 1px solid var(--steel-300); border-radius: 8px; padding: 8px; font-family: var(--ff); font-size: 14px; font-weight: 700; color: var(--steel-900); background: #fff; outline: none; }
.ce-grid input:focus { border-color: var(--blue-accent); }

.contract__meta { padding: 12px 18px; border-bottom: 1px solid var(--steel-200); max-width: 460px; }
.contract__meta .r-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: end; padding: 5px 0; }
.contract__meta .k { color: var(--steel-500); font-weight: 600; font-size: 13px; white-space: nowrap; }
.contract__meta .v {
  color: var(--steel-900); font-weight: 700; font-size: 13.5px; text-align: right;
  border-bottom: 1px solid var(--steel-400); padding-bottom: 3px; min-height: 19px; line-height: 1.3;
}

.contract__body { padding: 6px 18px 4px; }
.cl { margin: 12px 0; break-inside: avoid; page-break-inside: avoid; }
.cl__title { margin: 0 0 6px; font-size: 14px; font-weight: 800; color: var(--blue-800); }
.cl__list { margin: 0; padding: 0; list-style: none; }
.cl__list li { font-size: 12.8px; line-height: 1.6; color: var(--steel-800, #2a3340); margin-bottom: 5px; padding-inline-start: 2px; }
.cl-n { font-weight: 800; color: var(--blue-600); margin-inline-end: 3px; }

.contract__signwrap { padding: 12px 18px 6px; border-top: 2px solid var(--steel-200); margin-top: 8px; }
.contract__signcap { font-size: 13px; font-weight: 700; color: var(--steel-700); margin-bottom: 10px; }
.contract__signgrid { display: flex; gap: 12px; }
.contract__signgrid .sign-card { flex: 1; margin-bottom: 0; }

.no-pdf { }
.pdf-doc .no-pdf { display: none !important; }

/* ---------- Chapter signatures ---------- */
.chapter-sign { border-top: 1px solid var(--steel-200); background: var(--steel-50); }
.chapter-sign__toggle {
  width: 100%; border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 15px; font-family: var(--ff); font-size: 13.5px; font-weight: 700; color: var(--blue-700);
}
.chapter-sign__toggle b { font-size: 12px; background: var(--steel-200); color: var(--steel-700); border-radius: 20px; padding: 2px 9px; }
.chapter-sign__body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; padding: 0 12px; }
.chapter-sign__body.is-open { max-height: 900px; padding: 0 12px 14px; }

.sign-card { background: var(--white); border: 1px solid var(--steel-200); border-radius: 12px; padding: 11px 12px; margin-bottom: 10px; }
.sign-card__role { font-size: 13px; font-weight: 800; color: var(--steel-900); margin-bottom: 7px; }
.sign-card__name {
  width: 100%; border: 1px solid var(--steel-200); border-radius: 8px; padding: 8px 10px;
  font-family: var(--ff); font-size: 14px; color: var(--steel-900); background: var(--steel-50);
  outline: none; margin-bottom: 8px;
}
.sign-card__name:focus { border-color: var(--blue-accent); background: #fff; }
.sign-pad-wrap {
  position: relative; border: 1px dashed var(--steel-300); border-radius: 10px;
  background: #fff; height: 120px; overflow: hidden;
}
.sign-pad { width: 100%; height: 120px; display: block; touch-action: none; cursor: crosshair; position: relative; z-index: 1; }
.sign-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--steel-300); font-size: 13px; pointer-events: none; z-index: 0;
}
.sign-pad.has-ink + .sign-hint { display: none; }
.sign-saved { width: 100%; height: 120px; object-fit: contain; display: block; background: #fff; }
.sign-clear {
  margin-top: 8px; border: 1px solid var(--steel-200); background: var(--steel-50);
  color: var(--steel-600, #52606d); border-radius: 8px; padding: 6px 12px;
  font-family: var(--ff); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.sign-clear:active { background: var(--steel-200); }

/* ---------- Action bar ---------- */
.actionbar {
  position: sticky; bottom: 0; z-index: 45;
  background: linear-gradient(0deg, var(--white) 70%, rgba(255,255,255,0));
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  display: flex; gap: 10px;
  border-top: 1px solid var(--steel-200);
}
.btn {
  flex: 1 1 0; border: none; border-radius: 12px;
  padding: 15px 12px; font-family: var(--ff); font-size: 15px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.1s, box-shadow 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(145deg, var(--blue-600), var(--blue-800));
  color: var(--white); box-shadow: 0 4px 14px rgba(14,42,77,0.35);
}
.btn--steel {
  background: linear-gradient(145deg, #6d7787, #47505f);
  color: var(--white); box-shadow: 0 4px 12px rgba(58,68,83,0.30);
}
.btn--wa {
  background: linear-gradient(145deg, #25d366, #1da851);
  color: var(--white); box-shadow: 0 4px 12px rgba(29,168,81,0.30);
}
.btn--ghost {
  background: var(--white); color: var(--blue-700);
  border: 1.5px solid var(--steel-300); box-shadow: var(--shadow-sm);
  flex: 0 0 auto; padding: 15px 16px;
}
.actionbar .btn { font-size: 14px; padding: 14px 8px; }

/* ---------- Projects drawer ---------- */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10,31,60,0.5); backdrop-filter: blur(3px);
  display: none; opacity: 0; transition: opacity 0.25s;
}
.drawer-overlay.is-open { display: block; opacity: 1; }
.drawer {
  position: absolute; top: 0; inset-inline-end: 0; height: 100%;
  width: 86%; max-width: 380px;
  background: var(--steel-50);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(.2,.7,.3,1);
}
[dir="rtl"] .drawer { transform: translateX(-100%); }
.drawer-overlay.is-open .drawer { transform: translateX(0); }
.drawer__head {
  padding: 16px 18px; background: var(--header-metal); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
}
.drawer__head h2 { margin: 0; font-size: 17px; font-weight: 800; }
.drawer__new { padding: 14px 16px 8px; }
.drawer__new .btn { width: 100%; }
.drawer__list { flex: 1 1 auto; overflow-y: auto; padding: 6px 12px 12px; }
.drawer__foot { padding: 12px; text-align: center; font-size: 11px; color: var(--steel-400); border-top: 1px solid var(--steel-200); }

.proj {
  background: var(--white); border: 1px solid var(--steel-200); border-radius: 12px;
  padding: 12px 13px; margin-bottom: 10px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: border-color 0.18s, transform 0.1s;
  display: flex; align-items: center; gap: 11px;
}
.proj:active { transform: scale(0.995); }
.proj.is-active { border-color: var(--blue-600); box-shadow: 0 0 0 2px rgba(27,74,122,0.15), var(--shadow-sm); }
.proj__ring {
  flex: 0 0 auto; width: 44px; height: 44px; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.proj__ring svg { transform: rotate(-90deg); }
.proj__ring .pct { position: absolute; font-size: 11px; font-weight: 800; color: var(--blue-700); }
.proj__main { flex: 1 1 auto; min-width: 0; }
.proj__name { font-size: 15px; font-weight: 700; color: var(--steel-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj__meta { font-size: 11.5px; color: var(--steel-400); margin-top: 2px; }
.proj.is-active .proj__name { color: var(--blue-700); }
.proj__actions { flex: 0 0 auto; display: flex; gap: 4px; }
.proj__btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--steel-200);
  background: var(--steel-50); color: var(--steel-500); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.proj__btn:active { background: var(--steel-200); }
.proj__btn.del:active { background: #fdeaea; color: #c0392b; }
.drawer__empty { text-align: center; color: var(--steel-400); font-size: 13.5px; padding: 30px 16px; line-height: 1.6; }

/* ---------- Report modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10,31,60,0.55); backdrop-filter: blur(3px);
  display: none; align-items: flex-end; justify-content: center;
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: var(--steel-50); width: 100%; max-width: 640px;
  max-height: 92vh; border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: sheetUp 0.3s cubic-bezier(.2,.7,.3,1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal__head {
  padding: 16px 18px; background: var(--header-metal); color: var(--white);
  border-radius: 20px 20px 0 0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal__head h2 { margin: 0; font-size: 17px; font-weight: 800; }
.modal__close {
  background: rgba(255,255,255,0.12); border: none; color: #fff;
  width: 34px; height: 34px; border-radius: 10px; font-size: 20px; cursor: pointer;
  display:flex;align-items:center;justify-content:center;
}
.modal__body { padding: 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal__actions {
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; border-top: 1px solid var(--steel-200); background: var(--white);
}

/* ---------- Report content ---------- */
.report { background: var(--white); border-radius: 12px; border: 1px solid var(--steel-200); overflow: hidden; }
.report__brandbar {
  background: var(--header-metal); color: #fff; padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
}
.report__brandbar .logo { width: 40px; height: 40px; font-size: 17px; }
.report__brandbar h3 { margin: 0; font-size: 16px; letter-spacing: 2px; }
.report__brandbar span { font-size: 11px; color: var(--steel-300); }
.report__meta { padding: 14px 18px; border-bottom: 1px solid var(--steel-200); }
.report__meta .r-row { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: baseline; padding: 3px 0; font-size: 13.5px; max-width: 470px; }
.report__meta .r-row .k { color: var(--steel-500); font-weight: 600; white-space: nowrap; }
.report__meta .r-row .v { color: var(--steel-900); font-weight: 700; text-align: right; }
.report__summary {
  display: flex; gap: 10px; padding: 14px 18px; background: var(--steel-50);
  border-bottom: 1px solid var(--steel-200);
}
.stat { flex: 1; text-align: center; background: var(--white); border: 1px solid var(--steel-200); border-radius: 10px; padding: 10px 6px; }
.stat .n { font-size: 22px; font-weight: 800; color: var(--blue-700); }
.stat .l { font-size: 11px; color: var(--steel-500); font-weight: 600; }
.stat.ok .n { color: var(--success); }

.report__chap { padding: 12px 18px; border-bottom: 1px solid var(--steel-100); }
.report__chap h4 { margin: 0 0 8px; font-size: 14px; color: var(--blue-700); font-weight: 800; }
.report__item { display: flex; gap: 8px; padding: 5px 0; font-size: 13.5px; line-height: 1.45; }
.report__item .mark { color: var(--success); font-weight: 800; flex: 0 0 auto; }
.report__item .txt b { color: var(--steel-900); }
.report__item .note {
  display: block; margin-top: 3px; color: var(--steel-600, #52606d);
  background: var(--steel-50); border-right: 3px solid var(--blue-accent);
  padding: 6px 9px; border-radius: 6px; font-size: 12.5px;
}
/* Report photos — large & clear for documenting defects/complaints */
.rep-photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.rep-photo {
  width: 100%; height: 210px; object-fit: cover;
  border-radius: 9px; border: 1px solid var(--steel-300); background: #eef1f5;
  break-inside: avoid; page-break-inside: avoid;
}
/* A single photo gets the full width and shows the whole frame (uncropped) */
.rep-photos .rep-photo:only-child {
  grid-column: 1 / -1; height: auto; max-height: 340px; object-fit: contain; padding: 4px;
}
.report__empty { padding: 30px 18px; text-align: center; color: var(--steel-400); font-size: 14px; }

/* Detailed report cards */
.report, .fullsheet, .contract { position: relative; overflow: hidden; }
.doc-wm {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 66%; max-width: 440px; opacity: 0.05; z-index: 0; pointer-events: none;
}
.report > *:not(.doc-wm),
.fullsheet > *:not(.doc-wm),
.contract > *:not(.doc-wm) { position: relative; z-index: 1; }
.report__chap { background: transparent; }
.rep-card {
  background: rgba(255,255,255,0.86); border: 1px solid var(--steel-200); border-radius: 10px;
  padding: 11px 12px; margin: 8px 0; break-inside: avoid; page-break-inside: avoid;
}
.rep-card__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.rc__status { font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 20px; flex: 0 0 auto; }
.rc__status.ok { color: var(--success); background: var(--success-soft); }
.rc__status.pending { color: var(--warn); background: #fbf1de; }
.rc__label { font-size: 14.5px; font-weight: 800; color: var(--steel-900); }
.rc__detail { font-size: 12.5px; color: var(--steel-600, #52606d); line-height: 1.5; }
.rc__note {
  margin-top: 7px; font-size: 13px; color: var(--steel-900); line-height: 1.5;
  background: #fffaf0; border: 1px solid #f0e2c4;
  border-right: 3px solid var(--warn); border-radius: 7px; padding: 7px 10px;
}
.rc__note-t { display: block; font-size: 10.5px; font-weight: 800; color: var(--warn); margin-bottom: 2px; }
.rc__photos { margin-top: 8px; }
.report__foot { padding: 12px 18px; font-size: 11px; color: var(--steel-400); text-align: center; }

/* ---------- Full checklist sheet (print-ready copy) ---------- */
.fullsheet { background: var(--white); border-radius: 12px; border: 1px solid var(--steel-200); overflow: hidden; }
.fullsheet__header {
  text-align: center; padding: 22px 18px 16px;
  border-bottom: 3px solid var(--blue-700);
  background: linear-gradient(180deg, #ffffff, #f4f7fb);
}
.fullsheet__header img { height: 132px; width: auto; display: block; margin: 0 auto 10px; }
.fullsheet__header h2 { margin: 6px 0 2px; font-size: 18px; color: var(--blue-800); font-weight: 800; letter-spacing: 1px; }
.fullsheet__header .doc-sub { font-size: 13px; color: var(--steel-500); font-weight: 600; }
.fullsheet__meta { padding: 12px 18px; border-bottom: 1px solid var(--steel-200); }
.fullsheet__meta .fm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.fullsheet__meta .fm { font-size: 12.5px; padding: 4px 0; border-bottom: 1px dotted var(--steel-200); }
.fullsheet__meta .fm .k { color: var(--steel-500); font-weight: 600; }
.fullsheet__meta .fm .v { color: var(--steel-900); font-weight: 700; }

/* NOTE: no break-inside:avoid on .fs-chapter — a whole chapter is taller than a
   page, so avoiding a break would push it entirely to the next page and leave the
   previous page mostly empty. Let chapters flow; only small blocks avoid breaks. */
.fs-chapter { }
.fs-chapter__title {
  display: flex; align-items: center; gap: 8px;
  background: var(--blue-800); color: #fff;
  padding: 9px 15px; font-size: 14px; font-weight: 800; margin-top: 2px;
  break-after: avoid; page-break-after: avoid;   /* keep title with following items */
}
.fs-label { margin-inline-end: 4px; }
.fs-chapter__title .lt {
  background: rgba(255,255,255,0.16); border-radius: 6px; padding: 1px 8px; font-size: 13px;
}
.fs-chapter__title .sub { font-weight: 500; color: #cfe0f0; font-size: 12px; }
.fs-group { font-size: 11.5px; font-weight: 800; color: var(--blue-700); background: var(--steel-50); padding: 6px 15px; border-bottom: 1px solid var(--steel-100); }
.fs-item { display: flex; gap: 10px; padding: 9px 15px; border-bottom: 1px solid var(--steel-100); break-inside: avoid; page-break-inside: avoid; }
.fs-box {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px;
  border: 2px solid var(--steel-400); border-radius: 4px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; color: var(--blue-700); line-height: 1;
}
.fs-box.checked { background: var(--blue-700); border-color: var(--blue-700); color: #fff; }
.fs-item .fs-text b { font-size: 13.5px; color: var(--steel-900); }
.fs-item .fs-text .fs-detail { font-size: 12px; color: var(--steel-500); line-height: 1.45; margin-top: 2px; }
.fs-item .fs-text .fs-note { display: block; margin-top: 4px; font-size: 12px; background: var(--steel-50); border-right: 3px solid var(--blue-accent); padding: 5px 8px; border-radius: 5px; color: #4a5563; }
.fs-line { border-bottom: 1px solid var(--steel-300); min-width: 90px; flex: 1; }

.fs-csign { padding: 10px 15px 14px; background: var(--steel-50); border-bottom: 2px solid var(--steel-200); break-inside: avoid; page-break-inside: avoid; }
.fs-csign__cap { font-size: 11px; font-weight: 800; color: var(--blue-700); letter-spacing: 0.4px; margin-bottom: 8px; }
.fs-csign__grid { display: flex; gap: 12px; }
.fs-csign__col { flex: 1; text-align: center; }
.fs-csign__role { font-size: 11.5px; font-weight: 700; color: var(--steel-700); margin-bottom: 4px; }
.fs-csign__img { width: 100%; height: 46px; object-fit: contain; background: #fff; border-bottom: 1px solid var(--steel-400); }
.fs-csign__line { height: 46px; border-bottom: 1px solid var(--steel-400); }
.fs-csign__name { font-size: 12px; font-weight: 700; color: var(--steel-900); margin-top: 3px; min-height: 15px; }
.fs-csign__date { font-size: 10px; color: var(--steel-500); margin-top: 2px; }

.fs-sign { padding: 16px 18px; border-top: 2px solid var(--steel-200); break-inside: avoid; page-break-inside: avoid; }
.fs-sign__statement { font-size: 12.5px; color: var(--steel-700); line-height: 1.6; margin-bottom: 16px; text-align: center; font-weight: 600; }
.fs-sign__grid { display: flex; gap: 14px; }
.fs-sign__col { flex: 1; text-align: center; }
.fs-sign__col .role { font-size: 13px; font-weight: 800; color: var(--blue-800); }
.fs-sign__col .role-sub { font-size: 11px; color: var(--steel-500); margin-bottom: 26px; }
.fs-sign__col .sign-line { border-top: 1px solid var(--steel-500); padding-top: 4px; font-size: 11px; color: var(--steel-500); }
.fullsheet__foot { padding: 12px 18px; font-size: 11px; color: var(--steel-400); text-align: center; }

.toast {
  position: fixed; bottom: 90px; right: 50%; transform: translateX(50%) translateY(20px);
  background: var(--steel-900); color: #fff; padding: 11px 20px; border-radius: 30px;
  font-size: 13.5px; font-weight: 600; z-index: 200; box-shadow: var(--shadow-lg);
  opacity: 0; transition: all 0.3s; pointer-events: none;
}
.toast.is-show { opacity: 1; transform: translateX(50%) translateY(0); }

/* ---------- Watermark (print only) ---------- */
.doc-watermark { display: none; }

/* ---------- Login screen ---------- */
.login {
  position: fixed; inset: 0; z-index: 120;
  background: var(--header-metal);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.login__box {
  width: 100%; max-width: 400px; text-align: center;
  background: var(--white); border-radius: 20px; padding: 26px 22px 20px;
  box-shadow: var(--shadow-lg);
}
.login__logo { width: 92px; height: 92px; margin: 0 auto 8px; }
.login__logo img { width: 100%; height: 100%; object-fit: contain; }
.login__title { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: 3px; color: var(--blue-800); }
.login__sub { font-size: 12px; color: var(--steel-400); font-weight: 500; margin-bottom: 18px; }
.login__prompt { font-size: 14px; font-weight: 600; color: var(--steel-600, #52606d); margin-bottom: 12px; }
.login__list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.login-item {
  border: 1px solid var(--steel-200); background: var(--steel-50); border-radius: 12px;
  padding: 13px 15px; font-family: var(--ff); font-size: 16px; font-weight: 700; color: var(--steel-900);
  cursor: pointer; text-align: right; transition: all 0.15s;
}
.login-item:active { background: var(--steel-100); }
.login-item.admin { background: linear-gradient(145deg, var(--blue-600), var(--blue-800)); color: #fff; border: none; }
.login__hint { font-size: 12.5px; color: var(--steel-400); line-height: 1.6; padding: 12px 6px; }
.login__selected { font-size: 16px; color: var(--steel-900); margin-bottom: 14px; }
.login__code {
  width: 100%; text-align: center; letter-spacing: 6px; font-size: 24px; font-weight: 800;
  border: 2px solid var(--steel-300); border-radius: 12px; padding: 12px; margin-bottom: 6px;
  font-family: var(--ff); color: var(--blue-800); outline: none; box-sizing: border-box;
}
.login__code:focus { border-color: var(--blue-accent); }
.login__err { color: #c0392b; font-size: 13px; font-weight: 600; min-height: 18px; margin-bottom: 6px; }
.login__submit { width: 100%; }
.login__back { margin-top: 12px; background: none; border: none; color: var(--blue-600); font-family: var(--ff); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.login__foot { margin-top: 18px; font-size: 11px; color: var(--steel-300); }

/* ---------- Admin: manage inspectors ---------- */
.insp-add { background: var(--steel-50); border: 1px solid var(--steel-200); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.insp-add__title { font-size: 14px; font-weight: 800; color: var(--blue-700); margin-bottom: 10px; }
.insp-add__name, .insp-add__pin {
  width: 100%; border: 1px solid var(--steel-300); border-radius: 9px; padding: 10px 12px;
  font-family: var(--ff); font-size: 15px; color: var(--steel-900); background: #fff; outline: none; margin-bottom: 8px; box-sizing: border-box;
}
.insp-add__name:focus, .insp-add__pin:focus { border-color: var(--blue-accent); }
.insp-add .btn { width: 100%; }
.insp-add__err { color: #c0392b; font-size: 12.5px; font-weight: 600; min-height: 16px; margin-top: 6px; text-align: center; }
.insp-list__title { font-size: 13px; font-weight: 700; color: var(--steel-500); margin-bottom: 8px; }
.insp-row { display: flex; align-items: center; justify-content: space-between; background: var(--white); border: 1px solid var(--steel-200); border-radius: 10px; padding: 11px 13px; margin-bottom: 8px; }
.insp-row span { font-size: 15px; font-weight: 700; color: var(--steel-900); }
.insp-del { border: 1px solid var(--steel-200); background: var(--steel-50); color: #c0392b; border-radius: 8px; padding: 5px 12px; font-family: var(--ff); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.insp-del:active { background: #fdeaea; }
.insp-empty { color: var(--steel-400); font-size: 14px; text-align: center; padding: 20px; }

/* ---------- Appendix files ---------- */
.appx-upload { display: flex; gap: 8px; margin-bottom: 14px; }
.appx-up-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 12px 6px; border-radius: 11px; cursor: pointer;
  border: 1.5px dashed var(--steel-300); background: var(--steel-50); color: var(--steel-600, #52606d);
  font-family: var(--ff); font-size: 12.5px; font-weight: 700; transition: all 0.15s;
}
.appx-up-btn span { font-size: 20px; }
.appx-up-btn:active { background: var(--steel-100); }
.appx-up-btn.cam { border: none; background: linear-gradient(145deg, var(--blue-500), var(--blue-700)); color: #fff; }
.appx-file { display: flex; align-items: center; gap: 11px; background: var(--white); border: 1px solid var(--steel-200); border-radius: 11px; padding: 9px 11px; margin-bottom: 9px; }
.appx-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--steel-200); cursor: zoom-in; flex: 0 0 auto; }
.appx-fileicon { width: 52px; height: 52px; border-radius: 8px; background: var(--steel-100); display: flex; align-items: center; justify-content: center; font-size: 24px; flex: 0 0 auto; }
.appx-file__main { flex: 1 1 auto; min-width: 0; }
.appx-file__name { font-size: 14px; font-weight: 700; color: var(--blue-700); text-decoration: none; word-break: break-word; display: block; }
.appx-file__meta { font-size: 11.5px; color: var(--steel-400); margin-top: 2px; }
.appx-file__del { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--steel-200); background: var(--steel-50); cursor: pointer; font-size: 15px; }
.appx-file__del:active { background: #fdeaea; }
.appx-empty { text-align: center; color: var(--steel-400); font-size: 14px; padding: 26px 12px; }

/* ---------- Admin: all projects view ---------- */
.ap-insp { margin-bottom: 16px; }
.ap-insp__name { font-size: 15px; font-weight: 800; color: var(--blue-800); background: var(--steel-100); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; }
.ap-insp__name b { color: var(--blue-600); font-size: 13px; }
.ap-proj { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--white); border: 1px solid var(--steel-200); border-radius: 9px; padding: 10px 12px; margin-bottom: 6px; }
.ap-proj__name { font-size: 14.5px; font-weight: 700; color: var(--steel-900); }
.ap-proj__meta { font-size: 12px; color: var(--steel-400); white-space: nowrap; }
.ap-empty { font-size: 13px; color: var(--steel-400); padding: 6px 12px; }

/* ---------- Drawer account ---------- */
.drawer__account { padding: 10px 14px; border-top: 1px solid var(--steel-200); }
.drawer__user { font-size: 12.5px; color: var(--steel-500); font-weight: 600; margin-bottom: 8px; text-align: center; }
.drawer__btn {
  width: 100%; border: 1px solid var(--steel-200); background: var(--steel-50); color: var(--steel-700);
  border-radius: 10px; padding: 10px; font-family: var(--ff); font-size: 13.5px; font-weight: 600; cursor: pointer; margin-bottom: 8px;
}
.drawer__btn:active { background: var(--steel-100); }
.drawer__btn.logout { color: var(--blue-700); }

/* ---------- Print ---------- */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  @page { margin: 12mm; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; height: auto !important; }

  /* Hide the entire app so no blank first page is generated */
  .app, .toast, .drawer-overlay, .modal-overlay:not(.is-open) { display: none !important; }

  /* Show only the OPEN report/full-checklist sheet */
  .modal-overlay.is-open {
    position: static !important; inset: auto !important;
    display: block !important; background: none !important; backdrop-filter: none !important;
  }
  .modal {
    position: static !important; max-height: none !important; height: auto !important;
    width: 100% !important; max-width: 100% !important;
    box-shadow: none !important; border-radius: 0 !important; animation: none !important;
    background: #fff !important; display: block !important;
  }
  .modal__head, .modal__actions { display: none !important; }
  .modal__body { overflow: visible !important; padding: 0 !important; }

  .report, .fullsheet, .contract { border: none !important; border-radius: 0 !important; background: transparent !important; position: relative; z-index: 1; overflow: visible !important; }
  .report__brandbar, .contract__brandbar { border-radius: 0; }

  /* Per-page watermark handled by the fixed .doc-watermark below — hide the inline one */
  .doc-wm { display: none !important; }

  /* Large, elegant watermark repeated on every printed page */
  .doc-watermark {
    display: block !important;
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 62%; max-width: 500px; height: auto;
    opacity: 0.06; z-index: 0; pointer-events: none;
  }

  /* Let the watermark show through content panels */
  .fullsheet__meta, .fs-item, .fs-group, .fs-sign, .fs-csign,
  .report__meta, .report__summary, .report__chap, .stat, .rep-card,
  .contract__meta, .contract__body, .contract__signwrap { background: transparent !important; }
  .fullsheet__header { background: transparent !important; }
  .contract__editbar { display: none !important; }   /* hide the terms editor when printing */

  /* Keep small logical blocks from splitting across pages (NOT whole chapters —
     that would push a tall chapter to the next page and leave blank space) */
  .rep-card, .fs-item, .fs-csign, .sign-card, .cl { break-inside: avoid; page-break-inside: avoid; }
  .report__chap h4, .fs-chapter__title { break-after: avoid; page-break-after: avoid; }
}
