/* ============================================================
   Nasjicad — Collaborate (collab.js): the Nasji Connect window,
   its small dialogs, and Nasji Projects on the Start page.
   Colours are the shell's tokens (tokens.css).
   ============================================================ */

/* the Start page's panes come and go with [hidden] (their display is flex) */
#start-page [hidden] { display: none !important; }

/* ---- buttons, fields, notes ---- */
.cl-btn { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #3a3a3a; color: var(--text); font: 12px var(--font-ui); cursor: pointer; white-space: nowrap; }
.cl-btn:hover:not(:disabled) { background: var(--hover); color: var(--text-bright); }
.cl-btn:disabled { opacity: .45; cursor: default; }
.cl-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.cl-btn.primary:hover:not(:disabled) { background: var(--accent-bright); }
.cl-btn.icon { width: 26px; padding: 0; justify-content: center; }
.cl-btn svg { width: 16px; height: 16px; flex: none; }
.cl-in, .cl-setup input { height: 24px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-input); color: var(--text-bright); font: 12px var(--font-ui); }
.cl-in:focus, .cl-setup input:focus { outline: none; border-color: var(--accent); }
.cl-hint { color: var(--text-dim); font-size: 12px; line-height: 1.5; padding: 4px 2px; }
.cl-error { color: var(--danger); margin: 6px 0; }
.cl-dim { color: var(--text-dim); font-weight: 400; }
.cl-grow { flex: 1; }
.cl-r { float: right; }
.cl-h { font-weight: 600; color: var(--text-bright); margin: 10px 2px 4px; }

/* ---- the window ---- */
.cl-win { position: fixed; z-index: 900; left: calc(50% - 460px); top: 90px; width: 920px; max-width: calc(100vw - 16px); height: 590px; max-height: calc(100vh - 100px);
  display: flex; flex-direction: column; background: var(--bg-palette); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); font: 12px var(--font-ui); }
.cl-head { display: flex; align-items: center; justify-content: space-between; height: 30px; padding: 0 6px 0 10px; background: var(--bg-titlebar); border-bottom: 1px solid var(--border); cursor: move; color: var(--text-bright); font-weight: 600; }
.cl-head span { display: inline-flex; align-items: center; gap: 6px; }
.cl-head svg { width: 16px; height: 16px; }
.cl-x { border: none; background: transparent; color: var(--text); font-size: 18px; width: 26px; height: 24px; cursor: pointer; border-radius: var(--radius); }
.cl-x:hover { background: var(--hover); color: #fff; }
.cl-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cl-setup { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cl-setup label { display: flex; align-items: center; gap: 6px; color: var(--text-dim); }
.cl-server { width: 300px; }
.cl-main { flex: 1; min-height: 0; display: flex; }
.cl-side { width: 210px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.cl-projects { flex: 1; overflow-y: auto; padding: 4px; }
.cl-proj { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: var(--radius); cursor: pointer; }
.cl-proj:hover { background: var(--hover); }
.cl-proj.on { background: var(--accent-soft); color: var(--text-bright); font-weight: 600; }
.cl-proj svg { width: 16px; height: 16px; flex: none; }
.cl-proj span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the trash button on each project: always visible (so it works by touch too), red on hover */
.cl-proj-del { flex: none; border: none; background: transparent; padding: 2px; border-radius: 3px; cursor: pointer; color: var(--text-dim); opacity: .55; line-height: 0; }
.cl-proj-del:hover { opacity: 1; background: var(--danger, #e04c4c); color: #fff; }
.cl-proj-del svg { width: 14px; height: 14px; }
.cl-side-acts { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-top: 1px solid var(--border-soft); }
.cl-pane { flex: 1; min-width: 0; overflow-y: auto; padding: 10px 12px; }
.cl-intro { max-width: 470px; }
.cl-ph { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; color: var(--text-bright); }
.cl-files { width: 100%; border-collapse: collapse; border: 1px solid var(--border); }
.cl-files th { text-align: left; font-weight: 600; color: var(--text-dim); padding: 5px 6px; border-bottom: 1px solid var(--border); background: #2b2b2b; }
.cl-files td { padding: 4px 6px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.cl-files td svg { width: 14px; height: 14px; vertical-align: -2px; }
.cl-files tr.cl-open td { background: var(--accent-soft); }
.cl-acts { display: flex; gap: 4px; justify-content: flex-end; }
.cl-ver { max-width: 120px; height: 26px; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); }
.cl-put { margin: 8px 0 4px; }
.cl-cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; }
.cl-ev { padding: 3px 4px; border-bottom: 1px solid var(--border-soft); }
.cl-foot { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--border); min-height: 32px; }
.cl-foot svg { width: 16px; height: 16px; vertical-align: -3px; }

/* ---- small dialogs ---- */
.cl-modal-back { position: fixed; inset: 0; z-index: 950; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; }
.cl-modal { width: 470px; max-width: calc(100vw - 32px); background: var(--bg-palette); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); font: 12px var(--font-ui); }
.cl-modal-head { display: flex; align-items: center; justify-content: space-between; height: 30px; padding: 0 6px 0 12px; background: var(--bg-titlebar); color: var(--text-bright); font-weight: 600; border-bottom: 1px solid var(--border); }
.cl-modal-body { padding: 12px 14px; line-height: 1.5; }
.cl-modal-body ul { margin: 6px 0; padding-left: 18px; }
.cl-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); }
.cl-field { display: flex; flex-direction: column; gap: 6px; }
.cl-field .cl-in, .cl-link { width: 100%; box-sizing: border-box; }

/* ---- Nasji Projects on the Start page ---- */
.st-projects { overflow: auto; }
.np-wrap { display: flex; gap: 18px; margin-top: 14px; min-height: 360px; }
.np-side { width: 200px; flex: none; border-right: 1px solid var(--border); padding-right: 12px; }
.np-user { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-bright); padding: 4px 2px 10px; border-bottom: 1px solid var(--border-soft); }
.np-user svg, .np-proj svg { width: 16px; height: 16px; flex: none; }
.np-h { color: var(--text-dim); font-weight: 600; margin: 10px 2px 4px; }
.np-proj { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: var(--radius); cursor: pointer; }
.np-proj:hover { background: var(--hover); }
.np-proj.on { background: var(--accent-soft); color: var(--text-bright); font-weight: 600; }
.np-proj span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the trash button on each project (Start page): always visible (so it works by touch too), red on hover */
.np-proj-del { flex: none; border: none; background: transparent; padding: 2px; border-radius: 3px; cursor: pointer; color: var(--text-dim); opacity: .55; line-height: 0; }
.np-proj-del:hover { opacity: 1; background: var(--danger, #e04c4c); color: #fff; }
.np-proj-del svg { width: 14px; height: 14px; }
.np-acts { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.np-main { flex: 1; min-width: 0; overflow-x: auto; }
.np-path { color: var(--text-dim); padding: 4px 0 10px; }
.np-path b { color: var(--text-bright); }
.np-files { width: 100%; border-collapse: collapse; border: 1px solid var(--border); }
.np-files th { text-align: left; font-weight: 600; color: var(--text-dim); padding: 7px 8px; border-bottom: 1px solid var(--border); background: #2b2b2b; white-space: nowrap; }
.np-files td { padding: 7px 8px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.np-files td:first-child { white-space: normal; }
.np-files td svg { width: 14px; height: 14px; vertical-align: -2px; }
.np-files tbody tr[data-fid] { cursor: pointer; }
.np-files tbody tr[data-fid]:hover td { background: var(--hover); color: var(--text-bright); }
.np-files tbody tr.other { opacity: .6; }

/* ---- members' roles: the role, ⋮ for an Administrator, the role menu ---- */
.cl-member { display: flex; align-items: center; gap: 6px; }
.cl-mname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-role { color: var(--text-dim); font-size: 11px; white-space: nowrap; }
.cl-dots { flex: none; width: 22px; height: 22px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text); cursor: pointer; font-size: 15px; line-height: 1; }
.cl-dots:hover { background: var(--hover); border-color: var(--border); color: var(--text-bright); }
.cl-role-pop { position: fixed; z-index: 1000; width: 260px; background: var(--bg-palette); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); padding: 6px 0; font: 12px var(--font-ui); }
.cl-role-search { display: flex; align-items: center; gap: 6px; margin: 0 8px 6px; padding: 0 8px; height: 30px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--bg-input); }
.cl-role-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--text-bright); font: inherit; }
.cl-role-search svg { width: 16px; height: 16px; flex: none; }
.cl-role-chev { color: var(--text-dim); }
.cl-role-opt { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; cursor: pointer; }
.cl-role-opt:hover { background: var(--hover); color: var(--text-bright); }
.cl-role-opt.on { background: var(--accent-soft); color: var(--text-bright); font-weight: 600; }
.cl-role-check { color: var(--accent-bright); font-size: 14px; }
.cl-role-none { padding: 8px 14px; color: var(--text-dim); }
/* a drawing's History in Nasji Connect: its versions by day, each with a ⋮ (Open, Open and audit, Restore to version) */
.cl-histbtn .cl-chev, .cl-dayh .cl-chev { display: inline-block; font-size: 10px; transition: transform .15s; }
.cl-histbtn.on .cl-chev { transform: rotate(180deg); }
.cl-files tr.cl-hist > td { padding: 0 0 6px 18px; background: var(--bg-input); white-space: normal; }
.cl-day.shut .cl-dayh .cl-chev { transform: rotate(-90deg); }
.cl-dayh { display: flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 6px 2px 3px; color: var(--text-dim); font: inherit; font-weight: 600; cursor: pointer; }
.cl-vrow { display: grid; grid-template-columns: 16px 40px minmax(90px, 1fr) minmax(0, 1.4fr) 70px 24px; align-items: center; gap: 8px; padding: 2px 6px 2px 14px; border-bottom: 1px solid var(--border-soft); }
.cl-vrow:hover { background: var(--hover); }
.cl-vrow svg { width: 14px; height: 14px; }
.cl-vnum { font-weight: 600; color: var(--text-bright); }
.cl-vby, .cl-vnote { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-vnote, .cl-vtime { color: var(--text-dim); }
.cl-vtime { text-align: right; white-space: nowrap; }
.cl-vrow.pruned { opacity: .5; }
.cl-latest { display: inline-block; padding: 0 5px; border-radius: 3px; background: var(--accent-soft); color: var(--text-bright); font-size: 11px; }
.cl-dots:disabled { cursor: default; opacity: .4; }
.cl-pop { width: 200px; }
.cl-role-opt.off { color: var(--text-dim); opacity: .6; cursor: default; }
.cl-role-opt.off:hover { background: transparent; color: var(--text-dim); }
.cl-audit ul { margin: 4px 0 10px; padding-left: 18px; }
.cl-audit .cl-bad li { color: #ff8a80; }
.cl-audit .cl-good { color: #7bd88f; }
.cl-memail { display: block; color: var(--text-dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.cl-setup .cl-email { width: 190px; }
.np-user small { display: block; font-weight: 400; color: var(--text-dim); }
