/* =====================================================================
   theme.css — Sistema de diseño "MM Lab Studio File" (réplica 1:1 de
   Claude Design). Web + API PHP. Modo claro/oscuro + acentos.
   Fuente de verdad: design-spec.md
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

/* ------------------------- TOKENS (claro) ------------------------- */
:root {
  --bg:#f2f3fa; --surface:#ffffff; --surface-2:#f5f6fb; --surface-3:#eceef7;
  --border:#e7e9f2; --border-2:#d8dbea;
  --text:#141626; --text-2:#5a6076; --text-3:#8b90a6;
  --primary:#5850ec; --primary-hover:#4740d6; --primary-weak:#ecebfd;
  --danger:#e5484d; --danger-weak:#fdeceb; --warning:#f2a53b; --success:#16a34a; --accent:#0ea5e9;
  --shadow:0 1px 2px rgba(20,22,38,.06),0 8px 24px rgba(20,22,38,.07);
  --shadow-lg:0 16px 48px rgba(20,22,38,.18);
  --font:'Manrope',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
}
/* ------------------------- TOKENS (oscuro) ------------------------ */
:root[data-theme="dark"] {
  --bg:#0b0c11; --surface:#14161e; --surface-2:#1a1d27; --surface-3:#232735;
  --border:#262a37; --border-2:#343949;
  --text:#eef0f7; --text-2:#a7adc0; --text-3:#6f7488;
  --primary:#8078ff; --primary-hover:#948dff; --primary-weak:#1d1b3c;
  --danger:#ff6166; --danger-weak:#2a1618;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35);
  --shadow-lg:0 18px 52px rgba(0,0,0,.6);
}
/* Acentos alternativos */
:root[data-accent="blue"]{ --primary:#2f6fed; --primary-hover:#245fd8; --primary-weak:#e6effd; }
:root[data-accent="blue"][data-theme="dark"]{ --primary:#4d8bff; --primary-hover:#659bff; --primary-weak:#101a30; }
:root[data-accent="teal"]{ --primary:#0e9c8a; --primary-hover:#0c887a; --primary-weak:#e0f5f1; }
:root[data-accent="teal"][data-theme="dark"]{ --primary:#2bc2ad; --primary-hover:#42d0bc; --primary-weak:#0c2320; }
:root[data-accent="rose"]{ --primary:#e5397a; --primary-hover:#d12e6d; --primary-weak:#fdeaf1; }
:root[data-accent="rose"][data-theme="dark"]{ --primary:#ff5c93; --primary-hover:#ff76a6; --primary-weak:#2a1320; }

/* ------------------------- BASE ------------------------- */
* { box-sizing:border-box; }
html,body { margin:0; padding:0; }
body {
  font-family:var(--font); background:var(--bg); color:var(--text);
  -webkit-font-smoothing:antialiased; min-height:100vh;
}
a { color:var(--primary); text-decoration:none; }
a:hover { color:var(--primary-hover); }
input,button,select,textarea { font-family:inherit; }
.hidden { display:none !important; }
.text-secondary { color:var(--text-2); }
.grow { flex:1; min-width:0; }

::-webkit-scrollbar { width:11px; height:11px; }
::-webkit-scrollbar-thumb { background:var(--border-2); border-radius:9px; border:3px solid transparent; background-clip:padding-box; }
::-webkit-scrollbar-track { background:transparent; }

@keyframes spin { to { transform:rotate(360deg); } }
@keyframes fadeUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }
@keyframes ovIn { from { opacity:0; } to { opacity:1; } }

/* ============================ AUTH ============================ */
.auth-wrap { min-height:100vh; display:grid; grid-template-columns:1.05fr 1fr; }
.auth-hero {
  position:relative; overflow:hidden; color:#fff; padding:56px;
  background:linear-gradient(150deg,var(--primary) 0%,var(--primary-hover) 100%);
  display:flex; flex-direction:column; justify-content:space-between;
}
.auth-hero .blob { position:absolute; border-radius:50%; }
.auth-hero .blob.a { width:520px; height:520px; background:rgba(255,255,255,.08); top:-160px; right:-160px; }
.auth-hero .blob.b { width:360px; height:360px; background:rgba(255,255,255,.06); bottom:-120px; left:-100px; }
.auth-hero .brand-row { display:flex; align-items:center; gap:12px; position:relative; }
.auth-hero .brand-badge { width:42px; height:42px; border-radius:12px; background:rgba(255,255,255,.16); display:flex; align-items:center; justify-content:center; }
.auth-hero .brand-name { font-size:18px; font-weight:800; letter-spacing:-.02em; }
.auth-hero .hero-mid { position:relative; max-width:420px; }
.auth-hero h1 { font-size:40px; line-height:1.1; font-weight:800; letter-spacing:-.03em; margin:0 0 18px; }
.auth-hero .hero-p { font-size:16px; line-height:1.6; opacity:.9; margin:0; }
.auth-hero .stats { display:flex; gap:26px; margin-top:34px; }
.auth-hero .stats .n { font-size:26px; font-weight:800; }
.auth-hero .stats .l { opacity:.8; font-size:13px; }
.auth-hero .copy { position:relative; font-size:13px; opacity:.75; }
.auth-side { display:flex; align-items:center; justify-content:center; padding:40px; }
.auth-card { width:100%; max-width:400px; animation:fadeUp .4s ease; }
.auth-card h2 { font-size:27px; font-weight:800; letter-spacing:-.02em; margin:0 0 6px; }
.auth-card .sub { color:var(--text-2); margin:0 0 26px; font-size:15px; }
.auth-lock { width:52px; height:52px; border-radius:14px; background:var(--primary-weak); display:flex; align-items:center; justify-content:center; margin-bottom:18px; }
.auth-row { display:flex; justify-content:space-between; align-items:center; margin-bottom:22px; font-size:13.5px; }
.remember { display:flex; align-items:center; gap:8px; color:var(--text-2); cursor:pointer; }
.remember input { width:15px; height:15px; accent-color:var(--primary); }
.auth-sep { display:flex; align-items:center; gap:12px; margin:22px 0; color:var(--text-3); font-size:13px; }
.auth-sep::before, .auth-sep::after { content:""; flex:1; height:1px; background:var(--border); }
.oauth-row { display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; }
.oauth-row button { height:44px; border:1px solid var(--border); background:var(--surface); border-radius:10px; font-weight:600; color:var(--text); cursor:pointer; }
.oauth-row button:hover { background:var(--surface-2); }
.auth-foot { text-align:center; margin:26px 0 0; color:var(--text-2); font-size:14px; }
.auth-foot a { font-weight:700; }
.terms { display:flex; align-items:flex-start; gap:9px; color:var(--text-2); font-size:13px; margin-bottom:20px; cursor:pointer; line-height:1.5; }
.terms input { width:15px; height:15px; margin-top:2px; accent-color:var(--primary); }
.otp-row { display:flex; gap:10px; margin-bottom:22px; }
.otp-row input { flex:1; height:58px; text-align:center; font-size:24px; font-weight:800; border:1px solid var(--border); background:var(--surface); color:var(--text); border-radius:12px; outline:none; }
.otp-row input:focus, .otp-row input.on { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-weak); }

/* ------------------------- FORM FIELDS ------------------------- */
.field { margin-bottom:16px; }
.field > label { display:block; font-size:13px; font-weight:600; color:var(--text-2); margin-bottom:7px; }
.input {
  width:100%; height:46px; border:1px solid var(--border); background:var(--surface); color:var(--text);
  border-radius:11px; padding:0 14px; font-size:15px; outline:none;
}
.input::placeholder { color:var(--text-3); }
.input:focus { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-weak); }
.input-wrap { position:relative; }
.input-icon { position:absolute; right:10px; top:50%; transform:translateY(-50%); background:none; border:none; color:var(--text-2); font-size:13px; cursor:pointer; }
select.input { cursor:pointer; }

/* ------------------------- BUTTONS ------------------------- */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; border-radius:11px; font-weight:700; font-size:14px; cursor:pointer; border:1px solid transparent; height:42px; padding:0 16px; transition:background .12s,border-color .12s; }
.btn svg { flex:none; }
.btn-primary { background:var(--primary); color:#fff; box-shadow:0 6px 16px -8px var(--primary); }
.btn-primary:hover { background:var(--primary-hover); }
.btn-secondary { background:var(--surface-2); color:var(--text); border-color:var(--border); }
.btn-secondary:hover { background:var(--surface-3); }
.btn-danger { background:var(--danger-weak); color:var(--danger); border-color:var(--danger); }
.btn-block { width:100%; }
.btn:disabled { opacity:.55; cursor:default; }
.btn-lg { height:48px; font-size:15px; }
.btn-icon { width:40px; height:40px; border-radius:10px; border:1px solid var(--border); background:var(--surface-2); color:var(--text-2); cursor:pointer; display:flex; align-items:center; justify-content:center; }
.btn-icon:hover { background:var(--surface-3); }

/* ============================ APP SHELL ============================ */
.app { display:grid; grid-template-columns:264px 1fr; height:100vh; }

/* ---- SIDEBAR ---- */
.sidebar { background:var(--surface); border-right:1px solid var(--border); display:flex; flex-direction:column; padding:18px 14px; gap:6px; overflow-y:auto; }
.side-brand { display:flex; align-items:center; gap:11px; padding:4px 8px 16px; }
.side-brand .badge { width:34px; height:34px; border-radius:10px; background:var(--primary); display:flex; align-items:center; justify-content:center; flex:none; }
.side-brand .name { font-size:15.5px; font-weight:800; letter-spacing:-.02em; line-height:1.15; }
.side-btn-primary { display:flex; align-items:center; justify-content:center; gap:9px; height:44px; background:var(--primary); color:#fff; border:none; border-radius:11px; font-size:14.5px; font-weight:700; cursor:pointer; box-shadow:0 6px 16px -8px var(--primary); margin-bottom:4px; }
.side-btn-primary:hover { background:var(--primary-hover); }
.side-btn-second { display:flex; align-items:center; justify-content:center; gap:9px; height:40px; background:var(--surface-2); color:var(--text); border:1px solid var(--border); border-radius:11px; font-size:14px; font-weight:600; cursor:pointer; margin-bottom:12px; }
.side-btn-second:hover { background:var(--surface-3); }
.nav { display:flex; flex-direction:column; gap:3px; }
.nav-item { display:flex; align-items:center; gap:12px; height:40px; padding:0 12px; border:none; border-radius:10px; cursor:pointer; font-size:14px; text-align:left; background:transparent; color:var(--text-2); font-weight:600; width:100%; }
.nav-item:hover { background:var(--surface-2); }
.nav-item.active { background:var(--primary-weak); color:var(--primary); font-weight:700; }
.nav-item .lbl { flex:1; }
.nav-item .count { background:var(--surface-3); color:var(--text-2); font-size:11.5px; font-weight:700; padding:1px 8px; border-radius:9px; }
.side-spacer { flex:1; }
.storage-card { text-align:left; border:1px solid var(--border); background:var(--surface-2); border-radius:14px; padding:14px; cursor:pointer; width:100%; }
.storage-card:hover { border-color:var(--border-2); }
.storage-card .head { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.storage-card .head span { font-size:13px; font-weight:700; color:var(--text); }
.storage-bar { height:7px; background:var(--surface-3); border-radius:6px; overflow:hidden; margin-bottom:9px; }
.storage-bar > span { display:block; height:100%; width:0%; background:linear-gradient(90deg,var(--primary),var(--accent)); border-radius:6px; }
.storage-card .used { font-size:12px; color:var(--text-2); }
.storage-card .cta { margin-top:12px; height:34px; border-radius:9px; background:var(--primary); color:#fff; font-size:13px; font-weight:700; display:flex; align-items:center; justify-content:center; }

/* ---- MAIN ---- */
.main { display:flex; flex-direction:column; overflow:hidden; min-width:0; }
.topbar { height:66px; flex:none; display:flex; align-items:center; gap:16px; padding:0 24px; border-bottom:1px solid var(--border); background:var(--surface); }
.searchbox { flex:1; max-width:440px; position:relative; }
.searchbox svg { position:absolute; left:13px; top:50%; transform:translateY(-50%); }
.searchbox input { width:100%; height:42px; border:1px solid var(--border); background:var(--surface-2); color:var(--text); border-radius:11px; padding:0 14px 0 40px; font-size:14px; outline:none; }
.searchbox input:focus { border-color:var(--primary); background:var(--surface); box-shadow:0 0 0 3px var(--primary-weak); }
.topbar-spacer { flex:1; }
.view-toggle { display:flex; background:var(--surface-2); border:1px solid var(--border); border-radius:10px; padding:3px; gap:2px; }
.view-toggle button { width:34px; height:32px; border:none; border-radius:8px; cursor:pointer; display:flex; align-items:center; justify-content:center; background:transparent; color:var(--text-3); }
.view-toggle button.active { background:var(--surface); color:var(--primary); }
.topbar-sep { width:1px; height:26px; background:var(--border); }
.avatar { width:38px; height:38px; border-radius:50%; background:linear-gradient(135deg,var(--primary),var(--accent)); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:14px; cursor:pointer; position:relative; }
.notif-badge { position:absolute; top:-4px; right:-4px; min-width:16px; height:16px; padding:0 4px; background:var(--danger); color:#fff; border-radius:9px; font-size:10px; font-weight:800; display:flex; align-items:center; justify-content:center; border:2px solid var(--surface); }
.content { flex:1; overflow-y:auto; padding:24px 28px 40px; }

/* avatar dropdown */
.avatar-menu { position:absolute; top:52px; right:0; background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow-lg); padding:6px; z-index:55; min-width:210px; animation:fadeUp .15s ease; }
.avatar-menu .am-head { padding:10px 12px; }
.avatar-menu .am-head .am-name { font-weight:700; font-size:14px; }
.avatar-menu .am-head .am-mail { color:var(--text-3); font-size:12px; }
.avatar-menu .divider { height:1px; background:var(--border); margin:5px 6px; }
.avatar-menu button { width:100%; display:flex; align-items:center; gap:11px; text-align:left; border:none; background:none; padding:9px 12px; border-radius:8px; font-size:13.5px; color:var(--text); cursor:pointer; }
.avatar-menu button:hover { background:var(--surface-2); }
.avatar-menu button.danger { color:var(--danger); }
.avatar-menu button.danger:hover { background:var(--danger-weak); }

/* ---- browse header ---- */
.browse-head { display:flex; align-items:center; gap:14px; margin-bottom:20px; min-height:40px; }
.browse-head .titles { flex:1; min-width:0; }
.crumbs { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.crumbs .crumb { border:none; background:none; cursor:pointer; font-size:20px; font-weight:800; letter-spacing:-.02em; padding:2px 4px; border-radius:6px; color:var(--text-3); }
.crumbs .crumb.last { color:var(--text); }
.crumbs .crumb:hover { background:var(--surface-3); }
.crumbs .sep { color:var(--text-3); display:flex; }
.section-title { font-size:22px; font-weight:800; letter-spacing:-.02em; margin:0; }
.count-label { font-size:13px; color:var(--text-3); margin-top:3px; }
.sort-wrap { position:relative; }
.sort-btn { display:flex; align-items:center; gap:8px; height:38px; padding:0 13px; border:1px solid var(--border); background:var(--surface); color:var(--text-2); border-radius:10px; font-size:13.5px; font-weight:600; cursor:pointer; }
.sort-btn:hover { background:var(--surface-2); }
.sort-menu { position:absolute; top:44px; right:0; background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow-lg); padding:6px; z-index:40; min-width:200px; animation:fadeUp .15s ease; }
.sort-menu button { width:100%; text-align:left; border:none; background:none; padding:9px 12px; border-radius:8px; font-size:13.5px; color:var(--text); cursor:pointer; }
.sort-menu button:hover { background:var(--surface-2); }

/* ---- selection bar ---- */
.sel-bar { display:flex; align-items:center; gap:12px; background:var(--primary-weak); border:1px solid var(--primary); border-radius:12px; padding:10px 14px; margin-bottom:18px; animation:fadeUp .2s ease; }
.sel-bar .sel-count { font-size:14px; font-weight:700; color:var(--primary); }
.sel-bar .sb { display:flex; align-items:center; gap:7px; height:34px; padding:0 12px; border:1px solid var(--border); background:var(--surface); color:var(--text); border-radius:9px; font-size:13px; font-weight:600; cursor:pointer; }
.sel-bar .sb:hover { background:var(--surface-2); }
.sel-bar .sb.danger { border-color:var(--danger); background:var(--danger-weak); color:var(--danger); }
.sel-bar .sb-close { width:34px; height:34px; border:none; background:none; color:var(--primary); cursor:pointer; border-radius:9px; display:flex; align-items:center; justify-content:center; }

/* ---- empty state ---- */
.empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:80px 20px; text-align:center; }
.empty-state .ico { width:80px; height:80px; border-radius:22px; background:var(--surface-2); display:flex; align-items:center; justify-content:center; margin-bottom:18px; }
.empty-state h3 { font-size:17px; font-weight:700; margin:0 0 6px; }
.empty-state p { color:var(--text-2); font-size:14px; margin:0; max-width:320px; }

/* ---- GRID ---- */
.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(178px,1fr)); gap:16px; }
.file-card { background:var(--surface); border:1.5px solid var(--border); border-radius:14px; overflow:hidden; cursor:pointer; position:relative; transition:border-color .12s,transform .12s; }
.file-card:hover { border-color:var(--primary); transform:translateY(-2px); }
.file-card.selected { background:var(--primary-weak); border-color:var(--primary); }
.file-card .fc-check { position:absolute; top:9px; left:9px; z-index:3; }
.fc-check button, .lr-check { width:22px; height:22px; border-radius:6px; border:2px solid var(--border-2); background:var(--surface); cursor:pointer; display:flex; align-items:center; justify-content:center; padding:0; color:#fff; }
.fc-check button.on, .lr-check.on { border-color:var(--primary); background:var(--primary); }
.file-card .fc-actions { position:absolute; top:8px; right:8px; z-index:3; display:flex; gap:3px; }
.fc-actions button { width:26px; height:26px; border:none; border-radius:7px; background:rgba(0,0,0,.04); cursor:pointer; display:flex; align-items:center; justify-content:center; padding:0; color:var(--text-2); }
.fc-actions button:hover { background:rgba(0,0,0,.09); }
:root[data-theme="dark"] .fc-actions button { background:rgba(255,255,255,.06); }
:root[data-theme="dark"] .fc-actions button:hover { background:rgba(255,255,255,.12); }
.file-card .tile { height:118px; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.file-card .tile img { width:100%; height:100%; object-fit:cover; }
.file-card .tile .ext { font-size:19px; font-weight:800; letter-spacing:.06em; }
.file-card .fc-body { padding:11px 12px 13px; }
.file-card .fc-name-row { display:flex; align-items:center; gap:5px; }
.file-card .fc-name { font-size:13.5px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; }
.file-card .fc-sub { font-size:11.5px; color:var(--text-3); margin-top:3px; }

/* ---- LIST ---- */
.list { background:var(--surface); border:1px solid var(--border); border-radius:14px; overflow:hidden; box-shadow:var(--shadow); }
.list .lhead, .list .lrow { display:grid; grid-template-columns:40px 1fr 120px 150px 44px; align-items:center; gap:12px; padding:10px 16px; border-bottom:1px solid var(--border); }
.list .lhead { padding:11px 16px; font-size:12px; font-weight:700; color:var(--text-3); text-transform:uppercase; letter-spacing:.04em; }
.list .lrow { cursor:pointer; background:transparent; }
.list .lrow:hover { background:var(--surface-2); }
.list .lrow.selected { background:var(--primary-weak); }
.list .lrow:last-child { border-bottom:none; }
.lrow .lr-check { width:20px; height:20px; border-radius:5px; }
.lrow .lr-file { display:flex; align-items:center; gap:12px; min-width:0; }
.lrow .lr-tile { width:36px; height:36px; border-radius:9px; display:flex; align-items:center; justify-content:center; flex:none; overflow:hidden; }
.lrow .lr-tile img { width:100%; height:100%; object-fit:cover; }
.lrow .lr-tile .ext { font-size:10px; font-weight:800; letter-spacing:.04em; }
.lrow .lr-name { display:flex; align-items:center; gap:6px; min-width:0; }
.lrow .lr-name span.nm { font-size:14px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lrow .lr-meta { font-size:13px; color:var(--text-2); }
.lrow .lr-kebab { width:32px; height:32px; border:none; border-radius:8px; background:none; cursor:pointer; display:flex; align-items:center; justify-content:center; padding:0; color:var(--text-3); }
.lrow .lr-kebab:hover { background:var(--surface-3); }

/* ============================ STORAGE / GENERIC PAGE ============================ */
.page { animation:fadeUp .3s ease; }
.page h1 { font-size:24px; font-weight:800; letter-spacing:-.02em; margin:0 0 4px; }
.page .lead { color:var(--text-2); margin:0 0 24px; font-size:14.5px; }
.usage-card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:24px; margin-bottom:26px; box-shadow:var(--shadow); }
.usage-card .top { display:flex; align-items:baseline; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
.usage-card .big { font-size:28px; font-weight:800; }
.usage-card .of { color:var(--text-2); font-size:15px; }
.usage-card .plan-badge { margin-left:auto; background:var(--primary-weak); color:var(--primary); font-size:12.5px; font-weight:700; padding:4px 12px; border-radius:20px; }
.usage-seg { height:14px; background:var(--surface-3); border-radius:9px; overflow:hidden; display:flex; }
.usage-seg > span { height:100%; }
.usage-legend { display:flex; flex-wrap:wrap; gap:18px; margin-top:16px; }
.usage-legend .li { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text-2); }
.usage-legend .dot { width:10px; height:10px; border-radius:3px; }
.plans-title { font-size:17px; font-weight:800; margin:0 0 16px; }
.plans { display:grid; grid-template-columns:repeat(3,1fr); gap:18px; }
.plan { border:1.5px solid var(--border); background:var(--surface); border-radius:16px; padding:24px; position:relative; box-shadow:var(--shadow); }
.plan.popular { border-color:var(--primary); background:var(--primary-weak); }
.plan .pop { position:absolute; top:16px; right:16px; background:var(--primary); color:#fff; font-size:11px; font-weight:700; padding:3px 10px; border-radius:20px; }
.plan .pname { font-size:15px; font-weight:800; margin-bottom:6px; }
.plan .price { display:flex; align-items:baseline; gap:4px; margin-bottom:4px; }
.plan .price .amt { font-size:30px; font-weight:800; }
.plan .price .per { color:var(--text-2); font-size:14px; }
.plan .quota { font-size:13.5px; color:var(--text-2); margin-bottom:18px; }
.plan .feats { display:flex; flex-direction:column; gap:10px; margin-bottom:22px; }
.plan .feat { display:flex; align-items:flex-start; gap:9px; font-size:13.5px; color:var(--text-2); line-height:1.4; }
.plan.popular .feat { color:var(--text); }
.plan .cta { width:100%; height:44px; border-radius:11px; font-size:14px; font-weight:700; cursor:pointer; border:1px solid var(--border); background:var(--surface-2); color:var(--text-2); }
.plan.popular .cta { border:none; background:var(--primary); color:#fff; }
.page .card-block { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:22px; margin-bottom:18px; box-shadow:var(--shadow); }
.page h2 { font-size:17px; font-weight:800; margin:0 0 14px; }

/* ============================ MODALS ============================ */
.modal-overlay { position:fixed; inset:0; background:rgba(10,11,18,.5); display:flex; align-items:center; justify-content:center; z-index:60; animation:ovIn .15s ease; padding:24px; }
.modal { background:var(--surface); border-radius:18px; box-shadow:var(--shadow-lg); overflow:hidden; animation:fadeUp .25s ease; width:520px; max-width:100%; }
.modal.sm { width:420px; }
.modal.md { width:560px; }
.modal-head { display:flex; align-items:center; gap:13px; padding:20px 22px; border-bottom:1px solid var(--border); }
.modal-head h3 { font-size:17px; font-weight:800; margin:0; }
.modal-x { width:34px; height:34px; border:none; background:var(--surface-2); border-radius:9px; cursor:pointer; display:flex; align-items:center; justify-content:center; color:var(--text-2); flex:none; }
.modal-x:hover { background:var(--surface-3); }
.modal-body { padding:22px; }
.modal-foot { display:flex; justify-content:flex-end; align-items:center; gap:10px; padding:16px 22px; border-top:1px solid var(--border); background:var(--surface-2); }

/* upload */
.dropzone { border:2px dashed var(--border-2); border-radius:14px; padding:34px 20px; text-align:center; cursor:pointer; background:var(--surface-2); }
.dropzone:hover, .dropzone.drag { border-color:var(--primary); background:var(--primary-weak); }
.dropzone .dz-ico { width:56px; height:56px; border-radius:16px; background:var(--primary-weak); display:flex; align-items:center; justify-content:center; margin:0 auto 14px; }
.dropzone .dz-title { font-size:15px; font-weight:700; margin-bottom:4px; }
.dropzone .dz-sub { font-size:13px; color:var(--text-2); }
.upload-list { margin-top:20px; display:flex; flex-direction:column; gap:12px; max-height:230px; overflow-y:auto; }
.upload-item { display:flex; align-items:center; gap:12px; }
.upload-item .u-tile { width:38px; height:38px; border-radius:9px; display:flex; align-items:center; justify-content:center; flex:none; font-size:10px; font-weight:800; letter-spacing:.03em; }
.upload-item .u-mid { flex:1; min-width:0; }
.upload-item .u-top { display:flex; justify-content:space-between; gap:10px; margin-bottom:5px; }
.upload-item .u-name { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.upload-item .u-status { font-size:12px; color:var(--text-3); flex:none; }
.upload-item .u-bar { height:6px; background:var(--surface-3); border-radius:5px; overflow:hidden; }
.upload-item .u-bar > span { display:block; height:100%; width:0%; background:var(--primary); border-radius:5px; transition:width .3s ease; }
.upload-item.done .u-bar > span { background:var(--success); }
.upload-item.error .u-bar > span { background:var(--danger); }

/* share */
.share-tile { width:42px; height:42px; border-radius:11px; display:flex; align-items:center; justify-content:center; flex:none; }
.share-tile .ext { font-size:11px; font-weight:800; letter-spacing:.03em; }
.share-head-txt h3 { font-size:16px; font-weight:800; margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.share-head-txt p { font-size:13px; color:var(--text-2); margin:2px 0 0; }
.share-label { display:block; font-size:12.5px; font-weight:700; color:var(--text-2); margin-bottom:8px; }
.share-link-row { display:flex; gap:9px; margin-bottom:20px; }
.share-link-row input { flex:1; height:44px; border:1px solid var(--border); background:var(--surface-2); color:var(--text-2); border-radius:10px; padding:0 13px; font-size:13.5px; outline:none; }
.copy-btn { height:44px; padding:0 16px; border:none; border-radius:10px; font-size:13.5px; font-weight:700; cursor:pointer; background:var(--primary); color:#fff; display:flex; align-items:center; gap:7px; }
.copy-btn.copied { background:var(--success); }
.perm-grid { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-bottom:20px; }
.perm-grid button { height:42px; border-radius:10px; font-size:13.5px; font-weight:600; cursor:pointer; border:1.5px solid var(--border); background:var(--surface); color:var(--text-2); }
.perm-grid button.on { border-color:var(--primary); background:var(--primary-weak); color:var(--primary); }
.share-opts { display:flex; flex-direction:column; gap:2px; border:1px solid var(--border); border-radius:12px; overflow:hidden; margin-bottom:8px; }
.share-opts .row { display:flex; align-items:center; gap:12px; padding:13px 15px; }
.share-opts .row .lbl { flex:1; font-size:14px; font-weight:600; }
.share-opts .divider { height:1px; background:var(--border); }
.share-opts select { height:36px; border:1px solid var(--border); background:var(--surface-2); color:var(--text); border-radius:8px; padding:0 10px; font-size:13px; font-weight:600; cursor:pointer; outline:none; }
.share-opts .num { width:74px; height:36px; border:1px solid var(--border); background:var(--surface-2); color:var(--text); border-radius:8px; padding:0 10px; font-size:13px; text-align:center; outline:none; }
.switch { width:44px; height:26px; border-radius:20px; border:none; cursor:pointer; padding:0; position:relative; background:var(--border-2); transition:background .15s; flex:none; }
.switch.on { background:var(--primary); }
.switch .knob { position:absolute; top:3px; left:3px; width:20px; height:20px; border-radius:50%; background:#fff; transition:left .15s; box-shadow:0 1px 3px rgba(0,0,0,.3); }
.switch.on .knob { left:21px; }
.share-pw-input { padding:0 15px 13px; }
.share-pw-input input { width:100%; height:40px; border:1px solid var(--border); background:var(--surface-2); color:var(--text); border-radius:9px; padding:0 12px; font-size:13.5px; outline:none; }

/* context menu */
.ctx-menu { position:fixed; background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow-lg); padding:6px; z-index:80; min-width:196px; animation:fadeUp .12s ease; }
.ctx-menu button { width:100%; display:flex; align-items:center; gap:11px; text-align:left; border:none; background:none; padding:9px 11px; border-radius:8px; font-size:13.5px; color:var(--text); cursor:pointer; }
.ctx-menu button:hover { background:var(--surface-2); }
.ctx-menu button.danger { color:var(--danger); }
.ctx-menu button.danger:hover { background:var(--danger-weak); }
.ctx-menu .divider { height:1px; background:var(--border); margin:5px 8px; }

/* ============================ PREVIEW (viewer) ============================ */
.viewer { position:fixed; inset:0; background:rgba(6,7,12,.82); display:flex; flex-direction:column; z-index:70; animation:ovIn .15s ease; }
.viewer-bar { height:62px; flex:none; display:flex; align-items:center; gap:14px; padding:0 22px; color:#fff; }
.viewer-tile { width:36px; height:36px; border-radius:9px; display:flex; align-items:center; justify-content:center; flex:none; }
.viewer-tile .ext { font-size:10px; font-weight:800; letter-spacing:.03em; }
.viewer-name { font-size:15px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.viewer-size { font-size:12.5px; opacity:.7; }
.viewer-btn { height:38px; padding:0 14px; border:1px solid rgba(255,255,255,.2); background:rgba(255,255,255,.08); color:#fff; border-radius:9px; font-size:13px; font-weight:600; cursor:pointer; display:flex; align-items:center; gap:7px; }
.viewer-btn.icon { width:38px; padding:0; justify-content:center; }
.viewer-body { flex:1; display:flex; align-items:center; justify-content:center; padding:20px 30px 30px; overflow:hidden; }
.viewer-body img, .viewer-body video { max-width:min(80vw,900px); max-height:78vh; border-radius:12px; box-shadow:0 20px 60px rgba(0,0,0,.5); }
.viewer-body iframe { width:min(60vw,560px); height:78vh; border:none; border-radius:8px; background:#fff; }
.viewer-body audio { width:min(70vw,540px); }
.no-preview { color:#fff; text-align:center; display:flex; flex-direction:column; align-items:center; gap:18px; }
.no-preview .np-tile { width:120px; height:120px; border-radius:22px; display:flex; align-items:center; justify-content:center; }
.no-preview .np-tile .ext { font-size:30px; font-weight:800; letter-spacing:.05em; }

/* ============================ TOASTS ============================ */
#toasts { position:fixed; bottom:26px; left:50%; transform:translateX(-50%); display:flex; flex-direction:column; gap:8px; z-index:90; align-items:center; }
.toast { background:var(--text); color:var(--surface); padding:12px 20px; border-radius:12px; font-size:14px; font-weight:600; box-shadow:var(--shadow-lg); animation:fadeUp .2s ease; display:flex; align-items:center; gap:10px; }
.toast.error { background:var(--danger); color:#fff; }
.toast .ok { color:var(--success); display:flex; }
.toast.error .ok { display:none; }

/* generic list rows (notif, teams, admin, versions, dev) */
.list-row { display:flex; align-items:center; gap:10px; padding:11px 4px; border-bottom:1px solid var(--border); }
.list-row:last-child { border-bottom:none; }
.list-row small { color:var(--text-3); font-size:12px; }

/* ============================ ADMIN PANEL ============================ */
.admin-tabs { display:flex; gap:4px; flex-wrap:wrap; margin:0 0 22px; border-bottom:1px solid var(--border); padding-bottom:0; }
.admin-tab { border:none; background:none; cursor:pointer; font-size:14px; font-weight:600; color:var(--text-2); padding:10px 14px; border-bottom:2px solid transparent; margin-bottom:-1px; }
.admin-tab:hover { color:var(--text); }
.admin-tab.active { color:var(--primary); border-bottom-color:var(--primary); font-weight:700; }
.metric-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:16px; margin-bottom:8px; }
.metric { background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:18px; box-shadow:var(--shadow); }
.metric .k { font-size:13px; color:var(--text-2); display:flex; align-items:center; gap:8px; }
.metric .v { font-size:26px; font-weight:800; margin-top:6px; }
.metric .ic { width:34px; height:34px; border-radius:9px; background:var(--primary-weak); color:var(--primary); display:flex; align-items:center; justify-content:center; }
.admin-toolbar { display:flex; align-items:center; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
.admin-toolbar .searchbox { max-width:320px; }
.table-wrap { background:var(--surface); border:1px solid var(--border); border-radius:14px; overflow:hidden; box-shadow:var(--shadow); }
.table-scroll { overflow-x:auto; }
table.admin-table { width:100%; border-collapse:collapse; font-size:13.5px; min-width:640px; }
table.admin-table th { text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-3); font-weight:700; padding:12px 14px; border-bottom:1px solid var(--border); background:var(--surface-2); white-space:nowrap; }
table.admin-table td { padding:11px 14px; border-bottom:1px solid var(--border); color:var(--text); vertical-align:middle; }
table.admin-table tr:last-child td { border-bottom:none; }
table.admin-table tr:hover td { background:var(--surface-2); }
.pill { display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:700; padding:3px 9px; border-radius:20px; }
.pill.ok { background:color-mix(in srgb, var(--success) 15%, transparent); color:var(--success); }
.pill.warn { background:color-mix(in srgb, var(--warning) 18%, transparent); color:var(--warning); }
.pill.bad { background:var(--danger-weak); color:var(--danger); }
.pill.info { background:var(--primary-weak); color:var(--primary); }
.pill.muted { background:var(--surface-3); color:var(--text-2); }
.icon-act { width:30px; height:30px; border:none; border-radius:8px; background:var(--surface-2); color:var(--text-2); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.icon-act:hover { background:var(--surface-3); }
.icon-act.danger:hover { background:var(--danger-weak); color:var(--danger); }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-grid .full { grid-column:1 / -1; }
.seg { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:20px; }
.seg-opt { border:1.5px solid var(--border); background:var(--surface); border-radius:14px; padding:16px; cursor:pointer; display:flex; gap:12px; align-items:flex-start; }
.seg-opt.on { border-color:var(--primary); background:var(--primary-weak); }
.seg-opt .radio { width:20px; height:20px; border-radius:50%; border:2px solid var(--border-2); flex:none; margin-top:2px; display:flex; align-items:center; justify-content:center; }
.seg-opt.on .radio { border-color:var(--primary); }
.seg-opt.on .radio::after { content:""; width:10px; height:10px; border-radius:50%; background:var(--primary); }
.seg-opt .st { font-weight:700; font-size:14.5px; }
.seg-opt .sd { font-size:12.5px; color:var(--text-2); margin-top:3px; }
@media (max-width:640px){ .form-grid, .seg { grid-template-columns:1fr; } }

/* ============================ RESPONSIVE ============================ */
@media (max-width:900px) {
  .auth-wrap { grid-template-columns:1fr; }
  .auth-hero { display:none; }
  .app { grid-template-columns:1fr; }
  .sidebar { position:fixed; left:0; top:0; bottom:0; width:264px; z-index:50; transform:translateX(-100%); transition:transform .2s ease; }
  .sidebar.open { transform:none; }
  .scrim { position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:45; }
  .plans { grid-template-columns:1fr; }
  .list .lhead, .list .lrow { grid-template-columns:34px 1fr 44px; }
  .list .col-size, .list .col-date { display:none; }
}
.menu-btn { display:none; }
@media (max-width:900px) { .menu-btn { display:flex; } }
