/* EDGE Data Collection Portal – styles */
:root {
  --bg: #f3f5f7; --card: #ffffff; --border: #dfe5ec; --border-2: #cbd3dc;
  --text: #1e293b; --muted: #64748b; --faint: #94a3b8;
  --primary: #0e7c4a; --primary-700: #0a6139; --primary-50: #e8f5ee; --primary-100: #cfeadb;
  --info: #2563eb; --info-50: #e8effd; --purple: #7c3aed; --purple-50: #f1eafd; --amber: #d97706; --amber-50: #fdf3e3;
  --danger: #dc2626; --danger-50: #fde8e8; --ok: #16a34a; --ok-50: #e7f7ec; --grey-50: #eef2f6;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; }
a { color: var(--info); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 600; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 .8em; }
small, .small { font-size: 12px; } .muted { color: var(--muted); } .faint { color: var(--faint); }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.hidden { display: none !important; }
.mt0{margin-top:0}.mt1{margin-top:8px}.mt2{margin-top:16px}.mt3{margin-top:24px}.mb1{margin-bottom:8px}.mb2{margin-bottom:16px}.ml1{margin-left:8px}
.flex { display: flex; align-items: center; gap: 8px; } .flex-wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; } .col { flex-direction: column; align-items: stretch; }
.grid { display: grid; gap: 12px; } .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: #0b3d2e; color: #fff; height: 54px; display: flex; align-items: center; padding: 0 16px; gap: 14px; box-shadow: 0 1px 0 rgba(255,255,255,.08); }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: #fff; }
.topbar .brand .logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #34d399, #0e7c4a); display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #04281c; letter-spacing: -.02em; }
.topbar .sub { color: #a7f3d0; font-weight: 400; font-size: 12px; margin-left: 4px; }
.topbar .spacer { flex: 1; }
.topbar .btn { color: #fff; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.topbar .btn:hover { background: rgba(255,255,255,.16); }
.topbar .who { font-size: 12px; color: #d1fae5; }

/* ---------- layout ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 20px 16px 60px; }
.page-narrow { max-width: 760px; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .sidenav { position: static !important; max-height: none !important; } }
.sidenav { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.sidenav a { display: block; padding: 6px 8px; border-radius: 6px; color: var(--text); font-size: 13px; }
.sidenav a:hover { background: var(--grey-50); text-decoration: none; }
.sidenav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 8px 4px; }
.sidenav .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--border-2); vertical-align: middle; }
.sidenav .dot.ok { background: var(--ok); } .sidenav .dot.part { background: var(--amber); } .sidenav .dot.none { background: var(--danger); } .sidenav .dot.na { background: var(--faint); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px; }
.card.compact { padding: 12px 14px; }
.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.card-head h3 { margin: 0; flex: 1; }
.card-head .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.section-card { scroll-margin-top: 70px; }
.section-card.na { opacity: .7; }
.section-card .body { margin-top: 10px; }
.section-card.collapsed .body { display: none; }
.section-card .toggle-btn { cursor: pointer; user-select: none; }
.edge-note { background: var(--primary-50); border-left: 3px solid var(--primary); padding: 8px 10px; border-radius: 6px; font-size: 12.5px; color: #14532d; margin: 8px 0 10px; }
.edge-note b { color: #0a6139; }

/* ---------- badges & chips ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.5; background: var(--grey-50); color: var(--muted); white-space: nowrap; }
.badge.measure { background: #0b3d2e; color: #d1fae5; font-family: Consolas, monospace; font-weight: 600; letter-spacing: .02em; }
.badge.req { background: var(--danger-50); color: var(--danger); }
.badge.opt { background: var(--grey-50); color: var(--muted); }
.badge.role-architect { background: var(--info-50); color: var(--info); }
.badge.role-mep { background: var(--purple-50); color: var(--purple); }
.badge.role-developer { background: var(--amber-50); color: var(--amber); }
.badge.role-admin { background: #0b3d2e; color: #d1fae5; }
.badge.stage { background: #fef3c7; color: #92400e; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-50); color: #15803d; } .chip.part { background: var(--amber-50); color: #b45309; } .chip.none { background: var(--danger-50); color: #b91c1c; } .chip.na { background: var(--grey-50); color: var(--muted); } .chip.info { background: var(--info-50); color: var(--info); } .chip.zero { background: var(--grey-50); color: var(--muted); }
.chip.sm { font-size: 11px; padding: 2px 8px; }

/* ---------- progress ---------- */
.progress { height: 10px; background: #e5eaf0; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--ok); transition: width .3s; }
.progress.part > span { background: var(--amber); } .progress.none > span { background: var(--danger); } .progress.zero > span { background: var(--border-2); }
.progress.lg { height: 14px; }
.pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.pct.ok { color: #15803d; } .pct.part { color: #b45309; } .pct.none { color: #b91c1c; } .pct.zero { color: var(--muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 13px; border-radius: 8px; border: 1px solid var(--border-2); background: #fff; color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; line-height: 1.2; white-space: nowrap; font-family: inherit; }
.btn:hover { background: var(--grey-50); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn.primary:hover { background: var(--primary-700); }
.btn.info { background: var(--info); border-color: var(--info); color: #fff; }
.btn.danger { background: #fff; border-color: #fca5a5; color: var(--danger); } .btn.danger:hover { background: var(--danger-50); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--info); } .btn.ghost:hover { background: var(--info-50); }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn.xs { padding: 2px 7px; font-size: 11.5px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.iconbtn { border: none; background: transparent; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 6px; font-size: 14px; } .iconbtn:hover { background: var(--grey-50); color: var(--text); }

/* ---------- forms ---------- */
label.lbl, .lbl { display: block; font-size: 12.5px; font-weight: 600; color: #334155; margin-bottom: 4px; }
.lbl .unit { color: var(--muted); font-weight: 500; } .lbl .req { color: var(--danger); margin-left: 2px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--border-2); border-radius: 7px; background: #fff; color: var(--text); font: inherit; font-size: 13.5px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,124,74,.15); }
input.filled, select.filled, textarea.filled { background: #f6fbf8; }
input.changed, select.changed, textarea.changed { border-color: var(--amber); }
textarea { min-height: 64px; resize: vertical; }
select { appearance: auto; }
.field { margin-bottom: 10px; min-width: 0; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.field .meta { font-size: 11px; color: var(--faint); margin-top: 3px; }
.field.wide { grid-column: 1 / -1; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
@media (max-width: 700px) { .field-grid { grid-template-columns: 1fr; } }
.yesno { display: flex; gap: 6px; }
.yesno button { flex: 1; padding: 6px 8px; border: 1px solid var(--border-2); background: #fff; border-radius: 7px; cursor: pointer; font: inherit; font-size: 13px; }
.yesno button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.yesno button.on.no { background: #475569; border-color: #475569; }
.applicable { display: flex; align-items: center; gap: 8px; background: var(--grey-50); padding: 8px 10px; border-radius: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.applicable label { font-weight: 600; font-size: 12.5px; }
.applicable select { width: auto; min-width: 160px; }

/* table field */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table.tbl { border-collapse: collapse; width: 100%; min-width: 600px; font-size: 13px; }
table.tbl th, table.tbl td { border-bottom: 1px solid var(--border); padding: 4px 6px; text-align: left; vertical-align: top; }
table.tbl th { background: var(--grey-50); font-weight: 600; font-size: 12px; color: #334155; white-space: normal; min-width: 110px; }
table.tbl td input, table.tbl td select { padding: 5px 7px; font-size: 13px; min-width: 100px; }
table.tbl td.act { width: 34px; text-align: center; }
table.tbl tr:last-child td { border-bottom: none; }

/* data tables (admin) */
table.data { border-collapse: collapse; width: 100%; font-size: 13px; background: #fff; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.data th { background: var(--grey-50); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #475569; font-weight: 600; white-space: nowrap; }
table.data tr:hover td { background: #fafbfc; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.table-wrap.card { padding: 0; }

/* docs list */
.doc-row { display: grid; grid-template-columns: minmax(220px, 2fr) 140px minmax(220px, 2fr) minmax(140px, 1.2fr) 150px; gap: 8px; align-items: start; padding: 8px 0; border-top: 1px dashed var(--border); }
.doc-files { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.fchip { display: inline-flex; align-items: center; gap: 4px; background: var(--grey-50); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; font-size: 12px; max-width: 100%; }
.fchip a { color: var(--info); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.fchip .iconbtn { padding: 0 3px; font-size: 11px; line-height: 1.2; }
.doc-row:first-child { border-top: none; }
.doc-row .doc-name { font-size: 13px; } .doc-row .doc-name .fmt { color: var(--muted); font-size: 11.5px; }
.doc-row input, .doc-row select { padding: 5px 7px; font-size: 12.5px; }
.doc-head { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
@media (max-width: 900px) { .doc-row { grid-template-columns: 1fr 1fr; } .doc-row .doc-name { grid-column: 1 / -1; } .doc-head { display: none; } }
.docs-title { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; font-size: 12.5px; font-weight: 700; color: #334155; }
.docs-title::before { content: "📎"; }
.mailbanner { background: #fffbeb; border: 1px solid #fcd34d; color: #78350f; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }
.mailbanner b { color: #92400e; }

/* remarks */
.remark { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.remark.clar { border-color: #fcd34d; background: #fffdf5; }
.remark.resolved { opacity: .65; }
.remark .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.remark .txt { white-space: pre-wrap; }
.remark.reply { margin-left: 28px; background: #fafbfc; }

/* misc */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 4px 12px; font-size: 13px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.stat .n { font-size: 26px; font-weight: 700; line-height: 1.1; } .stat .l { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 9px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; } .tabs a.on { color: var(--primary); border-color: var(--primary); }
.tabs a .cnt { background: var(--grey-50); color: var(--muted); border-radius: 999px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.tabs a .cnt.warn { background: var(--amber-50); color: #b45309; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
.savebar { position: fixed; right: 16px; bottom: 16px; z-index: 60; background: #0b3d2e; color: #d1fae5; padding: 8px 14px; border-radius: 999px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.2); display: none; }
.savebar.show { display: block; } .savebar.err { background: #7f1d1d; color: #fee2e2; }
.toast { position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 100; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h2 { margin-bottom: 12px; }
.modal.narrow { max-width: 440px; }
.identity { background: #ecfdf5; border: 1px solid #a7f3d0; padding: 8px 12px; border-radius: var(--radius); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; }
.identity b { color: #065f46; }
.hero { background: linear-gradient(135deg, #0b3d2e, #0e7c4a); color: #fff; border-radius: 14px; padding: 26px 28px; margin-bottom: 20px; }
.hero h1 { color: #fff; font-size: 24px; } .hero p { color: #d1fae5; margin: 0; }
.link-box { display: flex; gap: 6px; align-items: center; background: var(--grey-50); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.link-box input { border: none; background: transparent; padding: 2px 4px; font-size: 12px; font-family: Consolas, monospace; }
.role-card { border-top: 4px solid var(--border-2); }
.role-card.architect { border-top-color: var(--info); } .role-card.mep { border-top-color: var(--purple); } .role-card.developer { border-top-color: var(--amber); }
.pending-list { margin: 0; padding-left: 18px; font-size: 13px; } .pending-list li { margin-bottom: 3px; }
.review-box { background: #f8fafc; border: 1px dashed var(--border-2); border-radius: 8px; padding: 8px 10px; margin-top: 10px; display: grid; grid-template-columns: 180px 1fr auto; gap: 8px; align-items: center; }
@media (max-width: 700px) { .review-box { grid-template-columns: 1fr; } }
.review-box .lbl { margin: 0; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .g::before { background: var(--ok); } .legend .a::before { background: var(--amber); } .legend .r::before { background: var(--danger); } .legend .n::before { background: var(--border-2); }
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filterbar select, .filterbar input { width: auto; }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.overdue { color: var(--danger); font-weight: 600; }
.clar-alert { background: #fff7ed; border: 1px solid #fdba74; color: #7c2d12; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; }
/* document library */
.dropzone { border: 2px dashed var(--border-2); border-radius: 10px; padding: 22px 16px; text-align: center; color: var(--muted); background: #fafbfc; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-50); color: #14532d; }
.dropzone b { color: var(--text); }
.upl-list { margin-top: 10px; max-height: 260px; overflow: auto; }
.upl-item { display: grid; grid-template-columns: 1fr 90px 120px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.upl-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl-item .st { font-size: 11.5px; }
.upl-item .st.ok { color: #15803d; } .upl-item .st.err { color: var(--danger); }
.upl-bar { height: 6px; background: #e5eaf0; border-radius: 999px; overflow: hidden; } .upl-bar > span { display: block; height: 100%; background: var(--primary); width: 0; transition: width .2s; }
table.files td { vertical-align: middle; }
table.files .fname { font-weight: 600; word-break: break-word; }
table.files .fnote { font-size: 12px; color: var(--muted); }
table.files .ficon { font-size: 18px; margin-right: 6px; vertical-align: -2px; }
table.files td.actions { white-space: nowrap; }
table.files td.actions .btn { margin-right: 3px; }
.lib-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.lib-stats b { font-size: 16px; }
.danger-zone { border: 1px solid #fca5a5; background: #fff5f5; border-radius: var(--radius); padding: 12px 14px; }
.file-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; background: var(--info-50); color: var(--info); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.print-only { display: none; }
@media print {
  .topbar, .sidenav, .savebar, .toast, .no-print, .toolbar, .tabs { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; font-size: 12px; } .page { max-width: none; padding: 0; } .layout { display: block; }
  .card { box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  .section-card.collapsed .body { display: block; }
  input, select, textarea { border: none; border-bottom: 1px solid #ccc; border-radius: 0; padding: 2px 4px; }
}
