/* Loading screen and sign-in screen for the cloud version. Uses the app's own tokens from style.css. */

/* Until cloud.js marks the page ready, only the loading screen and the sign-in card show: no half-built app. */
html:not(.cos-ready) body > :not(.cos-loader):not(.cos-gate) { visibility: hidden; }

.cos-loader { position: fixed; inset: 0; z-index: 10001; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 16px; text-align: center; background: var(--canvas, #F3F1EC);
  color: var(--ink, #1D1D1B); font-family: var(--font-ui, system-ui, sans-serif); transition: opacity .25s ease; }
.cos-loader.out { opacity: 0; pointer-events: none; }
.cos-loader.gone { display: none; }
.cos-loader img { width: 56px; height: 56px; border-radius: 12px; margin-bottom: 4px; }
.cos-loader-title { font-size: 22px; font-weight: 700; letter-spacing: -.015em; }
.cos-loader-line { max-width: 400px; font-size: 15px; line-height: 1.5; color: var(--ink-2, #6B6A64); }
.cos-loader-bar { position: relative; width: 160px; height: 4px; margin-top: 8px; border-radius: 4px; overflow: hidden;
  background: var(--fog, #E9E6DE); }
.cos-loader-bar::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; border-radius: 4px;
  background: var(--ink, #1D1D1B); animation: cos-slide 1.1s ease-in-out infinite; }
@keyframes cos-slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .cos-loader-bar::after { animation: none; width: 100%; opacity: .35; } }

.cos-gate { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: var(--canvas, #F3F1EC); font-family: var(--font-ui, system-ui, sans-serif); color: var(--ink, #1D1D1B); }
.cos-gate.hidden { display: none; }
.cos-card { width: 100%; max-width: 400px; background: var(--card, #FBFAF7); border: 1px solid var(--line, #DCD8CE);
  border-radius: 14px; padding: 32px 28px 28px; box-shadow: var(--shadow-2); }
.cos-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.cos-brand img { width: 30px; height: 30px; border-radius: 7px; }
.cos-brand span { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.cos-card h1 { font-size: 22px; line-height: 1.25; margin: 0 0 6px; font-weight: 700; letter-spacing: -.015em; }
.cos-card p { margin: 0 0 18px; color: var(--ink-2, #6B6A64); font-size: 14px; line-height: 1.5; }
.cos-card label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2, #6B6A64); margin: 0 0 6px;
  text-transform: uppercase; letter-spacing: .04em; }
.cos-card input { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 11px 12px; margin-bottom: 14px;
  border: 1px solid var(--line-2, #D0CCC1); border-radius: var(--radius, 8px); background: #fff; color: var(--ink, #1D1D1B); }
.cos-card input:focus { outline: 2px solid var(--ink, #1D1D1B); outline-offset: 1px; border-color: transparent; }
.cos-card input.cos-code { font-family: var(--font-mono, monospace); font-size: 22px; letter-spacing: .3em; text-align: center; }
.cos-card .btn { width: 100%; justify-content: center; padding: 12px 16px; font-size: 15px; }
.cos-link { display: inline-block; margin-top: 14px; background: none; border: 0; padding: 0; font: inherit; font-size: 13px;
  color: var(--ink-2, #6B6A64); text-decoration: underline; cursor: pointer; }
.cos-msg { min-height: 20px; margin: 4px 0 12px; font-size: 13px; line-height: 1.45; }
.cos-msg.err { color: var(--danger, #E41E3F); }
.cos-msg.ok { color: var(--ok, #31A24C); }
.cos-qr { display: flex; justify-content: center; margin: 4px 0 12px; }
.cos-qr img { width: 180px; height: 180px; background: #fff; border: 1px solid var(--line, #DCD8CE); border-radius: 8px; padding: 8px; }
.cos-secret { font-family: var(--font-mono, monospace); font-size: 12px; word-break: break-all; background: var(--fog, #E9E6DE);
  border-radius: 6px; padding: 8px 10px; margin: 0 0 16px; }
.cos-steps { margin: 0 0 16px; padding-left: 18px; font-size: 14px; line-height: 1.55; color: var(--ink, #1D1D1B); }
.cos-who { font-size: 12px; color: var(--ink-3, #8F8D85); margin-top: 18px; }
