:root {
  --bg: #0f1220;
  --bg-2: #161a2e;
  --card: #1c2036;
  --card-2: #232840;
  --text: #eef1fa;
  --muted: #8b93b0;
  --accent: #6c8cff;
  --accent-2: #8a6cff;
  --danger: #ff5c7a;
  --ok: #3ddc97;
  --border: #2c3352;
  --radius: 14px;
}
* { box-sizing: border-box; }
/* Ensure the HTML `hidden` attribute always wins over display rules */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #232a4d 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center-note { text-align: center; margin: 10px 0 0; }
.ok { color: var(--ok); }
.err { color: var(--danger); }
.error { color: var(--danger); min-height: 18px; font-size: 13px; margin-top: 6px; }

.center-page { display: flex; align-items: center; justify-content: center; padding: 24px; }
.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
}

/* ---- brand ---- */
.brand { text-align: center; margin-bottom: 18px; }
.logo {
  width: 52px; height: 52px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 20px rgba(108,140,255,.45);
}
.brand h1 { font-size: 20px; margin: 12px 0 4px; }
.brand .muted { margin: 0; }

/* ---- login ---- */
.login-card { width: 100%; max-width: 380px; padding: 32px 28px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=password], select {
  width: 100%; margin-top: 6px; padding: 11px 13px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 14px; outline: none; transition: border .15s;
}
input:focus, select:focus { border-color: var(--accent); }
button { cursor: pointer; font-family: inherit; font-size: 14px; border-radius: 10px; border: none; transition: .15s; }
#submitBtn {
  width: 100%; padding: 12px; margin-top: 6px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
#submitBtn:hover { filter: brightness(1.08); }
#submitBtn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; padding: 9px 16px; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 8px 14px; }
.btn-ghost:hover { background: var(--card-2); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(255,92,122,.4); padding: 8px 14px; }
.btn-danger:hover { background: rgba(255,92,122,.12); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---- topbar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  background: rgba(20,24,42,.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand-inline { display: flex; align-items: center; gap: 10px; }
.brand-inline .logo { width: 36px; height: 36px; font-size: 20px; border-radius: 10px; }
.brand-name { font-weight: 700; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ---- layout ---- */
.container { max-width: 920px; margin: 24px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 20px; }
.upload-card { padding: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px; }
.section-head h2 { font-size: 16px; margin: 0; }

/* ---- dropzone ---- */
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 34px 20px;
  text-align: center; cursor: pointer; transition: .2s;
  background: rgba(108,140,255,.03);
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--accent); background: rgba(108,140,255,.09); }
.dz-icon { font-size: 30px; margin-bottom: 8px; color: var(--accent); }
.dropzone p { margin: 4px 0; }

/* ---- upload status ---- */
.upload-status { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.up-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.up-name { flex: 0 0 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-pct { flex: 0 0 46px; text-align: right; }
.progress { flex: 1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }

/* ---- file list ---- */
.file-list { padding: 6px 12px 16px; }
.file-row {
  display: flex; align-items: center; gap: 14px; padding: 12px;
  border-radius: 10px; transition: background .12s;
}
.file-row:hover { background: var(--card-2); }
.file-icon { font-size: 24px; width: 34px; text-align: center; }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { margin-top: 3px; }
.file-actions { display: flex; gap: 8px; }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 20px; font-size: 11px;
  background: rgba(108,140,255,.18); color: #a8b8ff;
}
.empty { text-align: center; padding: 34px 10px; }

/* ---- modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6,8,16,.68);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal { width: 100%; max-width: 460px; padding: 24px; }
.modal h3 { margin: 0 0 6px; }
.modal-label { display: block; margin: 16px 0 4px; font-size: 13px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.share-link-row { display: flex; gap: 8px; margin-top: 6px; }
.share-link-row input { flex: 1; }
.share-result { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- share page ---- */
.share-card { width: 100%; max-width: 420px; padding: 32px 28px; }
.share-file { text-align: center; margin: 4px 0 22px; }
.share-file-icon { font-size: 50px; }
.share-file-name { font-weight: 600; font-size: 17px; margin: 10px 0 6px; word-break: break-word; }
.download-btn { display: block; text-align: center; padding: 13px; font-size: 15px; text-decoration: none; }
.share-state { text-align: center; padding: 20px 0; }
.state-icon { font-size: 40px; }

/* ---- toast ---- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  padding: 11px 20px; border-radius: 10px; font-size: 13px; z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: fade .2s;
}
.toast-ok { background: #14352a; color: var(--ok); border: 1px solid rgba(61,220,151,.4); }
.toast-err { background: #3a1420; color: var(--danger); border: 1px solid rgba(255,92,122,.4); }

/* ---- user management ---- */
.modal-wide { max-width: 620px; }
.modal-subhead { margin: 18px 0 8px; font-size: 13px; color: var(--muted); }
.user-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.user-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
}
.user-row .u-name { font-weight: 600; }
.user-row .u-meta { flex: 1; min-width: 0; }
.user-row .u-role {
  font-size: 11px; padding: 2px 8px; border-radius: 20px; white-space: nowrap;
}
.role-admin { background: rgba(138,108,255,.2); color: #b9a6ff; }
.role-user { background: rgba(108,140,255,.15); color: #a8b8ff; }
.user-row .u-self { font-size: 11px; color: var(--muted); }
.user-create-row { display: flex; gap: 8px; flex-wrap: wrap; }
.user-create-row input { flex: 1; min-width: 120px; margin: 0; }
.user-create-row select { flex: 0 0 110px; margin: 0; }
.user-row-actions { display: flex; gap: 6px; }

@media (max-width: 600px) {
  .file-actions { flex-direction: column; }
  .file-name { max-width: 40vw; }
}
