* { box-sizing: border-box; margin: 0; padding: 0; }
body { font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #1a1a1a; background: #fff; }

#app { display: flex; height: 100vh; }

/* Sidebar */
#sidebar { width: 220px; background: #f7f8fa; border-right: 1px solid #e5e7eb; display: flex; flex-direction: column; }
.brand { font-weight: 700; font-size: 18px; padding: 18px 20px; border-bottom: 1px solid #e5e7eb; }
#nav { padding: 8px 0; overflow-y: auto; }
#nav a { display: flex; align-items: center; padding: 9px 20px; color: #374151; text-decoration: none; border-left: 3px solid transparent; }
#nav a:hover { background: #eef0f3; }
#nav a.active { background: #e8eefc; border-left-color: #2563eb; color: #1d4ed8; font-weight: 600; }
#nav .group { padding: 14px 20px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #9ca3af; }
/* Non-navigable data category (Reviews, RFIs): shown only for its status tag. */
#nav .nav-status { display: flex; align-items: center; padding: 9px 20px; color: #9ca3af; border-left: 3px solid transparent; cursor: help; }
#nav .nav-status .icon { opacity: .6; }

/* Main */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; border-bottom: 1px solid #e5e7eb; background: #fff; }
#crumbs { font-size: 13px; color: #6b7280; }
#crumbs a { color: #2563eb; text-decoration: none; }
#crumbs a:hover { text-decoration: underline; }
#hub { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #6b7280; }
#content { flex: 1; overflow: auto; padding: 24px; }

h1 { font-size: 20px; margin-bottom: 16px; }

/* Autodesk connection indicator (auto-renewing token) */
.auth-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  background: #d1d5db; cursor: help; flex-shrink: 0; }
.auth-dot.ok { background: #16a34a; }
.auth-dot.warn { background: #f59e0b; }

/* Header switch-hub button */
#switch-hub { font-size: 12px; padding: 4px 10px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: #374151; cursor: pointer; }
#switch-hub:hover { background: #f3f4f6; }

/* Projects: active vs archived sections */
.section-h { font-size: 14px; margin: 22px 0 8px; color: #374151; }
.section-h.muted { color: #9ca3af; }
.section-note { font-size: 12px; color: #9ca3af; margin-bottom: 8px; }
.tag.status-active { background: #dcfce7; color: #166534; }
.tag.status-archived { background: #f3f4f6; color: #9ca3af; }

/* Hub picker */
.hub-picker { max-width: 640px; }
.hub-hint { font-size: 13px; color: #6b7280; margin-bottom: 16px; }
.hub-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 12px 16px; margin-bottom: 8px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; cursor: pointer; }
.hub-row:hover { background: #f8fafc; border-color: #c7d2fe; }
.hub-row.no-admin { opacity: .75; }
.hub-row-name { font-weight: 600; color: #111827; flex: 1; }
.hub-row-region { font-size: 12px; color: #6b7280; }
.hub-row-admin { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.hub-row-admin.ok { background: #dcfce7; color: #166534; }
.hub-row-admin.no { background: #fee2e2; color: #991b1b; }

/* Admin-required block */
.admin-block { max-width: 640px; }
.admin-block .notice.error { margin: 12px 0 16px; }

/* Buttons */
button { font: inherit; cursor: pointer; border: 1px solid #d1d5db; background: #fff; border-radius: 6px; padding: 6px 12px; color: #374151; }
button:hover { background: #f3f4f6; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; background: #fafbfc; position: sticky; top: 0; }
tr:hover td { background: #fafbfc; }
td .link { color: #2563eb; cursor: pointer; }
td .link:hover { text-decoration: underline; }

/* States */
.msg { color: #6b7280; padding: 24px 0; }
.error { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; padding: 12px 16px; }
.notice { color: #92651a; background: #fff8eb; border: 1px solid #fde9c4; border-radius: 6px; padding: 12px 16px; }
.loading { color: #9ca3af; padding: 24px 0; }

/* Version pill (clickable → version history) */
.ver-pill { display: inline-block; min-width: 36px; text-align: center; font-size: 12px;
  padding: 2px 10px; border: 1px solid #c7d2fe; border-radius: 12px; color: #1d4ed8;
  background: #eef2ff; cursor: pointer; }
.ver-pill:hover { background: #e0e7ff; }

/* Right-side drawer (version history) */
.drawer-overlay { position: fixed; inset: 0; background: rgba(17,24,39,.35);
  display: flex; justify-content: flex-end; z-index: 50; }
.drawer { width: 440px; max-width: 92vw; height: 100%; background: #fff;
  box-shadow: -4px 0 16px rgba(0,0,0,.12); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #e5e7eb; font-weight: 600; }
.drawer-x { border: 0; background: none; font-size: 16px; cursor: pointer; color: #6b7280; padding: 0 4px; }
.drawer-body { padding: 6px 18px; overflow-y: auto; }
.ver-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f3f5; }
.ver-meta { flex: 1; min-width: 0; }
.ver-name { font-size: 13px; color: #1a1a1a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ver-sub { font-size: 12px; color: #6b7280; margin-top: 2px; }
.ver-dl { white-space: nowrap; }

/* Drawer tabs (Details / Activity log) */
.drawer-tabs { display: flex; border-bottom: 1px solid #e5e7eb; }
.drawer-tabs .tab { flex: 1; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; padding: 11px 8px; color: #6b7280; font-size: 13px; }
.drawer-tabs .tab:hover { background: #f7f8fa; }
.drawer-tabs .tab.active { color: #1d4ed8; border-bottom-color: #2563eb; font-weight: 600; }

/* Migration-status banner */
.migrate-flag { border-radius: 6px; padding: 8px 12px; font-size: 12px; margin-bottom: 12px; line-height: 1.4; }
.migrate-flag.blocked { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; }
.migrate-flag.untested { color: #92651a; background: #fff8eb; border: 1px solid #fde9c4; }
/* "info": migration works, but with documented limits (sheets collections, RFI attachments) */
.migrate-flag.info { color: #1e40af; background: #eff6ff; border: 1px solid #bfdbfe; }

/* Sheets: collection picker bar */
.coll-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.coll-bar label { font-size: 13px; color: #6b7280; }
.coll-picker { width: auto; min-width: 220px; }
.coll-count { font-size: 12px; color: #9ca3af; }

/* RFI status tags */
.tag.rfi-open { background: #dbeafe; color: #1d4ed8; }
.tag.rfi-answered { background: #ede9fe; color: #6d28d9; }
.tag.rfi-closed { background: #dcfce7; color: #166534; }
.tag.rfi-draft { background: #f3f4f6; color: #6b7280; }
.tag.rfi-submitted { background: #fef3c7; color: #92400e; }
.tag.rfi-void { background: #fee2e2; color: #991b1b; }

/* Activity log entries */
.act-entry { padding: 12px 0; border-bottom: 1px solid #f1f3f5; }
.act-title { font-size: 14px; color: #1a1a1a; margin-bottom: 4px; }
.act-change { font-size: 13px; color: #374151; margin-bottom: 4px; }
.act-sub { font-size: 12px; color: #9ca3af; }

/* Issue detail (key/value rows) + unreadable marker */
.kv { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f1f3f5; }
.kv .k { width: 132px; flex-shrink: 0; color: #6b7280; font-size: 13px; }
.kv .v { flex: 1; min-width: 0; font-size: 13px; color: #1a1a1a; word-break: break-word; }
.issue-foot { margin-top: 14px; color: #9ca3af; font-size: 12px; }
.unreadable { color: #b45309; font-style: italic; }

/* Files view toggle */
.toolbar { display: inline-flex; gap: 0; margin-bottom: 16px; border: 1px solid #d1d5db; border-radius: 6px; overflow: hidden; }
.toolbar .toggle { border: 0; border-radius: 0; border-right: 1px solid #d1d5db; padding: 6px 14px; background: #fff; }
.toolbar .toggle:last-child { border-right: 0; }
.toolbar .toggle.active { background: #e8eefc; color: #1d4ed8; font-weight: 600; }

/* Login */
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100%; padding: 24px; }
.login-card { width: 360px; max-width: 100%; display: flex; flex-direction: column; gap: 8px;
  border: 1px solid #e5e7eb; border-radius: 12px; padding: 28px; box-shadow: 0 6px 24px rgba(0,0,0,.06); background: #fff; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-hint { font-size: 12.5px; color: #6b7280; margin-bottom: 10px; line-height: 1.5; }
.login-card label { font-size: 12px; color: #6b7280; margin-top: 6px; }
.login-input { font: inherit; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; width: 100%; }
.login-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px #dbeafe; }
.login-btn { margin-top: 14px; padding: 10px; font-size: 14px; border-radius: 8px; }
.login-btn:disabled { opacity: .6; cursor: default; }
.login-msg { font-size: 12.5px; color: #6b7280; min-height: 18px; margin-top: 10px; line-height: 1.4; }
.login-msg.warn { color: #b45309; }

.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #eef0f3; color: #4b5563; }
.icon { display: inline-block; width: 18px; text-align: center; margin-right: 6px; }

/* API migration status tags (sidebar nav) */
.api-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 9px; margin-left: auto; padding: 2px 6px; border-radius: 8px; font-weight: 600; line-height: 1.3; white-space: nowrap; flex-shrink: 0; }
.api-tag.api-ok { background: #dcfce7; color: #166534; }
.api-tag.api-mixed { background: #f0fdf4; gap: 4px; }
.api-tag .api-m { font-size: 9px; padding: 0 3px; border-radius: 4px; }
.api-tag .api-m.ok { background: #bbf7d0; color: #166534; }
.api-tag .api-m.off { background: #e5e7eb; color: #9ca3af; text-decoration: line-through; }
.api-tag .api-m.pending { background: #fef3c7; color: #92400e; }
.api-tag.api-untested { background: #fef3c7; color: #92400e; cursor: help; }
.api-tag.api-none { background: #fee2e2; color: #991b1b; }

/* Photo grid (lazy thumbnails) */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-card { border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; background: #fff; }
.photo-card img { width: 100%; height: 120px; object-fit: cover; display: block; background: #f3f4f6; }
.photo-noimg { width: 100%; height: 120px; display: flex; align-items: center; justify-content: center; color: #9ca3af; background: #f3f4f6; font-size: 12px; }
.photo-cap { padding: 8px 10px; font-size: 12px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more { padding: 18px 0; text-align: center; }

/* --- Transfer button (projects table) --- */
.xfer-btn { font-size: 12px; padding: 4px 12px; border-color: #2563eb; color: #1d4ed8; background: #eff6ff; }
.xfer-btn:hover { background: #dbeafe; }

/* --- Transfer modal (centered) --- */
.drawer-overlay:has(.xfer-modal) { justify-content: center; align-items: center; }
.xfer-modal { width: 560px; max-width: 94vw; max-height: 88vh; background: #fff;
  border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.22); display: flex; flex-direction: column; }
.xfer-body { padding: 16px 20px; overflow-y: auto; }

/* source info cells */
.xfer-info-title { font-weight: 600; margin-bottom: 10px; color: #374151; }
.xfer-info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.xfer-cell { background: #f7f8fa; border: 1px solid #eef0f3; border-radius: 8px; padding: 12px; text-align: center; }
.xfer-cell-n { font-size: 22px; font-weight: 700; color: #111827; }
.xfer-cell-l { font-size: 12px; color: #6b7280; margin-top: 2px; }

/* first-party token row (sheet collections) */
.fp-token { border: 1px solid #eef0f3; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; background: #fafbfc; }
.fp-head { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.fp-label { color: #374151; font-weight: 600; }
.fp-status { flex: 1; font-size: 12px; color: #6b7280; }
.fp-status.ok { color: #166534; }
.fp-status.warn { color: #92651a; }
.fp-toggle { font-size: 12px; padding: 3px 10px; }
.fp-form { display: flex; gap: 8px; margin-top: 8px; }
.fp-input { flex: 1; font-size: 12px; }
.fp-save { font-size: 12px; white-space: nowrap; }

/* transfers list (persisted jobs, reopenable after tab close / re-login) */
.jobs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.jobs-head .section-h { margin: 10px 0 6px; }
.jobs-box { margin: 6px 0 18px; border: 1px solid #e5e7eb; border-radius: 10px; padding: 4px 14px 10px; background: #fafbfc; }
.job-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid #eef0f3; }
.job-row:first-of-type { border-top: 0; }
.job-meta { flex: 1; min-width: 0; }
.job-name { font-size: 13px; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-sub { font-size: 12px; color: #6b7280; }
.job-open { font-size: 12px; white-space: nowrap; }
.tag.job-running { background: #dbeafe; color: #1d4ed8; }
.tag.job-done { background: #dcfce7; color: #166534; }
.tag.job-error { background: #fee2e2; color: #991b1b; }
.tag.job-warn { background: #fef3c7; color: #92400e; }

/* copy-members checkbox row */
.xfer-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: #374151; margin-top: 4px; cursor: pointer; }
.xfer-check input { margin-top: 3px; }
.xfer-check-hint { color: #9ca3af; font-size: 12px; }

/* new-project form */
.xfer-form { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 0; border-top: 1px solid #eef0f3; }
.xfer-form label { font-size: 13px; color: #374151; }
.xfer-name, .xfer-hub { font: inherit; padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 6px; width: 100%; box-sizing: border-box; background: #fff; }
.xfer-form .xfer-start { align-self: flex-start; margin-top: 8px; }
.xfer-start { background: #2563eb; border-color: #2563eb; color: #fff; padding: 7px 16px; }
.xfer-start:hover { background: #1d4ed8; }
.xfer-start:disabled { opacity: .6; cursor: default; }

/* progress */
.xfer-progress { margin-top: 6px; }
.xfer-status { margin: 8px 0; }
.xfer-status.ok { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.xfer-meta { font-size: 12px; color: #6b7280; margin-bottom: 8px; word-break: break-all; }
.xfer-phase { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280;
  margin: 14px 0 6px; border-bottom: 1px solid #eef0f3; padding-bottom: 4px; }
.xfer-grp { margin: 8px 0; }
.xfer-grp-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 3px; }
.xfer-grp-name { color: #374151; }
.xfer-grp-count { color: #6b7280; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: #eef0f3; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: #2563eb; border-radius: 5px; transition: width .3s ease; }
.bar-fill.done { background: #16a34a; }
.bar-fill.err { background: #dc2626; }
/* demo mode: a category that didn't migrate is amber, not alarming red */
.bar-fill.warn { background: #f59e0b; }

/* demo mode: neutral one-liner in place of the red failed-items list */
.xfer-partial { margin-top: 12px; font-size: 12px; color: #6b7280; background: #f7f8fa;
  border: 1px solid #eef0f3; border-radius: 6px; padding: 8px 12px; }

/* toast (replaces alert) */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(17,24,39,.92); color: #fff; font-size: 13px; padding: 10px 18px;
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.18); z-index: 90;
  opacity: 1; transition: opacity .5s ease; }
.toast.out { opacity: 0; }
/* pacing line (adaptive throttle state) */
.xfer-throttle { margin-top: 10px; font-size: 12px; color: #6b7280; background: #f7f8fa;
  border: 1px solid #eef0f3; border-radius: 6px; padding: 6px 10px; font-variant-numeric: tabular-nums; }
.xfer-throttle.on { color: #92651a; background: #fff8eb; border-color: #fde9c4; }

.xfer-note { margin-top: 12px; font-size: 12px; color: #92651a; background: #fff8eb;
  border: 1px solid #fde9c4; border-radius: 6px; padding: 8px 12px; }

/* quiet reconnect note while the progress poll rides out a network blip */
.xfer-reconnect { margin-top: 8px; font-size: 12px; color: #9ca3af; font-style: italic; }

/* transfer advisory notices (job.warnings) — amber like .xfer-note, listed */
.xfer-warns { margin-top: 12px; border: 1px solid #fde9c4; border-radius: 6px; overflow: hidden; }
.xfer-warns-head { background: #fff8eb; color: #92651a; font-size: 12px; font-weight: 600; padding: 6px 12px; }
.xfer-warn-row { padding: 6px 12px; font-size: 12px; color: #6b7280; border-top: 1px solid #fde9c4; }

/* transfer failed-items list */
.xfer-errs { margin-top: 12px; border: 1px solid #fecaca; border-radius: 6px; overflow: hidden; }
.xfer-errs-head { background: #fef2f2; color: #b91c1c; font-size: 12px; font-weight: 600; padding: 6px 12px; }
.xfer-err-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 12px; font-size: 12px; border-top: 1px solid #fee2e2; }
/* Both columns flex with a floor: a long reason (the workshared-copy skip
   sentence) must WRAP, not nowrap-squeeze the name into a one-character
   vertical strip. min-width:0 lets flex actually shrink past content size. */
.xfer-err-name { color: #374151; word-break: break-all; flex: 1 1 55%; min-width: 0; }
.xfer-err-why { color: #b91c1c; flex: 1 1 45%; min-width: 0; text-align: right; overflow-wrap: anywhere; }

/* transfer: current-file byte progress + speed */
.xfer-current { margin: 10px 0; padding: 8px 10px; background: #f7f8fa; border: 1px solid #eef0f3; border-radius: 8px; }
.xfer-cur-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 4px; }
.xfer-cur-name { color: #374151; word-break: break-all; }
.xfer-cur-stat { color: #1d4ed8; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
