:root {
  --bg: #0F1012;
  --surface: #1A1B1F;
  --surface-2: #1E1F24;
  --raised: #24252B;
  --line: #2A2B31;
  --line-soft: #22232A;
  --text: #F1EFEA;
  --text-2: #C9C7C1;
  --muted: #A3A29C;
  --accent: #F5B83D;
  --on-accent: #1A1408;
  --ok: #8BE28B;
  --danger: #FF8A7A;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); -webkit-tap-highlight-color: transparent; }
body { min-height: 100dvh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
a:hover { color: #FFD27A; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { display: grid; place-items: center; min-height: 100dvh; color: var(--muted); }
svg { flex-shrink: 0; }
.hidden, [hidden] { display: none !important; }

/* ---------- buttons & inputs ---------- */
.btn { height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--on-accent); border: none; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.big { height: 54px; border-radius: 16px; font-family: var(--display); font-size: 17px; width: 100%; }
.btn.danger { color: var(--danger); border-color: #4A2C29; }
.btn.link { border: none; color: var(--accent); font-weight: 600; padding: 0 4px; }
.btn.link:hover { background: none; text-decoration: underline; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: none; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.input, select.input { height: 50px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 16px; width: 100%; }
.input:focus { outline: none; border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--text-2); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.error { color: var(--danger); font-size: 14px; min-height: 20px; }

/* ---------- sign in ---------- */
.auth { min-height: 100dvh; max-width: 440px; margin: 0 auto; padding: 72px 24px 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth .logo-lg { width: 64px; height: 64px; border-radius: 18px; background: var(--accent); display: grid; place-items: center; }
.auth h1 { margin: 18px 0 10px; font-family: var(--display); font-size: 40px; line-height: 1.05; letter-spacing: -0.03em; }
.auth p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.5; }
.auth form { display: flex; flex-direction: column; gap: 16px; margin-top: 36px; }
.auth .foot { text-align: center; font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100dvh; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding: 20px 20px calc(110px + var(--safe-b)); display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 21px; letter-spacing: -0.02em; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); font-family: var(--display); font-weight: 600; font-size: 16px; display: grid; place-items: center; }
.av { width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; font-family: var(--display); font-weight: 700; color: var(--on-accent); flex-shrink: 0; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 8px 12px calc(14px + var(--safe-b)); background: #141518; border-top: 1px solid var(--line); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.tabbar a { min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.fab { position: fixed; right: 20px; bottom: calc(96px + var(--safe-b)); z-index: 11; width: 60px; height: 60px; border-radius: 20px; border: none; background: var(--accent); display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.45); }

/* ---------- content ---------- */
.search { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.search input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; font-size: 15px; }
.card { padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.storage .row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); }
.storage .big { font-family: var(--display); font-size: 30px; font-weight: 700; }
.storage .big small { font-family: var(--body); font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width .2s; }
.banner { padding: 14px 16px; border-radius: 14px; background: #2B1F1D; border: 1px solid #4A2C29; color: #FFC9BF; font-size: 14px; line-height: 1.5; }

.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.head h1 { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
h2.sec { margin: 0; font-family: var(--display); font-size: 18px; font-weight: 600; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; padding: 6px 4px; border-radius: 6px; }
.crumbs a:hover { color: var(--text); background: var(--surface-2); }
.crumbs .cur { color: var(--text-2); padding: 6px 4px; }
.toolbar { display: none; gap: 10px; flex-wrap: wrap; }

.folders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.folder { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: left; text-decoration: none; color: var(--text); min-width: 0; }
.folder:hover { border-color: #3A3B42; color: var(--text); }
.folder .nm { font-size: 15px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 30px; }
.folder .mt { font-size: 12px; color: var(--muted); }
.folder .more { position: absolute; top: 4px; right: 4px; z-index: 1; }
.folder .cover { position: absolute; inset: 0; border-radius: 16px; }

.files { display: flex; flex-direction: column; }
.file { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.file-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 0; background: none; border: none; text-align: left; }
.thumb { width: 44px; height: 44px; border-radius: 12px; background: var(--raised); display: grid; place-items: center; font-family: var(--display); font-size: 11px; font-weight: 700; color: var(--accent); overflow: hidden; flex-shrink: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ft { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ft .nm { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ft .mt { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; border: 1.5px dashed var(--line); border-radius: 16px; }

/* ---------- drives & status ---------- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; flex-shrink: 0; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(139,226,139,.15); }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 3px rgba(255,138,122,.15); }
.badge { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: #1C2A1C; color: var(--ok); }
.badge.bad { background: #2E1E1C; color: var(--danger); }
.badge.warn { background: #2E271A; color: var(--accent); }
.badge.warn .dot { background: var(--accent); box-shadow: none; }
.drive-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.drive-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
a.drive-card:hover { border-color: #3A3B42; color: var(--text); }
.drive-card.off { opacity: .75; }
.dc-top { display: flex; justify-content: space-between; align-items: center; }
.dc-name { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.dc-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.status-wrap { display: flex; flex-direction: column; gap: 22px; max-width: 640px; }
.status-card { gap: 14px; }
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; color: var(--text-2); min-height: 26px; }
.status-row > span:first-child { display: flex; align-items: center; gap: 10px; }
.status-row > span:last-child { display: flex; align-items: center; gap: 4px; color: var(--text); text-align: right; }
.status-row b { font-family: var(--display); font-size: 17px; font-weight: 600; color: var(--text); }
.note { margin: 0; padding: 12px 14px; border-radius: 12px; background: #2B1F1D; color: #FFC9BF; font-size: 13px; line-height: 1.55; }
.side-drives { padding: 14px; gap: 12px; }
.side-drives .sd { display: flex; flex-direction: column; gap: 6px; }
.side-drives .sd-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.side-drives .sd-top span:last-child { color: var(--muted); white-space: nowrap; }
.pick-list button:disabled { opacity: .45; cursor: default; }
.pick-list .ft .mt { font-size: 12px; color: var(--muted); }
#offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 30; display: flex; align-items: center; justify-content: center; gap: 4px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: #2E1E1C; color: #FFC9BF; font-size: 14px; font-weight: 500; text-align: center; }

.ctl-row { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.ctl-row .btn { flex: 1 1 140px; }
.bar.busy span { width: 35% !important; animation: busy 1.1s ease-in-out infinite; }
@keyframes busy { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
.dropzone { display: none; }
body.is-offline .main { padding-top: 64px; }
#body { display: flex; flex-direction: column; gap: 24px; }

/* ---------- team ---------- */
.member { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.member .ft .nm { font-size: 15px; }
.chip-btn { height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.roles { font-size: 13px; line-height: 1.5; color: var(--text-2); display: flex; flex-direction: column; gap: 8px; }
.roles b { color: var(--text); font-weight: 600; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(5,5,6,.6); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out; }
.sheet { width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto; background: #15161A; border: 1px solid var(--line); border-bottom: none; border-radius: 28px 28px 0 0; padding: 12px 20px calc(28px + var(--safe-b)); display: flex; flex-direction: column; gap: 18px; animation: up .2s ease-out; }
.sheet .grab { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: #3A3B42; flex-shrink: 0; }
.sheet h2 { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 700; }
.sheet .sub { margin: -10px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.sheet .actions { display: flex; flex-direction: column; gap: 10px; }
.sheet .row-actions { display: flex; gap: 10px; }
.sheet .row-actions .btn { flex: 1; }
.menu-item { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 6px; border: none; background: none; border-radius: 12px; font-size: 16px; text-align: left; width: 100%; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.up-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--surface-2); }
.up-item .ft { gap: 8px; }
.up-item .line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.up-item .line span:last-child { color: var(--muted); flex-shrink: 0; }
.up-item .bar { height: 6px; }
.dest { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--accent); background: var(--surface-2); text-align: left; width: 100%; }
.dest .nm { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dest .chg { font-size: 13px; color: var(--accent); font-weight: 600; }
.pick-list { display: flex; flex-direction: column; max-height: 42dvh; overflow-y: auto; }
.pick-list button { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 8px; border: none; background: none; border-bottom: 1px solid var(--line-soft); text-align: left; font-size: 15px; }
.pick-list button:hover { background: var(--surface-2); }
.checks { display: flex; flex-direction: column; max-height: 30dvh; overflow-y: auto; padding: 4px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.cred { padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; line-height: 1.8; word-break: break-all; }
.cred b { color: var(--muted); font-weight: 500; }

.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(5,5,6,.94); display: flex; flex-direction: column; }
.viewer .vbar { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 20px; }
.viewer .vbar .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 500; }
.viewer .vbody { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 12px 24px; }
.viewer img, .viewer video { max-width: 100%; max-height: 100%; border-radius: 8px; }

.pill { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); z-index: 12; height: 44px; padding: 0 18px; border-radius: 22px; border: 1px solid var(--line); background: #1E1F24; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
#toast { position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top, 0px)); transform: translateX(-50%) translateY(-10px); z-index: 60; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: #F1EFEA; color: #141414; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: #FFC9BF; }
.drag-over { position: fixed; inset: 0; z-index: 45; background: rgba(15,16,18,.85); border: 3px dashed var(--accent); display: grid; place-items: center; font-family: var(--display); font-size: 24px; font-weight: 600; pointer-events: none; }

@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- laptop ---------- */
@media (min-width: 900px) {
  .tabbar, .fab, .topbar, .storage-mobile, .mobile-only { display: none !important; }
  .pill { bottom: 24px; }
  .sidebar { display: flex; flex-direction: column; gap: 28px; width: 280px; flex-shrink: 0; padding: 28px 20px; border-right: 1px solid var(--line-soft); position: sticky; top: 0; height: 100dvh; }
  .sidebar nav { display: flex; flex-direction: column; gap: 4px; }
  .sidebar nav a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-size: 14px; }
  .sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
  .sidebar nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); font-weight: 600; }
  .sidebar .storage .big { font-size: 22px; }
  .sidebar .acct { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: none; background: none; text-align: left; }
  .sidebar .acct:hover { background: var(--surface-2); }
  .main { padding: 32px 40px 48px; gap: 24px; }
  .toolbar { display: flex; }
  .head-search { width: 260px; }
  .dropzone { display: flex; align-items: center; justify-content: center; height: 72px; border-radius: 16px; border: 1.5px dashed #3A3B42; color: var(--muted); font-size: 14px; }
  .folders { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .drive-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .files.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
  .files.grid .file { flex-direction: column; align-items: stretch; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; position: relative; gap: 0; }
  .files.grid .file-main { flex-direction: column; align-items: stretch; padding: 0; gap: 0; }
  .files.grid .thumb { width: 100%; height: 130px; border-radius: 0; font-size: 16px; }
  .files.grid .ft { padding: 12px 40px 12px 12px; }
  .files.grid .more { position: absolute; right: 2px; bottom: 6px; }
  .scrim { align-items: center; }
  .sheet { border-radius: 24px; border-bottom: 1px solid var(--line); padding-bottom: 24px; }
  .sheet .grab { display: none; }
}
