/* ---------- tokens ---------- */
:root {
  --bg: #f4f5f9;
  --side: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f2f7;
  --surface-3: #e8eaf1;
  --text: #11131c;
  --muted: #6b7183;
  --border: #e5e7ef;
  --accent: #5b5bf7;
  --accent-2: #8b5cf6;
  --accent-soft: #ecebff;
  --accent-text: #ffffff;
  --grad: linear-gradient(135deg, #5b5bf7 0%, #8b5cf6 100%);
  --danger: #e5484d;
  --ok: #12a594;
  --warn: #c27a00;
  --shadow-sm: 0 1px 2px rgba(17, 19, 28, .05);
  --shadow: 0 1px 2px rgba(17, 19, 28, .04), 0 8px 24px -8px rgba(17, 19, 28, .12);
  --shadow-lg: 0 24px 60px -12px rgba(17, 19, 28, .35);
  --radius: 16px;
  --radius-sm: 11px;
  --c-images: #ff4d6d; --c-videos: #6c5cff; --c-music: #22b573; --c-docs: #f5a700; --c-other: #8a93a8;
  --k-folder: #5b8cff; --k-image: #ff4d6d; --k-video: #6c5cff; --k-audio: #22b573;
  --k-pdf: #ef4444; --k-text: #64748b; --k-doc: #2f6bff; --k-sheet: #16a34a;
  --k-slides: #f97316; --k-archive: #b7791f; --k-code: #0f9488; --k-file: #8a93a8;
  --side-w: 268px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e13; --side: #111319; --surface: #161922; --surface-2: #1e222d; --surface-3: #272c39;
    --text: #eef0f6; --muted: #8d95a8; --border: #242936; --accent: #7b7bff; --accent-2: #a17bff;
    --accent-soft: #232547; --accent-text: #ffffff; --danger: #f2626b; --ok: #36c4a8; --warn: #f0a63a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -10px rgba(0, 0, 0, .55);
    --shadow-lg: 0 30px 80px -10px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0e13; --side: #111319; --surface: #161922; --surface-2: #1e222d; --surface-3: #272c39;
  --text: #eef0f6; --muted: #8d95a8; --border: #242936; --accent: #7b7bff; --accent-2: #a17bff;
  --accent-soft: #232547; --accent-text: #ffffff; --danger: #f2626b; --ok: #36c4a8; --warn: #f0a63a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -10px rgba(0, 0, 0, .55);
  --shadow-lg: 0 30px 80px -10px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, "Noto Sans", "Noto Sans Tamil", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.65rem; line-height: 1.2; margin: 0; letter-spacing: -.02em; font-weight: 750; }
h2 { font-size: 1.08rem; margin: 0; letter-spacing: -.01em; font-weight: 700; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.grow { flex: 1; min-width: 0; }
.pad { padding: 18px; }
.hidden { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; }
.sep { width: 15px; height: 15px; color: var(--muted); opacity: .7; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--accent-text); box-shadow: 0 6px 16px -6px rgba(91, 91, 247, .6); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { color: var(--danger); border-color: transparent; background: transparent; padding: 0 10px; }
.btn.danger-ghost:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .88rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn .icon { width: 18px; height: 18px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; position: relative;
  border: 0; border-radius: 12px; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover, .icon-btn.on { background: var(--surface-2); }
.icon-btn.on { color: var(--accent); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.sm .icon { width: 17px; height: 17px; }
.stack { display: grid; gap: 14px; }
label, .label { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; }
input, select, .select {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 16px; font-weight: 400;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; background: var(--surface); }
input[readonly] { opacity: .7; }
select.select { width: auto; min-height: 38px; padding: 4px 30px 4px 10px; font-size: .9rem; font-weight: 600; background-color: var(--surface); }
.check-label { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check-label input, .person-pick input { width: 18px; min-height: 18px; height: 18px; accent-color: var(--accent); }
.two-col { display: grid; gap: 14px; }
@media (min-width: 560px) { .two-col { grid-template-columns: 1fr 1fr; } }
.alert { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); padding: 10px 12px; border-radius: 10px; margin: 10px 0; }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: 2px; letter-spacing: .02em; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

.avatar {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: .02em; text-shadow: 0 1px 1px rgba(0, 0, 0, .15);
}
.avatar.sm { width: 26px; height: 26px; font-size: .66rem; }
.avatar.lg { width: 44px; height: 44px; font-size: .95rem; }
.avatar.xl { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar.more { background: var(--surface-3) !important; color: var(--muted); text-shadow: none; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -7px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; align-items: center; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-sep { width: 1px; height: 22px; background: var(--border); flex: none; margin: 0 4px; }
.space-dot { width: 10px; height: 10px; border-radius: 4px; flex: none; display: inline-block; }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.segmented button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.color-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #fff; position: relative; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; min-height: 0; }
.swatch .icon { width: 16px; height: 16px; opacity: 0; }
.swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px currentColor; }
.swatch:has(input:checked) .icon { opacity: 1; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }
.people-pick { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.person-pick { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; font-weight: 500; cursor: pointer; }
.person-pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.meter { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.meter div { height: 100%; background: var(--grad); border-radius: 99px; transition: width .3s; }
.meter.full div { background: var(--danger); }
.meter.thin { height: 4px; margin: 5px 0 3px; }
.meter.flush { margin: 0; border-radius: 0; }

/* ---------- layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
  background: var(--side); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; padding: 18px 14px 16px; overflow-y: auto;
}
.brand-row { display: flex; align-items: center; gap: 11px; padding: 4px 8px 14px; color: var(--text); }
.logo { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--grad); color: #fff; flex: none; box-shadow: 0 6px 16px -6px rgba(91, 91, 247, .7); }
.logo .icon { width: 22px; height: 22px; stroke-width: 2.2; }
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-btn { margin: 0 0 12px; min-height: 46px; border-radius: 14px; }
.side-nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px;
  color: var(--muted); font-weight: 600; font-size: .93rem;
}
.nav-item span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.space .space-dot { margin: 0 5px; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 8px 4px 12px; font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.side-spaces { display: grid; gap: 2px; }
.side-empty { color: var(--muted); font-size: .84rem; padding: 4px 12px; }
.side-storage { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.storage-head { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: .9rem; }

.content { margin-left: var(--side-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 6px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.top-title { display: none; font-weight: 750; font-size: 1.08rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search {
  flex: 1; max-width: 560px; display: flex; align-items: center; gap: 10px; padding: 0 14px; margin-right: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; color: var(--muted); box-shadow: var(--shadow-sm);
}
.search input { border: 0; background: transparent; padding: 0; min-height: 44px; }
.search input:focus { outline: none; background: transparent; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bell .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }
.me-btn { border: 0; background: none; padding: 3px; border-radius: 50%; cursor: pointer; margin-left: 4px; }
.me-btn:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.main { padding: 8px 28px 120px; max-width: 1240px; }
.mobile-only { display: none !important; }
.tabbar { display: none; }
.fab { display: none; }

@media (max-width: 899px) {
  .sidebar { display: none; }
  .content { margin-left: 0; }
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-grid !important; }
  .topbar { padding: calc(8px + env(safe-area-inset-top)) 10px 8px 14px; border-bottom: 1px solid var(--border); }
  .topbar .logo { width: 34px; height: 34px; border-radius: 11px; margin-right: 6px; }
  .top-title { display: block; }
  .search { display: none; }
  .search-close { display: none !important; }
  body.searching .search { display: flex; margin: 0; }
  body.searching .top-title, body.searching .topbar .logo, body.searching .bell, body.searching .me-btn, body.searching .topbar > .icon-btn:not(.search-close) { display: none !important; }
  body.searching .search-close { display: inline-grid !important; }
  .main { padding: 14px 14px calc(150px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: color-mix(in srgb, var(--side) 90%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0;
    color: var(--muted); font: inherit; font-size: .68rem; font-weight: 650; background: none; border: 0; cursor: pointer;
  }
  .tab .icon { width: 23px; height: 23px; }
  .tab.active { color: var(--accent); }
  .fab {
    display: grid; place-items: center; position: fixed; z-index: 36;
    right: max(16px, env(safe-area-inset-right)); bottom: calc(78px + env(safe-area-inset-bottom));
    width: 58px; height: 58px; border-radius: 19px; border: 0; cursor: pointer;
    background: var(--grad); color: #fff; box-shadow: 0 10px 26px -6px rgba(91, 91, 247, .65);
  }
  .fab .icon { width: 27px; height: 27px; stroke-width: 2.2; }
  body.has-selection .fab { display: none; }
  h1 { font-size: 1.4rem; }
}

/* ---------- pages ---------- */
.page { animation: rise .25s ease-out; }
.narrow-page { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 6px 0 20px; }
.page-head .muted { margin-top: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.see-all { display: inline-flex; align-items: center; gap: 2px; font-size: .88rem; font-weight: 650; }
.see-all .icon { width: 16px; height: 16px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px 20px; color: var(--muted); }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.empty { text-align: center; padding: 50px 20px; display: grid; justify-items: center; gap: 8px; }
.empty .btn { margin-top: 10px; }
.empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); flex: none; }
.empty-icon .icon { width: 30px; height: 30px; }

/* home */
.hello { display: flex; align-items: center; gap: 14px; margin: 6px 0 18px; }
.hello h1 { font-size: 1.9rem; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 26px; }
.quick-btn {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; text-align: left;
  transition: transform .15s, box-shadow .15s;
}
.quick-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.q-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; flex: none; }
.q1 { background: linear-gradient(135deg, #5b5bf7, #8b5cf6); }
.q2 { background: linear-gradient(135deg, #f5a700, #f97316); }
.q3 { background: linear-gradient(135deg, #ff4d6d, #d6409f); }
.q4 { background: linear-gradient(135deg, #12a594, #22b573); }
@media (max-width: 640px) {
  .quick { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .quick-btn { flex-direction: column; gap: 6px; padding: 12px 4px; font-size: .74rem; text-align: center; background: none; border: 0; }
  .quick-btn:hover { transform: none; box-shadow: none; }
  .q-icon { width: 50px; height: 50px; border-radius: 16px; }
  .hello h1 { font-size: 1.5rem; }
}
.home-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 26px; }
@media (min-width: 1100px) { .home-cols { grid-template-columns: minmax(0, 1fr) 340px; } }
.overview { padding: 20px; }
.overview-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.big-num { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; }
.big-num .muted { font-size: 1rem; font-weight: 600; }
.overview-counts { display: flex; gap: 22px; }
.overview-counts div { display: grid; text-align: right; }
.overview-counts b { font-size: 1.2rem; }
.stack-bar { display: flex; gap: 3px; height: 12px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin: 16px 0 18px; }
.stack-bar span { height: 100%; min-width: 4px; }
.stack-bar span:first-child { border-radius: 99px 0 0 99px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 520px) { .cat-grid { grid-template-columns: 1fr 1fr; gap: 8px; } .overview { padding: 16px; } .cat-tile { padding: 9px; gap: 9px; } .cat-icon { width: 34px; height: 34px; } }
.cat-tile { display: flex; align-items: center; gap: 11px; padding: 11px; border-radius: 13px; background: var(--surface-2); color: var(--text); transition: background .15s; }
.cat-tile:hover { background: var(--surface-3); }
.cat-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.cat-text { display: grid; min-width: 0; }
.cat-text b { font-size: .92rem; }
.cat-text .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scroller .grid { display: grid; grid-auto-flow: column; grid-auto-columns: 170px; grid-template-columns: none; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.scroller .card-item { scroll-snap-align: start; }
.hint-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.hint-card .empty-icon { width: 46px; height: 46px; border-radius: 14px; }
.trash-note { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--muted); font-weight: 600; }
.activity { list-style: none; margin: 0; padding: 6px; }
.activity li { display: flex; gap: 11px; padding: 10px; border-radius: 12px; align-items: flex-start; }
.activity li:hover { background: var(--surface-2); }
.activity li > div { font-size: .9rem; line-height: 1.4; }
.activity li b { font-weight: 650; word-break: break-word; }
.activity .muted { display: block; margin-top: 2px; }

/* family spaces */
.space-grid { display: grid; gap: 12px; }
.space-grid.big { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.space-wrap { position: relative; }
.space-edit { position: absolute; bottom: 12px; right: 12px; background: var(--surface-2); color: var(--text); }
.space-edit:hover { background: var(--surface-3); }
.space-wrap .tag { position: absolute; left: 16px; bottom: 14px; }
.space-card {
  display: grid; gap: 4px; padding: 16px; border-radius: var(--radius); color: var(--text); position: relative; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--sc) 22%, var(--surface)) 0%, var(--surface) 70%);
  border: 1px solid color-mix(in srgb, var(--sc) 25%, var(--border)); transition: transform .15s, box-shadow .15s; text-align: left; font: inherit; cursor: pointer;
}
.space-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.space-card b { font-size: 1.02rem; margin-top: 8px; }
.space-card-top { display: flex; justify-content: space-between; align-items: center; }
.space-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--sc, var(--accent)); color: #fff; box-shadow: 0 6px 14px -6px var(--sc, var(--accent)); }
.space-card.add { --sc: var(--muted); border-style: dashed; background: transparent; min-height: 130px; }
.space-card.add .space-icon { background: var(--surface-2); color: var(--text); box-shadow: none; }
.space-banner {
  display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--radius); margin-bottom: 14px; flex-wrap: wrap;
  background: linear-gradient(120deg, color-mix(in srgb, var(--sc) 24%, var(--surface)) 0%, var(--surface) 75%);
  border: 1px solid color-mix(in srgb, var(--sc) 25%, var(--border));
}
.space-banner .space-icon { width: 50px; height: 50px; border-radius: 15px; }
.space-banner h1 { font-size: 1.35rem; }

/* toolbar + crumbs */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 16px; }
.tools { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.crumbs { display: flex; align-items: center; gap: 2px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font-weight: 650; flex: 1; min-width: 0; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs a, .crumbs button { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); padding: 6px 8px; border-radius: 9px; border: 0; background: none; font: inherit; cursor: pointer; }
.crumbs a:hover, .crumbs button:hover { background: var(--surface-2); }
.crumbs > :last-child { color: var(--text); }
.crumbs a .icon { width: 18px; height: 18px; }
.crumbs.small { font-size: .9rem; margin-bottom: 4px; }
@media (max-width: 640px) { .toolbar .crumbs { flex-basis: 100%; } .tools { margin-left: 0; width: 100%; } .tools select { margin-right: auto; } }

/* grid items */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.card-item {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.card-main { display: grid; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.card-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.is-folder .card-thumb { aspect-ratio: 16 / 9; background: color-mix(in srgb, var(--k-folder) 9%, var(--surface)); }
.thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-text { display: grid; padding: 10px 40px 12px 12px; min-width: 0; }
.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.meta { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-item .more { position: absolute; right: 4px; bottom: 8px; width: 34px; height: 34px; color: var(--muted); }
.check {
  position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 8px; z-index: 2;
  border: 2px solid rgba(255, 255, 255, .9); background: rgba(0, 0, 0, .25); color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0;
  opacity: 0; transition: opacity .15s;
}
.check .icon { width: 16px; height: 16px; stroke-width: 3; }
.card-item:hover .check, .row:hover .check, .check.on, .has-selection .check { opacity: 1; }
.check.on { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (hover: none) { .check { opacity: 0; } .has-selection .check, .check.on { opacity: 1; } }
.fav-badge { position: absolute; top: 9px; right: 9px; color: #ffb224; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3)); }
.fav-badge .icon { width: 18px; height: 18px; }
.row .fav-badge { position: static; margin-left: 6px; vertical-align: -3px; }
.row .fav-badge .icon { width: 15px; height: 15px; }
.play-badge { position: absolute; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff; backdrop-filter: blur(4px); }
.play-badge .icon { width: 18px; height: 18px; margin-left: 2px; }

.kind-tile { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; color: var(--kc, var(--k-file)); background: color-mix(in srgb, var(--kc, var(--k-file)) 14%, transparent); flex: none; }
.kind-tile.big { width: 58px; height: 58px; border-radius: 17px; }
.kind-tile.big .icon { width: 28px; height: 28px; }
.kind-folder { --kc: var(--k-folder); } .kind-image { --kc: var(--k-image); } .kind-video { --kc: var(--k-video); }
.kind-audio { --kc: var(--k-audio); } .kind-pdf { --kc: var(--k-pdf); } .kind-text { --kc: var(--k-text); }
.kind-doc { --kc: var(--k-doc); } .kind-sheet { --kc: var(--k-sheet); } .kind-slides { --kc: var(--k-slides); }
.kind-archive { --kc: var(--k-archive); } .kind-code { --kc: var(--k-code); } .kind-file { --kc: var(--k-file); }
.icon.kind-folder { color: var(--k-folder); }

/* list items */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; position: relative; border-bottom: 1px solid var(--border); padding-right: 6px; gap: 4px; }
.row:last-child { border-bottom: 0; }
.row.selected { background: var(--accent-soft); }
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 13px; padding: 9px 6px 9px 14px; min-height: 64px; color: inherit; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.row-main.static { cursor: default; }
.row:hover { background: var(--surface-2); }
.row .check { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); }
.row .check.on { background: var(--accent); border-color: var(--accent); }
.row-thumb { width: 44px; height: 44px; flex: none; border-radius: 11px; overflow: hidden; display: grid; place-items: center; }
.row-thumb .kind-tile { width: 44px; height: 44px; }
.row-text { min-width: 0; display: grid; }
.row .more { color: var(--muted); }

/* selection */
.selection-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 6px; min-width: 300px; max-width: calc(100% - 24px);
  background: var(--text); color: var(--bg); border-radius: 18px; box-shadow: var(--shadow-lg); animation: rise .2s;
}
.selection-bar .icon-btn { color: var(--bg); }
.selection-bar .icon-btn:hover { background: color-mix(in srgb, var(--bg) 15%, transparent); }
@media (max-width: 899px) { .selection-bar { bottom: calc(76px + env(safe-area-inset-bottom)); } }
@media (min-width: 900px) { .selection-bar { margin-left: calc(var(--side-w) / 2); } }

/* photos */
.month { font-size: .95rem; margin: 18px 2px 10px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 4px; }
@media (max-width: 520px) { .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 3px; } }
.photo { position: relative; aspect-ratio: 1; border: 0; padding: 0; background: var(--surface-2); cursor: pointer; overflow: hidden; display: grid; place-items: center; border-radius: 6px; }
.photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.photo:hover img { transform: scale(1.05); }
.photo .play-badge { width: 32px; height: 32px; right: 6px; bottom: 6px; }

/* links, people, settings */
.link-list, .people-list { display: grid; gap: 10px; }
.link-card, .person { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; }
.link-card.expired { opacity: .6; }
.person .name { display: block; }
.person .meter { max-width: 320px; }
.profile-row { display: flex; align-items: center; gap: 14px; }

/* security */
.mfa-status { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mfa-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; flex: none; background: var(--surface-2); color: var(--muted); }
.mfa-status.on .mfa-icon { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.mfa-status.on .mfa-icon .icon { stroke-width: 2.6; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; width: 100%; }
.login-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 2px; }
.login-list li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 6px; border-radius: 10px; font-size: .9rem; }
.login-list li > .icon { margin-top: 2px; color: var(--muted); }
.login-list li.bad > .icon, .login-list li.bad > div > div:first-child { color: var(--danger); }
.tag.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-weight: 400; }
.qr-box { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.qr-box img { width: 196px; height: 196px; border-radius: 10px; background: #fff; padding: 6px; flex: none; }
.qr-box > div { display: grid; gap: 8px; justify-items: start; flex: 1; min-width: 180px; }
.secret { font: 600 .95rem/1.5 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; word-break: break-all; background: var(--surface); padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); }
.code-input { font: 700 1.4rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .3em; text-align: center; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes code { font: 600 1.05rem/1 ui-monospace, Menlo, Consolas, monospace; text-align: center; padding: 11px; border-radius: 10px; background: var(--surface-2); letter-spacing: .06em; }
.mfa-help { margin-top: 16px; }
.mfa-help code { font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* ---------- sheets & dialogs ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 58; background: rgba(8, 10, 16, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out;
}
.sheet {
  background: var(--surface); width: 100%; max-height: 92vh; overflow: auto;
  border-radius: 24px 24px 0 0; padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
  animation: up .22s cubic-bezier(.2, .9, .3, 1); box-shadow: var(--shadow-lg);
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 2px auto 12px; }
@media (min-width: 640px) {
  .modal-wrap { align-items: center; padding: 20px; }
  .sheet { max-width: 440px; border-radius: 22px; padding: 22px 24px; animation: pop .18s ease-out; }
  .sheet.wide { max-width: 600px; }
  .sheet::before { display: none; }
}
.sheet-title { font-weight: 750; font-size: 1.1rem; margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; }
.sheet-title:empty { display: none; }
.sheet-sub { color: var(--muted); font-size: .9rem; margin: 0 0 10px; }
.actions { list-style: none; margin: 4px -8px 0; padding: 0; }
.actions button {
  width: 100%; display: flex; align-items: center; gap: 14px; min-height: 50px; padding: 0 10px;
  border: 0; background: none; color: inherit; font: inherit; font-weight: 550; text-align: left; cursor: pointer; border-radius: 13px;
}
.actions button:hover { background: var(--surface-2); }
.actions .danger { color: var(--danger); }
.action-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--surface-2); flex: none; }
.actions .danger .action-icon { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.actions .hint { color: var(--muted); font-size: .85rem; }
.folder-list { max-height: 44vh; overflow: auto; }
.menu-head, .account-head { display: flex; align-items: center; gap: 12px; padding: 4px 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-thumb { width: 46px; height: 46px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; flex: none; }
.menu-head .name { display: block; }
.dialog-buttons { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.dialog-buttons .grow:empty { flex: 1; }
@media (max-width: 639px) { .dialog-buttons .btn.primary, .dialog-buttons .btn.danger { flex: 1; } }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-size: .9rem; }
.success-head { display: flex; gap: 12px; align-items: center; }
.ok-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); flex: none; }
.ok-icon .icon { stroke-width: 2.6; }

/* ---------- viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 55; background: #07080b; color: #f2f3f7; display: flex; flex-direction: column; animation: fade .15s; }
.viewer-bar { display: flex; align-items: center; gap: 2px; padding: calc(6px + env(safe-area-inset-top)) 8px 6px; background: linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, .2)); }
.viewer-bar .titles { padding: 0 8px; }
.viewer-bar .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-bar .sub { font-size: .78rem; opacity: .65; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-bar .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.viewer-body { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; touch-action: pan-y pinch-zoom; }
.viewer-body img, .viewer-body video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-body pre { width: 100%; height: 100%; margin: 0; overflow: auto; padding: 18px; background: #fff; color: #111; font: 13px/1.55 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.viewer-body .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0, 0, 0, .45); color: #fff; width: 44px; height: 44px; border-radius: 50%; backdrop-filter: blur(6px); }
.viewer-body .nav.prev { left: 10px; } .viewer-body .nav.next { right: 10px; }
.viewer-none, .audio-card { text-align: center; padding: 20px; display: grid; justify-items: center; gap: 12px; }
.audio-card audio { width: min(420px, 86vw); }

/* ---------- uploads, toasts, drop ---------- */
.uploads {
  position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 45; width: min(380px, calc(100% - 24px));
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; animation: rise .2s;
}
@media (max-width: 899px) { .uploads { right: 12px; bottom: calc(146px + env(safe-area-inset-bottom)); } }
.uploads-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 4px; }
.head-btn { border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-align: left; padding: 8px 10px; cursor: pointer; }
.uploads ul { list-style: none; margin: 0; padding: 4px 0; max-height: 38vh; overflow: auto; border-top: 1px solid var(--border); }
.uploads li { padding: 7px 12px; font-size: .88rem; }
.up-line { display: flex; gap: 10px; align-items: center; }
.up-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); color: var(--muted); flex: none; }
.up-icon .icon { width: 16px; height: 16px; }
.up-icon.done { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.up-icon.error { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.up-icon.uploading { color: var(--accent); background: var(--accent-soft); }
.up-status { font-size: .76rem; color: var(--muted); }
.up-status.error { color: var(--danger); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 70;
  display: flex; align-items: center; gap: 14px;
  background: #1c1f27; color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px); font-size: .92rem; font-weight: 550; animation: rise .2s;
}
@media (max-width: 899px) { .toast { bottom: calc(150px + env(safe-area-inset-bottom)); } }
.toast.err { background: var(--danger); }
.toast-action { border: 0; background: none; color: #a5a8ff; font: inherit; font-weight: 700; cursor: pointer; padding: 0; white-space: nowrap; }
.drop-hint {
  position: fixed; inset: 14px; z-index: 60; border: 3px dashed var(--accent); border-radius: 26px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); backdrop-filter: blur(2px);
  display: grid; place-items: center; text-align: center; pointer-events: none; color: var(--accent);
}
.drop-hint > div { display: grid; justify-items: center; gap: 6px; font-size: 1.3rem; }
.drop-hint .icon { width: 44px; height: 44px; }
.drop-where { font-size: .95rem; font-weight: 600; }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(60px); opacity: .5; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
.selection-bar { animation: none; }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* ---------- plain pages: setup, login, errors ---------- */
body.plain {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 60%), var(--bg);
}
body.plain .card { padding: 30px 26px; width: 100%; box-shadow: var(--shadow-lg); border-radius: 24px; }
body.plain h1 { margin: 14px 0 6px; }
body.plain .muted { margin-bottom: 16px; }
.narrow { max-width: 420px; }
.center { text-align: center; }
.brand .logo { width: 52px; height: 52px; border-radius: 16px; }
.brand .logo .icon { width: 28px; height: 28px; }
.brand-icon { width: 28px; height: 28px; }
.center .brand { display: flex; justify-content: center; }
.checks { list-style: none; padding: 0; margin: 4px 0 18px; display: grid; gap: 8px; font-size: .88rem; }
.checks li { display: flex; gap: 8px; align-items: flex-start; }
.checks li .icon { width: 17px; height: 17px; margin-top: 2px; }
.checks .ok .icon { color: var(--ok); }
.checks .warn { color: var(--warn); }

/* ---------- public share pages ---------- */
body.share { min-height: 100vh; }
.share-top { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--side); }
.share-top b { font-size: 1.05rem; }
.share-top .logo { width: 34px; height: 34px; border-radius: 11px; }
.share-top .logo .icon { width: 20px; height: 20px; }
.share-wrap { max-width: 1100px; margin: 0 auto; padding: 22px 16px 40px; }
.share-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.share-head .kind-tile { width: 52px; height: 52px; border-radius: 15px; }
.share-head h1 { font-size: 1.45rem; word-break: break-word; }
.share-wrap .crumbs { margin-bottom: 12px; }
.share-wrap .row-main { min-height: 60px; }
.share-wrap .row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.share-preview { display: grid; justify-items: center; gap: 14px; }
.preview-media { max-width: 100%; max-height: 72vh; border-radius: 16px; background: #000; box-shadow: var(--shadow); }
.preview-doc { width: 100%; height: 72vh; border: 1px solid var(--border); border-radius: 16px; background: #fff; }
.preview-doc.text { height: 50vh; }
.preview-none { padding: 40px 20px; display: grid; justify-items: center; gap: 10px; }
.share-foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 18px; }

/* ---------- v3: roles, details, notes, tags, notices, menus ---------- */
textarea {
  width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 16px; resize: vertical; min-height: 44px;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; background: var(--surface); }
.avatar.xs { width: 18px; height: 18px; font-size: .55rem; }
.space-ico { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: color-mix(in srgb, var(--sc) 18%, transparent); color: var(--sc); flex: none; }
.space-ico .icon { width: 15px; height: 15px; }

/* item extras */
.item-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 5px; min-width: 0; }
.by { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; color: var(--muted); max-width: 100%; overflow: hidden; }
.by span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.tags.big { gap: 7px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  color: var(--tc); background: color-mix(in srgb, var(--tc) 15%, transparent); border: 0; font-family: inherit;
}
.tags.big .tag-chip { font-size: .82rem; padding: 4px 11px; }
.tag-chip.more { --tc: var(--muted); }
.tag-chip.toggle { cursor: pointer; border: 1.5px solid transparent; }
.tag-chip.toggle.on { border-color: var(--tc); }
.tag-chip .icon { width: 13px; height: 13px; stroke-width: 3; }
.tag-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.count-badge { display: inline-flex; align-items: center; gap: 3px; font-size: .74rem; font-weight: 700; color: var(--muted); }
.count-badge .icon { width: 14px; height: 14px; }
.badges { display: inline-flex; gap: 2px; }
.card-item .badges { position: absolute; top: 9px; right: 9px; }
.pin-badge { color: var(--accent); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
.pin-badge .icon, .badges .fav-badge .icon { width: 17px; height: 17px; }
.card-item .badges .fav-badge { position: static; }
.row .badges { margin-left: 6px; vertical-align: -3px; }
.row .badges .icon { width: 15px; height: 15px; }
.kind-tile .emoji { font-size: 1.35rem; line-height: 1; }
.kind-tile.big .emoji { font-size: 2.1rem; }
.is-folder .card-thumb:has(.has-emoji), .is-folder .card-thumb:has(.kind-tile[style]) { background: color-mix(in srgb, var(--kc, var(--k-folder)) 10%, var(--surface)); }
.card-item.dragging, .row.dragging { opacity: .45; }
.drop-over { outline: 2px dashed var(--accent) !important; outline-offset: 2px; background: var(--accent-soft) !important; border-radius: 12px; }

/* right-click menu */
.ctx-menu {
  position: fixed; z-index: 80; min-width: 230px; max-width: 300px; padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: pop .12s ease-out;
}
.ctx-menu button {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border: 0; background: none; color: inherit;
  font: inherit; font-size: .9rem; font-weight: 550; border-radius: 9px; cursor: pointer; text-align: left;
}
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--surface-2); outline: none; }
.ctx-menu button .icon { width: 17px; height: 17px; color: var(--muted); }
.ctx-menu .danger, .ctx-menu .danger .icon { color: var(--danger); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }
.ctx-menu .hint, .actions .hint { color: var(--muted); font-size: .8rem; }

/* noticeboard, pins, filters, banners */
.notice-card {
  padding: 14px 16px; border-radius: var(--radius); margin-bottom: 14px; display: block; color: var(--text);
  background: color-mix(in srgb, var(--sc, var(--accent)) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--sc, var(--accent)) 30%, var(--border));
  border-left: 4px solid var(--sc, var(--accent));
}
.notice-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.notice-head > .icon { color: var(--sc, var(--accent)); width: 18px; height: 18px; }
.notice-list { display: grid; gap: 10px; }
.notice-list .notice-card { margin: 0; }
.notice-text { font-size: .95rem; }
.note-render h2 { font-size: 1.3rem; margin: 10px 0 6px; }
.note-render h3 { font-size: 1.1rem; margin: 10px 0 4px; }
.note-render h4 { font-size: 1rem; margin: 8px 0 4px; }
.note-render p { margin: 2px 0; }
.note-render .gap { height: 8px; }
.note-render .bullet { padding-left: 18px; position: relative; margin: 2px 0; }
.note-render .bullet::before { content: "•"; position: absolute; left: 4px; color: var(--muted); }
.check-item { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: inherit; padding: 4px 0; cursor: pointer; }
.check-item input { width: 20px; height: 20px; min-height: 20px; margin-top: 1px; accent-color: var(--ok); flex: none; }
.check-item.done span { text-decoration: line-through; color: var(--muted); }
.pinned-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pin-chip { display: inline-flex; align-items: center; gap: 9px; padding: 6px 14px 6px 6px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; flex: none; }
.pin-chip:hover { background: var(--surface-2); }
.pin-chip .kind-tile { width: 32px; height: 32px; border-radius: 9px; }
.pin-chip .kind-tile .icon { width: 17px; height: 17px; }
.filters { padding-bottom: 14px; }
.chip-label { color: var(--muted); display: inline-flex; flex: none; }
.chip .avatar.xs { margin-left: -6px; }
.role-tag { vertical-align: 4px; }
.avatar-btn { border: 0; background: none; padding: 4px; border-radius: 99px; cursor: pointer; }
.avatar-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.q-count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 7px; }
.quote { color: var(--muted); font-style: italic; font-size: .86rem; margin-top: 2px; }

/* members, roles, type cards, switches */
.member-list { display: grid; gap: 4px; max-height: 40vh; overflow: auto; border: 1px solid var(--border); border-radius: 13px; padding: 6px; font-weight: 500; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 10px; }
.member-row:hover { background: var(--surface-2); }
.member-row select { width: auto; min-width: 128px; }
.role-help { font-weight: 400; font-size: .86rem; color: var(--muted); }
.role-help summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 4px 0; }
.role-help ul { margin: 4px 0; padding-left: 18px; display: grid; gap: 3px; }
.type-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.type-card { position: relative; display: grid; gap: 3px; padding: 12px; border: 1.5px solid var(--border); border-radius: 13px; cursor: pointer; font-weight: 500; }
.type-card input { position: absolute; opacity: 0; inset: 0; margin: 0; min-height: 0; cursor: pointer; }
.type-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.type-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.type-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--accent); margin-bottom: 4px; }
.type-card:has(input:checked) .type-icon { background: var(--accent); color: #fff; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; min-height: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-weight: 600; }
.switch-row .icon { width: 17px; height: 17px; vertical-align: -3px; color: var(--accent); }
.link-card.off { opacity: .55; }
.add-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.add-row input { flex: 1; min-width: 160px; }
.segmented.tabs { width: 100%; margin: 4px 0 6px; }
.segmented.tabs button { flex: 1; justify-content: center; }

/* details panel */
.details { display: grid; gap: 12px; }
.details .section { margin-bottom: 4px; }
.details .section-head { margin-bottom: 8px; }
.menu-thumb.big { width: 64px; height: 64px; border-radius: 15px; }
.menu-thumb img { width: 100%; height: 100%; object-fit: cover; }
.info-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: .9rem; padding: 12px 14px; background: var(--surface-2); border-radius: 13px; }
.info-grid dt { color: var(--muted); }
.info-grid dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.with-avatar { display: flex; align-items: center; gap: 7px; }
.emoji-row { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji-btn { width: 40px; height: 40px; border-radius: 11px; border: 1.5px solid var(--border); background: var(--surface); font-size: 1.25rem; cursor: pointer; color: var(--muted); }
.emoji-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.swatch-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.swatch-btn.on { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }
.swatch-btn .icon { width: 15px; height: 15px; }
.small-gap { gap: 10px; }
.comments { display: grid; gap: 4px; }
.comment { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 12px; }
.comment:hover { background: var(--surface-2); }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .93rem; margin-top: 1px; }
.comment-box { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.comment-box textarea { flex: 1; }

/* note editor */
.note-modal { position: fixed; inset: 0; z-index: 56; background: var(--bg); display: flex; flex-direction: column; animation: fade .15s; }
.note-bar { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; border-bottom: 1px solid var(--border); background: var(--side); flex-wrap: wrap; }
.note-bar .titles { display: grid; min-width: 0; }
.note-bar .titles b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; }
.note-scroll { flex: 1; overflow: auto; padding: 20px 16px calc(40px + env(safe-area-inset-bottom)); }
.note-body { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; font-size: 1.05rem; line-height: 1.6; }
.note-body .note-render h2:first-child { margin-top: 0; }
.note-editor { min-height: 62vh; font: 15px/1.6 ui-monospace, Menlo, Consolas, monospace; background: var(--surface); }
@media (max-width: 640px) { .note-bar .segmented button { padding: 6px 9px; } }

/* public upload box */
.narrow-share { max-width: 680px; }
.dropbox { padding: 16px; margin-bottom: 16px; display: grid; gap: 12px; }
.dropbox.over { outline: 2px dashed var(--accent); }
.drop-target {
  position: relative; display: grid; justify-items: center; gap: 4px; text-align: center; padding: 26px 16px; border-radius: 14px;
  border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); color: var(--accent); cursor: pointer;
}
.drop-target .icon { width: 34px; height: 34px; }
.drop-target b { color: var(--text); font-size: 1.05rem; }
.drop-target input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.drop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.drop-list li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: .88rem; }
.drop-list li.done .up-status { color: var(--ok); }
.drop-list li.error .up-status { color: var(--danger); }
.share-wrap .note { display: flex; gap: 8px; align-items: center; background: var(--accent-soft); padding: 10px 12px; border-radius: 12px; margin-bottom: 12px; }
.notice-head b { flex: none; }
.notice-head .muted { flex: 1; min-width: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-head b.grow { flex: 1; }
@media (max-width: 520px) {
  .space-banner { gap: 10px 12px; padding: 14px; }
  .space-banner .space-icon { width: 44px; height: 44px; }
  .space-banner > .grow { flex: 1 1 calc(100% - 60px); }
  .space-banner .avatar-btn { margin-left: 52px; margin-right: auto; }
}

.note-bar .titles { flex: 1 1 140px; }
