:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --line: #e3e6ee;
  --text: #141824;
  --muted: #646b7d;
  --brand: #e5383b;
  --brand-2: #ff6b4a;
  --brand-ink: #ffffff;
  --brand-soft: #fdecec;
  --ok: #1f9d6b;
  --ok-soft: #e4f6ee;
  --danger: #d62839;
  --shadow: 0 1px 2px rgba(20, 24, 36, .05), 0 8px 24px rgba(20, 24, 36, .06);
  --shadow-lg: 0 24px 60px rgba(20, 24, 36, .18);
  --radius: 16px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1017; --surface: #151a24; --surface-2: #1c2230; --line: #262d3d; --text: #eef1f7; --muted: #98a0b3;
    --brand-soft: #3a1a1d; --ok-soft: #13301f; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1017; --surface: #151a24; --surface-2: #1c2230; --line: #262d3d; --text: #eef1f7; --muted: #98a0b3;
  --brand-soft: #3a1a1d; --ok-soft: #13301f; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.5); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1180px; margin: 0 auto; height: 64px; padding: 0 20px; display: flex; align-items: center; gap: 18px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; text-decoration: none; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .02em; box-shadow: 0 6px 16px rgba(229, 56, 59, .35); }
.logo small { color: var(--muted); font-weight: 600; font-size: 12px; margin-left: 2px; }
.nav { display: flex; gap: 4px; margin-left: 10px; }
.nav a { padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.nav .count { background: var(--brand); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; }
.spacer { flex: 1; }
.user { position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2) center/cover; display: grid; place-items: center; font-weight: 700; cursor: pointer; padding: 0; }
.menu { position: absolute; right: 0; top: 46px; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; }
.menu .who { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .who b { display: block; }
.menu .who span { color: var(--muted); font-size: 13px; word-break: break-all; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; border: 0; background: none; text-decoration: none; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 110px; }
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; margin-bottom: 34px; }
.hero h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.12; letter-spacing: -.03em; margin: 0 0 12px; }
.hero h1 em { font-style: normal; background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); margin: 0 0 18px; font-size: 16px; max-width: 520px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 5px 11px; border-radius: 99px; }
.pill svg.i { width: 15px; height: 15px; color: var(--ok); }

.drop { position: relative; border: 2px dashed color-mix(in srgb, var(--brand) 40%, var(--line)); border-radius: 22px; background: var(--surface); padding: 34px 24px; text-align: center; box-shadow: var(--shadow); transition: .18s; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface)); transform: translateY(-2px); }
.drop .big { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 10px 24px rgba(229, 56, 59, .32); }
.drop .big svg.i { width: 30px; height: 30px; }
.drop h3 { margin: 0 0 4px; font-size: 18px; }
.drop p { margin: 0; color: var(--muted); font-size: 14px; }

.staged { margin-bottom: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); }
.staged .t { flex: 1; min-width: 0; }
.staged b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staged span { color: var(--muted); font-size: 13px; }

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.search { position: relative; width: 260px; }
.search svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search input { width: 100%; padding: 9px 12px 9px 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none; }
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.sec-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 26px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tool { position: relative; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: transform .15s, box-shadow .15s, border-color .15s; }
.tool:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.tool.dim { opacity: .38; }
.tool .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.tool .ic svg.i { width: 23px; height: 23px; }
.tool b { font-size: 15.5px; letter-spacing: -.01em; }
.tool span { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.tool .tag { position: absolute; top: 16px; right: 16px; font-size: 11px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 99px; }
.tool.ext .ic { background: var(--surface-2); color: var(--text); }

/* ---------- files ---------- */
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.files { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.frow { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.frow:last-child { border-bottom: 0; }
.frow .t { flex: 1; min-width: 0; }
.frow .t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow .t span { color: var(--muted); font-size: 13px; }
.badge { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); margin-left: 6px; }
.ftype { width: 40px; height: 46px; border-radius: 8px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; flex: none; position: relative; letter-spacing: .03em; }
.ftype::after { content: ''; position: absolute; right: 0; top: 0; border-width: 0 10px 10px 0; border-style: solid; border-color: var(--surface) color-mix(in srgb, #000 22%, transparent) color-mix(in srgb, #000 22%, transparent) transparent; border-radius: 0 6px 0 3px; }
.actions { display: flex; gap: 6px; align-items: center; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { width: 64px; height: 64px; border-radius: 18px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 9px 15px; border-radius: 11px; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: var(--brand-ink); box-shadow: 0 6px 16px rgba(229, 56, 59, .28); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.lg { padding: 13px 20px; font-size: 15px; border-radius: 13px; }
.btn.block { width: 100%; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icon { padding: 8px; width: 38px; height: 38px; }
.btn.danger { color: var(--danger); }

/* ---------- panel (modal / bottom sheet) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 12, 18, .45); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
.panel { background: var(--surface); width: min(620px, 100%); max-height: calc(100vh - 40px); border-radius: 22px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: pop .2s cubic-bezier(.2, .9, .3, 1.2); }
.panel-h { display: flex; gap: 14px; align-items: center; padding: 20px 22px 14px; }
.panel-h .ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.panel-h h3 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.panel-h p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.panel-b { padding: 4px 22px 18px; overflow-y: auto; flex: 1; }
.panel-f { padding: 14px 22px 20px; border-top: 1px solid var(--line); background: var(--surface); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.picker { border: 1.5px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; cursor: pointer; color: var(--muted); transition: .15s; }
.picker:hover, .picker.over { border-color: var(--brand); color: var(--text); background: color-mix(in srgb, var(--brand-soft) 40%, transparent); }
.picker b { color: var(--brand); }
.picker-row { display: flex; gap: 8px; margin-top: 10px; }
.picker-row .btn { flex: 1; }
.flist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.fitem { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.fitem .ftype { width: 32px; height: 38px; font-size: 9px; }
.fitem .t { flex: 1; min-width: 0; }
.fitem .t b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fitem .t span { font-size: 12px; color: var(--muted); }
.fitem .num { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); font-size: 12px; font-weight: 700; display: grid; place-items: center; }

.field { margin-top: 16px; }
.field label.l { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.inp { width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none; }
.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=color].inp { height: 44px; padding: 4px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 1 auto; border: 1px solid var(--line); background: var(--surface); padding: 9px 12px; border-radius: 11px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg button.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; font-size: 14px; margin-top: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

.progress { margin-top: 4px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; transition: width .2s; }
.bar.indet i { width: 35%; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.progress p { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); text-align: center; }

.done { text-align: center; padding: 8px 0 4px; }
.done .ok { width: 58px; height: 58px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 10px; }
.done .ok svg.i { width: 30px; height: 30px; stroke-width: 2.4; }
.done h4 { margin: 0 0 4px; font-size: 18px; }
.done p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.result { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; text-align: left; }
.result .t { flex: 1; min-width: 0; }
.result .t b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .t span { font-size: 12.5px; color: var(--muted); }
.err { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 12px; }

.toast { pointer-events: none; position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 60; box-shadow: var(--shadow-lg); animation: pop .2s; max-width: calc(100vw - 32px); }

/* ---------- mobile ---------- */
.tabbar { display: none; }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 18px; margin-bottom: 22px; }
  .hero p { font-size: 15px; }
  .nav { display: none; }
  .top-in { height: 58px; padding: 0 16px; }
  main { padding: 18px 16px 100px; }
  .search { width: 100%; order: -1; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tool { padding: 14px; gap: 8px; }
  .tool span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; }
  .tool b { font-size: 14.5px; }
  .tool .tag { display: none; }
  .scrim { padding: 0; align-items: flex-end; }
  .panel { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; animation: up .25s cubic-bezier(.2, .9, .3, 1); }
  .panel-f { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .frow { padding: 12px; gap: 10px; }
  .frow .actions .hide-m { display: none; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 10px; position: relative; }
  .tabbar a.on { color: var(--brand); }
  .tabbar .count { position: absolute; top: 2px; left: calc(50% + 6px); background: var(--brand); color: #fff; font-size: 10px; padding: 0 5px; border-radius: 99px; }
  .toast { bottom: 84px; }
}
@media (max-width: 380px) { .grid { grid-template-columns: 1fr; } }
@keyframes up { from { transform: translateY(100%); } }

/* ---------- kuota & admin ---------- */
.quota { margin-top: 10px; max-width: 360px; }
.quota .bar { height: 6px; }
.quota span { font-size: 12.5px; color: var(--muted); display: block; margin-top: 5px; }
.bar.full i { background: var(--danger); }
.bar.mini { height: 4px; max-width: 220px; margin-top: 6px; }
.avatar.sm { width: 38px; height: 38px; flex: none; cursor: default; font-size: 15px; }
.avatar.md { width: 46px; height: 46px; flex: none; cursor: default; font-size: 18px; }
.urow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.urow:last-child { border-bottom: 0; }
.urow.off { opacity: .6; }
.urow .t { flex: 1; min-width: 0; }
.urow .t b { display: block; font-weight: 600; }
.urow .t > span { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rolechip { font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.rolechip.super { background: var(--brand-soft); color: var(--brand); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.fgroup { margin-bottom: 10px; }
.fgroup-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 10px 0 2px; }
.check.sm { margin-top: 6px; font-size: 13.5px; }
.check.muted { opacity: .45; cursor: not-allowed; }
select.inp { appearance: auto; }
.dot-st { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-st.ok { background: var(--ok); }
.dot-st.bad { background: var(--danger); }
.when { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
@media (max-width: 820px) {
  .urow { padding: 12px; gap: 10px; flex-wrap: wrap; }
  .urow .t { flex-basis: calc(100% - 52px); }
  .urow .rolechip { margin-left: 48px; }
  .urow .btn { margin-left: auto; }
  .frow .when { display: none; }
}
