/* Sulla Cloud app: shared shell (sidebar, expandable nav groups, org
   switcher, top bar, theme picker, sign-in). Ported from the approved
   mockup; class names match it so screens can be compared side by side. */

.app {
  height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); overflow: hidden;
  font-family: var(--sans); color: var(--text); background: var(--paper);
  background-image: radial-gradient(900px 500px at 15% -10%, var(--glow-1), transparent 60%), radial-gradient(700px 400px at 100% 0%, var(--glow-2), transparent 55%);
  font-size: 13px; line-height: 1.45; -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "cv11" 1;
}

/* ── Sidebar (FilesBrowser .nav) ── */
.nav { position: relative; height: 100%; min-height: 0; overflow-y: auto; padding: 18px 14px 14px; border-right: 1px solid var(--line); background: var(--nav-bg); backdrop-filter: blur(14px); display: flex; flex-direction: column; gap: 3px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand .mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #1a2332); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.brand b { display: block; font-size: 13px; }
.brand span { display: block; font-size: 11px; color: var(--dim); }
.orgbtn { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 9px; margin: 0 0 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card-solid); text-align: left; box-shadow: var(--shadow-sm); }
.orgbtn:hover { border-color: var(--accent-line); }
.orgbtn .t { flex: 1; min-width: 0; }
.orgbtn .t b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orgbtn .t small { display: block; font-size: 10.5px; color: var(--dim); }
.orgbtn .chev { width: 14px; height: 14px; color: var(--dim); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.nav a .sv { display: grid; width: 16px; height: 16px; flex: none; opacity: .8; }
.nav a .sv svg { width: 16px; height: 16px; }
.nav a:hover { background: var(--ink-05); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.nav a.on .sv { opacity: 1; }
.nav a .cnt { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--paper-2); color: var(--muted); padding: 1px 7px; border-radius: 999px; }
.nav a .cnt.warn { background: var(--warn-soft); color: var(--warn); }
.nav a .cnt.live { background: var(--ok-soft); color: var(--ok); }
.nav a.sub { position: relative; padding: 6px 8px 6px 32px; font-size: 12.5px; border-radius: 7px; }
.nav a.sub .sv { width: 14px; height: 14px; } .nav a.sub .sv svg { width: 14px; height: 14px; }
.nav a.sub:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.nav a.sub.on { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.nav a.sub.on::before { content: ""; position: absolute; left: 13px; top: 7px; bottom: 7px; width: 2px; border-radius: 2px; background: var(--accent); }
.nav a.open { --sg-edge: color-mix(in srgb, var(--accent) 18%, var(--line)); border-radius: 9px 9px 0 0; background: color-mix(in srgb, var(--accent) 14%, var(--card-solid)); box-shadow: inset 1px 0 0 var(--sg-edge), inset -1px 0 0 var(--sg-edge), inset 0 1px 0 var(--sg-edge); }
.nav-subgroup { position: relative; margin: -3px 0 10px; padding: 5px 4px 6px; border-radius: 0 0 10px 10px; --sg-edge: color-mix(in srgb, var(--accent) 18%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--card-solid)); box-shadow: inset 1px 0 0 var(--sg-edge), inset -1px 0 0 var(--sg-edge), inset 0 -1px 0 var(--sg-edge); display: flex; flex-direction: column; gap: 1px; }
.nav-subgroup::before { content: ""; position: absolute; left: 17px; top: 0; bottom: 12px; width: 1px; background: color-mix(in srgb, var(--accent) 30%, var(--line-2)); }
.nav-subgroup .sg-h { position: relative; padding: 7px 8px 3px 32px; font-size: 9.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); }
.nav-subgroup .sg-h:first-child { padding-top: 3px; }
.nav-subgroup .sg-sep { position: relative; height: 1px; background: var(--line); margin: 5px 6px 2px 28px; }
.nav .sep { height: 1px; background: var(--line); margin: 10px 8px; }
.nav .grp { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); padding: 8px 10px 4px; }
.devline { display: flex; align-items: center; gap: 9px; padding: 5px 10px; color: var(--muted); font-size: 12px; border-radius: 8px; }
.devline .sv { width: 15px; height: 15px; display: grid; opacity: .75; } .devline .sv svg { width: 15px; height: 15px; }
.devline span.n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.devline.off { color: var(--dim); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); flex: none; display: inline-block; }
.dot.off { background: var(--idle); box-shadow: 0 0 0 3px var(--idle-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot.acc { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.quota { padding: 10px 10px 6px; font-size: 11px; color: var(--muted); }
.quota .bar, .bar { height: 4px; border-radius: 2px; background: var(--paper-2); overflow: hidden; margin: 6px 0 4px; }
.quota .bar i, .bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.quota b { color: var(--text); font-weight: 600; }
.syncline { display: flex; align-items: center; gap: 7px; padding: 8px 10px; font-size: 11.5px; color: var(--muted); border-radius: 9px; background: color-mix(in srgb, var(--card-solid) 60%, transparent); border: 1px solid var(--line); margin-top: 8px; }
.nav .foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.nav .foot b { display: block; font-size: 12px; }
.nav .foot small { display: block; color: var(--dim); font-size: 11px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, #9ec1d3, #3a7fa0); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.avatar.sq { border-radius: 8px; }
.avatar.m { background: linear-gradient(135deg, #f0c38e, #d98a0a); }
.avatar.d { background: linear-gradient(135deg, #b7a7e0, #6b4fbf); }
.avatar.p { background: linear-gradient(135deg, #9ad7b4, #1f9d55); }
.avatar.a { background: linear-gradient(135deg, #1a2332, #3a7fa0); }
.avatar.sm { width: 20px; height: 20px; font-size: 9px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; border-radius: 11px; }
.stack { display: flex; } .stack .avatar { border: 2px solid var(--card-solid); } .stack .avatar + .avatar { margin-left: -7px; }

/* Org popover */
.pop { position: fixed; z-index: 60; width: 270px; padding: 6px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card-solid); box-shadow: var(--shadow-lg); display: none; }
.pop.open { display: block; }
.pop .hd { padding: 7px 9px 5px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.pop button.it { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 9px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.pop button.it:hover { background: var(--ink-05); }
.pop button.it .t { flex: 1; min-width: 0; } .pop button.it b { display: block; font-size: 12.5px; } .pop button.it small { display: block; color: var(--dim); font-size: 11px; }
.pop button.it .ck { width: 16px; height: 16px; color: var(--accent); }
.pop .ms { height: 1px; margin: 5px 4px; background: var(--line-2); }
.pop button.ln { display: flex; gap: 8px; align-items: center; width: 100%; padding: 7px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12.5px; text-align: left; }
.pop button.ln:hover { background: var(--ink-05); color: var(--text); }
.pop button.ln span { width: 14px; height: 14px; display: grid; } .pop button.ln svg { width: 14px; height: 14px; }

/* ── Main column + top bar (FilesBrowser .top) ── */
.maincol { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.top { display: flex; align-items: center; gap: 14px; padding: 12px 28px; border-bottom: 1px solid var(--line); background: var(--top-bg); backdrop-filter: blur(10px); position: relative; z-index: 5; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12.5px; white-space: nowrap; }
.crumbs b { color: var(--text); font-weight: 600; } .crumbs .c { color: var(--muted); } .crumbs .c:hover { color: var(--accent-2); }
.search { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 520px; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--card-solid); color: var(--dim); font-size: 12.5px; min-width: 0; }
.search .si { display: grid; width: 14px; height: 14px; flex: none; } .search .si svg { width: 14px; height: 14px; }
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--text); padding: 0; }
.search input::placeholder { color: var(--dim); }
kbd { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; color: var(--dim); background: var(--paper); }
.top .acts { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.themebox { display: flex; align-items: center; gap: 6px; }

/* Nav counts on submenu rows reuse .cnt; the org/device lists can be empty. */
.nav .navnote { padding: 4px 10px 6px; font-size: 11.5px; color: var(--dim); }
.nav .devline.skel { color: transparent; }
.nav .devline.skel span.n { height: 9px; border-radius: 5px; background: var(--ink-05); }
.orgbtn[disabled] { cursor: progress; opacity: .7; }
.pop button.it[disabled] { opacity: .6; cursor: progress; }
.pop .hint { padding: 6px 9px 8px; font-size: 11.5px; color: var(--dim); }
.search input:disabled { cursor: not-allowed; }
.search.is-off { opacity: .7; }
.themebox .seg button { cursor: pointer; }

/* Boot curtain: shown until auth resolves so the shell never flashes empty data. */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--paper); z-index: 40; }
.boot[hidden] { display: none; }

/* Sign in (same flows as the legacy dashboard: email code, phone, password). */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: var(--paper);
  background-image: radial-gradient(900px 500px at 15% -10%, var(--glow-1), transparent 60%), radial-gradient(700px 400px at 100% 0%, var(--glow-2), transparent 55%); }
.signin-card { width: min(420px, 100%); padding: 26px 26px 22px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--card-solid); box-shadow: var(--shadow-lg); }
.signin-card .brand { padding: 0 0 18px; }
.signin-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 680; letter-spacing: -.02em; }
.signin-card > p { margin: 0 0 16px; color: var(--muted); font-size: 12.5px; }
.signin-card > .seg { display: flex; margin-bottom: 14px; } .signin-card > .seg button { flex: 1; justify-content: center; }
.signin-card form { display: flex; flex-direction: column; gap: 10px; }
.signin-card form label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.signin-card .btn.pri { justify-content: center; padding: 9px 12px; font-size: 13px; }
.signin-card .linkish { border: 0; background: none; padding: 0; color: var(--accent-2); font-size: 12px; font-weight: 500; }
.signin-card .err { min-height: 18px; color: var(--bad); font-size: 12px; }
.signin-card .fine { margin: 14px 0 0; color: var(--dim); font-size: 11.5px; }
.signin-card .themebox { margin-top: 16px; justify-content: flex-end; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .app { grid-template-columns: 72px minmax(0, 1fr); }
  .nav { padding: 14px 8px; }
  .nav .brand div:last-child, .orgbtn .t, .orgbtn .chev, .nav a > span:not(.sv), .nav .grp, .nav .devline span.n, .nav .foot > div:last-child, .nav .quota, .nav-subgroup, .nav .navnote { display: none; }
  .nav a { justify-content: center; padding: 9px; }
  .orgbtn { justify-content: center; padding: 6px; }
  .devline { justify-content: center; }
  .top { padding: 10px 14px; }
  .top .search { display: none; }
}

/* The account footer is a button (it opens the account menu). */
.nav button.foot { width: 100%; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; text-align: left; color: inherit; font: inherit; }
.nav button.foot:hover b { color: var(--accent-2); }
.nav button.foot > span:last-child { min-width: 0; }
.nav button.foot b, .nav button.foot small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-subgroup .tdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; align-self: center; justify-self: center; }
#accountPop { width: 220px; }
