/* FlowCAD3D cloud platform: sign-in screen, read-only banner, cloud status, project browser, profile, messages. */

/* ---------- sign-in screen ---------- */
#cloud-gate { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% 10%, #13305c 0%, var(--fc-navy) 60%); overflow-y: auto; }
#cloud-gate[hidden] { display: none; }
body.cloud-locked #app { visibility: hidden; }
.cg-card { width: 100%; max-width: 420px; background: var(--bg2); color: var(--fg); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); padding: 28px 28px 18px; }
.cg-logo { display: block; height: 42px; margin: 0 auto 18px; }
.cg-body h1 { font-size: 20px; margin: 0 0 12px; }
.cg-body p { line-height: 1.5; }
.cg-form { display: flex; flex-direction: column; gap: 10px; }
.cg-field { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 13px; }
.cg-field .inp { min-height: 42px; font-size: 15px; }
.cg-submit { min-height: 44px; margin-top: 6px; text-decoration: none; }
.cg-link { align-self: center; color: var(--accent); }
.cg-wait { text-align: center; padding: 30px 0; color: var(--fg3); }
.cg-msg { border-radius: var(--radius); padding: 10px 12px; font-size: 13px; line-height: 1.45; background: var(--bg4); }
.cg-msg.err { background: rgba(220, 38, 38, .10); color: var(--danger-fg); border: 1px solid rgba(220, 38, 38, .35); }
.cg-msg.warn { background: var(--ban-warn-bg); color: var(--ban-warn-fg); }
.cg-msg.ok { background: var(--ban-ok-bg); color: var(--ban-ok-fg); }
.cg-foot { text-align: center; margin-top: 18px; }

/* ---------- read-only banner and status ---------- */
#cloud-banner { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--ban-warn-bg); color: var(--ban-warn-fg); font-size: 13px; border-bottom: 1px solid var(--line); }
#cloud-banner .cb-ico { display: inline-flex; }
#cloud-banner .grow { flex: 1; }
#cloud-banner { position: absolute; top: 0; left: 0; right: 0; height: 36px; box-sizing: border-box; z-index: 5; }
#center.has-banner > .workspace { top: 36px; }
.st-cloud { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 10px; white-space: nowrap; }
.st-cloud .ico { width: 15px; height: 15px; }
.st-cloud.ok { color: var(--ok); }
.st-cloud.warn { color: var(--warn); }
.st-cloud.err { color: var(--err); }
.st-cloud.busy { color: var(--accent); }
.st-cloud.muted { color: var(--fg3); }

/* ---------- project browser ---------- */
.cp-bar { gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.cp-search { flex: 1; min-width: 180px; }
.cp-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.cp-row.current { box-shadow: inset 3px 0 0 var(--accent); }
.cp-chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; margin-left: 6px; background: var(--bg4); color: var(--fg2); vertical-align: middle; }
.cp-chip.mine { background: var(--ban-ok-bg); color: var(--ban-ok-fg); }
.cp-chip.other { background: var(--ban-warn-bg); color: var(--ban-warn-fg); }
.cp-chip.warn { background: rgba(220, 38, 38, .12); color: var(--danger-fg); }
.cp-dash { margin: 14px 0; }
.cp-storage { margin: 6px 0 12px; }
.cp-sbar { height: 10px; border-radius: 5px; background: var(--bg4); overflow: hidden; margin-bottom: 4px; }
.cp-sbar > div { height: 100%; background: var(--ok); }
.cp-storage.warn .cp-sbar > div { background: var(--warn); }
.cp-storage.err .cp-sbar > div { background: var(--err); }
.cp-kinds { margin-bottom: 12px; }
.cp-indet { width: 35% !important; animation: cp-indet 1.2s ease-in-out infinite; }
@keyframes cp-indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

/* ---------- toolbar: user, messages ---------- */
.tb-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.tb-msg { position: relative; }
.tb-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--err); color: #FFFFFF; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.tb-msg .tb-badge { position: absolute; top: 3px; right: 1px; }
.tb-badge[hidden] { display: none; }

/* ---------- profile ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; padding-bottom: 6px; flex-wrap: wrap; }
.pf-top { gap: 14px; align-items: center; margin-bottom: 10px; }
.pf-avatar { width: 84px; height: 84px; border-radius: 50%; background: var(--accentbg); display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; font-size: 28px; font-weight: 700; color: var(--accent); }
.pf-avatar img { width: 100%; height: 100%; object-fit: cover; }
.co-logo img { max-height: 70px; max-width: 260px; background: #FFFFFF; padding: 6px; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- messages drawer ---------- */
#cloud-drawer { position: fixed; top: var(--tb-h); right: 0; bottom: 0; width: min(400px, 100vw); z-index: 900; background: var(--bg2); border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.cd-head { display: flex; align-items: center; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
.cd-head .grow { flex: 1; }
.cd-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.cd-conv.unread .t1, .li.unread .t1 { font-weight: 700; }
.cd-thead { align-items: center; gap: 6px; }
.cd-msgs { flex: 1; min-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; }
.cd-msg { max-width: 85%; align-self: flex-start; background: var(--bg3); border: 1px solid var(--line); border-radius: 10px 10px 10px 2px; padding: 6px 10px; }
.cd-msg.mine { align-self: flex-end; background: var(--accentbg); border-radius: 10px 10px 2px 10px; }
.cd-meta { font-size: 11px; color: var(--fg3); margin-bottom: 2px; }
.cd-text { white-space: normal; word-wrap: break-word; line-height: 1.4; }
.cd-ref { margin-top: 4px; }
.cd-read { background: none; border: 0; padding: 0; margin-top: 2px; font-size: 11px; color: var(--fg3); cursor: pointer; display: block; margin-left: auto; }
.cd-compose { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.cd-compose textarea { resize: vertical; min-height: 54px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--fg3); }
.dot.on { background: var(--ok); }

@media (max-width: 700px) {
  .cg-card { padding: 20px 16px 14px; }
  #cloud-drawer { width: 100vw; }
}
.cd-compose .field { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; margin: 0; }
.cd-compose .field label { font-size: 12px; color: var(--fg2); }
